]> git.sur5r.net Git - u-boot/blobdiff - drivers/gpio/mvebu_gpio.c
gpio: atmel_pio4: give a full configuration when muxing pins
[u-boot] / drivers / gpio / mvebu_gpio.c
index 9564ce2b13ea9f313f006d5e6a5448fad36bbd76..e8b1c5965cb4d281af54f707d6cc6b774e924696 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Stefan Roese <sr@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -10,8 +9,6 @@
 #include <asm/io.h>
 #include <errno.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define MVEBU_GPIOS_PER_BANK   32
 
 struct mvebu_gpio_regs {
@@ -43,6 +40,10 @@ static int mvebu_gpio_direction_output(struct udevice *dev, unsigned gpio,
        struct mvebu_gpio_priv *priv = dev_get_priv(dev);
        struct mvebu_gpio_regs *regs = priv->regs;
 
+       if (value)
+               setbits_le32(&regs->data_out, BIT(gpio));
+       else
+               clrbits_le32(&regs->data_out, BIT(gpio));
        clrbits_le32(&regs->io_conf, BIT(gpio));
 
        return 0;
@@ -88,7 +89,7 @@ static int mvebu_gpio_probe(struct udevice *dev)
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
        struct mvebu_gpio_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct mvebu_gpio_regs *)dev_get_addr(dev);
+       priv->regs = (struct mvebu_gpio_regs *)devfdt_get_addr(dev);
        uc_priv->gpio_count = MVEBU_GPIOS_PER_BANK;
        priv->name[0] = 'A' + dev->req_seq;
        uc_priv->bank_name = priv->name;