From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! pinctrl: Rockchip: Update from Linux
Date: Wed, 9 Jun 2021 19:49:13 +0200 [thread overview]
Message-ID: <20210609174913.27194-1-a.fatoum@pengutronix.de> (raw)
The original code uses regmap for the base address and reg for the
offset to add onto it. The barebox port combines both into one pointer
named reg. In rockchip_pinctrl_set_func(), two different offsets are
used with the same base address. The code erroneously uses
reg (base + offset) in place of base, leading to memory writes into
the wrong registers. Fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/pinctrl/pinctrl-rockchip.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c3d89938943c..df702fbb6164 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -715,19 +715,19 @@ static int rockchip_pinctrl_set_func(struct rockchip_pin_bank *bank, int pin,
int mux)
{
struct rockchip_pinctrl *info = bank->drvdata;
- void __iomem *reg;
+ void __iomem *base, *reg;
u8 bit;
u32 data, route_location, route_reg, route_val;
int iomux_num = (pin / 8);
int mux_type;
int mask;
- reg = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
+ base = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
? info->reg_pmu : info->reg_base;
/* get basic quadrupel of mux registers and the correct reg inside */
mux_type = bank->iomux[iomux_num].type;
- reg += bank->iomux[iomux_num].offset;
+ reg = base + bank->iomux[iomux_num].offset;
dev_dbg(info->pctl_dev.dev, "setting func of GPIO%d-%d to %d\n",
bank->bank_num, pin, mux);
@@ -750,7 +750,7 @@ static int rockchip_pinctrl_set_func(struct rockchip_pin_bank *bank, int pin,
if (bank->route_mask & BIT(pin)) {
if (rockchip_get_mux_route(bank, pin, mux, &route_location,
&route_reg, &route_val)) {
- void __iomem *route = reg;
+ void __iomem *route = base;
/* handle special locations */
switch (route_location) {
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2021-06-09 17:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 17:49 Ahmad Fatoum [this message]
2021-06-11 11:52 ` 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=20210609174913.27194-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--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