]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gpio: aspeed: Fix incorrect offset of read back register.
authorBilly Tsai <billy_tsai@aspeedtech.com>
Wed, 13 Apr 2022 05:34:51 +0000 (13:34 +0800)
committerTom Rini <trini@konsulko.com>
Tue, 19 Apr 2022 18:51:11 +0000 (14:51 -0400)
The offset of the current read back register is the value of the gpio pin,
not the value written for the gpio output.
This patch fix it to avoid the other gpio output value controlled by the
same register being set incorrectly.

Fixes: 7ad889b0f37a ("gpio: Add Aspeed GPIO driver")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
drivers/gpio/gpio-aspeed.c

index a8a2afcb5c85c46250fcefc877658965ef3024a9..2c5415c671d10518846862a1006df0f583e2f5a6 100644 (file)
@@ -211,7 +211,7 @@ static int aspeed_gpio_direction_output(struct udevice *dev, unsigned int offset
        struct aspeed_gpio_priv *priv = dev_get_priv(dev);
        const struct aspeed_gpio_bank *bank = to_bank(offset);
        u32 dir = readl(bank_reg(priv, bank, reg_dir));
-       u32 output = readl(bank_reg(priv, bank, reg_val));
+       u32 output = readl(bank_reg(priv, bank, reg_rdata));
 
        dir |= GPIO_BIT(offset);
        writel(dir, bank_reg(priv, bank, reg_dir));
@@ -239,7 +239,7 @@ aspeed_gpio_set_value(struct udevice *dev, unsigned int offset, int value)
 {
        struct aspeed_gpio_priv *priv = dev_get_priv(dev);
        const struct aspeed_gpio_bank *bank = to_bank(offset);
-       u32 data = readl(bank_reg(priv, bank, reg_val));
+       u32 data = readl(bank_reg(priv, bank, reg_rdata));
 
        if (value)
                data |= GPIO_BIT(offset);