Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26746337rwd; Mon, 3 Jul 2023 14:26:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlG2G+GamkxGhBnV5Dt5fe38jUZhNZGgC7Cx8ohCBfWMUXzQZ42skUNxrRGenoB4SOopTVsf X-Received: by 2002:a17:90b:1997:b0:262:b22b:8ab5 with SMTP id mv23-20020a17090b199700b00262b22b8ab5mr10015808pjb.17.1688419582839; Mon, 03 Jul 2023 14:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688419582; cv=none; d=google.com; s=arc-20160816; b=UvsCHWlPVRbN2Rj09MOxZDAG6VzoS/+DoclYGZtLKRjFRE++ZWQ4EHNgzlcbrs4vyc YuOCjW5kx2CBSSBRpQ3N3cUqtZ5TltEUanDJypi9oRMSiRZEnXQempYByFkcQNyYdUv/ gWXLRTnQusDg76zFNb78iyG6x4acrKrrsRkZWIe3xGDUTH6ViZSoIuZJrS7Lr+Hp0g6j /PT7HLSAPrLWiT/PqX/pD9z9SwTTCqQM424OVEcNp0fydt0rQDpSG50wPpz9p7RDy6hS ul7qNkPFH0OraXHaFthpLdVhd/7XaarF58eFdTx4M5Z++UDhOwlEbzC4CuNaTuc66tsw ni5A== 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=pzVkmEgU5WzK/Ygg1Ob57YCyS+9xMsLU8cmnnEEo+/M=; fh=Lfb1xLtDS7GmnVb/I4ejrQfEYVIhLJCzWJ3AYTR+mRg=; b=EEk7X1OrjF0UABOA5mpT2ARaUqLIjpe/Xl9myLX1wTqVQd9EcuRepAhQhlgINgVul2 ZY4UEPYk+iOYr2OgyRVSgi+Pga2qk0Ie/UVeNw9XyBAlwzbhT94Hqit8E5Cd505EjZJz gP1Xv4cfT1F9eyVANB0BQzsY5qKnSnRbT5I5dcwBgHkP6tdlfY5FcJrjQyWjlQGw8snp GIFqab8eOwDBwNe7c5Z0c4i3mE2MatxDPshfJ8VJlDQ4zIGJjquyAeQp3JkD+aE+3rcx sGvjAvSn9XMsaALUtGyrfqQnlnNZWUaJQ3SFNhkKqUDEBgStJmbbAs4ZQ67pDnn1BWvY +9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="ggNSk/H1"; 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 a24-20020a17090ad81800b002639394cfcdsi6516349pjv.145.2023.07.03.14.26.08; Mon, 03 Jul 2023 14:26:22 -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="ggNSk/H1"; 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 S230098AbjGCVKv (ORCPT + 99 others); Mon, 3 Jul 2023 17:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjGCVKu (ORCPT ); Mon, 3 Jul 2023 17:10:50 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 145BBE59; Mon, 3 Jul 2023 14:10:49 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7835ae70e46so192218039f.3; Mon, 03 Jul 2023 14:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688418648; x=1691010648; 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=pzVkmEgU5WzK/Ygg1Ob57YCyS+9xMsLU8cmnnEEo+/M=; b=ggNSk/H1Gu+SWvUTcFKzi52A/Nuq5OjwcnWpXPbpm5zYS5lRO/GqinQIi6LRvFf5js 9Ngg0qC9cVjdZcSTmjXDHFeUIRkRBls9EEhikCDCOxNawCsO8WILiqeW5+JB58sDyB69 29LRRFms3nDEznT2wR6Zf6+jhz3o8/NAV1fnTnUP1aWW53+ZLN0abqkjojIHkP+CEOGw Ofe3cRV0hk0KI1mZrS2cIrcU4qQjvD3lLI+oahSb4kVllxLodasgApQgSGNK7iHTwW8i jJ1q3whXmgGphg/X6maRg+ZWZSWrDnijv2tJCTeyhSnK3xJQQ1PvBM97VTBWWBNDuU57 x//A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688418648; x=1691010648; 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=pzVkmEgU5WzK/Ygg1Ob57YCyS+9xMsLU8cmnnEEo+/M=; b=laqMVwS7fH9bPv8m7JpByAFBEHDl/+hdr2SX7I2i80zbQmaivQ7lzf5YReGGT2rDt1 MLkqIy0+j8+Ggfq7DQ6QH4Hn2mhSLCci07fmWF79vwmx2F5yGA/ZW7CSO+ldc42WbbiV BTSziVSOQByOka7e4O1Zwl5cB969hxWa1C6VIYDSOQSf8R1+93feROGh80kR2sE/oyz5 x0E1qQFkvZE9gv8eOVs24DNAYahLTnlDVWu5zh9HdzWo0Vu7vSmz592Qg2kUgFTJ+CWH HaN1t5gNLkr1jHqLV5IjbD+bGu62DnH6XGWf5y4LJYqweVCLVBawtJZI1AODR5l2PnJU 9RgQ== X-Gm-Message-State: AC+VfDw+HpuuPr5fiMC/o/HXrbVQk3m7WC8HMhQG1YPSUh+aao8999Zy PEtu41Fcei+L3bZA9NsgGuWFdVRrFUc4/BuYb4v/xEtkht2JnA== X-Received: by 2002:a6b:f10d:0:b0:783:727b:7073 with SMTP id e13-20020a6bf10d000000b00783727b7073mr11630255iog.20.1688418648099; Mon, 03 Jul 2023 14:10:48 -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 22:10:21 +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, On Mon, Jul 3, 2023 at 3:13=E2=80=AFPM Biju Das wrote: > > Hi Prabhakar, > > > -----Original Message----- > > From: Lad, Prabhakar > > Sent: Monday, July 3, 2023 1:43 PM > > 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 > > Subject: Re: [RFC PATCH 1/4] pinctrl: renesas: rzg2l: Include pinmap in > > RZG2L_GPIO_PORT_PACK() macro > > > > 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 pin= s > > > > 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 > > > > pins > > > > 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 pinma= p > > > > 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_gpio_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). > > Maybe introduce a helper macro to address this case. > > #define RZG2L_GPIO_PORT_PACK_WITH_HOLES(m, n, a, f) for these 2 cases > > and use RZG2L_GPIO_PORT_PACK(n, a, f) for the one without holes. > Agreed will do. Cheers, Prabhakar