Merge tag 'efi-2020-01-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / drivers / gpio / gpio-rcar.c
index ddedbe6c0e3900699147eefc404c7817f7e869fb..594e0a470a99c92f9b912e61a4dd6e591337d917 100644 (file)
@@ -1,12 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2017 Marek Vasut <marek.vasut@gmail.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <dm/pinctrl.h>
 #include <errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -118,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,
@@ -174,8 +172,11 @@ static int rcar_gpio_probe(struct udevice *dev)
 static const struct udevice_id rcar_gpio_ids[] = {
        { .compatible = "renesas,gpio-r8a7795" },
        { .compatible = "renesas,gpio-r8a7796" },
+       { .compatible = "renesas,gpio-r8a77965" },
        { .compatible = "renesas,gpio-r8a77970" },
+       { .compatible = "renesas,gpio-r8a77990" },
        { .compatible = "renesas,gpio-r8a77995" },
+       { .compatible = "renesas,rcar-gen2-gpio" },
        { .compatible = "renesas,rcar-gen3-gpio" },
        { /* sentinel */ }
 };