From: Billy Tsai <billy_tsai@aspeedtech.com>
To: <ryan_chen@aspeedtech.com>, <chiawei_wang@aspeedtech.com>,
<BMC-SW@aspeedtech.com>, <andrew@aj.id.au>,
<billy_tsai@aspeedtech.com>, <u-boot@lists.denx.de>
Subject: [PATCH] gpio: aspeed: Fix incorrect offset of read back register.
Date: Wed, 13 Apr 2022 13:34:51 +0800 [thread overview]
Message-ID: <20220413053451.2975-1-billy_tsai@aspeedtech.com> (raw)
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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index a8a2afcb5c..2c5415c671 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -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);
--
2.25.1
next reply other threads:[~2022-04-13 11:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 5:34 Billy Tsai [this message]
2022-04-14 6:40 ` [PATCH] gpio: aspeed: Fix incorrect offset of read back register Ryan Chen
2022-04-20 13:12 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220413053451.2975-1-billy_tsai@aspeedtech.com \
--to=billy_tsai@aspeedtech.com \
--cc=BMC-SW@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=chiawei_wang@aspeedtech.com \
--cc=ryan_chen@aspeedtech.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox