Add support of a reset key on MikroTik RB91x board series to get a rather usefull ability to reset a device into factory config by pressing the key.
Since a reset key on RB91x shares a gpio line with NAND (IO7 and ALE), we see 2 ways to support it: * Add a board specific module that manages this shared gpio line, * Rename already existed board specific gpio-latch module into gpio-rb91x-shared -- it becomes a module for managing _all_ shared gpio lines, including the line with the key. We've implemented the first option, since it doesn't brake an existing schema, it turned out that gpio-latch and rb91x-nand modules need only several fixes. A new key module registers a gpio controller that exports 3 virtual gpio lines: one output-capable-only for NAND, one input-capable-only for key and one output-capable-only for NAND to ban a key polling. While we were implementing a key, we realized that somehow we broke a Wi-Fi: a kernel started to invoke init function of routerboot partition parser module too early: when a SPI flash with routerboot partitions hadn't been found yet, and ath9k failed to load calibration data from hard_config partition. All seems to be working on my RB912UAG-2HPnD. Tested kernels 5.4 and 5.10. Denis Kalashnikov (2): ath79: add support for reset key on MikroTik RB912UAG-2HPnD ath79: mikrotik: Change the moment of routerboot partition parser init target/linux/ath79/config-5.10 | 1 + target/linux/ath79/config-5.4 | 1 + ...9342_mikrotik_routerboard-912uag-2hpnd.dts | 23 +- .../ath79/files/drivers/gpio/gpio-latch.c | 4 +- .../ath79/files/drivers/gpio/gpio-rb91x-key.c | 220 ++++++++++++++++++ .../files/drivers/mtd/nand/raw/rb91x_nand.c | 15 +- target/linux/ath79/mikrotik/config-default | 1 + .../patches-5.10/939-mikrotik-rb91x.patch | 19 ++ .../patches-5.4/939-mikrotik-rb91x.patch | 19 ++ .../drivers/platform/mikrotik/routerboot.c | 2 +- 10 files changed, 298 insertions(+), 7 deletions(-) create mode 100644 target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c -- 2.31.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel