Message ID | 0a76e524a79cfd177361be0f6e9a2b8903812c4b.1532954043.git.michal.simek@xilinx.com |
---|---|
State | Accepted |
Commit | bf2a69de81908f36a5853b36cc2afbd976856e3b |
Delegated to: | Michal Simek |
Headers | show |
Series | [U-Boot,1/4] gpio: xilinx: Find out bank before use in xilinx_gpio_get_function() | expand |
Am 30.07.2018 um 14:34 schrieb Michal Simek: > 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> > --- > > drivers/gpio/xilinx_gpio.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c > index 776a147cc8d7..1e5f3da8d7e8 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; > } > Reviewed-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 776a147cc8d7..1e5f3da8d7e8 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; }
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> --- drivers/gpio/xilinx_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)