diff options
Diffstat (limited to 'drivers/pinctrl/sh-pfc/gpio.c')
-rw-r--r-- | drivers/pinctrl/sh-pfc/gpio.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index 5d3a35ce0912..ba353735ecf2 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c | |||
@@ -62,7 +62,8 @@ static void gpio_get_data_reg(struct sh_pfc_chip *chip, unsigned int offset, | |||
62 | static u32 gpio_read_data_reg(struct sh_pfc_chip *chip, | 62 | static u32 gpio_read_data_reg(struct sh_pfc_chip *chip, |
63 | const struct pinmux_data_reg *dreg) | 63 | const struct pinmux_data_reg *dreg) |
64 | { | 64 | { |
65 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; | 65 | phys_addr_t address = dreg->reg; |
66 | void __iomem *mem = address - chip->mem->phys + chip->mem->virt; | ||
66 | 67 | ||
67 | return sh_pfc_read_raw_reg(mem, dreg->reg_width); | 68 | return sh_pfc_read_raw_reg(mem, dreg->reg_width); |
68 | } | 69 | } |
@@ -70,7 +71,8 @@ static u32 gpio_read_data_reg(struct sh_pfc_chip *chip, | |||
70 | static void gpio_write_data_reg(struct sh_pfc_chip *chip, | 71 | static void gpio_write_data_reg(struct sh_pfc_chip *chip, |
71 | const struct pinmux_data_reg *dreg, u32 value) | 72 | const struct pinmux_data_reg *dreg, u32 value) |
72 | { | 73 | { |
73 | void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt; | 74 | phys_addr_t address = dreg->reg; |
75 | void __iomem *mem = address - chip->mem->phys + chip->mem->virt; | ||
74 | 76 | ||
75 | sh_pfc_write_raw_reg(mem, dreg->reg_width, value); | 77 | sh_pfc_write_raw_reg(mem, dreg->reg_width, value); |
76 | } | 78 | } |
@@ -340,6 +342,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *), | |||
340 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | 342 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) |
341 | { | 343 | { |
342 | struct sh_pfc_chip *chip; | 344 | struct sh_pfc_chip *chip; |
345 | phys_addr_t address; | ||
343 | unsigned int i; | 346 | unsigned int i; |
344 | int ret; | 347 | int ret; |
345 | 348 | ||
@@ -351,11 +354,12 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | |||
351 | * that covers the data registers. In that case don't try to handle | 354 | * that covers the data registers. In that case don't try to handle |
352 | * GPIOs. | 355 | * GPIOs. |
353 | */ | 356 | */ |
357 | address = pfc->info->data_regs[0].reg; | ||
354 | for (i = 0; i < pfc->num_windows; ++i) { | 358 | for (i = 0; i < pfc->num_windows; ++i) { |
355 | struct sh_pfc_window *window = &pfc->windows[i]; | 359 | struct sh_pfc_window *window = &pfc->windows[i]; |
356 | 360 | ||
357 | if (pfc->info->data_regs[0].reg >= window->phys && | 361 | if (address >= window->phys && |
358 | pfc->info->data_regs[0].reg < window->phys + window->size) | 362 | address < window->phys + window->size) |
359 | break; | 363 | break; |
360 | } | 364 | } |
361 | 365 | ||