From: Benjamin Herrenschmidt Date: Thu, 17 May 2018 08:11:56 +0000 (+1000) Subject: gpio: aspeed: Set output latch before changing direction X-Git-Tag: v4.19~849^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af7949284910a1f0b7814625051b8acf99af74d2;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Christopher Bostic Reviewed-by: Andrew Jeffery Tested-by: Joel Stanley Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 77e485557498..f210bed83dd6 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;