Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2083333rdh; Tue, 26 Sep 2023 11:49:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJmi5/GZdDFCnRojejF0+k0ajwLYmrPXIYdECVXVR0p4g9rbnafCPKyWmXCfTw3tHQUdbn X-Received: by 2002:a05:6a20:bb21:b0:15d:9a73:b146 with SMTP id fc33-20020a056a20bb2100b0015d9a73b146mr6330827pzb.54.1695754185989; Tue, 26 Sep 2023 11:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695754185; cv=none; d=google.com; s=arc-20160816; b=yxt7NNxD2BUTWRBi2C2Qe0+ZakwQXyzyuQVgdXiiCpiBcj0T/ZdOiIy4+Q8lqmW6zR 6+qEexKrvJ0xznbi0dHc2OqNluvLX+xziXappVnxYfby38rmp+SNid3YEkatOf3LiOwm HC2xnAOnbYForm/56+Jdmy6WuCbtNLr32TumHgmjxIkByKtOUP/nsNQ4AsoWzK8Hiqn4 HOetYMlv5E5GdyQz2DtO6FxoJ+XsHWl7/P9mpcd6IbMB/zyI3tajxisFfxNYWgYsfskj MYg9MeicoSSXQHtrxoSX0VpqnqbjbrO6TfXdlbIcm9DricIR3OtxPoExp7YnsY5gGUFC /kww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oCGAB9bjd2rRkobql917EBDyBbo8Xf1tmOkuieid9Qw=; fh=9WUlotjdcho09YgDC581cPl/eySsmGPZyQaqau6O77w=; b=wepnPnqrt83XIgTv5keDF+lAbdlBWGpPtjFxLyxKLqqA/yOyXilMHVHI41bv4Q3b/d cSdsJlMn5dDMFLa1DQWPBhpvAIVe8lLM9VoQpJ31BUBLJ78CBwIHQOgh+1WpI5AOwSkg pk36gbNXCAaA6k4MIkSdJ9jJrPgwTXd39LeWNRh1lDubGmk568O+oU6SuWIUyqmxpjlU 94SztHnvcVDli/iTbt8h1cEHE/DqFuTUB4TywDB0H46bYnuO5rEI297lv174eY//nhfP +w5M8L3gRF/R1nMtEJwSGgW1nXeT3gn3t6Wyn9bsvv0NhRjhBLK/94B8D0pEeynw7pwl 49Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=HFmsZ4Rr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v70-20020a638949000000b0056cab36f3e1si13613363pgd.221.2023.09.26.11.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 11:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=HFmsZ4Rr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0D36D8098484; Tue, 26 Sep 2023 02:56:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232983AbjIZJ4T (ORCPT + 99 others); Tue, 26 Sep 2023 05:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234161AbjIZJ4K (ORCPT ); Tue, 26 Sep 2023 05:56:10 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 704EFCCD for ; Tue, 26 Sep 2023 02:55:58 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9a64619d8fbso1056305366b.0 for ; Tue, 26 Sep 2023 02:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1695722156; x=1696326956; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oCGAB9bjd2rRkobql917EBDyBbo8Xf1tmOkuieid9Qw=; b=HFmsZ4RrW76dmgghgjnLmy/if7RGsBsH4gCiOAm04mIl6nM43bU4nQtLpo9Mipeio4 JUhdNIn4w3HgA3gLB+81owUI+uiPg/4oyDitaKB+k6BzOwxh8C6RoMsHT6RFdWJ/t5fa kZkn3eT+bQKDuIZbyX+KdFGTZlx/r1PFcgLzEr1Wa9Gxr4hkCtQiDoaruQAnT9TdaoLw Lk8iZytyVRi3Hc982kBcXwdfyLV5KKQ7qefdk6LDk/U0aXwxhIAfzfZc7PFdV29YdBRj k6fRmlWHQ+eJ/xaWFtECSUf0Xd7QCXN5TOpRM4YTq/E0wPiTnPiEcvndPYLYKtNKLhqs A6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695722156; x=1696326956; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oCGAB9bjd2rRkobql917EBDyBbo8Xf1tmOkuieid9Qw=; b=azGj/7a/iNF2/JQe6GT1ZXBlFrfMnHBSoz5OqZuXs3QoyiZrx5ECpePB23sGU8vMqe paHs1bT7fktepJTOKYnLUrX5Ki89dblkQ9LERWQ/Q+4LymybzGPXPSwoxfbscB6O3LxQ PENpnU76Rvfk9wRfFuv5jOcltiOf+bFGanhVM3nDB03VDEHtjSVernLwMkMAXtzQdfz+ gNG1ano/gGGNMWk6isQEqFP0qd8m6Z9/tNeICb89dkDtRYHNNSdijmyr/G01hs4URUDa ROIOf+jvhSAX0qFrg5F0E0nKA65iPrlCTtphYN4+X8AInkpxqMJXe63TR5U8GQiGOhkc de1g== X-Gm-Message-State: AOJu0Yx7djBmT3tT30hKP+//ESv6mqt9T2V7UT/T9Xyp/4KUgK9dLQt0 VrthOQE6Jh0HXuRJIfLHM4su9g== X-Received: by 2002:a17:906:3188:b0:9ae:5fdc:aee8 with SMTP id 8-20020a170906318800b009ae5fdcaee8mr8441103ejy.53.1695722156458; Tue, 26 Sep 2023 02:55:56 -0700 (PDT) Received: from [192.168.32.2] ([82.78.167.177]) by smtp.gmail.com with ESMTPSA id j26-20020a170906831a00b00997d7aa59fasm7698269ejx.14.2023.09.26.02.55.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Sep 2023 02:55:55 -0700 (PDT) Message-ID: <1f1b5174-cfd4-4393-3a86-9adfc8c2cce1@tuxon.dev> Date: Tue, 26 Sep 2023 12:55:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 25/37] pinctrl: renesas: rzg2l: adapt function number for RZ/G3S To: Geert Uytterhoeven Cc: 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, prabhakar.mahadev-lad.rj@bp.renesas.com, 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 References: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> <20230912045157.177966-26-claudiu.beznea.uj@bp.renesas.com> Content-Language: en-US From: claudiu beznea In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:56:42 -0700 (PDT) Hi, Geert, On 21.09.2023 15:51, Geert Uytterhoeven wrote: > Hi Claudiu, > > Thanks for your patch! > > On Tue, Sep 12, 2023 at 6:53 AM Claudiu wrote: >> From: Claudiu Beznea >> >> On RZ/G3S PFC register allow setting 8 functions for individual ports >> (function1 to function8). For function1 register need to be configured >> with 0, for function8 register need to be configured with 7. >> We cannot use zero based addressing when requesting functions from >> different code places as documentation (RZG3S_pinfunction_List_r1.0.xlsx) >> states explicitly that function0 has different meaning. > > According to that table, function0 is GPIO. Yes, I'll mention it like this in the next version. > >> For this add a new member to struct rzg2l_hwcfg that will keep the >> offset that need to be substracted before applying a value to PFC register. >> >> Signed-off-by: Claudiu Beznea > > Reviewed-by: Geert Uytterhoeven > > But one question below... > >> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c >> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c >> @@ -136,9 +136,11 @@ struct rzg2l_register_offsets { >> /** >> * struct rzg2l_hwcfg - hardware configuration data structure >> * @regs: hardware specific register offsets >> + * @func_base: base number for port function (see register PFC) >> */ >> struct rzg2l_hwcfg { >> const struct rzg2l_register_offsets regs; >> + u8 func_base; >> }; >> >> struct rzg2l_dedicated_configs { >> @@ -221,6 +223,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev, >> unsigned int group_selector) >> { >> struct rzg2l_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); >> + const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; >> const struct pinctrl_pin_desc *pin_desc; >> unsigned int i, *psel_val, *pin_data; >> struct function_desc *func; >> @@ -247,9 +250,9 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev, >> off = 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]); >> + pin, off, psel_val[i] - hwcfg->func_base); >> >> - rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i]); >> + rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i] - hwcfg->func_base); >> } >> >> return 0; > > Perhaps the adjustment should be done in rzg2l_dt_subnode_to_map() > instead, when obtaining MUX_FUNC() from DT? That would allow you to do > some basic validation on it too, which is currently completely missing > (reject out-of-range values overflowing into adjacent PFC fields, > reject zero on RZ/G3S). I'll have a look on this. I see .set_mux() can also be called from sysfs though pinmux-select exported file thus, I don't know at the moment if validating it on rzg2l_dt_subnode_to_map() will be enough. Would it be OK to have this outside of this series or you would prefer it now? Thank you, Claudiu Beznea > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.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