mt7621 GPIO mapping mystery

Peter Naulls peter at
Fri Jan 20 11:24:59 PST 2023

I posted previously on GPIOs, which caused some debate; this may or may not
be relevant, but I'd be remiss to not mention it:

I've been chasing an issue with GPIO mapping in for an mt7621 on the OpenWrt
5.10.161 etc kernels.

In short, GPIOS up to at least 17 work, but 22 and beyond do not - 5-17 and 
22-24 are LEDs, so their operation should be immediately obvious. The are all 
active high and are all wired as you'd expect.

This all works as expected on a previous 4.14 kernel.  To say that there
have been significant changes in drivers, GPIO handling and device tree since
that kernel would be an understatement.

I have tried exporting the GPIOS as LEDs, named GPIOs, direct manipulation in
/sys/class/gpio and libgpiod, but something is amiss. The actual value of the 
GPIO as seen in software can manipulated in all cases, but the physical value
does not change.

Suspiciously, MDIO/MDC are at GPIOs 20 and 21, so I don't know if these are
upsetting the physical mapping.  I've also turned off as much as possible in
the device tree, and built the kernel without switch and ethernet drivers, etc.

I'm tearing my hair out here, so any clues at all would be appreciated.


More information about the openwrt-devel mailing list