linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig
@ 2012-06-27 15:51 Roland Stigge
  2012-06-27 15:51 ` [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional Roland Stigge
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Roland Stigge @ 2012-06-27 15:51 UTC (permalink / raw)
  To: dedekind1, linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen, linux
  Cc: Roland Stigge

From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>

Since this driver depends on the amba pl08x dma driver, select it in Kconfig.

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Roland Stigge <stigge@antcom.de>
---
 drivers/mtd/nand/Kconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index de69978..a9e8b73 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -417,6 +417,7 @@ config MTD_NAND_PXA3xx
 config MTD_NAND_SLC_LPC32XX
 	tristate "NXP LPC32xx SLC Controller"
 	depends on ARCH_LPC32XX
+	select AMBA_PL08X
 	help
 	  Enables support for NXP's LPC32XX SLC (i.e. for Single Level Cell
 	  chips) NAND controller. This is the default for the PHYTEC 3250
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional
  2012-06-27 15:51 [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Roland Stigge
@ 2012-06-27 15:51 ` Roland Stigge
  2012-06-29 10:37   ` Artem Bityutskiy
  2012-06-27 15:51 ` [PATCH 3/4] mtd: lpc32xx_slc: Use of_get_named_gpio() Roland Stigge
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Roland Stigge @ 2012-06-27 15:51 UTC (permalink / raw)
  To: dedekind1, linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen, linux
  Cc: Roland Stigge

From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>

This patch supports missing wp gpio.

Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Roland Stigge <stigge@antcom.de>
---
 drivers/mtd/nand/lpc32xx_slc.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index b27b3b3..ab72aca 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -192,7 +192,7 @@ struct lpc32xx_nand_cfg_slc {
 	u32     rhold;
 	u32     rsetup;
 	bool    use_bbt;
-	unsigned wp_gpio;
+	int     wp_gpio;
 	struct mtd_partition *parts;
 	unsigned num_parts;
 };
@@ -295,7 +295,8 @@ static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
  */
 static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
 {
-	gpio_set_value(host->ncfg->wp_gpio, 0);
+	if (gpio_is_valid(host->ncfg->wp_gpio))
+		gpio_set_value(host->ncfg->wp_gpio, 0);
 }
 
 /*
@@ -303,7 +304,8 @@ static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
  */
 static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host)
 {
-	gpio_set_value(host->ncfg->wp_gpio, 1);
+	if (gpio_is_valid(host->ncfg->wp_gpio))
+		gpio_set_value(host->ncfg->wp_gpio, 1);
 }
 
 /*
@@ -819,7 +821,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Missing platform data\n");
 		return -ENOENT;
 	}
-	if (gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
+	if (gpio_is_valid(host->ncfg->wp_gpio) &&
+			gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
 		dev_err(&pdev->dev, "GPIO not available\n");
 		return -EBUSY;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] mtd: lpc32xx_slc: Use of_get_named_gpio()
  2012-06-27 15:51 [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Roland Stigge
  2012-06-27 15:51 ` [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional Roland Stigge
@ 2012-06-27 15:51 ` Roland Stigge
  2012-06-27 15:51 ` [PATCH 4/4] mtd: lpc32xx_slc: Make probe() return -EPROBE_DEFER if necessary Roland Stigge
  2012-06-27 19:15 ` [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Russell King - ARM Linux
  3 siblings, 0 replies; 9+ messages in thread
From: Roland Stigge @ 2012-06-27 15:51 UTC (permalink / raw)
  To: dedekind1, linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen, linux
  Cc: Roland Stigge

This patch makes the lpc32xx_slc driver use of_get_named_gpio() instead of
of_get_named_gpio_flags() whose flags are discarded anyway.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
---
 drivers/mtd/nand/lpc32xx_slc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index ab72aca..4e8db3a 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -770,7 +770,7 @@ static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev)
 	}
 
 	pdata->use_bbt = of_get_nand_on_flash_bbt(np);
-	pdata->wp_gpio = of_get_named_gpio_flags(np, "gpios", 0, NULL);
+	pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0);
 
 	return pdata;
 }
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] mtd: lpc32xx_slc: Make probe() return -EPROBE_DEFER if necessary
  2012-06-27 15:51 [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Roland Stigge
  2012-06-27 15:51 ` [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional Roland Stigge
  2012-06-27 15:51 ` [PATCH 3/4] mtd: lpc32xx_slc: Use of_get_named_gpio() Roland Stigge
@ 2012-06-27 15:51 ` Roland Stigge
  2012-06-27 19:15 ` [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Russell King - ARM Linux
  3 siblings, 0 replies; 9+ messages in thread
From: Roland Stigge @ 2012-06-27 15:51 UTC (permalink / raw)
  To: dedekind1, linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen, linux
  Cc: Roland Stigge

Via of_get_named_gpio(), wp_gpio can become -EPROBE_DEFER which now makes
probe() return -EPROBE_DEFER as well to wait until the gpio controller is
probed before trying to probe lpc32xx_slc again.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
---
 drivers/mtd/nand/lpc32xx_slc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 4e8db3a..142a91d 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -821,6 +821,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Missing platform data\n");
 		return -ENOENT;
 	}
+	if (host->ncfg->wp_gpio == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
 	if (gpio_is_valid(host->ncfg->wp_gpio) &&
 			gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
 		dev_err(&pdev->dev, "GPIO not available\n");
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig
  2012-06-27 15:51 [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Roland Stigge
                   ` (2 preceding siblings ...)
  2012-06-27 15:51 ` [PATCH 4/4] mtd: lpc32xx_slc: Make probe() return -EPROBE_DEFER if necessary Roland Stigge
@ 2012-06-27 19:15 ` Russell King - ARM Linux
  2012-06-27 19:26   ` Alexandre Pereira da Silva
  3 siblings, 1 reply; 9+ messages in thread
From: Russell King - ARM Linux @ 2012-06-27 19:15 UTC (permalink / raw)
  To: Roland Stigge
  Cc: dedekind1, linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen

On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
> From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> 
> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
> 
> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> Signed-off-by: Roland Stigge <stigge@antcom.de>
> ---
>  drivers/mtd/nand/Kconfig |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> index de69978..a9e8b73 100644
> --- a/drivers/mtd/nand/Kconfig
> +++ b/drivers/mtd/nand/Kconfig
> @@ -417,6 +417,7 @@ config MTD_NAND_PXA3xx
>  config MTD_NAND_SLC_LPC32XX
>  	tristate "NXP LPC32xx SLC Controller"
>  	depends on ARCH_LPC32XX
> +	select AMBA_PL08X
>  	help
>  	  Enables support for NXP's LPC32XX SLC (i.e. for Single Level Cell
>  	  chips) NAND controller. This is the default for the PHYTEC 3250

Surely not?  Drivers using DMA engine really should not depend on any
particular DMA engine implementation.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig
  2012-06-27 19:15 ` [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Russell King - ARM Linux
@ 2012-06-27 19:26   ` Alexandre Pereira da Silva
  2012-06-27 19:30     ` Russell King - ARM Linux
  0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Pereira da Silva @ 2012-06-27 19:26 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Roland Stigge, dedekind1, linux-mtd, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen

On Wed, Jun 27, 2012 at 4:15 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
>> From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
>>
>> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
>>
>> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
>> Signed-off-by: Roland Stigge <stigge@antcom.de>
>> ---
>>  drivers/mtd/nand/Kconfig |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
>> index de69978..a9e8b73 100644
>> --- a/drivers/mtd/nand/Kconfig
>> +++ b/drivers/mtd/nand/Kconfig
>> @@ -417,6 +417,7 @@ config MTD_NAND_PXA3xx
>>  config MTD_NAND_SLC_LPC32XX
>>       tristate "NXP LPC32xx SLC Controller"
>>       depends on ARCH_LPC32XX
>> +     select AMBA_PL08X
>>       help
>>         Enables support for NXP's LPC32XX SLC (i.e. for Single Level Cell
>>         chips) NAND controller. This is the default for the PHYTEC 3250
>
> Surely not?  Drivers using DMA engine really should not depend on any
> particular DMA engine implementation.

Should the DMA code in this driver be ifdef'd like in spi-pl022.c?

Or just depend on DMA_ENGINE instead?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig
  2012-06-27 19:26   ` Alexandre Pereira da Silva
@ 2012-06-27 19:30     ` Russell King - ARM Linux
  2012-06-27 19:49       ` Alexandre Pereira da Silva
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King - ARM Linux @ 2012-06-27 19:30 UTC (permalink / raw)
  To: Alexandre Pereira da Silva
  Cc: Roland Stigge, dedekind1, linux-mtd, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen

On Wed, Jun 27, 2012 at 04:26:18PM -0300, Alexandre Pereira da Silva wrote:
> On Wed, Jun 27, 2012 at 4:15 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
> >> From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> >>
> >> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
> >>
> >> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> >> Signed-off-by: Roland Stigge <stigge@antcom.de>
> >> ---
> >>  drivers/mtd/nand/Kconfig |    1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> >> index de69978..a9e8b73 100644
> >> --- a/drivers/mtd/nand/Kconfig
> >> +++ b/drivers/mtd/nand/Kconfig
> >> @@ -417,6 +417,7 @@ config MTD_NAND_PXA3xx
> >>  config MTD_NAND_SLC_LPC32XX
> >>       tristate "NXP LPC32xx SLC Controller"
> >>       depends on ARCH_LPC32XX
> >> +     select AMBA_PL08X
> >>       help
> >>         Enables support for NXP's LPC32XX SLC (i.e. for Single Level Cell
> >>         chips) NAND controller. This is the default for the PHYTEC 3250
> >
> > Surely not?  Drivers using DMA engine really should not depend on any
> > particular DMA engine implementation.
> 
> Should the DMA code in this driver be ifdef'd like in spi-pl022.c?
> 
> Or just depend on DMA_ENGINE instead?

Well, the DMA engine API gets stubbed out when no DMA engine is selected,
so I'm not sure why spi-pl022 needs all those ifdefs (yes, you may wish
to do that if you want to shrink your driver private struct size.)

Provided the driver is capable of working without DMA engine, I don't see
any reason what so ever to make that driver select or depend on DMA engine
stuff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig
  2012-06-27 19:30     ` Russell King - ARM Linux
@ 2012-06-27 19:49       ` Alexandre Pereira da Silva
  0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Pereira da Silva @ 2012-06-27 19:49 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Roland Stigge, dedekind1, linux-mtd, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen

On Wed, Jun 27, 2012 at 4:30 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> Well, the DMA engine API gets stubbed out when no DMA engine is selected,
> so I'm not sure why spi-pl022 needs all those ifdefs (yes, you may wish
> to do that if you want to shrink your driver private struct size.)
>
> Provided the driver is capable of working without DMA engine, I don't see
> any reason what so ever to make that driver select or depend on DMA engine
> stuff.

Ok, so this one can be dropped.

It was proposed because of an build error in the past, but it's not
happening anymore.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional
  2012-06-27 15:51 ` [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional Roland Stigge
@ 2012-06-29 10:37   ` Artem Bityutskiy
  0 siblings, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2012-06-29 10:37 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux-mtd, aletes.xgr, linux-kernel, linux-doc,
	devicetree-discuss, dwmw2, kevin.wells, srinivas.bakki,
	linux-arm-kernel, hechtb, lars, b32955, leiwen, linux

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

On Wed, 2012-06-27 at 17:51 +0200, Roland Stigge wrote:
> From: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> 
> This patch supports missing wp gpio.
> 
> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> Signed-off-by: Roland Stigge <stigge@antcom.de>

Pushed patches 2-4, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-29 10:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27 15:51 [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Roland Stigge
2012-06-27 15:51 ` [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional Roland Stigge
2012-06-29 10:37   ` Artem Bityutskiy
2012-06-27 15:51 ` [PATCH 3/4] mtd: lpc32xx_slc: Use of_get_named_gpio() Roland Stigge
2012-06-27 15:51 ` [PATCH 4/4] mtd: lpc32xx_slc: Make probe() return -EPROBE_DEFER if necessary Roland Stigge
2012-06-27 19:15 ` [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig Russell King - ARM Linux
2012-06-27 19:26   ` Alexandre Pereira da Silva
2012-06-27 19:30     ` Russell King - ARM Linux
2012-06-27 19:49       ` Alexandre Pereira da Silva

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).