[PATCH v2 0/2] ath79: add a support for reset key on MikroTik RB912

Denis Kalashnikov denis281089 at gmail.com
Tue Nov 16 08:06:42 PST 2021


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.

Changes in v2:
* In mikrotik routerboot module use MTD notifier instead of late_initcall. This
  is approved by the module author.

Denis Kalashnikov (2):
  ath79: add support for reset key on MikroTik RB912UAG-2HPnD
  generic: platform/mikrotik: use MTD notifier

 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 | 216 ++++++++++++++++++
 .../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/rb_hardconfig.c |  16 +-
 .../drivers/platform/mikrotik/rb_softconfig.c |  16 +-
 .../drivers/platform/mikrotik/routerboot.c    |  45 +++-
 .../drivers/platform/mikrotik/routerboot.h    |   8 +-
 13 files changed, 352 insertions(+), 32 deletions(-)
 create mode 100644 target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c

-- 
2.31.1




More information about the openwrt-devel mailing list