Patchwork mtd: mxc_nand: Make use of supplied pinctrl data

login
register
mail settings
Submitter Marek Vasut
Date Jan. 7, 2013, 2:28 p.m.
Message ID <1357568885-15507-1-git-send-email-marex@denx.de>
Download mbox | patch
Permalink /patch/209936/
State New
Headers show

Comments

Marek Vasut - Jan. 7, 2013, 2:28 p.m.
The MXC NAND driver doesn't consider the pinctrl data supplied via DT, which
will result in NAND pins not being properly configured.

Make the driver use pinctrl, but to prevent breakage on various boards, do not
fail if the pinctrl data are not available, only print a warning message.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/mxc_nand.c |    6 ++++++
 1 file changed, 6 insertions(+)
Sascha Hauer - Jan. 7, 2013, 5:13 p.m.
On Mon, Jan 07, 2013 at 03:28:05PM +0100, Marek Vasut wrote:
> The MXC NAND driver doesn't consider the pinctrl data supplied via DT, which
> will result in NAND pins not being properly configured.
> 
> Make the driver use pinctrl, but to prevent breakage on various boards, do not
> fail if the pinctrl data are not available, only print a warning message.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> ---
>  drivers/mtd/nand/mxc_nand.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 45204e4..ed805fb 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -34,6 +34,7 @@
>  #include <linux/completion.h>
>  #include <linux/of_device.h>
>  #include <linux/of_mtd.h>
> +#include <linux/pinctrl/consumer.h>
>  
>  #include <asm/mach/flash.h>
>  #include <linux/platform_data/mtd-mxc_nand.h>
> @@ -1385,6 +1386,7 @@ static int mxcnd_probe(struct platform_device *pdev)
>  	struct mtd_info *mtd;
>  	struct mxc_nand_host *host;
>  	struct resource *res;
> +	struct pinctrl *pinctrl;
>  	int err = 0;
>  
>  	/* Allocate memory for MTD device structure and private data */
> @@ -1449,6 +1451,10 @@ static int mxcnd_probe(struct platform_device *pdev)
>  	if (!res)
>  		return -ENODEV;
>  
> +	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> +	if (IS_ERR(pinctrl))
> +		dev_warn(&pdev->dev, "No PINCTRL data for the NAND driver!\n");
> +
>  	host->base = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!host->base)
>  		return -ENOMEM;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jean-Christophe PLAGNIOL-VILLARD - Jan. 8, 2013, 7:58 p.m.
On 15:28 Mon 07 Jan     , Marek Vasut wrote:
> The MXC NAND driver doesn't consider the pinctrl data supplied via DT, which
> will result in NAND pins not being properly configured.
> 
> Make the driver use pinctrl, but to prevent breakage on various boards, do not
> fail if the pinctrl data are not available, only print a warning message.
nack

we will at bus level

Best Regards,
J.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> Cc: Lothar Waßmann <LW@KARO-electronics.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mtd/nand/mxc_nand.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 45204e4..ed805fb 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -34,6 +34,7 @@
>  #include <linux/completion.h>
>  #include <linux/of_device.h>
>  #include <linux/of_mtd.h>
> +#include <linux/pinctrl/consumer.h>
>  
>  #include <asm/mach/flash.h>
>  #include <linux/platform_data/mtd-mxc_nand.h>
> @@ -1385,6 +1386,7 @@ static int mxcnd_probe(struct platform_device *pdev)
>  	struct mtd_info *mtd;
>  	struct mxc_nand_host *host;
>  	struct resource *res;
> +	struct pinctrl *pinctrl;
>  	int err = 0;
>  
>  	/* Allocate memory for MTD device structure and private data */
> @@ -1449,6 +1451,10 @@ static int mxcnd_probe(struct platform_device *pdev)
>  	if (!res)
>  		return -ENODEV;
>  
> +	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> +	if (IS_ERR(pinctrl))
> +		dev_warn(&pdev->dev, "No PINCTRL data for the NAND driver!\n");
> +
>  	host->base = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!host->base)
>  		return -ENOMEM;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Marek Vasut - Jan. 8, 2013, 8:22 p.m.
Dear Jean-Christophe PLAGNIOL-VILLARD,

> On 15:28 Mon 07 Jan     , Marek Vasut wrote:
> > The MXC NAND driver doesn't consider the pinctrl data supplied via DT,
> > which will result in NAND pins not being properly configured.
> > 
> > Make the driver use pinctrl, but to prevent breakage on various boards,
> > do not fail if the pinctrl data are not available, only print a warning
> > message.
> 
> nack
> 
> we will at bus level

Can you please elaborate? I don't understand what you're complaining about at 
all, sorry.

Best regards,
Marek Vasut
Shawn Guo - Jan. 9, 2013, 6:41 a.m.
On Tue, Jan 08, 2013 at 09:22:46PM +0100, Marek Vasut wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> > On 15:28 Mon 07 Jan     , Marek Vasut wrote:
> > > The MXC NAND driver doesn't consider the pinctrl data supplied via DT,
> > > which will result in NAND pins not being properly configured.
> > > 
> > > Make the driver use pinctrl, but to prevent breakage on various boards,
> > > do not fail if the pinctrl data are not available, only print a warning
> > > message.
> > 
> > nack
> > 
> > we will at bus level
> 
> Can you please elaborate? I don't understand what you're complaining about at 
> all, sorry.
> 
He is talking about patch [1] which is likely to hit mainline for 3.9.

Shawn

[1] http://thread.gmane.org/gmane.linux.kernel/1409263
Marek Vasut - Jan. 9, 2013, 9:08 a.m.
Dear Shawn Guo,

> On Tue, Jan 08, 2013 at 09:22:46PM +0100, Marek Vasut wrote:
> > Dear Jean-Christophe PLAGNIOL-VILLARD,
> > 
> > > On 15:28 Mon 07 Jan     , Marek Vasut wrote:
> > > > The MXC NAND driver doesn't consider the pinctrl data supplied via
> > > > DT, which will result in NAND pins not being properly configured.
> > > > 
> > > > Make the driver use pinctrl, but to prevent breakage on various
> > > > boards, do not fail if the pinctrl data are not available, only
> > > > print a warning message.
> > > 
> > > nack
> > > 
> > > we will at bus level
> > 
> > Can you please elaborate? I don't understand what you're complaining
> > about at all, sorry.
> 
> He is talking about patch [1] which is likely to hit mainline for 3.9.
> 
> Shawn
> 
> [1] http://thread.gmane.org/gmane.linux.kernel/1409263

Oh, this is good, thanks for explaining Shawn!

Well, this patch can be applied as a fallback if it doesn't hit 3.9 , either way 
works for me.

Best regards,
Marek Vasut

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 45204e4..ed805fb 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -34,6 +34,7 @@ 
 #include <linux/completion.h>
 #include <linux/of_device.h>
 #include <linux/of_mtd.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <asm/mach/flash.h>
 #include <linux/platform_data/mtd-mxc_nand.h>
@@ -1385,6 +1386,7 @@  static int mxcnd_probe(struct platform_device *pdev)
 	struct mtd_info *mtd;
 	struct mxc_nand_host *host;
 	struct resource *res;
+	struct pinctrl *pinctrl;
 	int err = 0;
 
 	/* Allocate memory for MTD device structure and private data */
@@ -1449,6 +1451,10 @@  static int mxcnd_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&pdev->dev, "No PINCTRL data for the NAND driver!\n");
+
 	host->base = devm_request_and_ioremap(&pdev->dev, res);
 	if (!host->base)
 		return -ENOMEM;