diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-07-30 10:02:53 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2018-08-07 11:03:43 +0200 |
commit | bf2a69de81908f36a5853b36cc2afbd976856e3b (patch) | |
tree | 9d047cbd26f16b48f9b13f654a819efcaa92268d | |
parent | 6f81ff04224bd25827fd74b0f0529d62b597e741 (diff) | |
download | u-boot-bf2a69de81908f36a5853b36cc2afbd976856e3b.zip u-boot-bf2a69de81908f36a5853b36cc2afbd976856e3b.tar.gz u-boot-bf2a69de81908f36a5853b36cc2afbd976856e3b.tar.bz2 |
gpio: xilinx: Set value before changing direction
Set a value before changing gpio direction. This will ensure that the
old value is not propagated when direction has changed but new value is
not written yet.
Reported-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
-rw-r--r-- | drivers/gpio/xilinx_gpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 776a147..1e5f3da 100644 --- a/drivers/gpio/xilinx_gpio.c +++ b/drivers/gpio/xilinx_gpio.c @@ -139,14 +139,14 @@ static int xilinx_gpio_direction_output(struct udevice *dev, unsigned offset, if (platdata->bank_input[bank]) return -EINVAL; + xilinx_gpio_set_value(dev, offset, value); + if (!platdata->bank_output[bank]) { val = readl(&platdata->regs->gpiodir + bank * 2); val = val & ~(1 << pin); writel(val, &platdata->regs->gpiodir + bank * 2); } - xilinx_gpio_set_value(dev, offset, value); - return 0; } |