Skip to contentSkip to conversation

gpio-f7188x: Add support for NCT5104D

PATCH Applied Paolo Pisati 2 participants 2 messages Nov 3 – Nov 6 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio-f7188x: Add support for NCT5104D

The Nuvoton NCT5104D is a Super I/O with four UARTs and 17 GPIO lines, found on PC Engines APU2 boards. Like the NCT6126D, it keeps its GPIOs in logical device 7, uses 1 for input in the direction register, and has a single data register and no Fintek vendor ID.

It differs from the NCT6126D in three ways:
- the device ID carries the silicon revision in its low nibble, so match 0xC452 (rev. B) and 0xC453 (rev. C); the NCT6102D and NCT6106D report the same IDs and are untested
- the output type sits in logical device 0x0F, one register per group, with 1 for open drain
- GP0x and GP1x share their pins with UART C and UART D (CR1C bits 3 and 2). Register a bank only when its pins are routed to GPIO and its group is enabled in LD7 CR30, and log each skipped bank

Only GP0x and GP1x are supported; GP67, the one line of group 6, is left out: its pin is not connected on the APU2.

This replaces the out-of-tree gpio-nct5104d driver that PC Engines ships with the datasheet, which was posted once in 2017:
https://github.com/tasanakorn/linux-gpio-nct5104d
https://lore.kernel.org/r/[email protected]

Tested push-pull and open-drain configurations on a PC Engines APU2, with UART C and D switched to GPIO in the firmware.

The code is the author's; Claude (Opus 5.5 and Fable 5.1) reviewed it and drafted this changelog.

---
 drivers/gpio/Kconfig       |   2 +-
 drivers/gpio/gpio-f7188x.c | 102 +++++++++++++++++++++++++++++++++----
 2 files changed, 92 insertions(+), 12 deletions(-)
drivers/gpio/Kconfig +1 -1
index 55e4280029d8..7edc8a2d9262 100644
@@ -1060,7 +1060,7 @@ config GPIO_F7188X
 	help
 	  This option enables support for GPIOs found on Fintek Super-I/O
 	  chips F71869, F71869A, F71882FG, F71889F and F81866.
-	  As well as Nuvoton Super-I/O chip NCT6126D.
+	  As well as Nuvoton Super-I/O chips NCT6126D and NCT5104D.
 
 	  To compile this driver as a module, choose M here: the module will
 	  be called f7188x-gpio.
drivers/gpio/gpio-f7188x.c +91 -11

205 lines not on this page · raw message

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

Signature · 1 line
2.43.0
#1 lore raw
Quoted 15 lines · Paolo Pisati

The Nuvoton NCT5104D is a Super I/O with four UARTs and 17 GPIO lines, found on PC Engines APU2 boards. Like the NCT6126D, it keeps its GPIOs in logical device 7, uses 1 for input in the direction register, and has a single data register and no Fintek vendor ID.

It differs from the NCT6126D in three ways:
- the device ID carries the silicon revision in its low nibble, so match 0xC452 (rev. B) and 0xC453 (rev. C); the NCT6102D and NCT6106D report the same IDs and are untested
- the output type sits in logical device 0x0F, one register per group, with 1 for open drain
- GP0x and GP1x share their pins with UART C and UART D (CR1C bits 3 and 2). Register a bank only when its pins are routed to GPIO and its group is enabled in LD7 CR30, and log each skipped bank

Quoted 1 line

[...]

Applied, thanks!

[1/1] gpio-f7188x: Add support for NCT5104D

      https://git.kernel.org/brgl/c/75b1038b88ddb729cfc8d5652d944924b16cc8a5

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>