net: sun8i_emac: Use consistent clock bitfield definitions
[oweals/u-boot.git] / drivers / gpio / spear_gpio.c
index 367b6701663470db932371daf07d14dc23e508ff..4e4cd125457dcb930a346d9f59d2b3c10173f33e 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2012 Stefan Roese <sr@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -9,6 +8,7 @@
  */
 
 #include <common.h>
+#include <malloc.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -36,7 +36,10 @@ int gpio_set_value(unsigned gpio, int value)
 {
        struct gpio_regs *regs = (struct gpio_regs *)CONFIG_GPIO_BASE;
 
-       writel(1 << gpio, &regs->gpiodata[DATA_REG_ADDR(gpio)]);
+       if (value)
+               writel(1 << gpio, &regs->gpiodata[DATA_REG_ADDR(gpio)]);
+       else
+               writel(0, &regs->gpiodata[DATA_REG_ADDR(gpio)]);
 
        return 0;
 }