gpio: aspeed: Fix incorrect offset of read back register.
Subsystems (2)
Billy Tsai
reviewerPATCH 1/1 gpio: aspeed: Fix incorrect offset of read back register.
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.
--- drivers/gpio/gpio-aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-aspeed.c +2 -2
@@ -211,7 +211,7 @@ static int aspeed_gpio_direction_output(struct udevice *dev, unsigned int offsetstruct 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);
Signature · 1 line
2.25.1
Ryan Chen
reviewerQuoted 9 lines
-----Original Message-----
From: Billy Tsai <[email protected]>
Sent: Wednesday, April 13, 2022 1:35 PM
To: Ryan Chen <[email protected]>; ChiaWei Wang <[email protected]>; BMC-SW <[email protected]>; [email protected]; Billy Tsai <[email protected]>; [email protected]
Subject: [PATCH] gpio: aspeed: Fix incorrect offset of read back register.
Quoted 7 lines
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 <[email protected]>
Quoted 28 lines
--- drivers/gpio/gpio-aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-aspeed.c index renamed from drivers/gpio/gpio-aspeed.c +0
-0
a8a2afcb5c..2c5415c671100644drivers/gpio/gpio-aspeed.c +1
-1@@ -211,7 +211,7 @@ static int aspeed_gpio_direction_output(struct udevice *dev, unsigned int offsetstruct 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){drivers/gpio/gpio-aspeed.c +1
-2struct 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); --2.25.1
Quoted 7 lines · Billy Tsai
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom