[PATCH 0/5] pinctrl: sunxi: fix A523 GPIO IRQ blunder

From: Andre Przywara

Date: Mon Mar 23 2026 - 07:14:02 EST


When playing around with an Allwinner A527 board, I noticed that the
GPIO IRQ operation was broken, evident by not working SD card detect
functionality. The GPIO line reflected the CD pin correctly (as shown in
/sys/kernel/debug/gpio), but the core code just wouldn't react to those
changes.
This is admittedly mostly my fault, due to misunderstanding the IRQ
assocication in the original A523 DT submission.

Digging a bit deeper I found three bugs around this whole operation:
1) The A523 was marked as needing the "irq_read_needs_mux" workaround,
even though this is not true. This itself wouldn't be too critical, if
not:
2) The irq_read_needs_mux workaround routine assumes that the IRQ mux is
always using value 0x6, which is not true for newer SoCs (D1, A523).
3) The association between GPIO IRQ banks and their interrupts is
off-by-one for the A523. Interrupts are triggered, but the wrong ones.

This series fixes all those issues. Due to dependencies between DT and
code this is a bit involved:
- Patch 2/5 drops the irq_read_needs_mux workaround for the non-affected
SoCs, which fixes one part of the problem by masking bug #2 above.
- Patch 4/5 adds the missing IRQ line for the (non-implemented!) PortA
GPIO bank to the DT, which corrects the IRQ association.

Those two patches alone are fixing the immediate issue. If people agree,
these should be taken ASAP, I added Fixes: lines for the backports.

However there is more:
- The DT binding only describes 10 IRQs for the A523, so patch 3/5
corrects that value, to make the new DT pass DT validation.
- The pinctrl code would only expect 10 IRQs, so would now be missing
the one for the last bank (PortK). Patch 5/5 fixes that number, but
is more elaborate since it needs now to cater for old DTs carrying
just 10 interrupts. Not too happy or convinced about that workaround,
eager to hear about better solutions here. Please note that no board
so far uses PortK interrupts, so this isn't too criticial right now.
- For good measure, patch 1/5 fixes the workaround to cope with IRQ mux
values other than 0x6. This is now more robust, not requiring to know
the IRQ mux value at all, also saving one MMIO read and fixing a
potential race with other pinctrl mux code.

This applies on top of v7.0-rc5 (really the .get_direction callback
fix[1] merged into v7.0-rc3), plus the two patches from Michal's series[2],
which I assume would be applied shortly.

Please have a look and test, especially on A523/A527/T527 boards!

Cheers,
Andre

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=01e10d0272b9
[2] https://lore.kernel.org/linux-sunxi/20260320-rc2-boot-hang-v6-0-74dca70dd60e@xxxxxxxxxxxxx

Andre Przywara (5):
pinctrl: sunxi: Rework IRQ remuxing to avoid fixed mux value
pinctrl: sunxi: Remove unneeded IRQ remuxing for some SoCs
dt-bindings: pinctrl: sun55i-a523: increase IRQ bank number
arm64: dts: allwinner: a523: Add missing GPIO interrupt
pinctrl: sunxi: a523: add missing IRQ bank (plus old DT workaround)

.../allwinner,sun55i-a523-pinctrl.yaml | 8 ++--
.../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 3 +-
drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c | 2 -
drivers/pinctrl/sunxi/pinctrl-sun50i-h6.c | 1 -
drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c | 1 -
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 1 -
drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c | 3 +-
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 45 ++++++++++++-------
drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 -
9 files changed, 37 insertions(+), 28 deletions(-)


base-commit: c369299895a591d96745d6492d4888259b004a9e
prerequisite-patch-id: dcb1e8190ce649778193c3b391f759d4bcba9a28
prerequisite-patch-id: e003cee1830cf260b932fd6503a62270a1930310
--
2.43.0