Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2709490pxb; Thu, 10 Feb 2022 03:57:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRoMMYWylWk6+fIXNN1PY6ZP3ZRTpj4lhTJRY8rwmjHmAFSNW9RHyHcZJA/HvPhIHMcbWY X-Received: by 2002:a17:902:e843:: with SMTP id t3mr7180110plg.19.1644494266584; Thu, 10 Feb 2022 03:57:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644494266; cv=none; d=google.com; s=arc-20160816; b=WsMVaogqY65p6l+k/H6f/uh/hYrWtcWpXT4OtxGI15KVccg37BHZZhdguR3w5qwguF a2zmD+Fxh62ze9Ej0oxctdI5NsOspQcem6pI+JC3coRCzvwFXQ7WiyIJw50YzZGgUwr0 74lGykMTfrr10o+qXrJTcMqWRwE59ZtfWIU9pKSVFcLdBAt7ytkLyHoBEjaZI0r7tRi3 8n6ejboj9tF/g37zi3PnKbB2XDt0kgiSGPwHFt9OitF613neHuDgMyHqcB8m2cNhdcj0 B3cpuLVtsPpNrXbpnzVC+P3QheSyC5IYYkaesV3pRf4MzeI/hkMg2i/b46o/VVW1sNNo CJ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=cjct5Hzc0rniCQIooxtRXHAcQO2wd9+NieCPcoCDKIE=; b=UmC1Wv5Qu5QUTddBK0P0mYBrAW7dYtWh1TANt3ZJ3YGjAfpMxpwDo+OzIruMgkyWNK ofbDjWitkbNmlpJFfIGCJ2UZvDsW/Idt5o6Pjgz55ViGt5BpFStWPy15/Qdo7kThpXQ2 M8OqYEf0DWSVVcDKZGVtB7NbMCX81U3/j5GYOyITL1tX476Xe9zwRbwXsRABgXtAcN/D r/5BRQULQEgNoTQPbtO/yeRoJa/f1eP/xVWT9GM22kVhK+rr4Bl458o3OGeM6G0lgW7r 0ztDjLoFNbzL09of0HJcopNllKGkE6OPw476Vj6GMwoNMJQmhHO7tmloL1eKO48VghP/ pszQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21si20139025pfk.319.2022.02.10.03.57.34; Thu, 10 Feb 2022 03:57:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239503AbiBJKSu (ORCPT + 99 others); Thu, 10 Feb 2022 05:18:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237520AbiBJKSt (ORCPT ); Thu, 10 Feb 2022 05:18:49 -0500 Received: from out28-125.mail.aliyun.com (out28-125.mail.aliyun.com [115.124.28.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50BC11C2; Thu, 10 Feb 2022 02:18:49 -0800 (PST) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1530151|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_regular_dialog|0.00618255-0.00198199-0.991836;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047212;MF=zhouyanjie@wanyeetech.com;NM=1;PH=DS;RN=6;RT=6;SR=0;TI=SMTPD_---.MnxRg3g_1644488326; Received: from 192.168.88.129(mailfrom:zhouyanjie@wanyeetech.com fp:SMTPD_---.MnxRg3g_1644488326) by smtp.aliyun-inc.com(10.147.44.145); Thu, 10 Feb 2022 18:18:46 +0800 Subject: Re: [PATCH] pinctrl: ingenic: Fix regmap on X series SoCs To: Aidan MacDonald , paul@crapouillou.net, linus.walleij@linaro.org Cc: linux-mips@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220209230452.19535-1-aidanmacdonald.0x0@gmail.com> From: Zhou Yanjie Message-ID: Date: Thu, 10 Feb 2022 18:18:45 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20220209230452.19535-1-aidanmacdonald.0x0@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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) 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, ®map_config); > if (IS_ERR(jzpc->map)) {