From: Marek Vasut Date: Sun, 21 Apr 2019 20:46:25 +0000 (+0200) Subject: gpio: renesas: Migrate to pinctrl GPIO accessors X-Git-Tag: v2019.07-rc2~18^2~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fbf26bea3964735604f1621288a63b23daf48cea;p=oweals%2Fu-boot.git gpio: renesas: Migrate to pinctrl GPIO accessors Switch to generic pin controller API for configuring pins as GPIOs instead of using the ad-hoc call into the R-Car PFC driver. Moreover, add .free() implementation for the GPIO controller. Signed-off-by: Marek Vasut Cc: Alex Kiernan Cc: Christoph Muellner Cc: Eugeniu Rosca Cc: Patrice Chotard Cc: Patrick DELAUNAY Cc: Philipp Tomsich Cc: Simon Glass --- diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 6fd1270640..594e0a470a 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -117,19 +118,17 @@ static int rcar_gpio_get_function(struct udevice *dev, unsigned offset) static int rcar_gpio_request(struct udevice *dev, unsigned offset, const char *label) { - struct rcar_gpio_priv *priv = dev_get_priv(dev); - struct udevice *pctldev; - int ret; - - ret = uclass_get_device(UCLASS_PINCTRL, 0, &pctldev); - if (ret) - return ret; + return pinctrl_gpio_request(dev, offset); +} - return sh_pfc_config_mux_for_gpio(pctldev, priv->pfc_offset + offset); +static int rcar_gpio_free(struct udevice *dev, unsigned offset) +{ + return pinctrl_gpio_free(dev, offset); } static const struct dm_gpio_ops rcar_gpio_ops = { .request = rcar_gpio_request, + .free = rcar_gpio_free, .direction_input = rcar_gpio_direction_input, .direction_output = rcar_gpio_direction_output, .get_value = rcar_gpio_get_value,