Skip to content

Commit

Permalink
gpio: vf610: set value before the direction to avoid a glitch
Browse files Browse the repository at this point in the history
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: 659d8a6 ("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>
  • Loading branch information
Haibo Chen authored and Bartosz Golaszewski committed Oct 18, 2023
1 parent 4302326 commit fc36341
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-vf610.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,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);
}

Expand Down

0 comments on commit fc36341

Please sign in to comment.