From patchwork Tue Sep 12 04:51:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13380679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AB86CA0EC3 for ; Tue, 12 Sep 2023 04:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ysc7qmyTH4PHU/Hbhlu7Wobn+cZmPT42kvkHhsOuNQk=; b=ayCcxt8WYS0hTg v3lHn0k/b998eIjDSm3msXhmNAYqhzwkuNHu/+pY6ceScc0itdWch1u9QHhlYpxTk1gBWWAsonGXi D1wghbISUiUg0uPkeOlnbQiqXQ7Y9FJoSSJaQJMPyL41hTKPnOQCKNIZVAtMgVVdqJTBICkuxy0m8 UxvAcX5E6uNmu5t4ps6smPuCVx05C3kXELAyQ/jqEulrNzYekJe6izJkkaLplkziRP/Agmb1TKu8W 99Xaqe6aYmctapthv0qEMwCv1myu49z/TyakgEQAH7jfJtjl8/NFk95Zl8W/zEmjFEGPtaMFl/lBZ m5eSskDRWBd79LvIZLCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfvPG-0028Ri-21; Tue, 12 Sep 2023 04:53:46 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfvOf-0027s9-0U for linux-arm-kernel@lists.infradead.org; Tue, 12 Sep 2023 04:53:12 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so6661131a12.0 for ; Mon, 11 Sep 2023 21:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1694494387; x=1695099187; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RhCaDIua2ELjKm61B/fNI293TcxyRj4KFS/PJUnGxg8=; b=LvY4LRgSsMvIqhROFwtcKWZ4sL31LGRgba+ZIF+Hfz0Uyq5qRxkwpXP4uRFhOd9ykL P3gS5NT2/ivWHieqHH3a08PE9YETd4Fb01Mwjvzh8SykLBHYKSQE02y+GWVunAsFlqfa 4znLKEM0l5xSFz8hr2ggJbrUOfKsaLBhCbumX+IUwZYXAX7JnMsIFfKHD5Dp+fjqc1Hc 1pDAB1ln9SV+IbOdLmASTwX3V1dpzq5ojwRf47a/jzlFI5NWEuyCwW29xcNI+kvG6VzS k+4viZc9e0paPkfOCGIKq8vcbwWBvEuKwiRlun9MhWB/bQVh+meLQjD9vuhkWQdXYkP0 j2DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694494387; x=1695099187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RhCaDIua2ELjKm61B/fNI293TcxyRj4KFS/PJUnGxg8=; b=u+qwsETZwkocvugjmikVYi3jrpjOTbbR9aetj2pGVJ1xxVF1yUF/N61T1si/F4rpiJ 8MH6ugs7j2dOxD0HXMbLn1Sw2NRVfUSHhJAIte2iyNkzMX56kDL5h3kVij++kVF6fxx+ omOb0cY+1qKcRchInEOL7kqGPlm8rl5ktd3KYRA2x+rKWsXFcBMdm6Tht+EqFEDKO6Kn /kiRD8031UcJJRMM86UbXW1dIeZMZeh8lhueaad4djiVas4PHrSpJ/vzEMbVP/gc3uF/ 5qqvELB4saBLcHzvd5ZLK/Ug5lMlgqXcDIFhOhrHKBJdGMmxJO9hBst1WTYd2zvQEZge QVoA== X-Gm-Message-State: AOJu0YzUMvWQGW5AxzmgOSOEzz/I1ftAwwxIRM+DQlhiPTuTNPy5wttu 0WKPqkRBTj4MQ2oAgb5TEosh5A== X-Google-Smtp-Source: AGHT+IHtDAyGWwsTihwqYWIWjYGcMH84Kzvqf+B4fLDDAmKoCa48e1lUhWY9yaNrMxhEuORomBRuuw== X-Received: by 2002:aa7:dd01:0:b0:523:1053:9b50 with SMTP id i1-20020aa7dd01000000b0052310539b50mr10347895edv.20.1694494387802; Mon, 11 Sep 2023 21:53:07 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.145]) by smtp.gmail.com with ESMTPSA id f21-20020a05640214d500b0051e22660835sm5422415edx.46.2023.09.11.21.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 21:53:07 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: geert+renesas@glider.be, 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 Cc: 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 Subject: [PATCH 25/37] pinctrl: renesas: rzg2l: adapt function number for RZ/G3S Date: Tue, 12 Sep 2023 07:51:45 +0300 Message-Id: <20230912045157.177966-26-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> References: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_215309_216476_6D909D00 X-CRM114-Status: GOOD ( 13.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. 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 --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 8bdf065aa85b..80cacac7ec95 100644 --- 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;