summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/renesas/pinctrl.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2021-12-23 15:56:18 +0100
committerGeert Uytterhoeven <geert+renesas@glider.be>2022-02-22 09:57:18 +0100
commitceb8d2acbb2a9dd98baaaff1a9e237dcaeeb44c5 (patch)
treed33faf481ac64f3599cf2049c841efbf8fb0991e /drivers/pinctrl/renesas/pinctrl.c
parentb67fc1c66732ff08380ea8a4abb3d061ac097d35 (diff)
downloadlwn-ceb8d2acbb2a9dd98baaaff1a9e237dcaeeb44c5.tar.gz
lwn-ceb8d2acbb2a9dd98baaaff1a9e237dcaeeb44c5.zip
pinctrl: renesas: Factor out .pin_to_portcr() address handling
All implementations of the .pin_to_portcr() method implement the same conversion from Port Control Register offset to virtual address. Factor it out into the two callers. Remove the pfc parameter, as it is no longer used. Note that the failure handling in r8a7740_pin_to_portcr() is pro forma, as the function is never called with an invalid pin number. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/a485d4986a17259256988eb14e3a4c2b8d61c303.1640270559.git.geert+renesas@glider.be
Diffstat (limited to 'drivers/pinctrl/renesas/pinctrl.c')
-rw-r--r--drivers/pinctrl/renesas/pinctrl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pinctrl/renesas/pinctrl.c b/drivers/pinctrl/renesas/pinctrl.c
index 0bdfc1ab3608..3e4a67c67591 100644
--- a/drivers/pinctrl/renesas/pinctrl.c
+++ b/drivers/pinctrl/renesas/pinctrl.c
@@ -919,7 +919,8 @@ void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
{
- void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin);
+ void __iomem *reg = pfc->windows->virt +
+ pfc->info->ops->pin_to_portcr(pin);
u32 value = ioread8(reg) & PORTnCR_PULMD_MASK;
switch (value) {
@@ -936,7 +937,8 @@ unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
void rmobile_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
unsigned int bias)
{
- void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin);
+ void __iomem *reg = pfc->windows->virt +
+ pfc->info->ops->pin_to_portcr(pin);
u32 value = ioread8(reg) & ~PORTnCR_PULMD_MASK;
switch (bias) {