Re: [PATCH v4 4/7] pinctrl: ingenic: Add X2600 register and GPIO IRQ support
From: Paul Cercueil
Date: Thu Nov 19 2026 - 04:52:30 EST
Hi Nikolaus,
Le mercredi 18 novembre 2026 à 18:25 +0100, H. Nikolaus Schaller a écrit :
> Support the X2600 GPIO register layout with a 0x1000 bank stride,
> per-port shadow registers and load registers. The GPIO interrupt
> acknowledgement uses the existing JZ4770 flag-clear register path.
>
> Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
I'm close to ACK this but I think the patchset overall needs a v5 (for a few
things I see in the following patches) so I added one small nit below.
I only reviewed the first half of the v3 yesterday, and didn't get to review the
second half that you already had sent the v4 :)
> ---
>
> Notes:
> Changes V4:
> - Simplify the GPIO port index used for the legacy global shadow-load
> register.
> (suggested by Paul Cercueil)
>
> drivers/pinctrl/pinctrl-ingenic.c | 49 ++++++++++++++++++++++++-------
> 1 file changed, 39 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-
> ingenic.c
> index 7f65f3abf05f5..981789e468ac5 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -70,6 +70,9 @@
> #define X2000_GPIO_SR 0xd0
> #define X2000_GPIO_SMT 0xe0
>
> +#define X2600_GPIO_SHADOW_OFFSET 0x800
> +#define X2600_GPIO_PAGLD (X2600_GPIO_SHADOW_OFFSET +
> 0xf0)
> +
> #define REG_SET(x) ((x) + 0x4)
> #define REG_CLEAR(x) ((x) + 0x8)
>
> @@ -114,6 +117,7 @@ enum jz_version {
> ID_X1600,
> ID_X2000,
> ID_X2100,
> + ID_X2600,
> };
>
> struct ingenic_chip_info {
> @@ -164,7 +168,8 @@ static const unsigned long enabled_socs =
> IS_ENABLED(CONFIG_MACH_X1600) << ID_X1600 |
> IS_ENABLED(CONFIG_MACH_X1830) << ID_X1830 |
> IS_ENABLED(CONFIG_MACH_X2000) << ID_X2000 |
> - IS_ENABLED(CONFIG_MACH_X2100) << ID_X2100;
> + IS_ENABLED(CONFIG_MACH_X2100) << ID_X2100 |
> + IS_ENABLED(CONFIG_MACH_X2600) << ID_X2600;
>
> static bool
> is_soc(const struct ingenic_pinctrl *jzpc, enum jz_version version)
> @@ -3549,15 +3554,21 @@ static void ingenic_gpio_shadow_set_bit(struct
> ingenic_gpio_chip *jzgc,
> else
> reg = REG_CLEAR(reg);
>
> - regmap_write(jzgc->jzpc->map, REG_PZ_BASE(
> - jzgc->jzpc->info->reg_offset) + reg, BIT(offset));
> + if (is_soc_or_above(jzgc->jzpc, ID_X2600))
> + regmap_write(jzgc->jzpc->map, jzgc->reg_base +
> X2600_GPIO_SHADOW_OFFSET + reg,
> + BIT(offset));
> + else
> + regmap_write(jzgc->jzpc->map, REG_PZ_BASE(jzgc->jzpc->info-
> >reg_offset) + reg,
> + BIT(offset));
> }
>
> static void ingenic_gpio_shadow_set_bit_load(struct ingenic_gpio_chip *jzgc)
> {
> - regmap_write(jzgc->jzpc->map, REG_PZ_GID2LD(
> - jzgc->jzpc->info->reg_offset),
> - jzgc->gc.base / PINS_PER_GPIO_CHIP);
> + if (is_soc_or_above(jzgc->jzpc, ID_X2600))
> + regmap_write(jzgc->jzpc->map, jzgc->reg_base +
> X2600_GPIO_PAGLD, 1);
> + else
> + regmap_write(jzgc->jzpc->map, REG_PZ_GID2LD(jzgc->jzpc->info-
> >reg_offset),
> + jzgc->gc.base / PINS_PER_GPIO_CHIP);
> }
>
> static void jz4730_gpio_set_bits(struct ingenic_gpio_chip *jzgc,
> @@ -3852,16 +3863,34 @@ static inline void ingenic_shadow_config_pin(struct
> ingenic_pinctrl *jzpc,
> unsigned int pin, u8 reg, bool set)
> {
> unsigned int idx = pin % PINS_PER_GPIO_CHIP;
> + unsigned int offt = pin / PINS_PER_GPIO_CHIP;
> +
> + if (set)
> + reg = REG_SET(reg);
> + else
> + reg = REG_CLEAR(reg);
>
> - regmap_write(jzpc->map, REG_PZ_BASE(jzpc->info->reg_offset) +
> - (set ? REG_SET(reg) : REG_CLEAR(reg)), BIT(idx));
> + if (is_soc_or_above(jzpc, ID_X2600)) {
> + u32 target_reg = (offt * jzpc->info->reg_offset) +
> X2600_GPIO_SHADOW_OFFSET + reg;
> +
> + regmap_write(jzpc->map, target_reg, BIT(idx));
> + } else {
> + regmap_write(jzpc->map, REG_PZ_BASE(jzpc->info->reg_offset) +
> reg, BIT(idx));
I'd write
if (is_soc_or_above(jzpc, ID_X2600))
reg_base = (offt * jzpc->info->reg_offset) + X2600_GPIO_SHADOW_OFFSET;
else
reg_base = REG_PZ_BASE(jzpc->info->reg_offset);
reg = set ? REG_SET(reg) : REG_CLEAR(reg);
regmap_write(jzpc->map, reg_base + reg, BIT(idx));
Cheers,
-Paul
> + }
> }
>
> static inline void ingenic_shadow_config_pin_load(struct ingenic_pinctrl
> *jzpc,
> unsigned int pin)
> {
> - regmap_write(jzpc->map, REG_PZ_GID2LD(jzpc->info->reg_offset),
> - pin / PINS_PER_GPIO_CHIP);
> + unsigned int offt = pin / PINS_PER_GPIO_CHIP;
> +
> + if (is_soc_or_above(jzpc, ID_X2600)) {
> + u32 target_load_reg = (offt * jzpc->info->reg_offset) +
> X2600_GPIO_PAGLD;
> +
> + regmap_write(jzpc->map, target_load_reg, 1);
> + } else {
> + regmap_write(jzpc->map, REG_PZ_GID2LD(jzpc->info-
> >reg_offset), offt);
> + }
> }
>
> static inline void jz4730_config_pin_function(struct ingenic_pinctrl *jzpc,