From ec85e48a113514502563a06c5d0278a57a8b6b86 Mon Sep 17 00:00:00 2001 From: Denis Kalashnikov Date: Wed, 19 Jan 2022 13:25:05 +0300 Subject: 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 Reviewed-by: Sergey Ryazanov Tested-by: Koen Vandeputte --- .../ar9342_mikrotik_routerboard-912uag-2hpnd.dts | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'target/linux/ath79/dts') diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts index 77a0d29113..b7ab1cacdb 100644 --- a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -16,6 +16,13 @@ led-upgrade = &led_power; }; + gpio_key: gpio_key { + compatible = "mikrotik,gpio-rb91x-key"; + gpio-controller; + #gpio-cells = <2>; + gpio = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + gpio_latch: gpio_latch { compatible = "gpio-latch"; gpio-controller; @@ -27,7 +34,7 @@ <0>, /* Not connected */ <&gpio 13 GPIO_ACTIVE_HIGH>, <&gpio 14 GPIO_ACTIVE_HIGH>, - <&gpio 15 GPIO_ACTIVE_HIGH>, + <&gpio_key 0 GPIO_ACTIVE_HIGH>, <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */ }; @@ -40,7 +47,8 @@ <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */ <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */ <&gpio 12 GPIO_ACTIVE_LOW>, /* Read/Write Enable (nRW) */ - <&gpio_latch 8 GPIO_ACTIVE_LOW>; /* Latch Enable (nLE) */ + <&gpio_latch 8 GPIO_ACTIVE_LOW>, /* Latch Enable (nLE) */ + <&gpio_key 2 GPIO_ACTIVE_HIGH>; /* Key poll disable */ partitions { compatible = "fixed-partitions"; @@ -64,6 +72,17 @@ }; }; + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + button@0 { + label = "reset"; + linux,code = ; + gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>; + }; + }; + leds { compatible = "gpio-leds"; -- cgit v1.2.3