Skip to content

Commit

Permalink
gpio: gpio-vf610: do not touch other bits when set the target bit
Browse files Browse the repository at this point in the history
For gpio controller contain register PDDR, when set one target bit,
current logic will clear all other bits, this is wrong. Use operator
'|=' to fix it.

Fixes: 659d8a6 ("gpio: vf610: add imx7ulp support")
Reviewed-by: Peng Fan <[email protected]>
Signed-off-by: Haibo Chen <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
  • Loading branch information
Haibo Chen authored and brgl committed May 20, 2022
1 parent 42226c9 commit 9bf3ac4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpio/gpio-vf610.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
{
struct vf610_gpio_port *port = gpiochip_get_data(chip);
unsigned long mask = BIT(gpio);
u32 val;

if (port->sdata && port->sdata->have_paddr)
vf610_gpio_writel(mask, port->gpio_base + GPIO_PDDR);
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);

Expand Down

0 comments on commit 9bf3ac4

Please sign in to comment.