Skip to contentSkip to conversation

pinctrl: sunxi: Allwinner A733 support

RFC PATCH In review Andre Przywara 7 participants 19 messages Aug 21, 2025 – Sep 10

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

cover pinctrl: sunxi: Allwinner A733 support

This series adds support for the pinctrl and GPIO IP in 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-4), then using the changed code to enable support for this new generation, in patch 5/9. Patch 6/9 adds support for the one new feature of this SoC's pinctrl IP, the lockless GPIO settings feature.
Patch 7/9 adds the new DT bindings, patch 8/9 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 9/9 then adds the driver stub file, which just describes the GPIO bank configuration and lists the two quirk bits that engage the code changes added for the new layout.

Based on v6.17-rc1.

I am marking this as RFC, as I don't have suitable hardware for testing. Also I am not 100% convinced the IRQ number to pin mapping, as needed by the new IRQ register location, works correctly.
Please have a look, check whether the changes look sane, and test it if you have access to hardware.

A branch (together with the AXP318W PMIC code) is available at:
https://github.com/apritzel/linux/commits/a733-rfc

Cheers,
Andre

Andre Przywara (9):
pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT
pinctrl: sunxi: pass down flags to pinctrl routines
pinctrl: sunxi: only use PortK special handling on A523
pinctrl: sunxi: refactor IRQ register accessors
pinctrl: sunxi: support A733 generation MMIO register layout
pinctrl: sunxi: add support for set/clear regs
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   | 51 +++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 85 +++++++++++--------
 drivers/pinctrl/sunxi/pinctrl-sunxi.h         | 76 +++++++++++------
 9 files changed, 169 insertions(+), 62 deletions(-)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
Signature · 1 line
2.46.3
#1 lore raw

RFC PATCH 1/9 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         | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h         | 2 +-
 5 files changed, 5 insertions(+), 5 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 69cd2b4ebd7d7..86a12bce0e335 100644
@@ -36,7 +36,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 7d2308c37d29e..0f703cacfe5e3 100644
@@ -35,7 +35,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 +1 -1
index 0fb057a07dccb..0a5acbd978da9 100644
@@ -1521,7 +1521,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 	pctl->dev = &pdev->dev;
 	pctl->desc = desc;
 	pctl->variant = flags & SUNXI_PINCTRL_VARIANT_MASK;
-	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 ad26e4de16a85..fb17fae2dab69 100644
@@ -88,7 +88,7 @@
 #define SUN4I_FUNC_IRQ		6
 
 #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.46.3
maintainer
#2 lore raw

Re: [RFC PATCH 1/9] pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT

Dne četrtek, 21. avgust 2025 ob 02:42:24 Srednjeevropski poletni čas je Andre Przywara napisal(a):

Quoted 5 lines

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.

That was bound to happen.

Quoted 8 lines

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.

Best regards,
Jernej

Quoted 74 lines
---
 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         | 2 +-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h         | 2 +-
 5 files changed, 5 insertions(+), 5 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 69cd2b4ebd7d7..86a12bce0e335 100644
@@ -36,7 +36,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 7d2308c37d29e..0f703cacfe5e3 100644
@@ -35,7 +35,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 +1 -1
index 0fb057a07dccb..0a5acbd978da9 100644
@@ -1521,7 +1521,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 	pctl->dev = &pdev->dev;
 	pctl->desc = desc;
 	pctl->variant = flags & SUNXI_PINCTRL_VARIANT_MASK;
-	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 ad26e4de16a85..fb17fae2dab69 100644
@@ -88,7 +88,7 @@
 #define SUN4I_FUNC_IRQ		6
 
 #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)
 
#3 lore raw

RFC PATCH 2/9 pinctrl: sunxi: pass down flags to pinctrl routines

In reply to Andre Przywara

Recent changes in the Allwinner pinctrl/GPIO IP made us add some quirks, which the new SoCs (A523 family) need to use. We now have a comfortable "flags" field on the per-SoC setup side, to tag those quirks we need, but were translating those flag bits into specific fields for runtime use, in the init routine.
Now the newest Allwinner GPIO IP adds even more quirks and exceptions, some of a boolean nature.
To avoid inventing various new boolean flags for the runtime struct sunxi_pinctrl, let's just directly pass on the flags variable used by the setup code, so runtime can check for those various quirk bits directly.

Rename the "variant" member to "flags", and directly copy the value from the setup code into there. Move the variant masking from the init routine to the functions which actually use the "variant" value.

This mostly paves the way for the new A733 IP generation, which needs more quirks to be checked at runtime.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 19 +++++++++++--------
 drivers/pinctrl/sunxi/pinctrl-sunxi.h |  2 +-
 2 files changed, 12 insertions(+), 9 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +11 -8
index 0a5acbd978da9..a5e390c7ba0ba 100644
@@ -157,6 +157,7 @@ sunxi_pinctrl_desc_find_function_by_name(struct sunxi_pinctrl *pctl,
 					 const char *pin_name,
 					 const char *func_name)
 {
+	unsigned long variant = pctl->flags & SUNXI_PINCTRL_VARIANT_MASK;
 	int i;
 
 	for (i = 0; i < pctl->desc->npins; i++) {
@@ -168,7 +169,7 @@ sunxi_pinctrl_desc_find_function_by_name(struct sunxi_pinctrl *pctl,
 			while (func->name) {
 				if (!strcmp(func->name, func_name) &&
 					(!func->variant ||
-					func->variant & pctl->variant))
+					func->variant & variant))
 					return func;
 
 				func++;
@@ -1288,6 +1289,7 @@ static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl,
 static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 {
 	struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev);
+	unsigned long variant = pctl->flags & SUNXI_PINCTRL_VARIANT_MASK;
 	void *ptr;
 	int i;
 
@@ -1312,7 +1314,7 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 		const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
 		struct sunxi_pinctrl_group *group = pctl->groups + pctl->ngroups;
 
-		if (pin->variant && !(pctl->variant & pin->variant))
+		if (pin->variant && !(variant & pin->variant))
 			continue;
 
 		group->name = pin->pin.name;
@@ -1339,11 +1341,11 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 		const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
 		struct sunxi_desc_function *func;
 
-		if (pin->variant && !(pctl->variant & pin->variant))
+		if (pin->variant && !(variant & pin->variant))
 			continue;
 
 		for (func = pin->functions; func->name; func++) {
-			if (func->variant && !(pctl->variant & func->variant))
+			if (func->variant && !(variant & func->variant))
 				continue;
 
 			/* Create interrupt mapping while we're at it */
@@ -1371,14 +1373,14 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 		const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
 		struct sunxi_desc_function *func;
 
-		if (pin->variant && !(pctl->variant & pin->variant))
+		if (pin->variant && !(variant & pin->variant))
 			continue;
 
 		for (func = pin->functions; func->name; func++) {
 			struct sunxi_pinctrl_function *func_item;
 			const char **func_grp;
 
-			if (func->variant && !(pctl->variant & func->variant))
+			if (func->variant && !(variant & func->variant))
 				continue;
 
 			func_item = sunxi_pinctrl_find_function_by_name(pctl,
@@ -1520,7 +1522,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 
 	pctl->dev = &pdev->dev;
 	pctl->desc = desc;
-	pctl->variant = flags & SUNXI_PINCTRL_VARIANT_MASK;
+	pctl->flags = flags;
 	if (flags & SUNXI_PINCTRL_NCAT2_REG_LAYOUT) {
 		pctl->bank_mem_size = D1_BANK_MEM_SIZE;
 		pctl->pull_regs_offset = D1_PULL_REGS_OFFSET;
@@ -1556,8 +1558,9 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev,
 
 	for (i = 0, pin_idx = 0; i < pctl->desc->npins; i++) {
 		const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
+		unsigned long variant = pctl->flags & SUNXI_PINCTRL_VARIANT_MASK;
 
-		if (pin->variant && !(pctl->variant & pin->variant))
+		if (pin->variant && !(variant & pin->variant))
 			continue;
 
 		pins[pin_idx++] = pin->pin;
drivers/pinctrl/sunxi/pinctrl-sunxi.h +1 -1
index fb17fae2dab69..77a08ccde095a 100644
@@ -174,7 +174,7 @@ struct sunxi_pinctrl {
 	unsigned			*irq_array;
 	raw_spinlock_t			lock;
 	struct pinctrl_dev		*pctl_dev;
-	unsigned long			variant;
+	unsigned long			flags;
 	u32				bank_mem_size;
 	u32				pull_regs_offset;
 	u32				dlevel_field_width;
Signature · 1 line
2.46.3
#4 lore raw

RFC PATCH 3/9 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 a5e390c7ba0ba..2af6ebef7a10b 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.46.3
#5 lore raw

RFC PATCH 4/9 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 2af6ebef7a10b..540fa6c285cfc 100644
@@ -734,9 +734,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;
@@ -1072,7 +1073,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;
@@ -1119,7 +1120,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 */
@@ -1129,7 +1130,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;
@@ -1146,7 +1147,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;
@@ -1250,7 +1251,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) {
@@ -1491,7 +1492,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;
@@ -1678,10 +1679,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.46.3
#6 lore raw

RFC PATCH 5/9 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 540fa6c285cfc..ff7c5439a458e 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;
@@ -1526,15 +1526,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 252cf58387e33..2b9e93972a5d3 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
@@ -92,7 +98,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
@@ -177,6 +185,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;
@@ -236,6 +246,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.46.3
#7 lore raw

RFC PATCH 6/9 pinctrl: sunxi: add support for set/clear regs

In reply to Andre Przywara

The Allwinner pinctrl/GPIO IP so far features just a single GPIO data register, which holds the logic level for every output pin on each port. To set or clear the level of a single pin, we need to do a read/modify/write operation, which needs to be protected by a lock.

The new pinctrl IP introduced with the Allwinner A733 now supports two extra registers, the value of which will be ORed in respectively NANDed out from the current value when being written. This allows for lockless single writes to set or clear GPIO pins.

Add support for this feature to the sunxi pinctrl code, by adding a quirk bit and checking this when writing to the data register. If the new registers are available, skip the lock and read/modify/write operation, and just write the mask directly to the respective register.

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 27 +++++++++++++++------------
 drivers/pinctrl/sunxi/pinctrl-sunxi.h |  3 +++
 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +15 -12
index ff7c5439a458e..0d08c48b57b65 100644
@@ -971,18 +971,21 @@ static int sunxi_pinctrl_gpio_set(struct gpio_chip *chip, unsigned int offset,
 
 	sunxi_data_reg(pctl, offset, &reg, &shift, &mask);
 
-	raw_spin_lock_irqsave(&pctl->lock, flags);
-
-	val = readl(pctl->membase + reg);
-
-	if (value)
-		val |= mask;
-	else
-		val &= ~mask;
-
-	writel(val, pctl->membase + reg);
-
-	raw_spin_unlock_irqrestore(&pctl->lock, flags);
+	if (pctl->flags & SUNXI_PINCTRL_HAS_SET_CLEAR_REGS) {
+		if (value)
+			writel(mask, pctl->membase + reg + DATA_SET_OFFSET);
+		else
+			writel(mask, pctl->membase + reg + DATA_CLR_OFFSET);
+	} else {
+		raw_spin_lock_irqsave(&pctl->lock, flags);
+		val = readl(pctl->membase + reg);
+		if (value)
+			val |= mask;
+		else
+			val &= ~mask;
+		writel(val, pctl->membase + reg);
+		raw_spin_unlock_irqrestore(&pctl->lock, flags);
+	}
 
 	return 0;
 }
drivers/pinctrl/sunxi/pinctrl-sunxi.h +3 -0
index 2b9e93972a5d3..96f1cb9d6c89c 100644
@@ -43,6 +43,8 @@
 #define MUX_REGS_OFFSET		0x0
 #define MUX_FIELD_WIDTH		4
 #define DATA_REGS_OFFSET	0x10
+#define DATA_SET_OFFSET			0x04
+#define DATA_CLR_OFFSET			0x08
 #define DATA_FIELD_WIDTH	1
 #define DLEVEL_REGS_OFFSET	0x14
 #define DLEVEL_FIELD_WIDTH	2
@@ -99,6 +101,7 @@
 #define SUNXI_PINCTRL_PORTF_SWITCH	BIT(9)
 #define SUNXI_PINCTRL_ELEVEN_BANKS	BIT(10)
 #define SUNXI_PINCTRL_NCAT3_REG_LAYOUT	BIT(11)
+#define SUNXI_PINCTRL_HAS_SET_CLEAR_REGS	BIT(12)
 
 #define PIO_NCAT3_POW_MOD_SEL_REG	0x040
 #define PIO_POW_MOD_SEL_REG		0x340
Signature · 1 line
2.46.3
#8 lore raw

Re: [RFC PATCH 6/9] pinctrl: sunxi: add support for set/clear regs

Hi Andre,

thanks for your patch!

Quoted 6 lines · Andre Przywara
drivers/pinctrl/sunxi/pinctrl-sunxi.c +5 -1
-       raw_spin_unlock_irqrestore(&pctl->lock, flags);
+       if (pctl->flags & SUNXI_PINCTRL_HAS_SET_CLEAR_REGS) {
+               if (value)
+                       writel(mask, pctl->membase + reg + DATA_SET_OFFSET);
+               else
+                       writel(mask, pctl->membase + reg + DATA_CLR_OFFSET);

drivers/pinctrl/sunxi/pinctrl-sunxi.c static int sunxi_pinctrl_gpio_set(struct gpio_chip *chip, unsigned int offset, · line 988

Quoted 10 lines
drivers/pinctrl/sunxi/pinctrl-sunxi.c +10 -0
+       } else {
+               raw_spin_lock_irqsave(&pctl->lock, flags);
+               val = readl(pctl->membase + reg);
+               if (value)
+                       val |= mask;
+               else
+                       val &= ~mask;
+               writel(val, pctl->membase + reg);
+               raw_spin_unlock_irqrestore(&pctl->lock, flags);
+       }

This is now starting to re-implement the generic MMIO GPIO chip, which I'm not so happy about, this is simply the difference between passing just a single data register to the generic config or passing a set and clear register.

        ret = bgpio_init(&g->gc, dev, 4,
                         g->base + GPIO_DATA_IN,
                         g->base + GPIO_DATA_SET,
                         g->base + GPIO_DATA_CLR,
                         g->base + GPIO_DIR,
                         NULL,
                         0);

...

I also notice:
pctl->chip->of_gpio_n_cells = 3;

Is Allwinner one of those drivers that could actually start using select GPIO_GENERIC nowadays?

Please look at
commit bd3ce71078bde4ecbfc60d49c96d1c55de0635cc
"gpiolib: of: Handle threecell GPIO chips"

And the example user:
drivers/gpio/gpio-spacemit-k1.c
esp how it uses spacemit_of_node_instance_match().

If it's possible to switch over to GPIO_GENERIC this hopeless maintainer would love if that could be done first so the picture gets more clear.

Yours,
Linus Walleij

Yours,
Linus Walleij

#9 lore raw

RFC PATCH 7/9 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 154e03da8ce98..c04b04acf6e45 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.46.3
Acked-by on v1 7/9
#10 lore raw

Re: [RFC PATCH 7/9] dt-bindings: pinctrl: add compatible for Allwinner A733

Quoted 10 lines · 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.

#11 lore raw

RFC PATCH 8/9 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 86a12bce0e335..437c955463bac 100644
@@ -41,6 +41,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.46.3
#12 lore raw

Re: [RFC PATCH 8/9] pinctrl: sunxi: a523-r: add a733-r compatible string

Hi Andre,

Quoted 11 lines · 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.

If the bank and pin counts are the same and the pinmux values are provided by the DT, that means they _are_ compatible, right?

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
#13 lore raw

Re: [RFC PATCH 8/9] pinctrl: sunxi: a523-r: add a733-r compatible string

Hi Julian,

I know this email is almost comically old, but still didn't want this left unanswered before sending a new revision:

Quoted 10 lines · Julian Calaby

Hi Andre,

Quoted 7 lines · 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.

Quoted 7 lines
Quoted 4 lines

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.

If the bank and pin counts are the same and the pinmux values are provided by the DT, that means they _are_ compatible, right?

I wouldn't say so: I would argue the devices are different, and not necessarily every driver written for the old device can cope with the new one. For instance U-Boot still goes with hardcoded pinmux tables (because that's simpler to implement there), which don't match between A523-R and A733-R. And I would see a point if that would enable old kernels to use that new SoC, but because the main pinctrl is different anyway, that doesn't help us.

But it's not a very strong opinion, so if the maintainers disagree with me, I am happy to change that.

Cheers,
Andre

#14 lore raw

RFC PATCH 9/9 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 | 51 +++++++++++++++++++++
 3 files changed, 57 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 +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.46.3
#15 lore raw
In reply to Andre Przywara

Hi Andre,

In case it helps when you next spin this series: these patches have been part of my local A733 boot stack on a Radxa Cubie A7S for a while now. UART console, MMC, LEDs and USB all sit on top of them here and I have seen no problems attributable to the pinctrl driver. Happy to turn around tests on real hardware whenever a v2 shows up, or to run anything specific in the meantime.

Testing here is AI-assisted (Claude Code).

Thanks,
Enzo

#16 lore raw
In reply to Andre Przywara

Hi Andre,

This series no longer applies to mainline. Patch 1/9 fails on current master (45c13f3f9e3b), for two separate reasons - one of them from outside the series, which is why I am reporting it rather than just fixing it locally.

Applying the series in order:

[RFC PATCH 1/9] pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT
error: patch failed: drivers/pinctrl/sunxi/pinctrl-sunxi.c:1521
error: patch failed: drivers/pinctrl/sunxi/pinctrl-sunxi.h:88

The blocking one is your own patch 2/9. It merged as 42e06688c6cb ("pinctrl: sunxi: pass down flags to pinctrl routines") without 1/9, so sunxi_pinctrl_init_with_flags() now reads

	pctl->flags = flags;

where 1/9 still expects

	pctl->variant = flags & SUNXI_PINCTRL_VARIANT_MASK;

as context. A 3-way merge does not resolve it - both sides touch adjacent lines, so it conflicts.

The second is unrelated to your work. 70f8915ea4e9 ("pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown") inserted SUN4I_FUNC_DISABLED_OLD/NEW into 1/9's header hunk context, and added a fifth use of SUNXI_PINCTRL_NEW_REG_LAYOUT, in sunxi_pinctrl_irq_request_resources(). The header hunk merges cleanly with -3, but that new use is not covered by the rename, so the tree then fails to build with an undeclared identifier.

Patches 3/9 through 9/9 apply cleanly once 1/9 is resolved.

Static reproduction only - no A733 hardware here, so nothing in this message says anything about whether the series works. I am not sending a
rebase: which shape 1/9 should take now that 2/9 is in is your call.

Vinicius

#17 lore raw

Hi,

Quoted 3 lines · Vinicius Pedrosa

Hi Andre,

This series no longer applies to mainline. Patch 1/9 fails on current

Yes, naturally, this series is quite old, and we had some changes and fixes in pinctrl meanwhile. I didn't find time in the last cycles, but will send an update *after*
-rc1 is released. So just a bit more patience ...

Cheers,
Andre

P.S. What was the particular purpose of you sending this email? I can't help to feel this is AI generated, isn't it? But the breakage is obvious, and as you can imagine I am well aware of my patch having been merged, and other patches in the vicinity which I authored or reviewed conflicting. In fact I regularly rebase my branches on every -rc1, I just didn't get around to send a new version.

Quoted 38 lines

master (45c13f3f9e3b), for two separate reasons - one of them from outside the series, which is why I am reporting it rather than just fixing it locally.

Applying the series in order:

[RFC PATCH 1/9] pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT
error: patch failed: drivers/pinctrl/sunxi/pinctrl-sunxi.c:1521
error: patch failed: drivers/pinctrl/sunxi/pinctrl-sunxi.h:88

The blocking one is your own patch 2/9. It merged as 42e06688c6cb ("pinctrl: sunxi: pass down flags to pinctrl routines") without 1/9, so sunxi_pinctrl_init_with_flags() now reads

	pctl->flags = flags;

where 1/9 still expects

	pctl->variant = flags & SUNXI_PINCTRL_VARIANT_MASK;

as context. A 3-way merge does not resolve it - both sides touch adjacent lines, so it conflicts.

The second is unrelated to your work. 70f8915ea4e9 ("pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown") inserted SUN4I_FUNC_DISABLED_OLD/NEW into 1/9's header hunk context, and added a fifth use of SUNXI_PINCTRL_NEW_REG_LAYOUT, in sunxi_pinctrl_irq_request_resources(). The header hunk merges cleanly with -3, but that new use is not covered by the rename, so the tree then fails to build with an undeclared identifier.

Patches 3/9 through 9/9 apply cleanly once 1/9 is resolved.

Static reproduction only - no A733 hardware here, so nothing in this message says anything about whether the series works. I am not sending a
rebase: which shape 1/9 should take now that 2/9 is in is your call.

Vinicius

#18 lore raw

Hi Andre,

Thanks. "After -rc1" is exactly what I wanted to know, so I'll wait for it.

On the P.S.: I wrote it from my own notes and ran it through an AI to fix the English, and you're right that it came out worse for it. English isn't my first language and I leaned on the tool too much, which got you a forty-line report of something you already knew. Point taken.

The reason I was on your series at all: I'm porting the Radxa Cubie A7Z (A733) and building a Yocto BSP layer for it, so console comes through pinctrl. The board isn't here yet. Once it arrives and v2 is out, I'm happy to test on real A733 hardware and send results either way. You posted the RFC as untested for lack of a board, and I'll have one.

Thanks,
Vinicius