Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1502632rdb; Wed, 20 Sep 2023 10:50:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3QaGQIHesj6a0HdiyxgGAomGRJwlKVraDpa1h4Pxs1tLJvHOTGAco9G4iMy7fpQOKs4nE X-Received: by 2002:a17:903:230c:b0:1c3:8976:e821 with SMTP id d12-20020a170903230c00b001c38976e821mr2958597plh.15.1695232256106; Wed, 20 Sep 2023 10:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695232256; cv=none; d=google.com; s=arc-20160816; b=YtwTSzO7f09rn+05RxWfA8m4i3wHpUMBI6QiQuEgnH1dgCJlEPxXJBHT+YjbwzVZ/T fPafzPbSg9+w5wYiB/D7AaWRcJR4I3HlUAJfjmJdo8tz5DMeagpP4lDuwBbzh+7fJx+v 27fE44oer2xghVGKY7QygfXS/e5V9rSPsh0rJjFnqWfaw+h+k9z/bEsj21d5jZNEXxt6 6Y5SSCYzSPrJOjJuylk0S4yi4LLmMCYqbYtIWomy9+UuE6Gxa6D8ChfMk5VQMpmaZjFw lFMusLvfJMWK4GIh+zfCSewezqHmZFewo4tpbvA6g24I7oJh+Zrvt8ARkSsj2FN2LtvK MmIg== 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=95fTQPVKJHWmCHRYGh/6GuNTqeE/4yo9MhUnxDaE2lo=; fh=xlGzv0QVgt7W1apACfgUKb4Ak15xIrseGkini9J4K/A=; b=gyrdp/yILHfgr8kOS/BfEXwjN7634D0gGguQcu4BosN9p59jE1duWuHvfFSSK4PMtX G8tNhpwrdN4O6g42I5Z4RtdyuVAs4U5bIovtrdQNm+tHOD3niqUNtpHFUpVvHmXNrdsC Ntbku4jHKPTagscsqPedaWGR4aHkDRb1OeKoYJr2EZhUfSAM2+jHkvzKp56DFyyfAG3B TKid/ISsl7TfyJC4EQ/CrY/BHPsBirJ79VoFrvQ6uJ5k/LOEbwWtNcTSWE4Hqz0RpmK7 Og3H/F5cQJqAnNi3NSOIpTXUngsSXloiJOjPwRAtU92BPIAMD3tIu+PfB7R3rB1Jds5p ysYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CB0wsID4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t12-20020a1709027fcc00b001b89bd6fd59si11920017plb.215.2023.09.20.10.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 10:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CB0wsID4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 36C62824E796; Wed, 20 Sep 2023 06:44:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236165AbjITNob (ORCPT + 99 others); Wed, 20 Sep 2023 09:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234771AbjITNo3 (ORCPT ); Wed, 20 Sep 2023 09:44:29 -0400 Received: from mail-vk1-xa35.google.com (mail-vk1-xa35.google.com [IPv6:2607:f8b0:4864:20::a35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C1AAD; Wed, 20 Sep 2023 06:44:23 -0700 (PDT) Received: by mail-vk1-xa35.google.com with SMTP id 71dfb90a1353d-4962ea9921aso2682665e0c.0; Wed, 20 Sep 2023 06:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695217462; x=1695822262; darn=vger.kernel.org; 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=95fTQPVKJHWmCHRYGh/6GuNTqeE/4yo9MhUnxDaE2lo=; b=CB0wsID4G4zWqt++NXEzpOaoNFWcw4IxRRt5gXO70xHnC1/fyV71xpb75nTQqol9Iu SwhhSL/uA7+zmlv7VnCOAfoW17mI7ei2SHMRY6tBNRW3GBqgQ4E2jssSZZldg/JMXPAP T6pp+f/wCjhyAgTZwbTJubSAvA4IZq+vMRvhz1iACvH8YPHHmcKyjkqQQeAyTfjDSvMI D/oawpmL5mBIeg05ACF3auxGooFM25KbyMCH+tIoQJfMzGr+vKzRDz5sMwqS2JKSWzZC KYxsz64Fy4PWJ4vkeQ5NHPmnsHJ5J04ohbfsR+Ei+hRNTEIgE7Z3Q1S6+eFY1PJIPiyn cRGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695217462; x=1695822262; 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=95fTQPVKJHWmCHRYGh/6GuNTqeE/4yo9MhUnxDaE2lo=; b=PqEV+7aVztKDXkKKQFa1wbGJdDc/KLALsKIaIvegz2L8QD+dPAuwcb1hWS5DTJxQfv Xdum/Lz9xe50nxi0TO6cjRtF3Tai+cJnt9ubfl+w+Jkk1/yf+Jv+Z4lfCyJ7Req0EnRJ z19bKblu5zF95l6BzqbOzBJm6i/wAfGGWtpFV4wEZXdqSFSn7paiL9Au0BAcSOCvDOJC eGQYu7YYfX3jXtWUPkq9PFBmnyzGRxumUKo/eFfpebhn13fUqhwRuIQrnRnjGzQQRH53 cWinsvIAa1DkqgsTGO65gJzbAemuQ7Pku0xufOm5jIaX/xxnvwotWcoNb7DeGp7U9LK2 FUfg== X-Gm-Message-State: AOJu0YzWg/RkTc3uGU7aW6bqmwZKuscCeP33gMhuyroNe/G+xa59mP8w fYYeMuhnGfIJ67CjSf4S11EC8XQgceNlTw4YgrE= X-Received: by 2002:a1f:4c43:0:b0:48f:e2eb:6dd9 with SMTP id z64-20020a1f4c43000000b0048fe2eb6dd9mr2628965vka.8.1695217462414; Wed, 20 Sep 2023 06:44:22 -0700 (PDT) MIME-Version: 1.0 References: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> <20230912045157.177966-24-claudiu.beznea.uj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Wed, 20 Sep 2023 14:43:55 +0100 Message-ID: Subject: Re: [PATCH 23/37] pinctrl: renesas: rzg2l: index all registers based on port offset To: Geert Uytterhoeven Cc: Claudiu , prabhakar.mahadev-lad.rj@bp.renesas.com, mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, magnus.damm@gmail.com, catalin.marinas@arm.com, will@kernel.org, biju.das.jz@bp.renesas.com, quic_bjorande@quicinc.com, arnd@arndb.de, konrad.dybcio@linaro.org, neil.armstrong@linaro.org, nfraprado@collabora.com, rafal@milecki.pl, wsa+renesas@sang-engineering.com, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea 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_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 06:44:31 -0700 (PDT) Hi Geert, On Wed, Sep 20, 2023 at 2:22=E2=80=AFPM Geert Uytterhoeven wrote: > > Hi Claudiu, > > Thanks for your patch! > > On Tue, Sep 12, 2023 at 6:53=E2=80=AFAM Claudiu wrote: > > From: Claudiu Beznea > > > > To get address that needs to be read/write for specific port > > functionalities the P(), PM(), PMC(), PFC(), PIN(), IOLH() IEN(), ISEL(= ) > > macros are used. Some of these macros received as argument the hardware > > port identifier, some hardware port offset address (e.g. ISEL() receive= d > > port identifier, IOLH() received port offset address). This makes hard = to > > extend the current driver for SoCs were port identifiers are not contin= uous > > in memory map of pin controller. This is the case for RZ/G3S pin contro= ller > > were ports are mapped as follows: > > > > port offset port identifier > > ----------- --------------- > > 0x20 P0 > > 0x21 P5 > > 0x22 P6 > > 0x23 P11 > > 0x24 P12 > > 0x25 P13 > > 0x26 P14 > > 0x27 P15 > > 0x28 P16 > > 0x29 P17 > > 0x2a P18 > > 0x30 P1 > > 0x31 P2 > > 0x32 P3 > > 0x33 P4 > > 0x34 P7 > > 0x35 P8 > > 0x36 P8 > > 0x37 P10 > > > > To make this achievable change all the above macros used to get the add= ress > > of a port register for specific port functionality based on port hardwa= re > > address. Shortly, all the above macros will get as argument the port > > offset address listed in the above table. > > > > With this RZG2L_SINGLE_PIN_GET_PORT_OFFSET() and > > RZG2L_PIN_ID_TO_PORT_OFFSET() were replaced by > > and RZG2L_GPIO_PORT_GET_INDEX()? > > > RZG2L_PIN_CFG_TO_PORT_OFFSET(), RZG2L_SINGLE_PIN_GET_CFGS() and > > RZG2L_GPIO_PORT_GET_CFGS() were replaced by RZG2L_PIN_CFG_TO_CAPS(). > > > > Also rzg2l_pinctrl_set_pfc_mode() don't need port argument anymore. > > Also rzg2l_gpio_direction_input() and rzg2l_gpio_direction_output() don= 't > > need to translate port and bit locally as this can be done by > > rzg2l_gpio_set_direction(). > > > > To use the same naming for port, bit/pin and register offset the > > port_offset variable names in different places was replaced by variable > > named off and there is no need to initialize anymore cfg and bit in > > different code places. > > > > Signed-off-by: Claudiu Beznea > > This looks like a nice cleanup, thanks a lot! > Prabhakar: do you like it, too? > Yes indeed, I loved it when I reviewed it internally. This makes it easier for me to add those extra port pins present on rz/five ;) Reviewed-by: Lad Prabhakar Tested-by: Lad Prabhakar Cheers, Prabhakar > Reviewed-by: Geert Uytterhoeven > You can find a few suggestions for improvement below... > > > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c > > @@ -202,9 +202,11 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_de= v *pctldev, > > unsigned int group_selector) > > { > > struct rzg2l_pinctrl *pctrl =3D pinctrl_dev_get_drvdata(pctldev= ); > > + const struct pinctrl_pin_desc *pin_desc; > > + unsigned int i, *psel_val, *pin_data; > > struct function_desc *func; > > - unsigned int i, *psel_val; > > struct group_desc *group; > > + u32 port, pin, off; > > Please move the new variable declarations inside the for(), and > combine them with their initialization. > > > int *pins; > > > > func =3D pinmux_generic_get_function(pctldev, func_selector); > > @@ -218,11 +220,17 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_d= ev *pctldev, > > pins =3D group->pins; > > > > for (i =3D 0; i < group->num_pins; i++) { > > - dev_dbg(pctrl->dev, "port:%u pin: %u PSEL:%u\n", > > - RZG2L_PIN_ID_TO_PORT(pins[i]), RZG2L_PIN_ID_TO_= PIN(pins[i]), > > - psel_val[i]); > > - rzg2l_pinctrl_set_pfc_mode(pctrl, RZG2L_PIN_ID_TO_PORT(= pins[i]), > > - RZG2L_PIN_ID_TO_PIN(pins[i])= , psel_val[i]); > > + pin_desc =3D &pctrl->desc.pins[pins[i]]; > > + pin_data =3D pin_desc->drv_data; > > + > > + port =3D RZG2L_PIN_ID_TO_PORT(pins[i]); > > As port is unused but in the debug print, please drop the variable, > and use RZG2L_PIN_ID_TO_PORT() in the debug print below. > > > + pin =3D RZG2L_PIN_ID_TO_PIN(pins[i]); > > + off =3D RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); > > + > > + dev_dbg(pctrl->dev, "port:%u pin: %u off:%x PSEL:%u\n",= port, > > + pin, off, psel_val[i]); > > + > > + rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i]= ); > > } > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m6= 8k.org > > In personal conversations with technical people, I call myself a hacker. = But > when I'm talking to journalists I just say "programmer" or something like= that. > -- Linus Torvalds > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel