From: Andre Przywara <andre.przywara@arm.com>
To: Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>
Cc: Michal Piekos <michal.piekos@mmpsystems.pl>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] pinctrl: sunxi: fix A523 GPIO IRQ blunder
Date: Mon, 23 Mar 2026 12:01:46 +0100 [thread overview]
Message-ID: <20260323110151.2352832-1-andre.przywara@arm.com> (raw)
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@mmpsystems.pl
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
next reply other threads:[~2026-03-23 11:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 11:01 Andre Przywara [this message]
2026-03-23 11:01 ` [PATCH 1/5] pinctrl: sunxi: Rework IRQ remuxing to avoid fixed mux value Andre Przywara
2026-03-23 17:04 ` Chen-Yu Tsai
2026-03-23 11:01 ` [PATCH 2/5] pinctrl: sunxi: Remove unneeded IRQ remuxing for some SoCs Andre Przywara
2026-03-23 17:07 ` Chen-Yu Tsai
2026-03-23 11:01 ` [PATCH 3/5] dt-bindings: pinctrl: sun55i-a523: increase IRQ bank number Andre Przywara
2026-03-23 17:10 ` Chen-Yu Tsai
2026-04-07 16:14 ` Rob Herring (Arm)
2026-03-23 11:01 ` [PATCH 4/5] arm64: dts: allwinner: a523: Add missing GPIO interrupt Andre Przywara
2026-03-23 17:08 ` Chen-Yu Tsai
2026-03-23 11:01 ` [PATCH 5/5] pinctrl: sunxi: a523: add missing IRQ bank (plus old DT workaround) Andre Przywara
2026-03-23 17:41 ` Chen-Yu Tsai
2026-03-24 14:22 ` Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260323110151.2352832-1-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=michal.piekos@mmpsystems.pl \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox