pcengines/apu2-documentation

GPIO NCT5104D does not work on APU4 but works on APU2

Opened this issue · 1 comments

PCEngines firmware version
v4.12.0.1 for APU4
coreboot build 20170228 for APU2

APU variant
apu4d2
apu2c2

OS and OS Version
OpenWRT 22.03

Affected component(s), peripheral(s) or functionality
NCT5104D GPIO does not seem to work with APU4, works with APU2

Brief summary
I built an OpenWRT image x86_64 from 22.03 branch that uses kernel 5.10. I tested in an old APU2 board and everything works (LEDs, buttons and NCT5104D GPIO's) but when i used the same image on APU4 i notice that i can't physically (i measured) control NCT5104D GPIO's even though i can see them change with /sys/kernel/debug/gpio.

This is the scheme i used to verify

gpiochip0: GPIOs 0-7, parent: platform/gpio-nct5104d, gpio-nct5104d, can sleep:
 gpio-0   (                    |sysfs               ) out lo 
 gpio-1   (                    |sysfs               ) out lo 
 gpio-2   (                    |sysfs               ) out lo 
 gpio-3   (                    |sysfs               ) out lo 
 gpio-4   (                    |sysfs               ) out lo 
 gpio-5   (                    |sysfs               ) out lo 
 gpio-6   (                    |sysfs               ) out lo 

gpiochip1: GPIOs 10-17, parent: platform/gpio-nct5104d, gpio-nct5104d, can sleep:

gpiochip2: GPIOs 505-511, parent: platform/gpio_amd_fch, gpio_amd_fch:
 gpio-505 (front-led1          |apu:green:1         ) out lo ACTIVE LOW
 gpio-506 (front-led2          |apu:green:2         ) out hi ACTIVE LOW
 gpio-507 (front-led3          |apu:green:3         ) out lo ACTIVE LOW
 gpio-508 (front-button        |front button        ) in  hi ACTIVE LOW
 gpio-509 (simswap             )
 gpio-510 (mpcie2_reset        )
 gpio-511 (mpcie3_reset        )

How reproducible
Use OpenWRT 22.03 image and install kmod-pcengines-apuv2 and kmod-gpio-nct5104d

How to reproduce

Steps to reproduce the behavior:

  1. echo 3 > /sys/class/gpio/export
  2. echo out > /sys/class/gpio/gpio3/direction
  3. echo 0 > /sys/class/gpio/gpio3/value
  4. echo 1 > /sys/class/gpio/gpio3/value

Expected behavior
Measure 0 to 3.3V on gpio3 when changing value.

Actual behavior
I can see the change happening in software but physically gpio3 stays at 3.3V

Additional context
Same image/FW works in apu2 but not in apu4

Solutions you've tried
I do not know any solution.

Hi @gilfrade,

First thing I would check is the UART C / D settings in the BIOS setup menu. The GPIO pins on the NCT5104D can be used for GPIO or for UART, so if UART C / D are enabled, then the GPIO functionality will not be available. UART C utilizes pins 0-7, while UART D uses pins 10-17.

Please navigate to the setup menu and check if the UART C and UART D settings are set to Disabled. If they're not Disabled, toggle them using the o and p keys and press s to save and reboot.

Here's the relevant documentation for entering the setup menu, maybe you'll find it helpful: https://pcengines.github.io/apu2-documentation/theory-of-operation/#boot-menu