diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2022-11-09 16:33:04 +0300 |
---|---|---|
committer | Geert Uytterhoeven <geert+renesas@glider.be> | 2022-11-17 22:34:51 +0300 |
commit | 80d34260f36c6c55f03c3c33be4a11ec06202e98 (patch) | |
tree | 9ca81b09e57a5fd93bf63c5d675a4f700e01ff72 /drivers | |
parent | 41a87e789c7c2cdeb302331043f866c0138f0413 (diff) | |
download | linux-80d34260f36c6c55f03c3c33be4a11ec06202e98.tar.xz |
pinctrl: renesas: gpio: Use dynamic GPIO base if no function GPIOs
Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using
static gpiobase allocation") in gpio/for-next, one or more warnings are
printed during boot on systems where the pin controller also provides
GPIO functionality:
gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
Fix this for ARM-based SH/R-Mobile SoCs by:
1. Taking into account a non-zero GPIO base in the various GPIO chip
callbacks,
2. Switching to dynamic allocation of the GPIO base when support for
legacy function GPIOs is not enabled.
On SuperH SoCs using legacy function GPIOs, the GPIO bases of the GPIO
controller and the GPIO function controller must not be changed, as all
board files rely on the fixed GPIO_* and GPIO_FN_* definitions provided
by the various <cpu/sh*.h> header files.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/df2cf30ac4c3cbee726799f32b727c1ebe62819c.1668000684.git.geert+renesas@glider.be
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/renesas/gpio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c index ea3d38b4af8d..5758daf94fe2 100644 --- a/drivers/pinctrl/renesas/gpio.c +++ b/drivers/pinctrl/renesas/gpio.c @@ -135,12 +135,12 @@ static int gpio_pin_request(struct gpio_chip *gc, unsigned offset) if (idx < 0 || pfc->info->pins[idx].enum_id == 0) return -EINVAL; - return pinctrl_gpio_request(offset); + return pinctrl_gpio_request(gc->base + offset); } static void gpio_pin_free(struct gpio_chip *gc, unsigned offset) { - return pinctrl_gpio_free(offset); + return pinctrl_gpio_free(gc->base + offset); } static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset, @@ -164,7 +164,7 @@ static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset, static int gpio_pin_direction_input(struct gpio_chip *gc, unsigned offset) { - return pinctrl_gpio_direction_input(offset); + return pinctrl_gpio_direction_input(gc->base + offset); } static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset, @@ -172,7 +172,7 @@ static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset, { gpio_pin_set_value(gpiochip_get_data(gc), offset, value); - return pinctrl_gpio_direction_output(offset); + return pinctrl_gpio_direction_output(gc->base + offset); } static int gpio_pin_get(struct gpio_chip *gc, unsigned offset) @@ -238,7 +238,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip) gc->label = pfc->info->name; gc->parent = pfc->dev; gc->owner = THIS_MODULE; - gc->base = 0; + gc->base = IS_ENABLED(CONFIG_PINCTRL_SH_FUNC_GPIO) ? 0 : -1; gc->ngpio = pfc->nr_gpio_pins; return 0; |