Skip to contentSkip to conversation

pinctrl: sunxi: Add Allwinner A733 support

PATCH In review Andre Przywara 5 participants 16 messages Sep 10 – Oct 12

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover pinctrl: sunxi: Add Allwinner A733 support

Hi,

more than a year(!) after the RFC, now the first "proper" version of the pinctrl and GPIO IP support for the new Allwinner A733 SoC. I originally had planned to prepend the GPIO_GENERIC support [1] here, but there are quite some nasty details to solve there, and I don't want to jeopardise the hardware enablement for this SoC on this rework. LinusW, I hope you can forgive me for dropping this rework (just for this series), I still want to work on this, but it takes more time. I do understand this would make you to give up some of your leverage on this topic then, so please let me know if that's fine for you. I can elaborate on the GPIO_GENERIC problems if you like.
So compared to the RFC this is mostly a rebase, dropping one patch that has already been merged (RFC PATCH 2/9 "pinctrl: sunxi: pass down flags to pinctrl routines"). I also dropped the patch that introduces the GPIO set/clear optimisation, using the new separate registers, as this would become obsolete with the adoption of GPIO_GENERIC.
Changelog below, based on v7.3-rc1.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

================================
Add GPIO and pinctrl support for the new Allwinner A733 SoC. With all our abstractions and data structure driven code, life could have been so easy, but Allwinner decided to change the layout of the MMIO register frame, which requires all kinds of special handling and code changes here and there. Hopefully this new layout (which admittedly looks more future proof) will stay around for a while, but I am not holding my breath on this.

In summary, the changes are:
- Each GPIO bank now occupies 128 bytes instead of just 36 or 48.
- PortA (not implemented on the A733) starts at offset 0x80, not at 0.
- The non-bank specific registers are moved into this gap at the beginning.
- There are two new registers per bank, to set or clear bits in the GPIO data register, to allow for single-write, lockless GPIO settings.
- The drive level register is moved (to make room for the set/clr regs).
- The IRQ registers are moved into the now bigger respective bank control registers part, instead of being grouped separately, as before.

The series follows the usual pattern of refactoring first, to prepare for the new MMIO frame layout (patches 1-3), then using the changed code to enable support for this new generation, in patch 4/7. Patch 5/7 adds the new DT bindings, patch 6/7 enables the secondary controller, which curiously is not using the new layout, but looks very similar to the secondary A523 pin controller.
The final patch 7/7 then adds the driver stub file, which just describes the GPIO bank configuration and lists the one quirk bit that engages the code changes added for the new layout.

Please have a look, review and test.
I tested this on a Cubie A7Z board.

Cheers,
Andre

Changes in v1:
- rebase on v7.3-rc1
- drop already applied RFC patch 2/9
- drop SET/CLEAR register patch

Andre Przywara (7):
pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT
pinctrl: sunxi: only use PortK special handling on A523
pinctrl: sunxi: refactor IRQ register accessors
pinctrl: sunxi: support A733 generation MMIO register layout
dt-bindings: pinctrl: add compatible for Allwinner A733
pinctrl: sunxi: a523-r: add a733-r compatible string
pinctrl: sunxi: add support for the Allwinner A733

 .../allwinner,sun55i-a523-pinctrl.yaml        |  6 +-
 drivers/pinctrl/sunxi/Kconfig                 |  5 ++
 drivers/pinctrl/sunxi/Makefile                |  1 +
 drivers/pinctrl/sunxi/pinctrl-sun20i-d1.c     |  2 +-
 drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c |  3 +-
 drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c   |  2 +-
 drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c   | 50 +++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 41 +++++++----
 drivers/pinctrl/sunxi/pinctrl-sunxi.h         | 71 +++++++++++++------
 9 files changed, 139 insertions(+), 42 deletions(-)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935

Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/7 pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT

After keeping the pinctrl IP mostly register compatible for almost a decade, in 2021 Allwinner introduced some changes to the register layout, which made us use a flag called SUNXI_PINCTRL_NEW_REG_LAYOUT. Now with their latest SoC (A733), Allwinner changed the pinctrl IP again, so "NEW" isn't really a fitting name anymore.

Rename the symbol to SUNXI_PINCTRL_NCAT2_REG_LAYOUT, with "NCAT2" being a name often used in vendor source code to signify this "new" generation of SoCs.

Just a rename of the symbol, no actual code changes.

---
 drivers/pinctrl/sunxi/pinctrl-sun20i-d1.c     | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c   | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 4 ++--
 drivers/pinctrl/sunxi/pinctrl-sunxi.h         | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sun20i-d1.c +1 -1
index 8efe35b77af4d..37a60e5d1163b 100644
@@ -821,7 +821,7 @@ static const struct sunxi_pinctrl_desc d1_pinctrl_data = {
 static int d1_pinctrl_probe(struct platform_device *pdev)
 {
 	return sunxi_pinctrl_init_with_flags(pdev, &d1_pinctrl_data,
-					     SUNXI_PINCTRL_NEW_REG_LAYOUT);
+					     SUNXI_PINCTRL_NCAT2_REG_LAYOUT);
 }
 
 static const struct of_device_id d1_pinctrl_match[] = {
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c +1 -1
index 462aa1c4a5fa6..9e07fbb5be7cb 100644
@@ -35,7 +35,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev)
 	return sunxi_pinctrl_dt_table_init(pdev, a523_r_nr_bank_pins,
 					   a523_r_irq_bank_muxes,
 					   &a523_r_pinctrl_data,
-					   SUNXI_PINCTRL_NEW_REG_LAYOUT);
+					   SUNXI_PINCTRL_NCAT2_REG_LAYOUT);
 }
 
 static const struct of_device_id a523_r_pinctrl_match[] = {
drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c +1 -1
index b6f78f1f30ac4..801f62abc93df 100644
@@ -34,7 +34,7 @@ static int a523_pinctrl_probe(struct platform_device *pdev)
 	return sunxi_pinctrl_dt_table_init(pdev, a523_nr_bank_pins,
 					   a523_irq_bank_muxes,
 					   &a523_pinctrl_data,
-					   SUNXI_PINCTRL_NEW_REG_LAYOUT |
+					   SUNXI_PINCTRL_NCAT2_REG_LAYOUT |
 					   SUNXI_PINCTRL_ELEVEN_BANKS);
 }
 
drivers/pinctrl/sunxi/pinctrl-sunxi.c +2 -2
index 25489beeb3125..bc6948e3fb495 100644
@@ -1107,7 +1107,7 @@ static int sunxi_pinctrl_irq_request_resources(struct irq_data *d)
 	muxval = (readl(pctl->membase + reg) & mask) >> shift;
 
 	/* Change muxing to GPIO INPUT mode if at reset value */
-	if (pctl->flags & SUNXI_PINCTRL_NEW_REG_LAYOUT)
+	if (pctl->flags & SUNXI_PINCTRL_NCAT2_REG_LAYOUT)
 		disabled_mux = SUN4I_FUNC_DISABLED_NEW;
 	else
 		disabled_mux = SUN4I_FUNC_DISABLED_OLD;
@@ -1589,7 +1589,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 	pctl->dev = &pdev->dev;
 	pctl->desc = desc;
 	pctl->flags = flags;
-	if (flags & SUNXI_PINCTRL_NEW_REG_LAYOUT) {
+	if (flags & SUNXI_PINCTRL_NCAT2_REG_LAYOUT) {
 		pctl->bank_mem_size = D1_BANK_MEM_SIZE;
 		pctl->pull_regs_offset = D1_PULL_REGS_OFFSET;
 		pctl->dlevel_field_width = D1_DLEVEL_FIELD_WIDTH;
drivers/pinctrl/sunxi/pinctrl-sunxi.h +1 -1
index 0daf7600e2fb0..c519055e31b73 100644
@@ -90,7 +90,7 @@
 #define SUN4I_FUNC_DISABLED_NEW 15
 
 #define SUNXI_PINCTRL_VARIANT_MASK	GENMASK(7, 0)
-#define SUNXI_PINCTRL_NEW_REG_LAYOUT	BIT(8)
+#define SUNXI_PINCTRL_NCAT2_REG_LAYOUT	BIT(8)
 #define SUNXI_PINCTRL_PORTF_SWITCH	BIT(9)
 #define SUNXI_PINCTRL_ELEVEN_BANKS	BIT(10)
 
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/7 pinctrl: sunxi: only use PortK special handling on A523

In reply to Andre Przywara

The Allwinner A523 pinctrl IP requires an exception for addressing PortK, since the registers for this GPIO bank did not fit anymore in the existing MMIO frame. Since the A523 was also the first SoC to actually implement PortK, we just enabled this quirk unconditionally. Now the new Allwinner A733 changed the MMIO frame layout, so PortK can and must be handled without any special code.

Mark the special casing for PortK with the ELEVEN_BANKS quirk flag we introduced, so that it will only be used on SoCs using the A523 pinctrl IP.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +1 -1
index bc6948e3fb495..2524e0b3a2a5a 100644
@@ -67,7 +67,7 @@ static u32 sunxi_bank_offset(const struct sunxi_pinctrl *pctl, u32 pin)
 {
 	u32 offset = 0;
 
-	if (pin >= PK_BASE) {
+	if (pin >= PK_BASE && (pctl->flags & SUNXI_PINCTRL_ELEVEN_BANKS)) {
 		pin -= PK_BASE;
 		offset = PIO_BANK_K_OFFSET;
 	}
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 2/7
#3 lore raw

Re: [PATCH 2/7] pinctrl: sunxi: only use PortK special handling on A523

Quoted 8 lines · Andre Przywara

The Allwinner A523 pinctrl IP requires an exception for addressing PortK, since the registers for this GPIO bank did not fit anymore in the existing MMIO frame. Since the A523 was also the first SoC to actually implement PortK, we just enabled this quirk unconditionally. Now the new Allwinner A733 changed the MMIO frame layout, so PortK can and must be handled without any special code.

Quoted 5 lines

Mark the special casing for PortK with the ELEVEN_BANKS quirk flag we introduced, so that it will only be used on SoCs using the A523 pinctrl IP.

Quoted 20 lines
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +1 -2
index bc6948e3fb495..2524e0b3a2a5a 100644
@@ -67,7 +67,7 @@ static u32 sunxi_bank_offset(const struct sunxi_pinctrl *pctl, u32 pin)
 {
        u32 offset = 0;
 
-       if (pin >= PK_BASE) {
+       if (pin >= PK_BASE && (pctl->flags & SUNXI_PINCTRL_ELEVEN_BANKS)) {
                pin -= PK_BASE;
                offset = PIO_BANK_K_OFFSET;
        }
--

2.47.3

#4 lore raw

PATCH 3/7 pinctrl: sunxi: refactor IRQ register accessors

In reply to Andre Przywara

So far on Allwinner SoCs the registers for controlling the IRQ capabilities of each bank are grouped separately, behind all the pinmux related register for all banks:

    0x000   0x024      0x144       0x200  0x220     0x320
    PortA   PortB  ... PortJ <gap> IRQ-A  IRQ-B ... IRQ-J

The newest SoCs now group the IRQ registers together with the other per-bank registers, so we need to change the accessor functions to account for that:
0x080 0x0c0 0x100 0x140 0x580 0x5c0
PortA IRQ-A PortB IRQ-B ... PortK IRQ-K

In preparation for supporting those newer SoCs, pass in the pointer to "struct sunxi_pinctrl" instead of just its member "desc", so that we gain access to the flags, to later determine which of the layout variants we need to use. To simplify that, add a new sunxi_irq_base_reg() function that returns the respective IRQ register base address.
Also split off the IRQ control register base offset (0x200) from each IRQ register's offset, so that the individual offsets can be added later separately, to that base address.

No functional change at this point, just refactoring.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 21 +++++-----
 drivers/pinctrl/sunxi/pinctrl-sunxi.h | 55 ++++++++++++++++-----------
 2 files changed, 44 insertions(+), 32 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +11 -10
index 2524e0b3a2a5a..5f08c75549b4d 100644
@@ -762,9 +762,10 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl,
 		else
 			val = 0xD; /* 3.3V */
 
-		reg = readl(pctl->membase + sunxi_grp_config_reg(pin));
+		reg = readl(pctl->membase + sunxi_grp_config_reg(pctl, pin));
 		reg &= ~IO_BIAS_MASK;
-		writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin));
+		writel(reg | val, pctl->membase +
+		       sunxi_grp_config_reg(pctl, pin));
 		return 0;
 	case BIAS_VOLTAGE_PIO_POW_MODE_CTL:
 		val = uV > 1800000 && uV <= 2500000 ? BIT(bank) : 0;
@@ -1140,7 +1141,7 @@ static void sunxi_pinctrl_irq_release_resources(struct irq_data *d)
 static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
 {
 	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
-	u32 reg = sunxi_irq_cfg_reg(pctl->desc, d->hwirq);
+	u32 reg = sunxi_irq_cfg_reg(pctl, d->hwirq);
 	u8 index = sunxi_irq_cfg_offset(d->hwirq);
 	unsigned long flags;
 	u32 regval;
@@ -1187,7 +1188,7 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
 static void sunxi_pinctrl_irq_ack(struct irq_data *d)
 {
 	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
-	u32 status_reg = sunxi_irq_status_reg(pctl->desc, d->hwirq);
+	u32 status_reg = sunxi_irq_status_reg(pctl, d->hwirq);
 	u8 status_idx = sunxi_irq_status_offset(d->hwirq);
 
 	/* Clear the IRQ */
@@ -1197,7 +1198,7 @@ static void sunxi_pinctrl_irq_ack(struct irq_data *d)
 static void sunxi_pinctrl_irq_mask(struct irq_data *d)
 {
 	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
-	u32 reg = sunxi_irq_ctrl_reg(pctl->desc, d->hwirq);
+	u32 reg = sunxi_irq_ctrl_reg(pctl, d->hwirq);
 	u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
 	unsigned long flags;
 	u32 val;
@@ -1214,7 +1215,7 @@ static void sunxi_pinctrl_irq_mask(struct irq_data *d)
 static void sunxi_pinctrl_irq_unmask(struct irq_data *d)
 {
 	struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
-	u32 reg = sunxi_irq_ctrl_reg(pctl->desc, d->hwirq);
+	u32 reg = sunxi_irq_ctrl_reg(pctl, d->hwirq);
 	u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
 	unsigned long flags;
 	u32 val;
@@ -1318,7 +1319,7 @@ static void sunxi_pinctrl_irq_handler(struct irq_desc *desc)
 
 	chained_irq_enter(chip, desc);
 
-	reg = sunxi_irq_status_reg_from_bank(pctl->desc, bank);
+	reg = sunxi_irq_status_reg_from_bank(pctl, bank);
 	val = readl(pctl->membase + reg);
 
 	if (val) {
@@ -1557,7 +1558,7 @@ static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl,
 
 		writel(src | div << 4,
 		       pctl->membase +
-		       sunxi_irq_debounce_reg_from_bank(pctl->desc, i));
+		       sunxi_irq_debounce_reg_from_bank(pctl, i));
 	}
 
 	return 0;
@@ -1745,10 +1746,10 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 	for (i = 0; i < pctl->desc->irq_banks; i++) {
 		/* Mask and clear all IRQs before registering a handler */
 		writel(0, pctl->membase +
-			  sunxi_irq_ctrl_reg_from_bank(pctl->desc, i));
+			  sunxi_irq_ctrl_reg_from_bank(pctl, i));
 		writel(0xffffffff,
 		       pctl->membase +
-		       sunxi_irq_status_reg_from_bank(pctl->desc, i));
+		       sunxi_irq_status_reg_from_bank(pctl, i));
 
 		irq_set_chained_handler_and_data(pctl->irq[i],
 						 sunxi_pinctrl_irq_handler,
drivers/pinctrl/sunxi/pinctrl-sunxi.h +33 -22

128 lines not on this page · raw message

Signature · 1 line
2.47.3
#5 lore raw

PATCH 4/7 pinctrl: sunxi: support A733 generation MMIO register layout

In reply to Andre Przywara

After Allwinner changed the layout of the pinctrl/GPIO IP MMIO register frame only a few years back, the new SoC generation (starting with the A733) changes the layout again: each port now uses 128 instead of 36 or 48 bytes, and the drive level registers move to make space for the new set/clear data registers. Also the PortA registers start at offset 0x80 instead of 0x0 as before, to make room for non-bank specific registers, like the pow_mod_sel registers, at the beginning of the MMIO frame. Finally the IRQ registers move into each bank's region.

Add yet another quirk bit to mark this case, and set the existing register offset values to match the new layout. This also requires to add new members to struct sunxi_pinctrl, to accommodate the extra changes. The actual runtime code changes are fortunately minor.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 14 ++++++++++++--
 drivers/pinctrl/sunxi/pinctrl-sunxi.h | 14 ++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +12 -2
index 5f08c75549b4d..35aa3a8ea1814 100644
@@ -65,7 +65,7 @@ static struct irq_chip sunxi_pinctrl_level_irq_chip;
  */
 static u32 sunxi_bank_offset(const struct sunxi_pinctrl *pctl, u32 pin)
 {
-	u32 offset = 0;
+	u32 offset = pctl->bank_offset;
 
 	if (pin >= PK_BASE && (pctl->flags & SUNXI_PINCTRL_ELEVEN_BANKS)) {
 		pin -= PK_BASE;
@@ -102,7 +102,7 @@ static void sunxi_dlevel_reg(const struct sunxi_pinctrl *pctl,
 {
 	u32 offset = pin % PINS_PER_BANK * pctl->dlevel_field_width;
 
-	*reg   = sunxi_bank_offset(pctl, pin) + DLEVEL_REGS_OFFSET +
+	*reg   = sunxi_bank_offset(pctl, pin) + pctl->drv_regs_offset +
 		 offset / BITS_PER_TYPE(u32) * sizeof(u32);
 	*shift = offset % BITS_PER_TYPE(u32);
 	*mask  = (BIT(pctl->dlevel_field_width) - 1) << *shift;
@@ -1592,15 +1592,25 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 	pctl->flags = flags;
 	if (flags & SUNXI_PINCTRL_NCAT2_REG_LAYOUT) {
 		pctl->bank_mem_size = D1_BANK_MEM_SIZE;
+		pctl->drv_regs_offset = DLEVEL_REGS_OFFSET;
 		pctl->pull_regs_offset = D1_PULL_REGS_OFFSET;
 		pctl->dlevel_field_width = D1_DLEVEL_FIELD_WIDTH;
+	} else if (flags & SUNXI_PINCTRL_NCAT3_REG_LAYOUT) {
+		pctl->bank_mem_size = A733_BANK_MEM_SIZE;
+		pctl->bank_offset = A733_BANK_OFFSET;
+		pctl->drv_regs_offset = A733_DLEVEL_REGS_OFFSET;
+		pctl->pull_regs_offset = A733_PULL_REGS_OFFSET;
+		pctl->dlevel_field_width = D1_DLEVEL_FIELD_WIDTH;
 	} else {
 		pctl->bank_mem_size = BANK_MEM_SIZE;
+		pctl->drv_regs_offset = DLEVEL_REGS_OFFSET;
 		pctl->pull_regs_offset = PULL_REGS_OFFSET;
 		pctl->dlevel_field_width = DLEVEL_FIELD_WIDTH;
 	}
 	if (flags & SUNXI_PINCTRL_ELEVEN_BANKS)
 		pctl->pow_mod_sel_offset = PIO_11B_POW_MOD_SEL_REG;
+	else if (flags & SUNXI_PINCTRL_NCAT3_REG_LAYOUT)
+		pctl->pow_mod_sel_offset = PIO_NCAT3_POW_MOD_SEL_REG;
 	else
 		pctl->pow_mod_sel_offset = PIO_POW_MOD_SEL_REG;
 
drivers/pinctrl/sunxi/pinctrl-sunxi.h +14 -0
index 15aa6fe62dbbc..d09467ed437a3 100644
@@ -53,6 +53,12 @@
 #define D1_DLEVEL_FIELD_WIDTH	4
 #define D1_PULL_REGS_OFFSET	0x24
 
+#define A733_BANK_MEM_SIZE	0x80
+#define A733_BANK_OFFSET	0x80
+#define A733_DLEVEL_REGS_OFFSET	0x20
+#define A733_PULL_REGS_OFFSET	0x30
+#define A733_IRQ_REGS_OFFSET	0x40
+
 #define PINS_PER_BANK		32
 
 #define IRQ_PER_BANK		32
@@ -94,7 +100,9 @@
 #define SUNXI_PINCTRL_NCAT2_REG_LAYOUT	BIT(8)
 #define SUNXI_PINCTRL_PORTF_SWITCH	BIT(9)
 #define SUNXI_PINCTRL_ELEVEN_BANKS	BIT(10)
+#define SUNXI_PINCTRL_NCAT3_REG_LAYOUT	BIT(11)
 
+#define PIO_NCAT3_POW_MOD_SEL_REG	0x040
 #define PIO_POW_MOD_SEL_REG		0x340
 #define PIO_11B_POW_MOD_SEL_REG		0x380
 #define PIO_POW_MOD_CTL_OFS		0x004
@@ -179,6 +187,8 @@ struct sunxi_pinctrl {
 	struct pinctrl_dev		*pctl_dev;
 	unsigned long			flags;
 	u32				bank_mem_size;
+	u32				bank_offset;
+	u32				drv_regs_offset;
 	u32				pull_regs_offset;
 	u32				dlevel_field_width;
 	u32				pow_mod_sel_offset;
@@ -238,6 +248,10 @@ static inline u32 sunxi_irq_hw_bank_num(const struct sunxi_pinctrl_desc *desc,
 
 static inline u32 sunxi_irq_base_reg(const struct sunxi_pinctrl *pctl, u16 bank)
 {
+	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;
 }
Signature · 1 line
2.47.3
#6 lore raw

Re: [PATCH 4/7] pinctrl: sunxi: support A733 generation MMIO register layout

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Critical] sunxi_irq_base_reg() fails to translate the logical IRQ bank index to the physical hardware…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] sunxi_irq_base_reg() fails to translate the logical IRQ bank index to the physical hardware GPIO bank index for NCAT3 layout, ignoring irq_bank_map. --

commit 45892bb17e985dc02bb352c830f93cc75106e307
Author: Andre Przywara <[email protected]>

pinctrl: sunxi: support A733 generation MMIO register layout

This commit adds support for the A733 SoC generation MMIO register layout. It introduces the SUNXI_PINCTRL_NCAT3_REG_LAYOUT flag and updates bank offsets, sizes, and IRQ register positions to accommodate the new hardware design.

Quoted 4 lines
drivers/pinctrl/sunxi/pinctrl-sunxi.h +0 -0
index 15aa6fe62dbbc..d09467ed437a3 100644

[ ... ]

drivers/pinctrl/sunxi/pinctrl-sunxi.h static inline u32 sunxi_irq_hw_bank_num(const struct sunxi_pinctrl_desc *desc, · line 254

Quoted 8 lines
drivers/pinctrl/sunxi/pinctrl-sunxi.h +4 -0
@@ -238,6 +248,10 @@ static inline u32 sunxi_irq_hw_bank_num(const struct sunxi_pinctrl_desc *desc,
 
 static inline u32 sunxi_irq_base_reg(const struct sunxi_pinctrl *pctl, u16 bank)
 {
+	if (pctl->flags & SUNXI_PINCTRL_NCAT3_REG_LAYOUT)
+		return pctl->bank_offset + bank * pctl->bank_mem_size +
+		       A733_IRQ_REGS_OFFSET;
+

[Severity: Critical]
Does this new branch need to translate the logical IRQ bank index to the physical hardware GPIO bank index?

By directly using bank * pctl->bank_mem_size instead of converting the logical index via sunxi_irq_hw_bank_num(), could this calculate the wrong physical addresses on SoCs with sparse IRQ capabilities?

For example, when sunxi_pinctrl_irq_handler() iterates over logical IRQ banks and calls sunxi_irq_status_reg_from_bank() which then calls sunxi_irq_base_reg(), will the handler read the wrong hardware register?

Could this cause the handler to see no pending interrupts and exit without clearing the actual interrupt, leading to an infinite interrupt loop and hard system lockup for level-triggered interrupts?

Quoted 3 lines
drivers/pinctrl/sunxi/pinctrl-sunxi.h +0 -0
 	return IRQ_REGS_OFFSET +
 	       sunxi_irq_hw_bank_num(pctl->desc, bank) * IRQ_MEM_SIZE;
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#7 lore raw

PATCH 5/7 dt-bindings: pinctrl: add compatible for Allwinner A733

In reply to Andre Przywara

The A733 contains a pin controller similar to previous SoCs, although with a change in the MMIO register frame layout.
This SoC uses the new style of DT binding, where the pinmux values for each pin group are stored in the new "allwinner,pinmux" property in the DT node.

Add the new compatible to the existing A523 binding, since they share a lot of features, including the number of banks and clocks.

---
 .../bindings/pinctrl/allwinner,sun55i-a523-pinctrl.yaml     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/allwinner,sun55i-a523-pinctrl.yaml +5 -1
index f87b8274cc372..d7d0ba32ced4d 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/pinctrl/allwinner,sun55i-a523-pinctrl.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Allwinner A523 Pin Controller
+title: Allwinner A523 & A733 Pin Controller
 
 maintainers:
   - Andre Przywara <[email protected]>
@@ -28,6 +28,8 @@ properties:
     enum:
       - allwinner,sun55i-a523-pinctrl
       - allwinner,sun55i-a523-r-pinctrl
+      - allwinner,sun60i-a733-pinctrl
+      - allwinner,sun60i-a733-r-pinctrl
 
   reg:
     maxItems: 1
@@ -126,6 +128,7 @@ allOf:
         compatible:
           enum:
             - allwinner,sun55i-a523-pinctrl
+            - allwinner,sun60i-a733-pinctrl
 
     then:
       properties:
@@ -138,6 +141,7 @@ allOf:
         compatible:
           enum:
             - allwinner,sun55i-a523-r-pinctrl
+            - allwinner,sun60i-a733-r-pinctrl
 
     then:
       properties:
Signature · 1 line
2.47.3
#8 lore raw

PATCH 6/7 pinctrl: sunxi: a523-r: add a733-r compatible string

In reply to Andre Przywara

The secondary Allwinner A733 pincontroller ("-r") is interestingly not using the same new MMIO frame layout as the main controller, but is in fact very similar to the A523-r one: it has two banks, with 14 and 6 pins each. From the driver's perspective, this is all we care about, so we can re-use the a523-r pinctrl driver for the a733-r, too.

The individual pinmux settings are different, so we must not use the a523-r compatible string as a fallback, but we can surely let the same driver care for both the a523-r and a733-r IP, as the pinmux values will be provided by the DT.

Add the a733-r compatible string to the match list, without further distinguishing between the two. Should differences be discovered later, we can easily split this up then.

---
 drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c +1 -0
index 9e07fbb5be7cb..dfdcfa740ecc9 100644
@@ -40,6 +40,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev)
 
 static const struct of_device_id a523_r_pinctrl_match[] = {
 	{ .compatible = "allwinner,sun55i-a523-r-pinctrl", },
+	{ .compatible = "allwinner,sun60i-a733-r-pinctrl", },
 	{}
 };
 
Signature · 1 line
2.47.3
#9 lore raw

Re: [PATCH 6/7] pinctrl: sunxi: a523-r: add a733-r compatible string

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the static desc->npins counter accumulates on probe deferral, causing out-of-bounds array reads with negative indices. --

commit 0f0363ee56222ed4bd5f82e32e391a15a8e11f99
Author: Andre Przywara <[email protected]>

pinctrl: sunxi: a523-r: add a733-r compatible string

Adds the allwinner,sun60i-a733-r-pinctrl compatible string to the A523-r pinctrl driver. The driver is reused for the A733-r IP since it shares a similar two-bank layout, with specific pinmux values provided by the DT.

drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c static int a523_r_pinctrl_probe(struct platform_device *pdev) · line 43

Quoted 9 lines
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c +1 -0
index 9e07fbb5be7cb..dfdcfa740ecc9 100644
@@ -40,6 +40,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev)
 
 static const struct of_device_id a523_r_pinctrl_match[] = {
 	{ .compatible = "allwinner,sun55i-a523-r-pinctrl", },
+	{ .compatible = "allwinner,sun60i-a733-r-pinctrl", },

[Severity: High]
This isn't a bug introduced by this patch, but does the static desc->npins counter accumulate on probe deferral, causing out-of-bounds array reads with negative indices?

When the driver is probed, it passes the statically allocated a523_r_pinctrl_data to sunxi_pinctrl_dt_table_init().

In drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:init_pins_table():

	for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) {
		desc->npins += pins_per_bank[i];

If the probe fails later (e.g., -EPROBE_DEFER), desc->npins is not reset. On the next probe, it increments again, allocating a larger array but only initializing the first valid elements.

Then prepare_function_table() iterates up to the accumulated desc->npins:

	for (i = 0; i < npins; i++) {
		struct sunxi_desc_pin *pin = &pins[i];
		int bank = (pin->pin.number - pin_base) / PINS_PER_BANK;

		if (irq_bank_muxes[bank]) {

For uninitialized pins, pin->pin.number is 0. With a pin_base like 352 (PL_BASE), the bank index becomes (0 - 352) / 32 = -11. This results in an out-of-bounds access irq_bank_muxes[-11].

Furthermore, searching for a non-existent DT pin name will scan into the uninitialized elements, calling strcmp(NULL, name) and potentially panicking the kernel.

Quoted 2 lines
drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c +0 -0
 	{}
 };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#10 lore raw

PATCH 7/7 pinctrl: sunxi: add support for the Allwinner A733

In reply to Andre Przywara

The Allwinner A733 changes the layout of the pinctrl MMIO register frame, but stays otherwise rather close to the previous IP. The main PIO looks similar to the one in the A523, with ports B-K being implemented, each also with the same number of pins per port as on the A523.

Use the DT based pinctrl driver to describe just the generic pinctrl properties, so advertise the number of pins per bank, interrupt capabilities and the new quirks. The actual function/mux assignment will be taken from the devicetree.

---
 drivers/pinctrl/sunxi/Kconfig               |  5 +++
 drivers/pinctrl/sunxi/Makefile              |  1 +
 drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c | 50 +++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
drivers/pinctrl/sunxi/Kconfig +5 -0
index dc62eba96348e..831bb1dc93738 100644
@@ -141,4 +141,9 @@ config PINCTRL_SUN55I_A523_R
 	default ARM64 && ARCH_SUNXI
 	select PINCTRL_SUNXI
 
+config PINCTRL_SUN60I_A733
+	bool "Support for the Allwinner A733 PIO"
+	default ARM64 && ARCH_SUNXI
+	select PINCTRL_SUNXI
+
 endif
drivers/pinctrl/sunxi/Makefile +1 -0
index 951b3f1e4b4f1..3658c9d06b498 100644
@@ -29,5 +29,6 @@ obj-$(CONFIG_PINCTRL_SUN50I_H616)	+= pinctrl-sun50i-h616.o
 obj-$(CONFIG_PINCTRL_SUN50I_H616_R)	+= pinctrl-sun50i-h616-r.o
 obj-$(CONFIG_PINCTRL_SUN55I_A523)	+= pinctrl-sun55i-a523.o
 obj-$(CONFIG_PINCTRL_SUN55I_A523_R)	+= pinctrl-sun55i-a523-r.o
+obj-$(CONFIG_PINCTRL_SUN60I_A733)	+= pinctrl-sun60i-a733.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80)		+= pinctrl-sun9i-a80.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80_R)	+= pinctrl-sun9i-a80-r.o
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.47.3
#11 lore raw

Re: [PATCH 7/7] pinctrl: sunxi: add support for the Allwinner A733

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [High] Incorrect mapping of logical to physical IRQ banks for NCAT3 layout breaks all A733 GPIO interrupts.
- [Medium] Commit message contradicts code regarding pin counts per port.

Pre-existing issues:
- [High] Off-by-one logic in irq_bank assignment causes out-of-bounds array writes and reads when a SoC's first bank has no pins.
- [High] Global static struct mutation across probe deferrals causes NULL pointer dereference and kernel panic. --

commit 8c3148d94675fca6724f59ce7243638c15e54f3b
Author: Andre Przywara <[email protected]>

pinctrl: sunxi: add support for the Allwinner A733

The Allwinner A733 changes the layout of the pinctrl MMIO register frame, but stays otherwise rather close to the previous IP. The main PIO looks similar to the one in the A523, with ports B-K being implemented, each also with the same number of pins per port as on the A523.

Quoted 5 lines

The Allwinner A733 changes the layout of the pinctrl MMIO register frame, but stays otherwise rather close to the previous IP. The main PIO looks similar to the one in the A523, with ports B-K being implemented, each also with the same number of pins per port as on the A523.

[Severity: Medium]
Are these pin counts actually identical? The commit message explicitly states ports B-K are implemented with the same number of pins per port as the A523, but in the patch PB has 11 pins and PK has 26 pins. In contrast, a523_nr_bank_pins defines PB with 15 pins and PK with 24 pins.

Quoted 5 lines
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +0 -0
new file mode 100644
index 0000000000000..ca82f08a3a65b

[ ... ]

drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c line 18

Quoted 3 lines
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +3 -0
+static const u8 a733_nr_bank_pins[SUNXI_PINCTRL_MAX_BANKS] =
+/*	  PA  PB  PC  PD  PE  PF  PG  PH  PI  PJ  PK */
+	{  0, 11, 17, 24, 16,  7, 15, 20, 17, 28, 26 };

[Severity: High]
This is a pre-existing issue, but will setting PA to 0 pins cause an out-of-bounds array write later during initialization?

When a SoC's first bank has 0 pins, prepare_function_table() processes PB (bank = 1) first. The initialization logic for irq_bank does this:

drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:prepare_function_table() {
    ...
    if (bank > last_bank)
        irq_bank++;
    func[lastfunc].muxval = irq_mux;
    func[lastfunc].irqbank = irq_bank;
    ...
}

Because bank (1) > last_bank (0), irq_bank increments from 0 to 1 before its first use. This shifts all subsequent banks by one, giving PK an irqbank of 10.

Later in sunxi_pinctrl_build_state():

drivers/pinctrl/sunxi/pinctrl-sunxi.c:sunxi_pinctrl_build_state() {
    ...
    int irqnum = func->irqnum + func->irqbank * IRQ_PER_BANK;
    pctl->irq_array[irqnum] = pin->pin.number;
    ...
}

For PK, this calculates an irqnum up to 351. Since pctl->irq_array is allocated with exactly 320 elements (10 * 32), does this write past the end of the array? This can also cause an out-of-bounds read on desc->irq_bank_map when handling PK interrupts.

Quoted 6 lines
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +6 -0
+
+static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
+/*	  PA  PB  PC  PD  PE  PF  PG  PH  PI  PJ  PK */
+	{  0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14};
+
+static struct sunxi_pinctrl_desc a733_pinctrl_data = {

drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c line 34

Quoted 10 lines
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +10 -0
+	.irq_banks = 10,
+	.irq_read_needs_mux = true,
+	.io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
+};
+
+static int a733_pinctrl_probe(struct platform_device *pdev)
+{
+	return sunxi_pinctrl_dt_table_init(pdev, a733_nr_bank_pins,
+					   a733_irq_bank_muxes,
+					   &a733_pinctrl_data,

[Severity: High]
This isn't a bug introduced by this patch, but is it safe to pass a statically allocated structure to sunxi_pinctrl_dt_table_init() where its npins state is mutated?

In init_pins_table(), the pin counts are accumulated indefinitely:

drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:init_pins_table() {
    ...
    for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) {
        desc->npins += pins_per_bank[i];
    ...
}

If the probe function defers, npins retains the accumulated value and doubles on the next probe attempt. While devm_kcalloc allocates an array for the doubled size, only the first elements are initialized.

When fill_pin_function() iterates up to the doubled npins, will it call strcmp(pins[i].pin.name, name) on zero-initialized elements, triggering a NULL pointer dereference and kernel panic?

drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c line 36

Quoted 2 lines
drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c new file +2 -0
+					   SUNXI_PINCTRL_NCAT3_REG_LAYOUT);
+}

[Severity: High]
Does the SUNXI_PINCTRL_NCAT3_REG_LAYOUT incorrectly map logical to physical IRQ banks, breaking all A733 GPIO interrupts?

When an interrupt fires on A733, sunxi_pinctrl_irq_handler() loops over the logical IRQ bank indices (0 to 9) and calls sunxi_irq_status_reg_from_bank(pctl, bank).

However, the layout logic directly multiplies by the logical bank index:

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;
    ...
}

For the first IRQ bank (PB, logical index 0), this calculates the offset for physical bank 0 (PA). PA has no pins and no interrupts. The physical registers for PB are at physical bank index 1. Because the mapping is bypassed, doesn't this cause the handler to read from the non-existent PA IRQ registers instead of PB?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
maintainer
#12 lore raw
In reply to Andre Przywara
Quoted 2 lines · Andre Przywara

more than a year(!) after the RFC, now the first "proper" version of the pinctrl and GPIO IP support for the new Allwinner A733 SoC.

Perseverance and grit!

Patches applied for 7.4.

Look into Sashikos comments and address with follow-up patches if applicable, I'm not a friend of the perpetual back-and-forth Sashiko causes and prefer to just apply and fix in-tree.

Yours,
Linus Walleij

#13 lore raw
In reply to Andre Przywara

Hi Andre,

While bringing up the Radxa Cubie A7Z on mainline, I went through the A733 io-bias code against the user manual (v0.92). The register layout doesn't match, on both controllers.

On the main PIO, GPIO_POW_MOD_SEL (0x040) has two-bit fields per supply
domain: PF is bits 11:10, PK is 21:20, and PB falls under the VCC-IO field at 25:24. sunxi_pinctrl_set_io_bias_cfg() treats it as one bit per bank, so a PF request writes bit 5 (inside the PC field) and a PK request writes bit 10, the low bit of PF.

The R-PIO has the same layout, PL at 1:0 and PM at 3:2. The a733-r compatible shares the A523-R descriptor, so it also gets the inverted encoding and the RMW at 0x344, which the A733 manual doesn't list.

PL is the case I like least. Running the unmodified helper on the host with the R-PIO state I read on my board (SEL 0x000aaaaa, 0x344 = 0) and a 3.3 V vcc-pl supply, SEL becomes 0x000aaaab. Per the manual table PL goes from 10 (fixed 3.3 V) to 11 (fixed 1.8 V). I haven't run that path on the board. With no A733 board DT upstream yet, I don't think anyone hits it today.

Locally I set BIAS_VOLTAGE_NONE for the A733 and gave the A733-R its own descriptor with NONE, leaving A523/A523-R as they are. That's roughly what the vendor BSP does too: its kernel never programs these registers and keeps the firmware setup (all auto on the main PIO here, PL/PM fixed at 3.3 V).

Tested on one board (the vendor kernel reports SoC version B), RAM-booted over FEL, with your pinctrl patches on an integration tree and fixed regulators for the 3.3 V PB and PM supplies. With a few printks I checked that UART0 (PB9) and a gpio-led on PM2 reach the helper on the first request of their bank and that SEL and SEL+4 stay unchanged. Same registers without the printks, and UART and the LED work. A523 is build-tested only.

Would you be OK with disabling the io-bias programming for A733/A733-R as a fix for now, and doing proper voltage mode support later? If so I'll send the two patches, with Fixes: tags for 0535bfbfa97b and 31d68e10381c.

Thanks,
Vinicius

maintainer
#14 lore raw
Quoted 4 lines · Vinicius Pedrosa

Would you be OK with disabling the io-bias programming for A733/A733-R as a fix for now, and doing proper voltage mode support later? If so I'll send the two patches, with Fixes: tags for 0535bfbfa97b and 31d68e10381c.

Just send the patches so we can review and discuss, no need to ask permission, if it's not OK we simply don't apply them. :D

Yours.
Linus Walleij

#15 lore raw
In reply to Vinicius Pedrosa

Hi,

thanks for the report!

Quoted 5 lines · Vinicius Pedrosa

Hi Andre,

While bringing up the Radxa Cubie A7Z on mainline, I went through the A733 io-bias code against the user manual (v0.92). The register layout doesn't match, on both controllers.

Just for the records: this paragraph above would have been enough, with that hint it's pretty obvious that it's wrong.
If you have tested it in a before-after/broken-works fashion, you could mention this, but there is little need in going full bit details on something that's quite obvious. So could you show that something doesn't work with the current code, but got fixed with some changes? Like the eMMC situation on the A523?

Quoted 31 lines

On the main PIO, GPIO_POW_MOD_SEL (0x040) has two-bit fields per supply
domain: PF is bits 11:10, PK is 21:20, and PB falls under the VCC-IO field at 25:24. sunxi_pinctrl_set_io_bias_cfg() treats it as one bit per bank, so a PF request writes bit 5 (inside the PC field) and a PK request writes bit 10, the low bit of PF.

The R-PIO has the same layout, PL at 1:0 and PM at 3:2. The a733-r compatible shares the A523-R descriptor, so it also gets the inverted encoding and the RMW at 0x344, which the A733 manual doesn't list.

PL is the case I like least. Running the unmodified helper on the host with the R-PIO state I read on my board (SEL 0x000aaaaa, 0x344 = 0) and a 3.3 V vcc-pl supply, SEL becomes 0x000aaaab. Per the manual table PL goes from 10 (fixed 3.3 V) to 11 (fixed 1.8 V). I haven't run that path on the board. With no A733 board DT upstream yet, I don't think anyone hits it today.

Locally I set BIAS_VOLTAGE_NONE for the A733 and gave the A733-R its own descriptor with NONE, leaving A523/A523-R as they are. That's roughly what the vendor BSP does too: its kernel never programs these registers and keeps the firmware setup (all auto on the main PIO here, PL/PM fixed at 3.3 V).

Tested on one board (the vendor kernel reports SoC version B), RAM-booted over FEL, with your pinctrl patches on an integration tree and fixed regulators for the 3.3 V PB and PM supplies. With a few printks I checked that UART0 (PB9) and a gpio-led on PM2 reach the helper on the first request of their bank and that SEL and SEL+4 stay unchanged. Same registers without the printks, and UART and the LED work. A523 is build-tested only.

Quoted 4 lines

Would you be OK with disabling the io-bias programming for A733/A733-R as a fix for now, and doing proper voltage mode support later? If so I'll send the two patches, with Fixes: tags for 0535bfbfa97b and 31d68e10381c.

What is the big problem with just extending the code to use 2 bits, for the A733? I sketched that here, looks pretty harmless, and is just a few lines.
The A523-R problem is more annoying, since Allwinner mixes and matches again here: the A733 register layout, but at an A523 offset. And I missed that part, which means it effectively breaks compatibility with the A523-R, so this needs more fixes, including the DT binding.

Cheers,
Andre