gpio: renesas: Migrate to pinctrl GPIO accessors
authorMarek Vasut <[email protected]>
Sun, 21 Apr 2019 20:46:25 +0000 (22:46 +0200)
committerMarek Vasut <[email protected]>
Sat, 4 May 2019 17:26:49 +0000 (19:26 +0200)
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 <[email protected]>
Cc: Alex Kiernan <[email protected]>
Cc: Christoph Muellner <[email protected]>
Cc: Eugeniu Rosca <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick DELAUNAY <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Simon Glass <[email protected]>
drivers/gpio/gpio-rcar.c

index 6fd127064050a07559649390c5ab140f11f8ff25..594e0a470a99c92f9b912e61a4dd6e591337d917 100644 (file)
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <dm/pinctrl.h>
 #include <errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -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,