summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-05-08 04:06:35 +0300
committerJoel Stanley <joel@jms.id.au>2018-05-11 13:48:01 +0300
commitbc4632fd353675dcf5c63ae8e1dd07c56eb2f079 (patch)
treec13189187aa2915bd9eab86a909b56cbd080bf61
parent468cbec6d2c91239332cb91b1f0a73aafcb6f0c6 (diff)
downloadlinux-bc4632fd353675dcf5c63ae8e1dd07c56eb2f079.tar.xz
gpio/aspeed: Set output latch before changing direction
In aspeed_gpio_dir_out(), we need to establish the new output value in the output latch *before* we change the direction to output in order to avoid a glitch on the output line if the previous value of the latch was different. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Christopher Bostic <cbostic@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r--drivers/gpio/gpio-aspeed.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 67f3eae3b550..ac54b9b25f74 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -287,11 +287,10 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,
spin_lock_irqsave(&gpio->lock, flags);
+ __aspeed_gpio_set(gc, offset, val);
reg = ioread32(bank_val_reg(gpio, bank, GPIO_DIR));
iowrite32(reg | GPIO_BIT(offset), bank_val_reg(gpio, bank, GPIO_DIR));
- __aspeed_gpio_set(gc, offset, val);
-
spin_unlock_irqrestore(&gpio->lock, flags);
return 0;