Skip to content

Commit

Permalink
mxs_gpio: fix the handling in gpio_direction_output()
Browse files Browse the repository at this point in the history
Setting the direction and an output value should be done by
1) set the desired output value,
2) switch to output.

If this is done in the inverse order, there can be a glitch on
the GPIO line.

This patch fixes this by using the order as described above.

Signed-off-by: Michael Heimpold <[email protected]>
Acked-by: Stefano Babic <[email protected]>
  • Loading branch information
mhei authored and sbabic committed Nov 13, 2013
1 parent 85164e0 commit ac135f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/mxs_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ int gpio_direction_output(unsigned gpio, int value)
struct mxs_register_32 *reg =
(struct mxs_register_32 *)(MXS_PINCTRL_BASE + offset);

writel(1 << PAD_PIN(gpio), &reg->reg_set);

gpio_set_value(gpio, value);

writel(1 << PAD_PIN(gpio), &reg->reg_set);

return 0;
}

Expand Down

0 comments on commit ac135f6

Please sign in to comment.