From: Kilian Strasser <kilian.strasser@wolfvision.net>
To: barebox@lists.infradead.org
Cc: Kilian Strasser <kilian.strasser@wolfvision.net>
Subject: [PATCH] pinctrl: rockchip: fix get_value
Date: Thu, 9 Feb 2023 10:56:40 +0100 [thread overview]
Message-ID: <20230209095640.47469-1-kilian.strasser@wolfvision.net> (raw)
Function gpioinfo returns wrong gpio values.
In the file pinctrl.rockchip.c a wrong register offset is used by the
function rockchip_gpiov2_get_value. Also the bit-mask for this register
is wrong. Change register offset for this function to GPIO_EXT_PORT and
set the bit-mask correctly.
Signed-off-by: Kilian Strasser <kilian.strasser@wolfvision.net>
---
drivers/pinctrl/pinctrl-rockchip.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c99074407f..66d700d324 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -226,6 +226,7 @@ enum {
RK_GPIOV2_DR_H = 0x04,
RK_GPIOV2_DDR_L = 0x08,
RK_GPIOV2_DDR_H = 0x0c,
+ RK_GPIOV2_EXT_PORT = 0x70,
};
static struct rockchip_pin_bank *gc_to_rockchip_pinctrl(struct gpio_chip *gc)
@@ -306,12 +307,8 @@ static int rockchip_gpiov2_get_value(struct gpio_chip *gc, unsigned int gpio)
struct rockchip_pin_bank *bank = gc_to_rockchip_pinctrl(gc);
u32 mask, r;
- mask = 1 << (gpio % 16);
-
- if (gpio < 16)
- r = readl(bank->reg_base + RK_GPIOV2_DR_L);
- else
- r = readl(bank->reg_base + RK_GPIOV2_DR_L);
+ mask = 1 << (gpio % 32);
+ r = readl(bank->reg_base + RK_GPIOV2_EXT_PORT);
return r & mask ? 1 : 0;
}
--
2.34.1
next reply other threads:[~2023-02-09 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 9:56 Kilian Strasser [this message]
2023-02-10 9:50 ` Sascha Hauer
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=20230209095640.47469-1-kilian.strasser@wolfvision.net \
--to=kilian.strasser@wolfvision.net \
--cc=barebox@lists.infradead.org \
/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