[PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown

Michal Piekos posted 1 patch 3 weeks, 2 days ago
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 13 +++++++++++++
drivers/pinctrl/sunxi/pinctrl-sunxi.h |  1 +
2 files changed, 14 insertions(+)
[PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Michal Piekos 3 weeks, 2 days ago
Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.

The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
is in unitialized state.

Solution is to set pinmux to GPIO INPUT in
sunxi_pinctrl_irq_request_resources() if it wasn't initialized
earlier.

Tested on Orange Pi Zero 3.

Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
Suggested-by: Chen-Yu Tsai <wens@kernel.org>
---
Changes in v3:
- Drop v2 solution which was returning input instead of error when pin
  is not initialized.
- Add checking pinmux configuration in
  sunxi_pinctrl_irq_request_resources() and set pin to input if
  uninitialized
- Link to v2: https://lore.kernel.org/r/20260308-rc2-boot-hang-v2-1-516fdb820953@mmpsystems.pl

Changes in v2:
- Dropped the previous faulty solution which was forcing the axp313 to
  use r_pio as interrupt controller as pointed out by Jernej Škrabec.
- Implemented suggestion from Andrey Skvortsov to return default
  direction as input
- Link to v1: https://lore.kernel.org/r/20260308-rc2-boot-hang-v1-0-d792d1a78dfd@mmpsystems.pl
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 13 +++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index c990b6118172..7d46f7613672 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -1089,6 +1089,9 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
 {
 	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
 	struct sunxi_desc_function *func;
+	unsigned int offset;
+	u32 reg, shift, mask;
+	u8 muxval;
 	int ret;
 
 	func = sunxi_pinctrl_desc_find_function_by_pin(pctl,
@@ -1096,6 +1099,16 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
 	if (!func)
 		return -EINVAL;
 
+	offset = pctl->irq_array[d->hwirq] - pctl->desc->pin_base;
+	sunxi_mux_reg(pctl, offset, &reg, &shift, &mask);
+	muxval = (readl(pctl->membase + reg) & mask) >> shift;
+
+	/* Change muxing to GPIO INPUT mode if at reset value */
+	if (muxval == SUN4I_FUNC_IO_DISABLE) {
+		sunxi_pmx_set(pctl->pctl_dev, pctl->irq_array[d->hwirq],
+			      SUN4I_FUNC_INPUT);
+	}
+
 	ret = gpiochip_lock_as_irq(pctl->chip,
 			pctl->irq_array[d->hwirq] - pctl->desc->pin_base);
 	if (ret) {
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index ad26e4de16a8..22c527fc6ae2 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -86,6 +86,7 @@
 
 #define SUN4I_FUNC_INPUT	0
 #define SUN4I_FUNC_IRQ		6
+#define SUN4I_FUNC_IO_DISABLE	7
 
 #define SUNXI_PINCTRL_VARIANT_MASK	GENMASK(7, 0)
 #define SUNXI_PINCTRL_NEW_REG_LAYOUT	BIT(8)

---
base-commit: 4ae12d8bd9a830799db335ee661d6cbc6597f838
change-id: 20260308-rc2-boot-hang-269e8546635b

Best regards,
-- 
Michal Piekos <michal.piekos@mmpsystems.pl>

Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Linus Walleij 2 weeks, 4 days ago
On Sat, Mar 14, 2026 at 9:10 AM Michal Piekos
<michal.piekos@mmpsystems.pl> wrote:

> Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
>
> The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> is in unitialized state.
>
> Solution is to set pinmux to GPIO INPUT in
> sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> earlier.
>
> Tested on Orange Pi Zero 3.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> Suggested-by: Chen-Yu Tsai <wens@kernel.org>

Should this have a Fixes: tag and should it be applied as an urgent fix?

Tag for stable?

Also: is there consensus with Andre that this is the way to proceed?

Yours,
Linus Walleij
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Chen-Yu Tsai 2 weeks, 4 days ago
On Thu, Mar 19, 2026 at 9:46 PM Linus Walleij <linusw@kernel.org> wrote:
>
> On Sat, Mar 14, 2026 at 9:10 AM Michal Piekos
> <michal.piekos@mmpsystems.pl> wrote:
>
> > Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> >
> > The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> > is in unitialized state.
> >
> > Solution is to set pinmux to GPIO INPUT in
> > sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> > earlier.
> >
> > Tested on Orange Pi Zero 3.
> >
> > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > Suggested-by: Chen-Yu Tsai <wens@kernel.org>
>
> Should this have a Fixes: tag and should it be applied as an urgent fix?

Fixes: 01e10d0272b9 ("pinctrl: sunxi: Implement gpiochip::get_direction()")

> Tag for stable?

The original patch wasn't tagged for stable. And it doesn't seem like it
was auto picked.

> Also: is there consensus with Andre that this is the way to proceed?

As Andre mentioned, the mux value for "disabled" is different between
generations. So we likely need to make the value part of
|struct sunxi_pinctrl_desc|.

Michal, can you respin a version so that we can get this fixed in the
same release?


ChenYu
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Michal Piekos 2 weeks, 4 days ago
On Thu, Mar 19, 2026 at 10:06:55PM +0800, Chen-Yu Tsai wrote:
> On Thu, Mar 19, 2026 at 9:46 PM Linus Walleij <linusw@kernel.org> wrote:
> >
> > On Sat, Mar 14, 2026 at 9:10 AM Michal Piekos
> > <michal.piekos@mmpsystems.pl> wrote:
> >
> > > Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> > >
> > > The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> > > is in unitialized state.
> > >
> > > Solution is to set pinmux to GPIO INPUT in
> > > sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> > > earlier.
> > >
> > > Tested on Orange Pi Zero 3.
> > >
> > > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > > Suggested-by: Chen-Yu Tsai <wens@kernel.org>
> >
> > Should this have a Fixes: tag and should it be applied as an urgent fix?
> 
> Fixes: 01e10d0272b9 ("pinctrl: sunxi: Implement gpiochip::get_direction()")
> 
> > Tag for stable?
> 
> The original patch wasn't tagged for stable. And it doesn't seem like it
> was auto picked.
> 
> > Also: is there consensus with Andre that this is the way to proceed?
> 
> As Andre mentioned, the mux value for "disabled" is different between
> generations. So we likely need to make the value part of
> |struct sunxi_pinctrl_desc|.
> 
> Michal, can you respin a version so that we can get this fixed in the
> same release?
> 

Yes but I am quite new to this so it might take me few hours to
understand the proposed solution and implement it.

> 
> ChenYu
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Andre Przywara 2 weeks, 4 days ago
Hi,

On 3/19/26 15:06, Chen-Yu Tsai wrote:
> On Thu, Mar 19, 2026 at 9:46 PM Linus Walleij <linusw@kernel.org> wrote:
>>
>> On Sat, Mar 14, 2026 at 9:10 AM Michal Piekos
>> <michal.piekos@mmpsystems.pl> wrote:
>>
>>> Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
>>>
>>> The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
>>> is in unitialized state.
>>>
>>> Solution is to set pinmux to GPIO INPUT in
>>> sunxi_pinctrl_irq_request_resources() if it wasn't initialized
>>> earlier.
>>>
>>> Tested on Orange Pi Zero 3.
>>>
>>> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
>>> Suggested-by: Chen-Yu Tsai <wens@kernel.org>
>>
>> Should this have a Fixes: tag and should it be applied as an urgent fix?
> 
> Fixes: 01e10d0272b9 ("pinctrl: sunxi: Implement gpiochip::get_direction()")
> 
>> Tag for stable?
> 
> The original patch wasn't tagged for stable. And it doesn't seem like it
> was auto picked.
> 
>> Also: is there consensus with Andre that this is the way to proceed?
> 
> As Andre mentioned, the mux value for "disabled" is different between
> generations. So we likely need to make the value part of
> |struct sunxi_pinctrl_desc|.

There is already the SUNXI_PINCTRL_NEW_REG_LAYOUT flag, which describes 
exactly that: the new layout increased the bit field to 4 bits, moving 
the HiZ value to 0xf.
But it's just a flag passed to sunxi_pinctrl_init_with_flags(), not 
stored in desc, and not available during runtime. Which is what I tried 
to fix for my A733 series:
https://lore.kernel.org/linux-arm-kernel/20250821004232.8134-3-andre.przywara@arm.com/

So maybe we can cherry-pick just this patch, then check for that flag?

Cheers,
Andre

> 
> Michal, can you respin a version so that we can get this fixed in the
> same release?
> 
> 
> ChenYu
> 

Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Michal Piekos 2 weeks, 4 days ago
On Thu, Mar 19, 2026 at 03:16:33PM +0100, Andre Przywara wrote:
> Hi,
> 
> On 3/19/26 15:06, Chen-Yu Tsai wrote:
> > On Thu, Mar 19, 2026 at 9:46 PM Linus Walleij <linusw@kernel.org> wrote:
> > > 
> > > On Sat, Mar 14, 2026 at 9:10 AM Michal Piekos
> > > <michal.piekos@mmpsystems.pl> wrote:
> > > 
> > > > Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> > > > 
> > > > The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> > > > is in unitialized state.
> > > > 
> > > > Solution is to set pinmux to GPIO INPUT in
> > > > sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> > > > earlier.
> > > > 
> > > > Tested on Orange Pi Zero 3.
> > > > 
> > > > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > > > Suggested-by: Chen-Yu Tsai <wens@kernel.org>
> > > 
> > > Should this have a Fixes: tag and should it be applied as an urgent fix?
> > 
> > Fixes: 01e10d0272b9 ("pinctrl: sunxi: Implement gpiochip::get_direction()")
> > 
> > > Tag for stable?
> > 
> > The original patch wasn't tagged for stable. And it doesn't seem like it
> > was auto picked.
> > 
> > > Also: is there consensus with Andre that this is the way to proceed?
> > 
> > As Andre mentioned, the mux value for "disabled" is different between
> > generations. So we likely need to make the value part of
> > |struct sunxi_pinctrl_desc|.
> 
> There is already the SUNXI_PINCTRL_NEW_REG_LAYOUT flag, which describes
> exactly that: the new layout increased the bit field to 4 bits, moving the
> HiZ value to 0xf.
> But it's just a flag passed to sunxi_pinctrl_init_with_flags(), not stored
> in desc, and not available during runtime. Which is what I tried to fix for
> my A733 series:
> https://lore.kernel.org/linux-arm-kernel/20250821004232.8134-3-andre.przywara@arm.com/
> 
> So maybe we can cherry-pick just this patch, then check for that flag?

I'll prepare v4 with your suggestion.

> 
> Cheers,
> Andre
> 
> > 
> > Michal, can you respin a version so that we can get this fixed in the
> > same release?
> > 
> > 
> > ChenYu
> > 
> 
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Andre Przywara 3 weeks ago
Hi,

On 3/14/26 09:09, Michal Piekos wrote:
> Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> 
> The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> is in unitialized state.
> 
> Solution is to set pinmux to GPIO INPUT in
> sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> earlier.
> 
> Tested on Orange Pi Zero 3.
> 
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> Suggested-by: Chen-Yu Tsai <wens@kernel.org>
> ---
> Changes in v3:
> - Drop v2 solution which was returning input instead of error when pin
>    is not initialized.
> - Add checking pinmux configuration in
>    sunxi_pinctrl_irq_request_resources() and set pin to input if
>    uninitialized
> - Link to v2: https://lore.kernel.org/r/20260308-rc2-boot-hang-v2-1-516fdb820953@mmpsystems.pl
> 
> Changes in v2:
> - Dropped the previous faulty solution which was forcing the axp313 to
>    use r_pio as interrupt controller as pointed out by Jernej Škrabec.
> - Implemented suggestion from Andrey Skvortsov to return default
>    direction as input
> - Link to v1: https://lore.kernel.org/r/20260308-rc2-boot-hang-v1-0-d792d1a78dfd@mmpsystems.pl
> ---
>   drivers/pinctrl/sunxi/pinctrl-sunxi.c | 13 +++++++++++++
>   drivers/pinctrl/sunxi/pinctrl-sunxi.h |  1 +
>   2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> index c990b6118172..7d46f7613672 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> @@ -1089,6 +1089,9 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
>   {
>   	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
>   	struct sunxi_desc_function *func;
> +	unsigned int offset;
> +	u32 reg, shift, mask;
> +	u8 muxval;
>   	int ret;
>   
>   	func = sunxi_pinctrl_desc_find_function_by_pin(pctl,
> @@ -1096,6 +1099,16 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
>   	if (!func)
>   		return -EINVAL;
>   
> +	offset = pctl->irq_array[d->hwirq] - pctl->desc->pin_base;
> +	sunxi_mux_reg(pctl, offset, &reg, &shift, &mask);
> +	muxval = (readl(pctl->membase + reg) & mask) >> shift;
> +
> +	/* Change muxing to GPIO INPUT mode if at reset value */
> +	if (muxval == SUN4I_FUNC_IO_DISABLE) {

The "high impedance"/reset value depends on the SoC generation: older 
SoCs didn't have one, so they used 0 (GPIO_INPUT), which is the closest 
to "off" you can get there. Most SoCs afterwards indeed used 0x7, as you 
set below, but newer SoCs (D1/T113, A523, ...) use 0xf now.

Would it work to do:
	if (muxval != SUN4I_FUNC_INPUT) {
or shall we just force SUN4I_FUNC_INPUT always, without even checking? 
Or can there be other settings already (for instance the IRQ function)?

Not really familiar with the call chain here, but shouldn't the mux be 
set to the IRQ function (0x6/0xe) here anyway?

> +		sunxi_pmx_set(pctl->pctl_dev, pctl->irq_array[d->hwirq],
> +			      SUN4I_FUNC_INPUT);
> +	}
> +
>   	ret = gpiochip_lock_as_irq(pctl->chip,
>   			pctl->irq_array[d->hwirq] - pctl->desc->pin_base);
>   	if (ret) {
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> index ad26e4de16a8..22c527fc6ae2 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> @@ -86,6 +86,7 @@
>   
>   #define SUN4I_FUNC_INPUT	0
>   #define SUN4I_FUNC_IRQ		6
> +#define SUN4I_FUNC_IO_DISABLE	7

As mentioned above, this cannot be a simple fixed define for all SoCs.

Cheers,
Andre

>   
>   #define SUNXI_PINCTRL_VARIANT_MASK	GENMASK(7, 0)
>   #define SUNXI_PINCTRL_NEW_REG_LAYOUT	BIT(8)
> 
> ---
> base-commit: 4ae12d8bd9a830799db335ee661d6cbc6597f838
> change-id: 20260308-rc2-boot-hang-269e8546635b
> 
> Best regards,

Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Chen-Yu Tsai 3 weeks ago
On Mon, Mar 16, 2026 at 10:37 PM Andre Przywara <andre.przywara@arm.com> wrote:
>
> Hi,
>
> On 3/14/26 09:09, Michal Piekos wrote:
> > Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> >
> > The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> > is in unitialized state.
> >
> > Solution is to set pinmux to GPIO INPUT in
> > sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> > earlier.
> >
> > Tested on Orange Pi Zero 3.
> >
> > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > Suggested-by: Chen-Yu Tsai <wens@kernel.org>
> > ---
> > Changes in v3:
> > - Drop v2 solution which was returning input instead of error when pin
> >    is not initialized.
> > - Add checking pinmux configuration in
> >    sunxi_pinctrl_irq_request_resources() and set pin to input if
> >    uninitialized
> > - Link to v2: https://lore.kernel.org/r/20260308-rc2-boot-hang-v2-1-516fdb820953@mmpsystems.pl
> >
> > Changes in v2:
> > - Dropped the previous faulty solution which was forcing the axp313 to
> >    use r_pio as interrupt controller as pointed out by Jernej Škrabec.
> > - Implemented suggestion from Andrey Skvortsov to return default
> >    direction as input
> > - Link to v1: https://lore.kernel.org/r/20260308-rc2-boot-hang-v1-0-d792d1a78dfd@mmpsystems.pl
> > ---
> >   drivers/pinctrl/sunxi/pinctrl-sunxi.c | 13 +++++++++++++
> >   drivers/pinctrl/sunxi/pinctrl-sunxi.h |  1 +
> >   2 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> > index c990b6118172..7d46f7613672 100644
> > --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> > +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> > @@ -1089,6 +1089,9 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
> >   {
> >       struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
> >       struct sunxi_desc_function *func;
> > +     unsigned int offset;
> > +     u32 reg, shift, mask;
> > +     u8 muxval;
> >       int ret;
> >
> >       func = sunxi_pinctrl_desc_find_function_by_pin(pctl,
> > @@ -1096,6 +1099,16 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
> >       if (!func)
> >               return -EINVAL;
> >
> > +     offset = pctl->irq_array[d->hwirq] - pctl->desc->pin_base;
> > +     sunxi_mux_reg(pctl, offset, &reg, &shift, &mask);
> > +     muxval = (readl(pctl->membase + reg) & mask) >> shift;
> > +
> > +     /* Change muxing to GPIO INPUT mode if at reset value */
> > +     if (muxval == SUN4I_FUNC_IO_DISABLE) {
>
> The "high impedance"/reset value depends on the SoC generation: older
> SoCs didn't have one, so they used 0 (GPIO_INPUT), which is the closest
> to "off" you can get there. Most SoCs afterwards indeed used 0x7, as you
> set below, but newer SoCs (D1/T113, A523, ...) use 0xf now.
>
> Would it work to do:
>         if (muxval != SUN4I_FUNC_INPUT) {
> or shall we just force SUN4I_FUNC_INPUT always, without even checking?
> Or can there be other settings already (for instance the IRQ function)?

Yes, by some badly written DT. Pinctrl muxing happens first, then
request_irq(), so you could accidentally re-mux a pin that some
peripheral is using into an IRQ if we don't do the check properly.

> Not really familiar with the call chain here, but shouldn't the mux be
> set to the IRQ function (0x6/0xe) here anyway?

The muxing happens happens a few lines below, right after
gpiochip_lock_as_irq(). However we're trying to silence the warning
that gpiochip_lock_as_irq() indirectly causes.


ChenYu

> > +             sunxi_pmx_set(pctl->pctl_dev, pctl->irq_array[d->hwirq],
> > +                           SUN4I_FUNC_INPUT);
> > +     }
> > +
> >       ret = gpiochip_lock_as_irq(pctl->chip,
> >                       pctl->irq_array[d->hwirq] - pctl->desc->pin_base);
> >       if (ret) {
> > diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> > index ad26e4de16a8..22c527fc6ae2 100644
> > --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> > +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> > @@ -86,6 +86,7 @@
> >
> >   #define SUN4I_FUNC_INPUT    0
> >   #define SUN4I_FUNC_IRQ              6
> > +#define SUN4I_FUNC_IO_DISABLE        7
>
> As mentioned above, this cannot be a simple fixed define for all SoCs.
>
> Cheers,
> Andre
>
> >
> >   #define SUNXI_PINCTRL_VARIANT_MASK  GENMASK(7, 0)
> >   #define SUNXI_PINCTRL_NEW_REG_LAYOUT        BIT(8)
> >
> > ---
> > base-commit: 4ae12d8bd9a830799db335ee661d6cbc6597f838
> > change-id: 20260308-rc2-boot-hang-269e8546635b
> >
> > Best regards,
>
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Chen-Yu Tsai 3 weeks, 2 days ago
On Sat, Mar 14, 2026 at 4:10 PM Michal Piekos
<michal.piekos@mmpsystems.pl> wrote:
>
> Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
>
> The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> is in unitialized state.
>
> Solution is to set pinmux to GPIO INPUT in
> sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> earlier.
>
> Tested on Orange Pi Zero 3.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> Suggested-by: Chen-Yu Tsai <wens@kernel.org>

Interesting solution, not at all what I had in mind. :D
This fixes things immediately for sunxi, and keeps proper pin lockout,
i.e. one can't use a pin muxed for other uses as a GPIO interrupt pin.
I was hoping that the maintainers could provide some guidance as to
whether the core could provide helpers for this, but for now:

Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
Re: [PATCH v3] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown
Posted by Michal Piekos 3 weeks, 2 days ago
On Sat, Mar 14, 2026 at 04:23:11PM +0800, Chen-Yu Tsai wrote:
> On Sat, Mar 14, 2026 at 4:10 PM Michal Piekos
> <michal.piekos@mmpsystems.pl> wrote:
> >
> > Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.
> >
> > The issue is caused by gpiochip_lock_as_irq() which is failing when gpio
> > is in unitialized state.
> >
> > Solution is to set pinmux to GPIO INPUT in
> > sunxi_pinctrl_irq_request_resources() if it wasn't initialized
> > earlier.
> >
> > Tested on Orange Pi Zero 3.
> >
> > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > Suggested-by: Chen-Yu Tsai <wens@kernel.org>
> 
> Interesting solution, not at all what I had in mind. :D
> This fixes things immediately for sunxi, and keeps proper pin lockout,
> i.e. one can't use a pin muxed for other uses as a GPIO interrupt pin.
> I was hoping that the maintainers could provide some guidance as to
> whether the core could provide helpers for this, but for now:
> 
> Reviewed-by: Chen-Yu Tsai <wens@kernel.org>

Thank you.