Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26140361rwd; Mon, 3 Jul 2023 06:03:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ZoQ1ekB4f1c5xOBSehOrkS2uq4S0klPSuz7/XRXvjxRTsOM6/vtkSan9uCQ/2YEFSSRoO X-Received: by 2002:a05:6870:818b:b0:19e:b8e0:1434 with SMTP id k11-20020a056870818b00b0019eb8e01434mr11881545oae.8.1688389439123; Mon, 03 Jul 2023 06:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688389439; cv=none; d=google.com; s=arc-20160816; b=mvB+LqQmHHBjIaAvuVSVttKSULpG6uppYYuDz1ystbPkXnF9oEVr9mOSNHGvM2+xBG fpbLQWilEP8Dj45HfZXgpaVdNuiduZqWYaZ2D/pyPkFHK8xTYecDgyqKqPpMq37+KtPw dqrGMI9eXXvEi9LxDBxSYOi5gx9zgwXf4jcXbwKQGUojaib3DCGbvPhOzDtl7hj8wt3b MDC12FCQ+OQ+0PGa2zaJaG4xzWNk9lVVB8TmgjZ4ZCwBa982UcOaQKdCuh5x3q150KBv YGPER0pF/ScneYLIH54tyhOroxSpQUbKGycEzeoAM30lt+g0k1yjKa3cyogIQQX+DuBr V/5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZcEoocC19pvVvckXEfOwPq0UrW7yuRC8cKDF3dCYEz4=; fh=Lfb1xLtDS7GmnVb/I4ejrQfEYVIhLJCzWJ3AYTR+mRg=; b=BGt6Mc4cEYFxQk0L2s+TlzXyxXhwUR693ZHd++IkIhcojV6fW7xgEWDUQu6kAV3oUu UF8QFI7YkGSPCgepr5ICMhgCgbReHjuNWc4eBjOfBij58SvVnWYyRpBu/syJCI2/k6ep roPw1VWe5M9lYLqyJuTkE9XDTEYg28e0qpuyyZBK67bvcluroe/3YJ+Lk9m+N61VttXV QTnae0VH5dSqUZxfLTO83lrCJqU630dQUxskuXlj4581ZgqEMACf8CmF9fzDTywbBUzb BSoNh5vue48cB5QwBEiE2b7y7Uw+68RGRi7B96jJegnZXxM9818tyNyj79w6OyuDTl2O 3UuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Xknf2hwH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020a0568301cc800b006b72f5ec8bfsi8816511otg.214.2023.07.03.06.03.43; Mon, 03 Jul 2023 06:03:59 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Xknf2hwH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjGCMnf (ORCPT + 99 others); Mon, 3 Jul 2023 08:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGCMnd (ORCPT ); Mon, 3 Jul 2023 08:43:33 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E39B9BC; Mon, 3 Jul 2023 05:43:32 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-345db6c12b4so16740205ab.0; Mon, 03 Jul 2023 05:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688388212; x=1690980212; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZcEoocC19pvVvckXEfOwPq0UrW7yuRC8cKDF3dCYEz4=; b=Xknf2hwH10pOXp2JSYKV5VMG25V29YwSCtAF1bztkGfwW1rGJHKDMcWVI7c1RRZJtz wdtoI40NHgRDbD0DvHw/0gUjHO4pnAdQRAeMWEByAK+mqgBCTExDYRuuisz4c6LcH7Cu lbefqBP2iBDZRZM6GhsVbEahUoSxwXYqWi0i1JQiaDvEpo6NgDzET3zJpDesMnb9lcu8 S2q1OYub0sdyeWS65VHBzhH6gIgGynBzeCJ1WwVCfzFyFItirpwAAAcfu41D8PGbVEyF UbeXgx3xtNy+8lD8iBLNS9HwmTP3xMrvFva1f1h3lfDYQyj0Gh7/4jsJablMW5y0+HtK X0cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688388212; x=1690980212; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZcEoocC19pvVvckXEfOwPq0UrW7yuRC8cKDF3dCYEz4=; b=MnHxA/gXIpQHDW7COsXDdJQO0oe60mzYXx0S6o9AclECjkB/YHptb7WwoTvhrEP1ZM 2RjkLG64RoTN66CZ1yf3wLc7QhRkLw1iXKgVvG90hXgNBw0EYP3tGWVl6st6fB0No3pA jeqw+n3HLoGbMpdR5g9T6leOQChe9jM5DXVJ8nBcr95HgqyCwlCVibNXCIZw7WoWjgHu q5FkTSVwjwe88KGwFrrueL8zaQu5imZC6zNlpdMZOP9V6aNPY57tcUMuoM93uSlCMGqh i5VvIVqf9K1NqPttVkKoY+3oD/IWMTNk2IsKJZaS4wyiTMtO1sqdmaUbcJkPoZSf0sXj cifA== X-Gm-Message-State: AC+VfDw2KZpvrBe4IF+3LLx3CluzgFkawSGLsJavHIY9fXJUHxl2vc6e Yw1CyV2mYkZvsZmlyJtmD/WRRSzsVmlUcAHIgh8= X-Received: by 2002:a6b:7a02:0:b0:785:d017:c16f with SMTP id h2-20020a6b7a02000000b00785d017c16fmr11368650iom.14.1688388212208; Mon, 03 Jul 2023 05:43:32 -0700 (PDT) MIME-Version: 1.0 References: <20230630120433.49529-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20230630120433.49529-2-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Mon, 3 Jul 2023 13:43:06 +0100 Message-ID: Subject: Re: [RFC PATCH 1/4] pinctrl: renesas: rzg2l: Include pinmap in RZG2L_GPIO_PORT_PACK() macro To: Biju Das Cc: Geert Uytterhoeven , Magnus Damm , Rob Herring , Krzysztof Kozlowski , Linus Walleij , "linux-renesas-soc@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Prabhakar Mahadev Lad Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Biju, Thank you for the review. On Mon, Jul 3, 2023 at 12:42=E2=80=AFPM Biju Das wrote: > > Hi Prabhakar, > > Thanks for the patch. > > > -----Original Message----- > > From: Prabhakar > > Sent: Friday, June 30, 2023 1:05 PM > > To: Geert Uytterhoeven ; Magnus Damm > > > > Cc: Rob Herring ; Krzysztof Kozlowski > > ; Linus Walleij > > ; linux-renesas-soc@vger.kernel.org; > > devicetree@vger.kernel.org; linux-riscv@lists.infradead.org; linux- > > kernel@vger.kernel.org; linux-gpio@vger.kernel.org; Biju Das > > ; Prabhakar ; > > Prabhakar Mahadev Lad > > Subject: [RFC PATCH 1/4] pinctrl: renesas: rzg2l: Include pinmap in > > RZG2L_GPIO_PORT_PACK() macro > > > > From: Lad Prabhakar > > > > Currently we assume all the port pins are sequential ie always PX_0 to > > PX_n (n=3D1..7) exist, but on RZ/Five SoC we have additional pins P19_1= to > > P28_5 which have holes in them, for example only one pin on port19 is > > available and that is P19_1 and not P19_0. > > > > So to handle such cases include pinmap for each port which would > > indicate the pin availability on each port. With this we also get > > additional pin validation, for example on the RZ/G2L SOC P0 has two pin= s > > P0_1 and P0_0 but with DT/SYSFS could use the P0_2-P0_7. > > > > While at it, update rzg2l_validate_gpio_pin() to use the port pinmap to > > validate the gpio pin. > > > > Signed-off-by: Lad Prabhakar > > --- > > drivers/pinctrl/renesas/pinctrl-rzg2l.c | 167 ++++++++++++------------ > > 1 file changed, 86 insertions(+), 81 deletions(-) > > > > diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > b/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > index 9511d920565e..a0c2e585e765 100644 > > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > @@ -67,10 +67,12 @@ > > PIN_CFG_FILCLKSEL) > > > > /* > > - * n indicates number of pins in the port, a is the register index > > - * and f is pin configuration capabilities supported. > > + * m indicates the bitmap of supported pins, n indicates number > > + * of pins in the port, a is the register index and f is pin > > + * configuration capabilities supported. > > */ > > -#define RZG2L_GPIO_PORT_PACK(n, a, f) (((n) << 28) | ((a) << 20= ) | > > (f)) > > +#define RZG2L_GPIO_PORT_PACK(m, n, a, f) ((UL(m) << 32) | (UL(n) <= < 28) > > | ((a) << 20) | (f)) > > I guess, you can still achieve RZG2L_GPIO_PORT_PACK(n, a, f) with > ((UL(PINMAP(n)) << 32) | (UL(n) << 28) | ((a) << 20) | (f)) > > #define PINMAP(n) GENMASK(n,0) ?? Then you don't need to modify rzg2l_gpi= o_configs. > Good point, but this would work if port pins didn't have any holes. For example on RZ/Five port P19 we have P19_1 pin only and P19_0 is not available (and similarly for port P25 we have P25_1). Cheers, Prabhakar