* [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733
@ 2026-11-26 20:33 Enzo Adriano
2026-11-26 21:09 ` Alastair D'Silva
2026-12-03 15:14 ` Andre Przywara
0 siblings, 2 replies; 3+ messages in thread
From: Enzo Adriano @ 2026-11-26 20:33 UTC (permalink / raw)
To: linusw, wens, jernej.skrabec, samuel
Cc: Andre Przywara, Vinicius Pedrosa, linux-gpio, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva, Norman Herms
A733 uses two-bit voltage-mode fields, but the handlers selected when
v7.4-rc1 added A733 support program them as one-bit fields. The R-PIO
handler also writes an A523 control register absent on A733.
Add BIAS_VOLTAGE_PIO_POW_AUTO to select auto (01) in every field of
POW_MOD_SEL at controller init and skip per-pin voltage setup. Use it
for both A733 controllers: the A733 User Manual v1.00 documents 01 as
auto in sections 18.14.6.1 and 18.14.7.20. Give A733-R a separate
descriptor so A523-R keeps its existing voltage handling.
On Orange Pi 4 Pro, the one-bit handler leaves bank H in 1.8 V mode
while supplied at 3.3 V, breaking RGMII Gigabit TX. Alastair D'Silva
reported that selecting auto mode restores TX.
Fixes: 0535bfbfa97b ("pinctrl: sunxi: add support for the Allwinner A733")
Fixes: 31d68e10381c ("pinctrl: sunxi: a523-r: add a733-r compatible string")
Link: https://lore.kernel.org/r/20261107000135.6b684277@ryzen.lan
Reported-by: Alastair D'Silva <alastair@d-silva.org>
Closes: https://lore.kernel.org/r/20261125115703.3724690-1-alastair@d-silva.org
Suggested-by: Andre Przywara <andre.przywara@arm.com>
Suggested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
Tested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> # Radxa Cubie A7Z
Tested-by: Norman Herms <dockseed@proton.me> # Radxa Cubie A7S (A733)
Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com>
---
Changes in v4:
- Rebase onto pinctrl fixes after the EINT-mux fix (context only).
- Carry Vinicius' and Norman's Tested-by tags from v3 (code unchanged),
and credit Alastair's report.
v3: https://lore.kernel.org/r/20261109-a733-pinctrl-v3@gmail.com
v2: https://lore.kernel.org/r/20261104-a733-pinctrl-v2@gmail.com
Replaces Andre's RFT: https://lore.kernel.org/r/20261013142351.771229-1-andre.przywara@arm.com
Tests: arm64 defconfig and W=1 sunxi build. Vinicius tested v3 on A7Z.
Norman tested on Cubie A7S with v7.3.6 plus A733 patches, this patch
and Pablo's IRQ-bank series backported, with his voltage-mode patches
removed. POW_VAL matched the schematic; 3.3 V SD High Speed and GPIO
IRQs on PK0, PB0 and PJ24 worked.
Not tested: v4 on hardware, 1.8 V SD switching, A523, pad voltages.
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 19 +++++++++++++++----
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c | 2 +-
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 ++++++-
drivers/pinctrl/sunxi/pinctrl-sunxi.h | 2 ++
4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
index cffc1e53eef1..006754c0645f 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
@@ -30,17 +30,28 @@ static struct sunxi_pinctrl_desc a523_r_pinctrl_data = {
.pin_base = PL_BASE,
};
+static struct sunxi_pinctrl_desc a733_r_pinctrl_data = {
+ .irq_banks = ARRAY_SIZE(a523_r_irq_bank_map),
+ .irq_bank_map = a523_r_irq_bank_map,
+ .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_AUTO,
+ .pin_base = PL_BASE,
+};
+
static int a523_r_pinctrl_probe(struct platform_device *pdev)
{
+ struct sunxi_pinctrl_desc *desc;
+
+ desc = (struct sunxi_pinctrl_desc *)of_device_get_match_data(&pdev->dev);
return sunxi_pinctrl_dt_table_init(pdev, a523_r_nr_bank_pins,
- a523_r_irq_bank_muxes,
- &a523_r_pinctrl_data,
+ a523_r_irq_bank_muxes, desc,
SUNXI_PINCTRL_NCAT2_REG_LAYOUT);
}
static const struct of_device_id a523_r_pinctrl_match[] = {
- { .compatible = "allwinner,sun55i-a523-r-pinctrl", },
- { .compatible = "allwinner,sun60i-a733-r-pinctrl", },
+ { .compatible = "allwinner,sun55i-a523-r-pinctrl",
+ .data = &a523_r_pinctrl_data },
+ { .compatible = "allwinner,sun60i-a733-r-pinctrl",
+ .data = &a733_r_pinctrl_data },
{}
};
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
index 456d9170c2a2..c66f57385075 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
@@ -23,7 +23,7 @@ static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
static struct sunxi_pinctrl_desc a733_pinctrl_data = {
.irq_banks = 10,
- .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
+ .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_AUTO,
};
static int a733_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index bf4ec4665e2b..e54ed9e0b403 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -732,7 +732,8 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl,
u32 val, reg;
int uV;
- if (!pctl->desc->io_bias_cfg_variant)
+ if (pctl->desc->io_bias_cfg_variant == BIAS_VOLTAGE_NONE ||
+ pctl->desc->io_bias_cfg_variant == BIAS_VOLTAGE_PIO_POW_AUTO)
return 0;
uV = regulator_get_voltage(supply);
@@ -1655,6 +1656,10 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
if (IS_ERR(clk))
return PTR_ERR(clk);
+ /* Select auto (01) for every bank, including shared VCC-IO. */
+ if (desc->io_bias_cfg_variant == BIAS_VOLTAGE_PIO_POW_AUTO)
+ writel(0x55555555, pctl->membase + pctl->pow_mod_sel_offset);
+
/*
* Seed the output latch shadow from the hardware so pins the
* bootloader left in output mode keep their state; see
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index 7c2f29e75519..7b36c5c2263e 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -130,6 +130,8 @@ enum sunxi_desc_bias_voltage {
*/
BIAS_VOLTAGE_PIO_POW_MODE_CTL,
BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV,
+ /* Two-bit PIO_POW_MOD_SEL fields set to automatic voltage detection. */
+ BIAS_VOLTAGE_PIO_POW_AUTO,
};
struct sunxi_desc_function {
base-commit: 721850a3086d109c7ea5841673766a393747e4f1
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733
2026-11-26 20:33 [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733 Enzo Adriano
@ 2026-11-26 21:09 ` Alastair D'Silva
2026-12-03 15:14 ` Andre Przywara
1 sibling, 0 replies; 3+ messages in thread
From: Alastair D'Silva @ 2026-11-26 21:09 UTC (permalink / raw)
To: Enzo Adriano
Cc: linusw, wens, jernej.skrabec, samuel, Andre Przywara,
Vinicius Pedrosa, Norman Herms, linux-gpio, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
On Thu, Nov 26, 2026 at 03:33:36PM -0500, Enzo Adriano wrote:
> A733 uses two-bit voltage-mode fields, but the handlers selected when
> v7.4-rc1 added A733 support program them as one-bit fields. The R-PIO
> handler also writes an A523 control register absent on A733.
>
> Add BIAS_VOLTAGE_PIO_POW_AUTO to select auto (01) in every field of
> POW_MOD_SEL at controller init and skip per-pin voltage setup. Use it
> for both A733 controllers: the A733 User Manual v1.00 documents 01 as
> auto in sections 18.14.6.1 and 18.14.7.20. Give A733-R a separate
> descriptor so A523-R keeps its existing voltage handling.
>
> On Orange Pi 4 Pro, the one-bit handler leaves bank H in 1.8 V mode
> while supplied at 3.3 V, breaking RGMII Gigabit TX. Alastair D'Silva
> reported that selecting auto mode restores TX.
>
> Fixes: 0535bfbfa97b ("pinctrl: sunxi: add support for the Allwinner A733")
> Fixes: 31d68e10381c ("pinctrl: sunxi: a523-r: add a733-r compatible string")
> Link: https://lore.kernel.org/r/20261107000135.6b684277@ryzen.lan
> Reported-by: Alastair D'Silva <alastair@d-silva.org>
> Closes: https://lore.kernel.org/r/20261125115703.3724690-1-alastair@d-silva.org
> Suggested-by: Andre Przywara <andre.przywara@arm.com>
> Suggested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
> Tested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> # Radxa Cubie A7Z
> Tested-by: Norman Herms <dockseed@proton.me> # Radxa Cubie A7S (A733)
> Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com>
Verified on Orange Pi 4 Pro: PIO_POW_MOD_SEL (0x02000040) reads
0x05555555 and 3.3 V RGMII Gigabit TX on bank H works at 1Gbps/Full
(DHCP, ping, and iperf3).
Reviewed-by: Alastair D'Silva <alastair@d-silva.org>
Tested-by: Alastair D'Silva <alastair@d-silva.org> # Orange Pi 4 Pro (A733)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733
2026-11-26 20:33 [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733 Enzo Adriano
2026-11-26 21:09 ` Alastair D'Silva
@ 2026-12-03 15:14 ` Andre Przywara
1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2026-12-03 15:14 UTC (permalink / raw)
To: Enzo Adriano, linusw, wens, jernej.skrabec, samuel
Cc: Vinicius Pedrosa, linux-gpio, linux-arm-kernel, linux-sunxi,
linux-kernel, Alastair D'Silva, Norman Herms
Hi Enzo,
On 11/26/26 21:33, Enzo Adriano wrote:
> A733 uses two-bit voltage-mode fields, but the handlers selected when
> v7.4-rc1 added A733 support program them as one-bit fields. The R-PIO
> handler also writes an A523 control register absent on A733.
>
> Add BIAS_VOLTAGE_PIO_POW_AUTO to select auto (01) in every field of
> POW_MOD_SEL at controller init and skip per-pin voltage setup. Use it
> for both A733 controllers: the A733 User Manual v1.00 documents 01 as
> auto in sections 18.14.6.1 and 18.14.7.20. Give A733-R a separate
> descriptor so A523-R keeps its existing voltage handling.
Thanks for the changes, that looks good to me now.
I did run some tests on A733, A523 and H616, but nothing that really
would affect this code, I think this requires eMMC or Ethernet on A733.
But others have reported that this fixes Ethernet.
Linusw: from my point of view this is good to be taken into
pinctrl/fixes, for v7.4 still.
> On Orange Pi 4 Pro, the one-bit handler leaves bank H in 1.8 V mode
> while supplied at 3.3 V, breaking RGMII Gigabit TX. Alastair D'Silva
> reported that selecting auto mode restores TX.
>
> Fixes: 0535bfbfa97b ("pinctrl: sunxi: add support for the Allwinner A733")
> Fixes: 31d68e10381c ("pinctrl: sunxi: a523-r: add a733-r compatible string")
> Link: https://lore.kernel.org/r/20261107000135.6b684277@ryzen.lan
> Reported-by: Alastair D'Silva <alastair@d-silva.org>
> Closes: https://lore.kernel.org/r/20261125115703.3724690-1-alastair@d-silva.org
> Suggested-by: Andre Przywara <andre.przywara@arm.com>
> Suggested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
> Tested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> # Radxa Cubie A7Z
> Tested-by: Norman Herms <dockseed@proton.me> # Radxa Cubie A7S (A733)
> Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> ---
> Changes in v4:
> - Rebase onto pinctrl fixes after the EINT-mux fix (context only).
> - Carry Vinicius' and Norman's Tested-by tags from v3 (code unchanged),
> and credit Alastair's report.
>
> v3: https://lore.kernel.org/r/20261109-a733-pinctrl-v3@gmail.com
> v2: https://lore.kernel.org/r/20261104-a733-pinctrl-v2@gmail.com
> Replaces Andre's RFT: https://lore.kernel.org/r/20261013142351.771229-1-andre.przywara@arm.com
>
> Tests: arm64 defconfig and W=1 sunxi build. Vinicius tested v3 on A7Z.
> Norman tested on Cubie A7S with v7.3.6 plus A733 patches, this patch
> and Pablo's IRQ-bank series backported, with his voltage-mode patches
> removed. POW_VAL matched the schematic; 3.3 V SD High Speed and GPIO
> IRQs on PK0, PB0 and PJ24 worked.
> Not tested: v4 on hardware, 1.8 V SD switching, A523, pad voltages.
>
> drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 19 +++++++++++++++----
> drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c | 2 +-
> drivers/pinctrl/sunxi/pinctrl-sunxi.c | 7 ++++++-
> drivers/pinctrl/sunxi/pinctrl-sunxi.h | 2 ++
> 4 files changed, 24 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> index cffc1e53eef1..006754c0645f 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> @@ -30,17 +30,28 @@ static struct sunxi_pinctrl_desc a523_r_pinctrl_data = {
> .pin_base = PL_BASE,
> };
>
> +static struct sunxi_pinctrl_desc a733_r_pinctrl_data = {
> + .irq_banks = ARRAY_SIZE(a523_r_irq_bank_map),
> + .irq_bank_map = a523_r_irq_bank_map,
> + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_AUTO,
> + .pin_base = PL_BASE,
> +};
> +
> static int a523_r_pinctrl_probe(struct platform_device *pdev)
> {
> + struct sunxi_pinctrl_desc *desc;
> +
> + desc = (struct sunxi_pinctrl_desc *)of_device_get_match_data(&pdev->dev);
> return sunxi_pinctrl_dt_table_init(pdev, a523_r_nr_bank_pins,
> - a523_r_irq_bank_muxes,
> - &a523_r_pinctrl_data,
> + a523_r_irq_bank_muxes, desc,
> SUNXI_PINCTRL_NCAT2_REG_LAYOUT);
> }
>
> static const struct of_device_id a523_r_pinctrl_match[] = {
> - { .compatible = "allwinner,sun55i-a523-r-pinctrl", },
> - { .compatible = "allwinner,sun60i-a733-r-pinctrl", },
> + { .compatible = "allwinner,sun55i-a523-r-pinctrl",
> + .data = &a523_r_pinctrl_data },
> + { .compatible = "allwinner,sun60i-a733-r-pinctrl",
> + .data = &a733_r_pinctrl_data },
> {}
> };
>
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> index 456d9170c2a2..c66f57385075 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> @@ -23,7 +23,7 @@ static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
>
> static struct sunxi_pinctrl_desc a733_pinctrl_data = {
> .irq_banks = 10,
> - .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
> + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_AUTO,
> };
>
> static int a733_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> index bf4ec4665e2b..e54ed9e0b403 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> @@ -732,7 +732,8 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl,
> u32 val, reg;
> int uV;
>
> - if (!pctl->desc->io_bias_cfg_variant)
> + if (pctl->desc->io_bias_cfg_variant == BIAS_VOLTAGE_NONE ||
> + pctl->desc->io_bias_cfg_variant == BIAS_VOLTAGE_PIO_POW_AUTO)
> return 0;
>
> uV = regulator_get_voltage(supply);
> @@ -1655,6 +1656,10 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
> if (IS_ERR(clk))
> return PTR_ERR(clk);
>
> + /* Select auto (01) for every bank, including shared VCC-IO. */
> + if (desc->io_bias_cfg_variant == BIAS_VOLTAGE_PIO_POW_AUTO)
> + writel(0x55555555, pctl->membase + pctl->pow_mod_sel_offset);
> +
> /*
> * Seed the output latch shadow from the hardware so pins the
> * bootloader left in output mode keep their state; see
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> index 7c2f29e75519..7b36c5c2263e 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> @@ -130,6 +130,8 @@ enum sunxi_desc_bias_voltage {
> */
> BIAS_VOLTAGE_PIO_POW_MODE_CTL,
> BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV,
> + /* Two-bit PIO_POW_MOD_SEL fields set to automatic voltage detection. */
> + BIAS_VOLTAGE_PIO_POW_AUTO,
> };
>
> struct sunxi_desc_function {
>
> base-commit: 721850a3086d109c7ea5841673766a393747e4f1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-03 17:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 20:33 [PATCH v4] pinctrl: sunxi: use automatic voltage detection on A733 Enzo Adriano
2026-11-26 21:09 ` Alastair D'Silva
2026-12-03 15:14 ` Andre Przywara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox