mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc: Ahmad Fatoum <>
Subject: [PATCH] fixup! pinctrl: Rockchip: Update from Linux
Date: Wed,  9 Jun 2021 19:49:13 +0200	[thread overview]
Message-ID: <> (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 <>
 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->, "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) {

barebox mailing list

             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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \
    --subject='Re: [PATCH] fixup'\!' pinctrl: Rockchip: Update from Linux' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox