GPIO mapping on Onion Omega2+ (MT7688)

Mike Bernardo mike at aion.cx
Mon Sep 6 10:29:38 PDT 2021


Hi John,

Thanks! This is great info.

I was able to apply that patch but I gather something changed with the gpiochip struct since this patch was valid:

drivers/gpio/gpio-mt7621.c: In function 'mediatek_gpio_bank_probe':
drivers/gpio/gpio-mt7621.c:244:11: error: 'struct gpio_chip' has no member named 'offset'; did you mean 'set'?
  rg->chip.offset = bank * MTK_BANK_WIDTH;
           ^~~~~~
           set
make[7]: *** [scripts/Makefile.build:262: drivers/gpio/gpio-mt7621.o] Error 1

I haven't had as much time as I'd like to work on this, I'm not sure it matters much for my purpose since the following is working:

gpioset -m wait gpiochip0 1=1

So it sounds like I do have working gpio, and maybe I will be able to make flashing the arduino dock work.

Mike

> On 2021/08/31, at 07:22:08 CDT (-05:00), John Thomson <lists at johnthomson.fastmail.com.au> wrote:
> 
> Hi Mike,
> 
> On Mon, 30 Aug 2021, at 21:05, Mike Bernardo wrote:
> 
>> 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?
> 
> Yes, that's it.
> You need to add the Linux gpiochip base to the (SoC) GPIO number you want to use.
> You may need to try each bank to get the correct one.
> See https://openwrt.org/docs/techref/hardware/port.gpio#software
> 
>> All of the GPIOs are unlableled, am I missing some type of ACPI mapping 
>> table? Or some kind of mapping in U-boot?
> 
> If you want these names populated,
> you can add the details to your dts file.
> The Linux binding documentation shows how (gpio-line-names):
> https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/gpio/gpio.txt
> 
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
> shows that GPIO 38 is a reset button, and 44 is the system LED,
> so you could have 38 blank names: "", and the 39th as "reset"
> 
>> 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"?
> 
> sysfs here is the driver that has claimed this GPIO number,
> because you (or something else) has exported that gpio number in /sys/class/gpio/
> 
>> It seems crazy it would have 3 GPIO chips with 32 lines each, so 
>> something seems wrong.
> 
> Expected: This is the way this system on a chip is built.
> 
>> Is it possible this might help?
>> 
>> http://patchwork.ozlabs.org/project/linux-gpio/patch/20210727152026.31019-3-sergio.paracuellos@gmail.com/
> 
> That patch is part of a series which fixes lazy labelling:
> An incomplete gpio-line-names array (where the number of passed
> named are less than ngpios)
> 
> 
> Hope that helps.
> 
> -- 
>  John Thomson




More information about the openwrt-devel mailing list