]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: Add Realtek Otto GPIO support
authorSander Vanheule <sander@svanheule.net>
Tue, 30 Mar 2021 17:48:43 +0000 (19:48 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 5 May 2021 14:07:40 +0000 (16:07 +0200)
commit0b90970b08fb8c91977d4912f693ffdc26c2c6ba
tree49ff43f5c5bb86f1b7cb4a95c9ba6ed690b254cb
parentee5b91ea1670594f5c20ecf4f484e9b5ca63d360
gpio: Add Realtek Otto GPIO support

Realtek MIPS SoCs (platform name Otto) have GPIO controllers with up to
64 GPIOs, divided over two banks. Each bank has a set of registers for
32 GPIOs, with support for edge-triggered interrupts.

Each GPIO bank consists of four 8-bit GPIO ports (ABCD and EFGH). Most
registers pack one bit per GPIO, except for the IMR register, which
packs two bits per GPIO (AB-CD).

Although the byte order is currently assumed to have port A..D at offset
0x0..0x3, this has been observed to be reversed on other, Lexra-based,
SoCs (e.g. RTL8196E/97D/97F).

Interrupt support is disabled for the fallback devicetree-compatible
'realtek,otto-gpio'. This allows for quick support of GPIO banks in
which the byte order would be unknown. In this case, the port ordering
in the IMR registers may not match the reversed order in the other
registers (DCBA, and BA-DC or DC-BA).

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-realtek-otto.c [new file with mode: 0644]