* [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads
@ 2018-11-12 15:25 A.s. Dong
2018-11-12 15:47 ` Martin Kaiser
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: A.s. Dong @ 2018-11-12 15:25 UTC (permalink / raw)
To: linux-gpio@vger.kernel.org
Cc: A.s. Dong, dongas86@gmail.com, martin@kaiser.cx,
linus.walleij@linaro.org, stefan@agner.ch, dl-linux-imx,
kernel@pengutronix.de, Fabio Estevam, Leonard Crestez,
shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
After patch b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support"),
NO_PAD_CTL pads map are not skipped anymore which results in
a possible memory corruption. As we actually only need to create config
maps for SCU pads and MMIO pads which are not using the default config
(a.k.a IMX_NO_PAD_CTL), so let's add a proper check before creating
the config maps. And during MMIO pads parsing, we also need update the
list_p point as SCU case to ensure the pin data next parsed is correct.
Cc: Linus Walleij <linus.walleij@linaro.org>
Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
Reported-by: Martin Kaiser <martin@kaiser.cx>
Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 78d33df..188001b 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -108,6 +108,15 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
new_map++;
for (i = j = 0; i < grp->num_pins; i++) {
pin = &((struct imx_pin *)(grp->data))[i];
+
+ /*
+ * We only create config maps for SCU pads or MMIO pads that
+ * are not using the default config(a.k.a IMX_NO_PAD_CTL)
+ */
+ if (!(info->flags & IMX_USE_SCU) &&
+ (pin->conf.mmio.config & IMX_NO_PAD_CTL))
+ continue;
+
new_map[j].type = PIN_MAP_TYPE_CONFIGS_PIN;
new_map[j].data.configs.group_or_pin =
pin_get_name(pctldev, pin->pin);
@@ -120,7 +129,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
new_map[j].data.configs.configs =
(unsigned long *)&pin->conf.scu;
new_map[j].data.configs.num_configs = 2;
- } else if (!(pin->conf.mmio.config & IMX_NO_PAD_CTL)) {
+ } else {
new_map[j].data.configs.configs =
&pin->conf.mmio.config;
new_map[j].data.configs.num_configs = 1;
@@ -549,6 +558,8 @@ static void imx_pinctrl_parse_pin_mmio(struct imx_pinctrl *ipctl,
pin_mmio->config = config & ~IMX_PAD_SION;
}
+ *list_p = list;
+
dev_dbg(ipctl->dev, "%s: 0x%x 0x%08lx", info->pins[*pin_id].name,
pin_mmio->mux_mode, pin_mmio->config);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads
2018-11-12 15:25 [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads A.s. Dong
@ 2018-11-12 15:47 ` Martin Kaiser
2018-11-12 17:20 ` Leonard Crestez
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Martin Kaiser @ 2018-11-12 15:47 UTC (permalink / raw)
To: A.s. Dong
Cc: dongas86@gmail.com, linus.walleij@linaro.org, stefan@agner.ch,
linux-gpio@vger.kernel.org, dl-linux-imx, kernel@pengutronix.de,
Fabio Estevam, Leonard Crestez, shawnguo@kernel.org,
linux-arm-kernel@lists.infradead.org
Hi Dong,
your patch looks good to me.
Thus wrote A.s. Dong (aisheng.dong@nxp.com):
> After patch b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support"),
> NO_PAD_CTL pads map are not skipped anymore which results in
> a possible memory corruption. As we actually only need to create config
> maps for SCU pads and MMIO pads which are not using the default config
> (a.k.a IMX_NO_PAD_CTL), so let's add a proper check before creating
> the config maps. And during MMIO pads parsing, we also need update the
> list_p point as SCU case to ensure the pin data next parsed is correct.
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
> Reported-by: Martin Kaiser <martin@kaiser.cx>
> Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads
2018-11-12 15:25 [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads A.s. Dong
2018-11-12 15:47 ` Martin Kaiser
@ 2018-11-12 17:20 ` Leonard Crestez
2018-11-15 1:01 ` Kevin Hilman
2018-11-19 13:52 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Leonard Crestez @ 2018-11-12 17:20 UTC (permalink / raw)
To: A.s. Dong
Cc: dongas86@gmail.com, martin@kaiser.cx, linus.walleij@linaro.org,
stefan@agner.ch, linux-gpio@vger.kernel.org, dl-linux-imx,
kernel@pengutronix.de, Fabio Estevam, shawnguo@kernel.org,
linux-arm-kernel@lists.infradead.org
On Mon, 2018-11-12 at 15:25 +0000, A.s. Dong wrote:
> After patch b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support"),
> NO_PAD_CTL pads map are not skipped anymore which results in
> a possible memory corruption. As we actually only need to create config
> maps for SCU pads and MMIO pads which are not using the default config
> (a.k.a IMX_NO_PAD_CTL), so let's add a proper check before creating
> the config maps. And during MMIO pads parsing, we also need update the
> list_p point as SCU case to ensure the pin data next parsed is correct.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
> Reported-by: Martin Kaiser <martin@kaiser.cx>
> Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Tested-by: Leonard Crestez <leonard.crestez@nxp.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads
2018-11-12 15:25 [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads A.s. Dong
2018-11-12 15:47 ` Martin Kaiser
2018-11-12 17:20 ` Leonard Crestez
@ 2018-11-15 1:01 ` Kevin Hilman
2018-11-19 13:52 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2018-11-15 1:01 UTC (permalink / raw)
To: linux-gpio@vger.kernel.org
Cc: A.s. Dong, dongas86@gmail.com, martin@kaiser.cx,
linus.walleij@linaro.org, stefan@agner.ch, dl-linux-imx,
kernel@pengutronix.de, Fabio Estevam, Leonard Crestez,
shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
"A.s. Dong" <aisheng.dong@nxp.com> writes:
> After patch b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support"),
> NO_PAD_CTL pads map are not skipped anymore which results in
> a possible memory corruption. As we actually only need to create config
> maps for SCU pads and MMIO pads which are not using the default config
> (a.k.a IMX_NO_PAD_CTL), so let's add a proper check before creating
> the config maps. And during MMIO pads parsing, we also need update the
> list_p point as SCU case to ensure the pin data next parsed is correct.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
> Reported-by: Martin Kaiser <martin@kaiser.cx>
> Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
After kernelCI found a similar failure, I verified that this patch gets
things booting again in today's linux-next.
Tested-by: Kevin Hilman <khilman@baylibre.com>
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads
2018-11-12 15:25 [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads A.s. Dong
` (2 preceding siblings ...)
2018-11-15 1:01 ` Kevin Hilman
@ 2018-11-19 13:52 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2018-11-19 13:52 UTC (permalink / raw)
To: Dong Aisheng
Cc: Dong Aisheng, Martin Kaiser, Stefan Agner,
open list:GPIO SUBSYSTEM, NXP Linux Team, Sascha Hauer,
Fabio Estevam, Leonard Crestez, Shawn Guo, Linux ARM
On Mon, Nov 12, 2018 at 4:25 PM A.s. Dong <aisheng.dong@nxp.com> wrote:
> After patch b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support"),
> NO_PAD_CTL pads map are not skipped anymore which results in
> a possible memory corruption. As we actually only need to create config
> maps for SCU pads and MMIO pads which are not using the default config
> (a.k.a IMX_NO_PAD_CTL), so let's add a proper check before creating
> the config maps. And during MMIO pads parsing, we also need update the
> list_p point as SCU case to ensure the pin data next parsed is correct.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
> Reported-by: Martin Kaiser <martin@kaiser.cx>
> Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Patch applied with all the test tags!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-19 13:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-12 15:25 [PATCH 1/1] pinctrl: imx: fix NO_PAD_CTL setting for MMIO pads A.s. Dong
2018-11-12 15:47 ` Martin Kaiser
2018-11-12 17:20 ` Leonard Crestez
2018-11-15 1:01 ` Kevin Hilman
2018-11-19 13:52 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).