pinctrl: renesas: Move drive strength configuration into sh_pfc_soc_operations
The upcoming Renesas R-Car Gen5 uses different mapping of bits in DRV control register, which is incompatible with existing DRV register bit mapping. Add .set_drive_strength callback into sh_pfc_soc_operations and call it from sh_pfc_pinconf_set(), to allow each SoC specific PFC driver to implement replacement .set_drive_strength. Make the current sh_pfc_pinconf_set_drive_strength() non-static, rename it with rcar_ prefix, and pass it as .set_drive_strength for existing PFC drivers. This is a preparatory patch for R-Car Gen5, no functional change. Signed-off-by: Hai Pham <hai.pham.ud@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> [Marek: Consistently use .set_drive_strength() and pass exisiting sh_pfc_pinconf_set_drive_strength() as its parameter for all PFC drivers. Rewrite commit message.]
This commit is contained in:
@@ -6186,6 +6186,7 @@ static const struct sh_pfc_soc_operations r8a7790_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a7790_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A7742
|
||||
|
||||
@@ -6936,6 +6936,7 @@ static const struct sh_pfc_soc_operations r8a7791_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a7791_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A7743
|
||||
|
||||
@@ -3145,6 +3145,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
|
||||
static const struct sh_pfc_soc_operations r8a7792_pfc_ops = {
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a7792_pinmux_info = {
|
||||
|
||||
@@ -5887,6 +5887,7 @@ static const struct sh_pfc_soc_operations r8a7794_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a7794_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A7745
|
||||
|
||||
@@ -6184,6 +6184,7 @@ static const struct sh_pfc_soc_operations r8a77951_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77951_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A774E1
|
||||
|
||||
@@ -6137,6 +6137,7 @@ static const struct sh_pfc_soc_operations r8a7796_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a7796_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A774A1
|
||||
|
||||
@@ -6378,6 +6378,7 @@ static const struct sh_pfc_soc_operations r8a77965_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77965_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A774B1
|
||||
|
||||
@@ -2567,6 +2567,7 @@ static const struct sh_pfc_soc_operations r8a77970_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77970_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a77970_pinmux_info = {
|
||||
|
||||
@@ -3084,6 +3084,7 @@ static const struct sh_pfc_soc_operations r8a77980_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77980_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a77980_pinmux_info = {
|
||||
|
||||
@@ -5336,6 +5336,7 @@ static const struct sh_pfc_soc_operations r8a77990_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77990_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL_PFC_R8A774C0
|
||||
|
||||
@@ -3210,6 +3210,7 @@ static const struct sh_pfc_soc_operations r8a77995_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a77995_pin_to_pocctrl,
|
||||
.get_bias = r8a77995_pinmux_get_bias,
|
||||
.set_bias = r8a77995_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a77995_pinmux_info = {
|
||||
|
||||
@@ -4382,6 +4382,7 @@ static const struct sh_pfc_soc_operations r8a779a0_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a779a0_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a779a0_pinmux_info = {
|
||||
|
||||
@@ -2094,6 +2094,7 @@ static const struct sh_pfc_soc_operations r8a779f0_pfc_ops = {
|
||||
.pin_to_pocctrl = r8a779f0_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a779f0_pinmux_info = {
|
||||
|
||||
@@ -4490,6 +4490,7 @@ static const struct sh_pfc_soc_operations r8a779g0_pin_ops = {
|
||||
.pin_to_pocctrl = r8a779g0_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a779g0_pinmux_info = {
|
||||
|
||||
@@ -4143,6 +4143,7 @@ static const struct sh_pfc_soc_operations r8a779h0_pin_ops = {
|
||||
.pin_to_pocctrl = r8a779h0_pin_to_pocctrl,
|
||||
.get_bias = rcar_pinmux_get_bias,
|
||||
.set_bias = rcar_pinmux_set_bias,
|
||||
.set_drive_strength = rcar_pinconf_set_drive_strength,
|
||||
};
|
||||
|
||||
const struct sh_pfc_soc_info r8a779h0_pinmux_info = {
|
||||
|
||||
@@ -743,8 +743,8 @@ sh_pfc_pinconf_find_drive_strength_reg(struct sh_pfc *pfc, unsigned int pin,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int sh_pfc_pinconf_set_drive_strength(struct sh_pfc *pfc,
|
||||
unsigned int pin, u16 strength)
|
||||
int rcar_pinconf_set_drive_strength(struct sh_pfc *pfc,
|
||||
unsigned int pin, u16 strength)
|
||||
{
|
||||
unsigned int offset;
|
||||
unsigned int size;
|
||||
@@ -831,7 +831,10 @@ static int sh_pfc_pinconf_set(struct sh_pfc_pinctrl *pmx, unsigned _pin,
|
||||
break;
|
||||
|
||||
case PIN_CONFIG_DRIVE_STRENGTH:
|
||||
ret = sh_pfc_pinconf_set_drive_strength(pfc, _pin, arg);
|
||||
if (!pfc->info->ops || !pfc->info->ops->set_drive_strength)
|
||||
return -ENOTSUPP;
|
||||
|
||||
ret = pfc->info->ops->set_drive_strength(pfc, _pin, arg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -245,6 +245,8 @@ struct sh_pfc_soc_operations {
|
||||
unsigned int bias);
|
||||
int (*pin_to_pocctrl)(unsigned int pin, u32 *pocctrl);
|
||||
int (*pin_to_portcr)(unsigned int pin);
|
||||
int (*set_drive_strength)(struct sh_pfc *pfc, unsigned int pin,
|
||||
u16 strength);
|
||||
};
|
||||
|
||||
struct sh_pfc_soc_info {
|
||||
@@ -741,5 +743,7 @@ rcar_pin_to_bias_reg(const struct sh_pfc_soc_info *info, unsigned int pin,
|
||||
unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin);
|
||||
void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
|
||||
unsigned int bias);
|
||||
int rcar_pinconf_set_drive_strength(struct sh_pfc *pfc,
|
||||
unsigned int pin, u16 strength);
|
||||
|
||||
#endif /* __SH_PFC_H */
|
||||
|
||||
Reference in New Issue
Block a user