diff options
author | Denis Kalashnikov <denis281089@gmail.com> | 2022-01-19 13:25:05 +0300 |
---|---|---|
committer | Koen Vandeputte <koen.vandeputte@ncentric.com> | 2022-01-19 16:40:12 +0100 |
commit | ec85e48a113514502563a06c5d0278a57a8b6b86 (patch) | |
tree | c25f6fa403e8fa36adb342fa74aca77fe09e7ab7 /target/linux/ath79/files/drivers/gpio/gpio-latch.c | |
parent | 522e414dcbe478fa150a49b743e15999026bf774 (diff) | |
download | upstream-ec85e48a113514502563a06c5d0278a57a8b6b86.tar.gz upstream-ec85e48a113514502563a06c5d0278a57a8b6b86.tar.bz2 upstream-ec85e48a113514502563a06c5d0278a57a8b6b86.zip |
ath79: add support for reset key on MikroTik RB912UAG-2HPnD
On MikroTik RB91x board series a reset key shares SoC gpio
line #15 with NAND ALE and NAND IO7. So we need a custom
gpio driver to manage this non-trivial connection schema.
Also rb91x-nand needs to have an ability to disable a polling
of the key while it works with NAND.
While we've been integrating rb91x-key into a firmware, we've
figured out that:
* In the gpio-latch driver we need to add a "cansleep" suffix to
several gpiolib calls,
* When gpio-latch and rb91x-nand fail to get a gpio and an error
is -EPROBE_DEFER, they shouldn't report about this, since this
actually is not an error and occurs when the gpio-latch probe
function is called before the rb91x-key probe.
We fix these related things here too.
Signed-off-by: Denis Kalashnikov <denis281089@gmail.com>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Diffstat (limited to 'target/linux/ath79/files/drivers/gpio/gpio-latch.c')
-rw-r--r-- | target/linux/ath79/files/drivers/gpio/gpio-latch.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch.c b/target/linux/ath79/files/drivers/gpio/gpio-latch.c index f3545a663e..976e683230 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch.c @@ -62,7 +62,7 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset) int ret; gpio_latch_lock(glc, false); - ret = gpiod_get_value(glc->gpios[offset]); + ret = gpiod_get_raw_value_cansleep(glc->gpios[offset]); gpio_latch_unlock(glc, false); return ret; @@ -81,7 +81,7 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) } gpio_latch_lock(glc, enable_latch); - gpiod_set_raw_value(glc->gpios[offset], value); + gpiod_set_raw_value_cansleep(glc->gpios[offset], value); gpio_latch_unlock(glc, disable_latch); } @@ -133,8 +133,10 @@ static int gpio_latch_probe(struct platform_device *pdev) glc->gpios[i] = devm_gpiod_get_index_optional(dev, NULL, i, GPIOD_OUT_LOW); if (IS_ERR(glc->gpios[i])) { - dev_err(dev, "failed to get gpio %d: %d\n", i, - PTR_ERR(glc->gpios[i])); + if (PTR_ERR(glc->gpios[i]) != -EPROBE_DEFER) { + dev_err(dev, "failed to get gpio %d: %d\n", i, + PTR_ERR(glc->gpios[i])); + } return PTR_ERR(glc->gpios[i]); } } |