linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhou Yanjie <zhouyanjie@wanyeetech.com>
To: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>,
	paul@crapouillou.net, linus.walleij@linaro.org
Cc: linux-mips@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: ingenic: Fix regmap on X series SoCs
Date: Thu, 10 Feb 2022 18:18:45 +0800	[thread overview]
Message-ID: <ad12e876-e3d2-dc6e-e89e-819686fe9eff@wanyeetech.com> (raw)
In-Reply-To: <20220209230452.19535-1-aidanmacdonald.0x0@gmail.com>

Hi Aidan,

On 2022/2/10 上午7:04, Aidan MacDonald wrote:
> The X series Ingenic SoCs have a shadow GPIO group which
> is at a higher offset than the other groups, and is used
> for all GPIO configuration. The regmap did not take this
> offset into account and set max_register too low. Writes
> to the shadow group registers were blocked, which made it
> impossible to change any pin configuration.
>
> Fix this by pretending there are at least 8 chips on any
> 'X' SoC for the purposes of calculating max_register. This
> ensures the shadow group is accessible.
>
> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
> ---
>   drivers/pinctrl/pinctrl-ingenic.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)


The M200 SoC (once planned to be called JZ4785) has a different shadow 
register offset address,

if it needs to be supported in the future, then we need to deal with it 
further, but fortunately pinctrl-ingenic.c

does not involve M200 support yet, so:


Reviewed-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>


Thanks and best regards!


>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
> index 2712f51eb238..9d2bccda50f1 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -4168,7 +4168,10 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
>   		return PTR_ERR(base);
>   
>   	regmap_config = ingenic_pinctrl_regmap_config;
> -	regmap_config.max_register = chip_info->num_chips * chip_info->reg_offset;
> +	if (chip_info->version >= ID_X1000)
> +		regmap_config.max_register = MIN(8, chip_info->num_chips) * chip_info->reg_offset;
> +	else
> +		regmap_config.max_register = chip_info->num_chips * chip_info->reg_offset;
>   
>   	jzpc->map = devm_regmap_init_mmio(dev, base, &regmap_config);
>   	if (IS_ERR(jzpc->map)) {

  reply	other threads:[~2022-02-10 10:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 23:04 [PATCH] pinctrl: ingenic: Fix regmap on X series SoCs Aidan MacDonald
2022-02-10 10:18 ` Zhou Yanjie [this message]
2022-02-10 11:03 ` Paul Cercueil
2022-02-10 23:10   ` Aidan MacDonald

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=ad12e876-e3d2-dc6e-e89e-819686fe9eff@wanyeetech.com \
    --to=zhouyanjie@wanyeetech.com \
    --cc=aidanmacdonald.0x0@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paul@crapouillou.net \
    /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;
as well as URLs for NNTP newsgroup(s).