2012-06-27 15:51:56

by Roland Stigge

[permalink] [raw]
Subject: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig

From: Alexandre Pereira da Silva <[email protected]>

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

Signed-off-by: Alexandre Pereira da Silva <[email protected]>
Signed-off-by: Roland Stigge <[email protected]>
---
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


2012-06-27 15:51:58

by Roland Stigge

[permalink] [raw]
Subject: [PATCH 4/4] mtd: lpc32xx_slc: Make probe() return -EPROBE_DEFER if necessary

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 <[email protected]>
Acked-by: Alexandre Pereira da Silva <[email protected]>
---
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

2012-06-27 15:51:54

by Roland Stigge

[permalink] [raw]
Subject: [PATCH 3/4] mtd: lpc32xx_slc: Use of_get_named_gpio()

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 <[email protected]>
Acked-by: Alexandre Pereira da Silva <[email protected]>
---
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

2012-06-27 15:51:53

by Roland Stigge

[permalink] [raw]
Subject: [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional

From: Alexandre Pereira da Silva <[email protected]>

This patch supports missing wp gpio.

Signed-off-by: Alexandre Pereira da Silva <[email protected]>
Signed-off-by: Roland Stigge <[email protected]>
---
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

2012-06-27 19:18:11

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig

On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
> From: Alexandre Pereira da Silva <[email protected]>
>
> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
>
> Signed-off-by: Alexandre Pereira da Silva <[email protected]>
> Signed-off-by: Roland Stigge <[email protected]>
> ---
> 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.

Subject: Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig

On Wed, Jun 27, 2012 at 4:15 PM, Russell King - ARM Linux
<[email protected]> wrote:
> On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
>> From: Alexandre Pereira da Silva <[email protected]>
>>
>> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
>>
>> Signed-off-by: Alexandre Pereira da Silva <[email protected]>
>> Signed-off-by: Roland Stigge <[email protected]>
>> ---
>> ?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?

2012-06-27 19:30:57

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig

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
> <[email protected]> wrote:
> > On Wed, Jun 27, 2012 at 05:51:12PM +0200, Roland Stigge wrote:
> >> From: Alexandre Pereira da Silva <[email protected]>
> >>
> >> Since this driver depends on the amba pl08x dma driver, select it in Kconfig.
> >>
> >> Signed-off-by: Alexandre Pereira da Silva <[email protected]>
> >> Signed-off-by: Roland Stigge <[email protected]>
> >> ---
> >> ?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.

Subject: Re: [PATCH 1/4] mtd: lpc32xx_slc: Select AMBA_PL08X in Kconfig

On Wed, Jun 27, 2012 at 4:30 PM, Russell King - ARM Linux
<[email protected]> 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.

2012-06-29 10:33:57

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH 2/4] mtd: lpc32xx_slc: Make wp gpio optional

On Wed, 2012-06-27 at 17:51 +0200, Roland Stigge wrote:
> From: Alexandre Pereira da Silva <[email protected]>
>
> This patch supports missing wp gpio.
>
> Signed-off-by: Alexandre Pereira da Silva <[email protected]>
> Signed-off-by: Roland Stigge <[email protected]>

Pushed patches 2-4, thanks!

--
Best Regards,
Artem Bityutskiy


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part