mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: "H. Nikolaus Schaller" <hns@goldelico.com>,
	Linus Walleij	 <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski	 <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bartosz Golaszewski	 <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	 letux-kernel@openphoenux.org
Subject: Re: [PATCH v3 4/7] pinctrl: ingenic: Add X2600 register and GPIO IRQ support
Date: Wed, 18 Nov 2026 10:23:46 +0100	[thread overview]
Message-ID: <3fb43f9b95a00bddb6ee2f6cd9a7491a5a499362.camel@crapouillou.net> (raw)
In-Reply-To: <ccaaca07b0b6764ce65ad746bfeb9efd362c3bde.1794987700.git.hns@goldelico.com>

Hi Nikolaus,

Le mercredi 18 novembre 2026 à 08:41 +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@goldelico.com>
> ---

Please add a changelog per patch right here, otherwise it's a bit hard to follow
what changed...

>  drivers/pinctrl/pinctrl-ingenic.c | 50 ++++++++++++++++++++++++-------
>  1 file changed, 40 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-
> ingenic.c
> index dc5d38c16e18d..4f1b096a3ac8e 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,
> @@ -3856,16 +3867,35 @@ 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));
> +	}
>  }
>  
>  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),
> +			     pin / PINS_PER_GPIO_CHIP);

Just reuse "offt" here.

Cheers,
-Paul

  reply	other threads:[~2026-11-18  9:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  7:41 [PATCH v3 0/7] pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 1/7] pinctrl: ingenic: Swap ID_X1600 and ID_X1830 H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 2/7] pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600 H. Nikolaus Schaller
2026-11-18  9:13   ` Paul Cercueil
2026-11-18  9:18     ` H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 3/7] dt-bindings: pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 4/7] pinctrl: ingenic: Add X2600 register and GPIO IRQ support H. Nikolaus Schaller
2026-11-18  9:23   ` Paul Cercueil [this message]
2026-11-18  7:41 ` [PATCH v3 5/7] pinctrl: ingenic: Add X2600 pin groups and functions H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 6/7] pinctrl: ingenic: Handle X2600 Port E Schmitt trigger H. Nikolaus Schaller
2026-11-18  7:41 ` [PATCH v3 7/7] pinctrl: ingenic: Handle X2600 Port E pull configuration H. Nikolaus Schaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3fb43f9b95a00bddb6ee2f6cd9a7491a5a499362.camel@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hns@goldelico.com \
    --cc=krzk+dt@kernel.org \
    --cc=letux-kernel@openphoenux.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®