* [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines
@ 2026-11-10 13:01 Vinicius Pedrosa
2026-11-10 13:21 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Pedrosa @ 2026-11-10 13:01 UTC (permalink / raw)
To: Linus Walleij, linux-gpio
Cc: Andre Przywara, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Bartosz Golaszewski, Enzo Adriano, Pablo Mazzini,
linux-arm-kernel, linux-sunxi, linux-kernel
The A733 description sets irq_read_needs_mux. When a GPIO used as an
interrupt is read, sunxi_pinctrl_gpio_get() then switches the pin to
input and back to SUN4I_FUNC_IRQ, which is function 6. The A733
interrupt function is 14, so after the first read the pin is left on
function 6 and its interrupt no longer fires.
On my board this breaks microSD card detection: the PF6
card-detect line is read at probe, and after that neither removal nor
insertion of the card is noticed.
The A733 data register reports the pin level while the pin is muxed
to the interrupt function, so the switch is not needed. The A523 and
D1 descriptions do not set this flag either. Drop it.
Fixes: 0535bfbfa97b ("pinctrl: sunxi: add support for the Allwinner A733")
Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
---
Tested on a Cubie A7Z with the pending A733 clock, PMIC and DT series
applied: before this change PF6 read back function 6 and card removal
and insertion were not seen; with it PF6 stays on function 14 and one
removal/insertion cycle was detected.
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
index ca82f08a3a65..456d9170c2a2 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
@@ -23,7 +23,6 @@ static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
static struct sunxi_pinctrl_desc a733_pinctrl_data = {
.irq_banks = 10,
- .irq_read_needs_mux = true,
.io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines
2026-11-10 13:01 [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines Vinicius Pedrosa
@ 2026-11-10 13:21 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-10 13:21 UTC (permalink / raw)
To: Vinicius Pedrosa, linux-gpio; +Cc: linux-sunxi
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] pinctrl: sunxi: wrong A733 IRQ bank offset calculation in
sunxi_irq_base_reg() [1]
--
commit e0da3dde27e4a3b5c2c95273c0b30e65e89fd5f3
Author: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
pinctrl: sunxi: a733: do not switch the mux to read IRQ lines
This commit removes irq_read_needs_mux from a733_pinctrl_data so that reading
an interrupt line does not switch the pin mux to function 6 instead of keeping
A733's interrupt function 14.
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> index ca82f08a3a65b..456d9170c2a27 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> @@ -23,7 +23,6 @@ static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
>
> static struct sunxi_pinctrl_desc a733_pinctrl_data = {
> .irq_banks = 10,
> - .irq_read_needs_mux = true,
> .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
> };
[Severity: High]
This problem wasn't introduced by this patch, but does sunxi_irq_base_reg()
calculate the wrong IRQ bank MMIO offset for a733_pinctrl_data [1]?
drivers/pinctrl/sunxi/pinctrl-sunxi.h:sunxi_irq_base_reg() {
if (pctl->flags & SUNXI_PINCTRL_NCAT3_REG_LAYOUT)
return pctl->bank_offset + bank * pctl->bank_mem_size +
A733_IRQ_REGS_OFFSET;
return IRQ_REGS_OFFSET +
sunxi_irq_hw_bank_num(pctl->desc, bank) * IRQ_MEM_SIZE;
}
Because A733 implements no PA pins (a733_nr_bank_pins[0] == 0),
sunxi_pinctrl_dt_table_init() assigns logical IRQ banks 0..9 to ports PB..PK,
whose hardware banks are 1..10. However, a733_pinctrl_data omits
irq_bank_map, and the SUNXI_PINCTRL_NCAT3_REG_LAYOUT branch in
sunxi_irq_base_reg() multiplies the logical bank index directly by
pctl->bank_mem_size without calling sunxi_irq_hw_bank_num().
As a result, IRQ register accesses target hardware banks 0..9 (PA..PJ)
instead of 1..10 (PB..PK), shifting every port's interrupt registers by one
bank and leaving port PK interrupts unmasked and uncleared at probe.
[1] https://sashiko.dev/#/bug/linux-213c0bba-8e71-4432-952e-9f5e320fd4b7
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110130157.112155-1-vinicius.eduardo.pedrosa@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-10 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 13:01 [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines Vinicius Pedrosa
2026-11-10 13:21 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox