All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudiu <claudiu.beznea@tuxon.dev>
To: nobuhiro1.iwamatsu@toshiba.co.jp, pavel@denx.de
Cc: cip-dev@lists.cip-project.org, biju.das.jz@bp.renesas.com,
	prabhakar.mahadev-lad.rj@bp.renesas.com,
	claudiu.beznea@tuxon.dev
Subject: [PATCH 5.10.y-cip 35/53] pinctrl: renesas: rzg2l: Adapt function number for RZ/G3S
Date: Fri, 19 Apr 2024 11:17:24 +0300	[thread overview]
Message-ID: <20240419081742.3496709-36-claudiu.beznea.uj@bp.renesas.com> (raw)
In-Reply-To: <20240419081742.3496709-1-claudiu.beznea.uj@bp.renesas.com>

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit 35a3610e5a2407913dd6505de06975ba5056af9e upstream.

On RZ/G3S PFC register allow setting 8 functions for individual ports
(function1 to function8). For function1 the register need to be
configured with 0, for function8 the register need to be configured with
7.  We cannot use zero based addressing when requesting functions from
different code places as the documentation
(RZG3S_pinfunction_List_r1.0.xlsx) states explicitly that function0 is
GPIO.

Add a new member to struct rzg2l_hwcfg that will keep the offset that
needs to be substracted before applying a value to a PFC register.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230929053915.1530607-17-claudiu.beznea@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 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 f6a7041028b6..e924bd19ecfb 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -132,9 +132,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 {
@@ -217,6 +219,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;
 	struct function_desc *func;
 	unsigned int i, *psel_val;
 	struct group_desc *group;
@@ -238,9 +241,9 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
 		u32 pin = RZG2L_PIN_ID_TO_PIN(pins[i]);
 
 		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;
-- 
2.39.2



  parent reply	other threads:[~2024-04-19  8:18 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  8:16 [PATCH 5.10.y-cip 00/53] Add initial support for the Renesas RZ/G3S SoC Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 01/53] clk: renesas: rzg2l: Wait for status bit of SD mux before continuing Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 02/53] clk: renesas: rzg2l: Lock around writes to mux register Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 03/53] clk: renesas: rzg2l: Trust value returned by hardware Claudiu
2024-04-21 14:15   ` Pavel Machek
2024-04-19  8:16 ` [PATCH 5.10.y-cip 04/53] clk: renesas: rzg2l: Use FIELD_GET() for PLL register fields Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 05/53] clk: renesas: rzg2l: Fix computation formula Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 06/53] clk: renesas: rzg2l-cpg: Reuse code in rzg2l_cpg_reset() Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 07/53] clk: renesas: rzg2l: Check reset monitor registers Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 08/53] dt-bindings: soc: renesas: Document Renesas RZ/G3S SoC variants Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 09/53] dt-bindings: soc: renesas: renesas,rzg2l-sysc: Document RZ/G3S SoC Claudiu
2024-04-19  8:16 ` [PATCH 5.10.y-cip 10/53] clk: renesas: rzg2l: Don't assume all CPG_MOD clocks support PM Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 11/53] clk: renesas: rzg2l: Convert to readl_poll_timeout_atomic() Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 12/53] clk: renesas: rzg2l: Use u32 for flag and mux_flags Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 13/53] clk: renesas: rzg2l: Simplify .determine_rate() Claudiu
2024-04-21 14:17   ` Pavel Machek
2024-04-22  5:13     ` claudiu beznea
2024-04-19  8:17 ` [PATCH 5.10.y-cip 14/53] clk: renesas: rzg2l: Use core->name for clock name Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 15/53] clk: renesas: rzg2l: Simplify the logic in rzg2l_mod_clock_endisable() Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 16/53] clk: renesas: rzg2l: Remove critical area Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 17/53] clk: renesas: rzg2l: Add support for RZ/G3S PLL Claudiu
2024-04-21 14:18   ` Pavel Machek
2024-04-22  4:43     ` claudiu beznea
2024-04-19  8:17 ` [PATCH 5.10.y-cip 18/53] clk: renesas: rzg2l: Add struct clk_hw_data Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 19/53] clk: renesas: rzg2l: Remove CPG_SDHI_DSEL from generic header Claudiu
2024-04-21 14:20   ` Pavel Machek
2024-04-19  8:17 ` [PATCH 5.10.y-cip 20/53] clk: renesas: rzg2l: Refactor SD mux driver Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 21/53] clk: divider: Add re-usable determine_rate implementations Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 22/53] clk: renesas: rzg2l: Add divider clock for RZ/G3S Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 23/53] dt-bindings: clock: renesas,rzg2l-cpg: Document RZ/G3S SoC Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 24/53] clk: renesas: Add minimal boot support for " Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 25/53] clk: renesas: r9a08g045: Add clock and reset support for SDHI1 and SDHI2 Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 26/53] clk: renesas: r9a07g04[34]: Use SEL_SDHI1_STS status configuration for SD1 mux Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 27/53] soc: renesas: Use "#ifdef" for single-symbol definition checks Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 28/53] soc: renesas: Identify RZ/G3S SoC Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 29/53] pinctrl: renesas: rzg2l: Make struct rzg2l_pinctrl_data::dedicated_pins constant Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 30/53] pinctrl: renesas: rzg2l: Make reverse order of enable() for disable() Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 31/53] pinctrl: renesas: rzg2l: Rename rzg2l_gpio_configs[] Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 32/53] pinctrl: renesas: rzg2l: Add validation of GPIO pin in rzg2l_gpio_request() Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 33/53] pinctrl: renesas: rzg2l: Index all registers based on port offset Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 34/53] pinctrl: renesas: rzg2l: Adapt for different SD/PWPR register offsets Claudiu
2024-04-19  8:17 ` Claudiu [this message]
2024-04-19  8:17 ` [PATCH 5.10.y-cip 36/53] pinctrl: renesas: rzg2l: Move DS and OI to SoC-specific configuration Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 37/53] pinctrl: renesas: rzg2l: Add support for different DS values on different groups Claudiu
2024-04-21 14:24   ` Pavel Machek
2024-04-22  5:09     ` claudiu beznea
2024-04-19  8:17 ` [PATCH 5.10.y-cip 38/53] dt-bindings: pinctrl: renesas: Document RZ/G3S SoC Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 39/53] pinctrl: renesas: rzg2l: Add RZ/G3S support Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 40/53] dt-bindings: mmc: renesas,sdhi: Document " Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 41/53] dt-bindings: serial: renesas,scif: document r9a08g045 support Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 42/53] dt-bindings: soc: renesas: Document RZ/G3S SMARC SoM Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 43/53] dt-bindings: soc: renesas: Document SMARC Carrier-II EVK Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 44/53] arm64: dts: renesas: Add initial DTSI for RZ/G3S SoC Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 45/53] arm64: dts: renesas: Add initial support for RZ/G3S SMARC SoM Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 46/53] arm64: dts: renesas: Add initial device tree for RZ SMARC Carrier-II Board Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 47/53] arm64: dts: renesas: Add initial device tree for RZ/G3S SMARC EVK board Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 48/53] arm64: dts: renesas: r9a08g045: Add nodes for SDHI1 and SDHI2 Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 49/53] arm64: dts: renesas: r9a08g045: Add missing cache-level for L3 cache Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 50/53] arm64: dts: renesas: rzg3s-smarc-som: Spelling s/device-type/device_type/ Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 51/53] arm64: dts: renesas: rzg3s-smarc-som: Enable SDHI2 Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 52/53] arm64: dts: renesas: rzg3s-smarc: Enable SDHI1 Claudiu
2024-04-19  8:17 ` [PATCH 5.10.y-cip 53/53] arm64: defconfig: Enable RZ/G3S (R9A08G045) SoC Claudiu
2024-04-19 10:07 ` [PATCH 5.10.y-cip 00/53] Add initial support for the Renesas RZ/G3S SoC Pavel Machek
2024-04-19 11:28   ` claudiu beznea
2024-04-21 14:14 ` Pavel Machek
2024-04-22 20:38 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240419081742.3496709-36-claudiu.beznea.uj@bp.renesas.com \
    --to=claudiu.beznea@tuxon.dev \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.