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>
This commit is contained in:
committed by
Koen Vandeputte
parent
522e414dcb
commit
ec85e48a11
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user