GPIO mapping on Onion Omega2+ (MT7688)
mike at aion.cx
Mon Aug 30 14:05:28 PDT 2021
Does anyone know how to get GPIO working on the Omega2+, I seem to have 3 GPIO chips but I can't create a GPIO for example "15", just getting invalid argument:
root at onion1:~# echo 15 > /sys/class/gpio/export
ash: write error: Invalid argument
I guess the number I specify to export would need to be at least 416?
root at onion1:~# gpiodetect
gpiochip0 [10000600.gpio-bank0] (32 lines)
gpiochip1 [10000600.gpio-bank1] (32 lines)
gpiochip2 [10000600.gpio-bank2] (32 lines)
root at onion1:~# grep '' /sys/class/gpio/gpiochip*/ngpio
root at onion1:~# dmesg | grep gpio
[ 0.269491] mt7621_gpio 10000600.gpio: registering 32 gpios
[ 0.275193] mt7621_gpio 10000600.gpio: registering 32 gpios
[ 0.280867] mt7621_gpio 10000600.gpio: registering 32 gpios
All of the GPIOs are unlableled, am I missing some type of ACPI mapping table? Or some kind of mapping in U-boot?
root at onion1:~# gpioinfo
gpiochip0 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
I can create all of the GPIOs from 416-511 and they show in /sys/kernel/debug/gpio but most are labeled with "sysfs", I guess I was looking for one to be labeled like "GPIO15"?
What I'm actually trying to do is be able to flash the atmel AVR microcontroller on the onion omega2 dock which is an arduino uno that the onion can plug into, the stock firmware sets GPIOs 15,16,17,19 to output direction to be able to reset the AVR (and maybe other functions as well?)
It seems crazy it would have 3 GPIO chips with 32 lines each, so something seems wrong.
I've also tried libmraa via python but that doesn't seem to have any magic in it either.
I was reading this but I can't figure out anything about how to get the GSGN?
Is it possible this might help?
I've been looking at the kernel docs for GPIO and the onion firmware source (modified openwrt/LEDE) but have not found anything useful yet.
Thanks for reading and thanks for any help. Also thanks for all your work on OpenWRT!
More information about the openwrt-devel