pinctrl: meson: Fix GPIO direction registers access
authorCarlo Caione <ccaione@baylibre.com>
Mon, 3 Dec 2018 18:00:42 +0000 (18:00 +0000)
committerNeil Armstrong <narmstrong@baylibre.com>
Wed, 5 Dec 2018 09:39:17 +0000 (10:39 +0100)
The macros used to set the direction of the GPIO pins are misused,
resulting in a wrong behavior when trying to read the GPIO input level
from U-Boot.

A better macro is also used when setting the output direction.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
drivers/pinctrl/meson/pinctrl-meson.c

index 0bd6152803d7f53719eb2ba0cd4ce156106f1561..b539749752c8420659870b6bd23c093fb9a85777 100644 (file)
@@ -136,7 +136,7 @@ int meson_gpio_direction_input(struct udevice *dev, unsigned int offset)
        if (ret)
                return ret;
 
-       clrsetbits_le32(priv->reg_gpio + reg, BIT(bit), 1);
+       setbits_le32(priv->reg_gpio + reg, BIT(bit));
 
        return 0;
 }
@@ -152,7 +152,7 @@ int meson_gpio_direction_output(struct udevice *dev,
        if (ret)
                return ret;
 
-       clrsetbits_le32(priv->reg_gpio + reg, BIT(bit), 0);
+       clrbits_le32(priv->reg_gpio + reg, BIT(bit));
 
        ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_OUT, &reg, &bit);
        if (ret)