diff mbox

[v2] pinctrl: imx25: ensure that a pin with id i is at position i in the info array

Message ID 1443018909-20871-1-git-send-email-u.kleine-koenig@pengutronix.de
State New
Headers show

Commit Message

Uwe Kleine-König Sept. 23, 2015, 2:35 p.m. UTC
The code in pinctrl-imx.c only works correctly if in the
imx_pinctrl_soc_info passed to imx_pinctrl_probe we have:

	info->pins[i].number = i
	conf_reg(info->pins[i]) = 4 * i

(which conf_reg(pin) being the offset of the pin's configuration
register).

When the imx25 specific part was introduced in b4a87c9b966f ("pinctrl:
pinctrl-imx: add imx25 pinctrl driver") we had:

	info->pins[i].number = i + 1
	conf_reg(info->pins[i]) = 4 * i

. Commit 34027ca2bbc6 ("pinctrl: imx25: fix numbering for pins") tried
to fix that but made the situation:

	info->pins[i-1].number = i
	conf_reg(info->pins[i-1]) = 4 * i

which is hardly better but fixed the error seen back then.

So insert another reserved entry in the array to finally yield:

	info->pins[i].number = i
	conf_reg(info->pins[i]) = 4 * i

Fixes: 34027ca2bbc6 ("pinctrl: imx25: fix numbering for pins")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1 sent with Message-Id:
1443018584-12186-1-git-send-email-u.kleine-koenig@pengutronix.de :

 - fix a formula in the commit log

 drivers/pinctrl/freescale/pinctrl-imx25.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Linus Walleij Oct. 2, 2015, 11:01 a.m. UTC | #1
On Wed, Sep 23, 2015 at 7:35 AM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

> The code in pinctrl-imx.c only works correctly if in the
> imx_pinctrl_soc_info passed to imx_pinctrl_probe we have:
>
>         info->pins[i].number = i
>         conf_reg(info->pins[i]) = 4 * i
>
> (which conf_reg(pin) being the offset of the pin's configuration
> register).
>
> When the imx25 specific part was introduced in b4a87c9b966f ("pinctrl:
> pinctrl-imx: add imx25 pinctrl driver") we had:
>
>         info->pins[i].number = i + 1
>         conf_reg(info->pins[i]) = 4 * i
>
> . Commit 34027ca2bbc6 ("pinctrl: imx25: fix numbering for pins") tried
> to fix that but made the situation:
>
>         info->pins[i-1].number = i
>         conf_reg(info->pins[i-1]) = 4 * i
>
> which is hardly better but fixed the error seen back then.
>
> So insert another reserved entry in the array to finally yield:
>
>         info->pins[i].number = i
>         conf_reg(info->pins[i]) = 4 * i
>
> Fixes: 34027ca2bbc6 ("pinctrl: imx25: fix numbering for pins")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Changes since (implicit) v1 sent with Message-Id:
> 1443018584-12186-1-git-send-email-u.kleine-koenig@pengutronix.de :

Patch applied for fixes.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c b/drivers/pinctrl/freescale/pinctrl-imx25.c
index faf635654312..293ed4381cc0 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -26,7 +26,8 @@ 
 #include "pinctrl-imx.h"
 
 enum imx25_pads {
-	MX25_PAD_RESERVE0 = 1,
+	MX25_PAD_RESERVE0 = 0,
+	MX25_PAD_RESERVE1 = 1,
 	MX25_PAD_A10 = 2,
 	MX25_PAD_A13 = 3,
 	MX25_PAD_A14 = 4,
@@ -169,6 +170,7 @@  enum imx25_pads {
 /* Pad names for the pinmux subsystem */
 static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = {
 	IMX_PINCTRL_PIN(MX25_PAD_RESERVE0),
+	IMX_PINCTRL_PIN(MX25_PAD_RESERVE1),
 	IMX_PINCTRL_PIN(MX25_PAD_A10),
 	IMX_PINCTRL_PIN(MX25_PAD_A13),
 	IMX_PINCTRL_PIN(MX25_PAD_A14),