Skip to content

Commit 07dd08c

Browse files
pbrkrgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Clarify OEN read/write support
We currently support OEN read/write for the RZ/G3S SoC but not the RZ/G2L SoC family (consisting of RZ/G2L, RZ/G2LC, RZ/G2UL, RZ/V2L & RZ/Five). The appropriate functions are renamed to clarify this and to match the callback names. We should also only set the oen_read and oen_write function pointers for the devices which support these operations. This requires us to check that these function pointers are valid before calling them. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20240625200316.4282-2-paul.barker.ct@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 71062e5 commit 07dd08c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ static bool rzg2l_ds_is_supported(struct rzg2l_pinctrl *pctrl, u32 caps,
999999
return false;
10001000
}
10011001

1002-
static bool rzg2l_oen_is_supported(u32 caps, u8 pin, u8 max_pin)
1002+
static bool rzg3s_oen_is_supported(u32 caps, u8 pin, u8 max_pin)
10031003
{
10041004
if (!(caps & PIN_CFG_OEN))
10051005
return false;
@@ -1010,7 +1010,7 @@ static bool rzg2l_oen_is_supported(u32 caps, u8 pin, u8 max_pin)
10101010
return true;
10111011
}
10121012

1013-
static u8 rzg2l_pin_to_oen_bit(u32 offset, u8 pin, u8 max_port)
1013+
static u8 rzg3s_pin_to_oen_bit(u32 offset, u8 pin, u8 max_port)
10141014
{
10151015
if (pin)
10161016
pin *= 2;
@@ -1021,31 +1021,31 @@ static u8 rzg2l_pin_to_oen_bit(u32 offset, u8 pin, u8 max_port)
10211021
return pin;
10221022
}
10231023

1024-
static u32 rzg2l_read_oen(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin)
1024+
static u32 rzg3s_oen_read(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin)
10251025
{
10261026
u8 max_port = pctrl->data->hwcfg->oen_max_port;
10271027
u8 max_pin = pctrl->data->hwcfg->oen_max_pin;
10281028
u8 bit;
10291029

1030-
if (!rzg2l_oen_is_supported(caps, pin, max_pin))
1030+
if (!rzg3s_oen_is_supported(caps, pin, max_pin))
10311031
return 0;
10321032

1033-
bit = rzg2l_pin_to_oen_bit(offset, pin, max_port);
1033+
bit = rzg3s_pin_to_oen_bit(offset, pin, max_port);
10341034

10351035
return !(readb(pctrl->base + ETH_MODE) & BIT(bit));
10361036
}
10371037

1038-
static int rzg2l_write_oen(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen)
1038+
static int rzg3s_oen_write(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen)
10391039
{
10401040
u8 max_port = pctrl->data->hwcfg->oen_max_port;
10411041
u8 max_pin = pctrl->data->hwcfg->oen_max_pin;
10421042
unsigned long flags;
10431043
u8 val, bit;
10441044

1045-
if (!rzg2l_oen_is_supported(caps, pin, max_pin))
1045+
if (!rzg3s_oen_is_supported(caps, pin, max_pin))
10461046
return -EINVAL;
10471047

1048-
bit = rzg2l_pin_to_oen_bit(offset, pin, max_port);
1048+
bit = rzg3s_pin_to_oen_bit(offset, pin, max_port);
10491049

10501050
spin_lock_irqsave(&pctrl->lock, flags);
10511051
val = readb(pctrl->base + ETH_MODE);
@@ -1220,6 +1220,8 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
12201220
break;
12211221

12221222
case PIN_CONFIG_OUTPUT_ENABLE:
1223+
if (!pctrl->data->oen_read)
1224+
return -EOPNOTSUPP;
12231225
arg = pctrl->data->oen_read(pctrl, cfg, _pin, bit);
12241226
if (!arg)
12251227
return -EINVAL;
@@ -1359,6 +1361,8 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
13591361

13601362
case PIN_CONFIG_OUTPUT_ENABLE:
13611363
arg = pinconf_to_config_argument(_configs[i]);
1364+
if (!pctrl->data->oen_write)
1365+
return -EOPNOTSUPP;
13621366
ret = pctrl->data->oen_write(pctrl, cfg, _pin, bit, !!arg);
13631367
if (ret)
13641368
return ret;
@@ -3070,8 +3074,6 @@ static struct rzg2l_pinctrl_data r9a07g043_data = {
30703074
#endif
30713075
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
30723076
.pmc_writeb = &rzg2l_pmc_writeb,
3073-
.oen_read = &rzg2l_read_oen,
3074-
.oen_write = &rzg2l_write_oen,
30753077
.hw_to_bias_param = &rzg2l_hw_to_bias_param,
30763078
.bias_param_to_hw = &rzg2l_bias_param_to_hw,
30773079
};
@@ -3087,8 +3089,6 @@ static struct rzg2l_pinctrl_data r9a07g044_data = {
30873089
.hwcfg = &rzg2l_hwcfg,
30883090
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
30893091
.pmc_writeb = &rzg2l_pmc_writeb,
3090-
.oen_read = &rzg2l_read_oen,
3091-
.oen_write = &rzg2l_write_oen,
30923092
.hw_to_bias_param = &rzg2l_hw_to_bias_param,
30933093
.bias_param_to_hw = &rzg2l_bias_param_to_hw,
30943094
};
@@ -3103,8 +3103,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = {
31033103
.hwcfg = &rzg3s_hwcfg,
31043104
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
31053105
.pmc_writeb = &rzg2l_pmc_writeb,
3106-
.oen_read = &rzg2l_read_oen,
3107-
.oen_write = &rzg2l_write_oen,
3106+
.oen_read = &rzg3s_oen_read,
3107+
.oen_write = &rzg3s_oen_write,
31083108
.hw_to_bias_param = &rzg2l_hw_to_bias_param,
31093109
.bias_param_to_hw = &rzg2l_bias_param_to_hw,
31103110
};

0 commit comments

Comments
 (0)