pinctrl: sunxi: preserve A733 firmware voltage modes
Commit Message
The A733 voltage-selection fields are two bits wide. The main controller
uses a separate VCCIO field at bits 25:24 for PB; the older one-bit
handler instead writes bit1 when PB is requested. A733 R-PIO also
differs from A523: its documented table has SEL at 0x340 and VAL at
0x348, without the A523 control register at 0x344.
Stop using those incompatible layouts on A733. Select BIAS_VOLTAGE_NONE
for both controllers and give A733-R its own descriptor, retaining the
A523-R descriptor and behavior. This preserves firmware voltage modes
when explicit bank supplies are requested. It does not implement dynamic
voltage switching or choose among conflicting manual AUTO descriptions.
The public October 14 discussion recommends this conservative treatment:
https://lore.kernel.org/all/20261014183516.172060-1-vinicius.eduardo.pedrosa@gmail.com/
AI assistance: Codex:gpt-6-astra.
Suggested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
Assisted-by: LLM
Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com>
---
This implements Vinicius Pedrosa's recommended conservative approach
for both A733 controllers, including a separate A733-R descriptor:
https://lore.kernel.org/r/20261014183516.172060-1-vinicius.eduardo.pedrosa@gmail.com
It avoids the disputed AUTO encoding and does not replace that public
discussion with a claim that voltage switching is solved.
The standalone base is official commit
d89e1d186ec9271bf78e62771779e9fc03bf0fc3 plus Pablo Mazzini's three
IRQ-bank v3 patches:
https://lore.kernel.org/r/20261025142412.112216-1-pmazzini@gmail.com
The IRQ changes are prerequisites, not part of this patch's diff.
With the separate A7S DT v2 and its PMIC/bank supplies enabled, two
final-candidate RAM boots preserved the main and R SEL controls and
PF supply selector across kernel handoff. UART0, R-I2C0/PMIC and
read-only MMC0 traffic worked, including after unused-regulator cleanup.
The firmware's PF high-voltage path was verified before each boot.
A regression harness exercised 60 A733 no-read/no-write cases, the old
main-handler wrong-bit counterexample, and the unchanged A523-R
handler behavior. Both changed objects built with W=1. A523-R hardware
was not tested; its behavior is retained and checked by the regression
harness. No analog voltage, UHS or dynamic voltage-switching claim is
made. The read-only VAL observations are not precision measurements.
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 20 +++++++++++++++----
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c | 3 ++-
2 files changed, 18 insertions(+), 5 deletions(-)
base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3
prerequisite-patch-id: 85db03df3394cdcb2780a0da122a74b2c1fe220d
prerequisite-patch-id: a3e883da50bf03e8f522444def66fec7f996ffbe
prerequisite-patch-id: c6889699a6dc13c336ce4cf4659e21b551e9a9fc
Comments
Hi Enzo,
I tested your patch on a Radxa Cubie A7Z (A733, 1 GiB LPDDR4), running
Linux 7.3-rc6 with our local A733 patch stack and SPL/TF-A/U-Boot,
without the vendor boot0. It's not your exact base, and a733.c applied
with a context adjustment (same change).
On 10/30/26 22:26, Enzo Adriano wrote:
> This preserves firmware voltage modes when explicit bank supplies are
> requested.
Three warm boots with your patch and one with our local A733 pinctrl
patches as control. In all four the main PIO and R-PIO voltage mode
registers were the same from U-Boot through Linux, also after the
unused regulator cleanup. SD card reads and USB1 Wi-Fi (with R-PIO
GPIOs) worked, and the R-I2C0 bus is there. The control produced the
same results, so this validates no regression on my setup rather than
demonstrating a before/after fix.
One detail: our DT had no vcc-pl-supply and vcc-pm-supply, so the dummy
regulator reports 0 V and the R-PIO path isn't exercised at all. I
added both (3.3 V) to the DT in memory for the test. PF already had its
supply.
I did not test cold boot, 1.8 V switching or A523.
Tested-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> # Cubie A7Z
Thanks,
Vinicius
@@ -30,17 +30,29 @@ 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,
+ /* A733 has two-bit voltage modes, without the A523 control register. */
+ .io_bias_cfg_variant = BIAS_VOLTAGE_NONE,
+ .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 },
{}
};
@@ -27,7 +27,8 @@ static struct sunxi_pinctrl_desc a733_pinctrl_data = {
.irq_banks = ARRAY_SIZE(a733_irq_bank_map),
.irq_bank_map = a733_irq_bank_map,
.irq_read_needs_mux = true,
- .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
+ /* Preserve the firmware-configured two-bit voltage modes. */
+ .io_bias_cfg_variant = BIAS_VOLTAGE_NONE,
};
static int a733_pinctrl_probe(struct platform_device *pdev)