Skip to content

Commit 35a3610

Browse files
claudiubezneageertu
authored andcommitted
pinctrl: renesas: rzg2l: Adapt function number for RZ/G3S
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>
1 parent 1f89aa9 commit 35a3610

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ struct rzg2l_register_offsets {
136136
/**
137137
* struct rzg2l_hwcfg - hardware configuration data structure
138138
* @regs: hardware specific register offsets
139+
* @func_base: base number for port function (see register PFC)
139140
*/
140141
struct rzg2l_hwcfg {
141142
const struct rzg2l_register_offsets regs;
143+
u8 func_base;
142144
};
143145

144146
struct rzg2l_dedicated_configs {
@@ -221,6 +223,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
221223
unsigned int group_selector)
222224
{
223225
struct rzg2l_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
226+
const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg;
224227
struct function_desc *func;
225228
unsigned int i, *psel_val;
226229
struct group_desc *group;
@@ -242,9 +245,9 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
242245
u32 pin = RZG2L_PIN_ID_TO_PIN(pins[i]);
243246

244247
dev_dbg(pctrl->dev, "port:%u pin: %u off:%x PSEL:%u\n",
245-
RZG2L_PIN_ID_TO_PORT(pins[i]), pin, off, psel_val[i]);
248+
RZG2L_PIN_ID_TO_PORT(pins[i]), pin, off, psel_val[i] - hwcfg->func_base);
246249

247-
rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i]);
250+
rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i] - hwcfg->func_base);
248251
}
249252

250253
return 0;

0 commit comments

Comments
 (0)