Skip to content

Commit 7d566a4

Browse files
prabhakarladgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Add function pointers for OEN register access
Introduce function pointers oen_read() and oen_write(), in the struct rzg2l_pinctrl_data to facilitate reading and writing to the PFC_OEN register. On the RZ/V2H(P) SoC, unlocking the PWPR.REGWE_B bit before writing to the PFC_OEN register is necessary, and the PFC_OEN register has more bits compared to the RZ/G2L family. To handle these differences between RZ/G2L and RZ/V2H(P) and to reuse the existing code for RZ/V2H(P), these function pointers are introduced. Additionally, populate these function pointers with appropriate data for existing SoCs. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> # on RZ/G3S Link: https://lore.kernel.org/r/20240530173857.164073-10-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent ede014c commit 7d566a4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ struct rzg2l_pinctrl_data {
255255
unsigned int n_variable_pin_cfg;
256256
void (*pwpr_pfc_lock_unlock)(struct rzg2l_pinctrl *pctrl, bool lock);
257257
void (*pmc_writeb)(struct rzg2l_pinctrl *pctrl, u8 val, u16 offset);
258+
u32 (*oen_read)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin);
259+
int (*oen_write)(struct rzg2l_pinctrl *pctrl, u32 caps, u32 offset, u8 pin, u8 oen);
258260
};
259261

260262
/**
@@ -1035,7 +1037,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
10351037
break;
10361038

10371039
case PIN_CONFIG_OUTPUT_ENABLE:
1038-
arg = rzg2l_read_oen(pctrl, cfg, _pin, bit);
1040+
arg = pctrl->data->oen_read(pctrl, cfg, _pin, bit);
10391041
if (!arg)
10401042
return -EINVAL;
10411043
break;
@@ -1144,7 +1146,7 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
11441146

11451147
case PIN_CONFIG_OUTPUT_ENABLE:
11461148
arg = pinconf_to_config_argument(_configs[i]);
1147-
ret = rzg2l_write_oen(pctrl, cfg, _pin, bit, !!arg);
1149+
ret = pctrl->data->oen_write(pctrl, cfg, _pin, bit, !!arg);
11481150
if (ret)
11491151
return ret;
11501152
break;
@@ -2623,6 +2625,8 @@ static struct rzg2l_pinctrl_data r9a07g043_data = {
26232625
#endif
26242626
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
26252627
.pmc_writeb = &rzg2l_pmc_writeb,
2628+
.oen_read = &rzg2l_read_oen,
2629+
.oen_write = &rzg2l_write_oen,
26262630
};
26272631

26282632
static struct rzg2l_pinctrl_data r9a07g044_data = {
@@ -2636,6 +2640,8 @@ static struct rzg2l_pinctrl_data r9a07g044_data = {
26362640
.hwcfg = &rzg2l_hwcfg,
26372641
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
26382642
.pmc_writeb = &rzg2l_pmc_writeb,
2643+
.oen_read = &rzg2l_read_oen,
2644+
.oen_write = &rzg2l_write_oen,
26392645
};
26402646

26412647
static struct rzg2l_pinctrl_data r9a08g045_data = {
@@ -2648,6 +2654,8 @@ static struct rzg2l_pinctrl_data r9a08g045_data = {
26482654
.hwcfg = &rzg3s_hwcfg,
26492655
.pwpr_pfc_lock_unlock = &rzg2l_pwpr_pfc_lock_unlock,
26502656
.pmc_writeb = &rzg2l_pmc_writeb,
2657+
.oen_read = &rzg2l_read_oen,
2658+
.oen_write = &rzg2l_write_oen,
26512659
};
26522660

26532661
static const struct of_device_id rzg2l_pinctrl_of_table[] = {

0 commit comments

Comments
 (0)