Merge tag 'u-boot-stm32-20211110' of https://source.denx.de/u-boot/custodians/u-boot-stm
[platform/kernel/u-boot.git] / drivers / gpio / stm32_gpio.c
index c2d7046..8667ed3 100644 (file)
@@ -11,7 +11,6 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <log.h>
-#include <asm/arch/gpio.h>
 #include <asm/arch/stm32.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -20,6 +19,8 @@
 #include <linux/errno.h>
 #include <linux/io.h>
 
+#include "stm32_gpio_priv.h"
+
 #define STM32_GPIOS_PER_BANK           16
 
 #define MODE_BITS(gpio_pin)            ((gpio_pin) * 2)
@@ -203,12 +204,13 @@ static int stm32_gpio_set_flags(struct udevice *dev, unsigned int offset,
                return idx;
 
        if (flags & GPIOD_IS_OUT) {
-               int value = GPIOD_FLAGS_OUTPUT(flags);
+               bool value = flags & GPIOD_IS_OUT_ACTIVE;
 
                if (flags & GPIOD_OPEN_DRAIN)
                        stm32_gpio_set_otype(regs, idx, STM32_GPIO_OTYPE_OD);
                else
                        stm32_gpio_set_otype(regs, idx, STM32_GPIO_OTYPE_PP);
+
                stm32_gpio_set_moder(regs, idx, STM32_GPIO_MODE_OUT);
                writel(BSRR_BIT(idx, value), &regs->bsrr);