]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: vf610: set value before the direction to avoid a glitch
authorHaibo Chen <haibo.chen@nxp.com>
Wed, 18 Oct 2023 09:00:17 +0000 (11:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 09:13:33 +0000 (11:13 +0200)
commit fc363413ef8ea842ae7a99e3caf5465dafdd3a49 upstream.

We found a glitch when configuring the pad as output high. To avoid this
glitch, move the data value setting before direction config in the
function vf610_gpio_direction_output().

Fixes: 659d8a62311f ("gpio: vf610: add imx7ulp support")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
[Bartosz: tweak the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpio-vf610.c

index 457ee42023f41e05b382cc02cf1d62361d4a177e..6c8aafec069cadb223ed6c555e7cd9ec2259f459 100644 (file)
@@ -137,14 +137,14 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
        unsigned long mask = BIT(gpio);
        u32 val;
 
+       vf610_gpio_set(chip, gpio, value);
+
        if (port->sdata && port->sdata->have_paddr) {
                val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
                val |= mask;
                vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
        }
 
-       vf610_gpio_set(chip, gpio, value);
-
        return pinctrl_gpio_direction_output(chip->base + gpio);
 }