]> git.baikalelectronics.ru Git - uboot.git/commitdiff
dm: gpio: da8xx_gpio: Add support for GPIO_ACTIVE_LOW/HIGH
authorAdam Ford <aford173@gmail.com>
Fri, 17 Aug 2018 04:21:57 +0000 (23:21 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 12 Sep 2018 01:38:00 +0000 (21:38 -0400)
With DM and device tree support, let's use the GPIO_ACTIVE_HIGH
and GPIO_ACTIVE_LOW from the device tree as they are intended.

Signed-off-by: Adam Ford <aford173@gmail.com>
drivers/gpio/da8xx_gpio.c

index 3e95f039f0613968a434abbd40caf381cdf18aa4..b0d49cb46f0422e99a747e59f5c064548afd9cb6 100644 (file)
@@ -493,12 +493,25 @@ static int davinci_gpio_get_function(struct udevice *dev, unsigned int offset)
        return GPIOF_OUTPUT;
 }
 
+static int davinci_gpio_xlate(struct udevice *dev, struct gpio_desc *desc,
+                             struct ofnode_phandle_args *args)
+{
+       desc->offset = args->args[0];
+
+       if (args->args[1] & GPIO_ACTIVE_LOW)
+               desc->flags = GPIOD_ACTIVE_LOW;
+       else
+               desc->flags = 0;
+       return 0;
+}
+
 static const struct dm_gpio_ops gpio_davinci_ops = {
        .direction_input        = davinci_gpio_direction_input,
        .direction_output       = davinci_gpio_direction_output,
        .get_value              = davinci_gpio_get_value,
        .set_value              = davinci_gpio_set_value,
        .get_function           = davinci_gpio_get_function,
+       .xlate                  = davinci_gpio_xlate,
 };
 
 static int davinci_gpio_probe(struct udevice *dev)