Re: gpio-mt7621 unroutable IRQs to bank0
From: Sergio Paracuellos
Date: Tue May 05 2026 - 11:09:31 EST
Hi,
On Tue, May 5, 2026 at 4:21 PM Thomas Gleixner <tglx@xxxxxxxxxx> wrote:
>
> On Tue, May 05 2026 at 14:01, Linus Walleij wrote:
> > On Sat, May 2, 2026 at 11:52 PM Vicente Bergas <vicencb@xxxxxxxxx> wrote:
> >> As a way to prove that this is indeed the problem,
> >> the following workaround makes it work.
> >> It just inverts the sorting order of all matches,
> >> so it picks Bank0 instead of Bank2.
> >
> > That's a tricksy bug, I can't exactly see where the issue
> > is.
> >
> > I think to solve this you might need to allocate an external
> > irqdomain that deal with the three different gpiochip
> > instances when translating the irqs.
>
> struct gpio_chip has this:
>
> /**
> * @of_node_instance_match:
> *
> * Determine if a chip is the right instance. Must be implemented by
> * any driver using more than one gpio_chip per device tree node.
> * Returns true if gc is the instance indicated by i (which is the
> * first cell in the phandles for GPIO lines and gpio-ranges).
> */
> bool (*of_node_instance_match)(struct gpio_chip *gc, unsigned int i);
>
> That driver falls in the category and lacks that callback, no?
>
> Thanks,
>
> tglx
The IP core used inside these SoCs has 3 banks of 32 GPIOs each but
there is only one device tree node because the registers of all the
banks are interwoven inside one single IO range. Thus, the driver
internally sets up a gpio controller instance per bank. The driver
lacks of_node_instance_match callback but I am not sure if it needs to
be implemented in this particular case since the driver is using
of_xlate callback for this.
Thanks,
Sergio Paracuellos