From patchwork Fri Sep 29 05:39:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13403694 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 2D7E3E743EE for ; Fri, 29 Sep 2023 05:40:50 +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=BwuWXcxAP1JrrLr3xxiDcM8YXbfBFI8xKNXA9wB3c7E=; b=Umjb2x0pSF7JZk hz4CBbNGMtsTiDWsPlribnLl+Vu/rnPxJCeaoIyaAE1FvwQI07rpeqFC65zJdjJM/b9j+ViuwwjuU 1C708+HWV3W0bTAxVQVnltPRuxQb/5hFIcleLqfTXLAVg93DB4To7kNC/g6NN3VhkjEnEB0xPi7yh jp7lkANbYVLmQwYvgeLxkZX+KwD7uwxMv0X+/xOjO/HjQANYhQnHeNxXuvw9vji3IBqCOh4chJr/8 8u61YDjnjK8JJZMCSI89dJikwAPFNk19iWK5iwdPbAfudtqcQ/PDTpQt5Q/M7ueNOLIFdonZW1KO/ ajmpS07d7GeZ0UWHnrtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qm6Eh-007BQY-1o; Fri, 29 Sep 2023 05:40:23 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qm6ED-007B51-0f for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2023 05:39:54 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9a65f9147ccso1775919666b.1 for ; Thu, 28 Sep 2023 22:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1695965992; x=1696570792; 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=/YwuLgv86cPyGl/Q9QiLo3L9zSgzmkr29pUnhaXKw20=; b=dBrMz99kFV8XKIsrnitp4nmtbYCMeQ3nR/jGp2twJAesUsgQ4/1FOfD266gjdeKWfT afNk8HbSA46ZErv9mnqzXUB08YtakZa2FJ7L12N9bk412FSJ6zaBv7ArUDnv1Gn61/iz SZe9k74kTz/jdrAyJuYCpW57UXpJXbNvov3abZL785iqsXsrB6VAhRC7lNB3p3qjhatZ R/QlMfa2sgsZPumEI7y5iN9UcuU5a9Tq6mUerF00eJoJEhBEQ2fIdS77AOiCXvKGYw/M OJE7hMlSYOoBIyKJB7g3GPv99X6/nfV+h1UzaGjjnla0GotmLB5VEYxRmq9uTk4//Wbe IQIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695965992; x=1696570792; 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=/YwuLgv86cPyGl/Q9QiLo3L9zSgzmkr29pUnhaXKw20=; b=gjkcI7gELLplFoTgPH2G0TwH9mm377eAEJmEcwRFeXvs7xDwZthUSjGvjdE0uBDhS0 UXOrRPF8SyevkGBi0an6vYAiDBhuf0iSb9WNc9Xt8T8opdg8M7+ozli8T9NpHERfqb5d HfEyKneqpSfBwR53gzo+TcknMMDe2AImXv0paLTqrMlfDs9fL7/uBzubZqG+9leYVWOZ AdxTiKfkP7CFWZnVW+gX0NDvP8Y4EFJ2pYuOWmbRZzQ0k/omZUvB4gTkPpOzDQEmkLSc PmQQSR8MCjNyasKe2tDjizKU876lwH6LKA3rnLgzK4Bsl2TKKLQrEW4kLEV5iSZhJMbI 0Jsw== X-Gm-Message-State: AOJu0YwUh2cnfr9qNxOwHpldNfuBFGQYjMn/rGk/JK4qsOr+FJL0I9Th ADFEj0j+zR9P+A21YqWbb8Qmew== X-Google-Smtp-Source: AGHT+IEXwarvffNSeOzlyRj6UStVxwkwWgD3IItelaJ8tdcyvIPhnC7iKAhCem4gJGu4cNt9nB28IQ== X-Received: by 2002:a17:906:5a4e:b0:9b2:d367:d818 with SMTP id my14-20020a1709065a4e00b009b2d367d818mr723684ejc.38.1695965992017; Thu, 28 Sep 2023 22:39:52 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.177]) by smtp.gmail.com with ESMTPSA id z19-20020a1709063ad300b009a1a653770bsm11971992ejd.87.2023.09.28.22.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 22:39:51 -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, linus.walleij@linaro.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, magnus.damm@gmail.com, catalin.marinas@arm.com, will@kernel.org, quic_bjorande@quicinc.com, konrad.dybcio@linaro.org, arnd@arndb.de, neil.armstrong@linaro.org, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 16/28] pinctrl: renesas: rzg2l: adapt function number for RZ/G3S Date: Fri, 29 Sep 2023 08:39:03 +0300 Message-Id: <20230929053915.1530607-17-claudiu.beznea@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230929053915.1530607-1-claudiu.beznea@bp.renesas.com> References: <20230929053915.1530607-1-claudiu.beznea@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230928_223953_243041_E35AA5BE X-CRM114-Status: GOOD ( 13.74 ) 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 is GPIO. 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 --- Changes in v2: - in commit description mentioned that function0 is GPIO - collected tags 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 7256d99fd552..73d8a84af04a 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 *psel_val, *pin_data; struct function_desc *func; @@ -246,9 +249,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", - RZG2L_PIN_ID_TO_PORT(pins[i]), pin, off, psel_val[i]); + RZG2L_PIN_ID_TO_PORT(pins[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;