[PATCH 3/3] omap3 nand: fix issue in board file to detect the nand
Mike Rapoport
mike at compulab.co.il
Wed May 12 04:30:17 EDT 2010
[Sukumar Ghorai wrote:
> From: Sukumar Ghorai <s-ghorai at ti.com>
>
> Board file modified to pass the GMPC phys_base address to nand driver. This is
> required to adopt the _prob function as in omap2.c
>
> Signed-off-by: Sukumar Ghorai <s-ghorai at ti.com>
> ---
> arch/arm/mach-omap2/board-cm-t35.c | 10 ++++++++++
> arch/arm/mach-omap2/board-devkit8000.c | 9 +++++++++
> arch/arm/mach-omap2/board-omap3beagle.c | 9 +++++++++
> arch/arm/mach-omap2/board-omap3touchbook.c | 9 +++++++++
> arch/arm/mach-omap2/board-overo.c | 8 ++++++++
> 5 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
> index fb23122..73a32bd
> --- a/arch/arm/mach-omap2/board-cm-t35.c
> +++ b/arch/arm/mach-omap2/board-cm-t35.c
> @@ -240,6 +240,16 @@ static struct platform_device cm_t35_nand_device = {
>
> static void __init cm_t35_init_nand(void)
> {
> + struct device *dev = &cm_t35_nand_device.dev;
> + int err = 0;
> +
> + err = gpmc_cs_request(cm_t35_nand_data.cs,
> + NAND_IO_SIZE, &cm_t35_nand_data.phys_base);
> + if (err < 0) {
> + dev_err(dev, "Cannot request GPMC CS\n");
> + return;
> + }
> +
> if (platform_device_register(&cm_t35_nand_device) < 0)
> pr_err("CM-T35: Unable to register NAND device\n");
Why won't you use gpmc_nand_init instead of platform_device_register?
With gpmc_nand_init there would be no need to request NAND CS in the
board files. Besides, if you convert the boards to use gpmc_nand_init at
the first place, it would simplify further patches.
> }
> diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
> index be50d18..86358e3
> --- a/arch/arm/mach-omap2/board-devkit8000.c
> +++ b/arch/arm/mach-omap2/board-devkit8000.c
> @@ -578,6 +578,9 @@ static void __init devkit8000_flash_init(void)
> u8 cs = 0;
> u8 nandcs = GPMC_CS_NUM + 1;
>
> + struct device *dev = &devkit8000_nand_device.dev;
> + int err = 0;
> +
> /* find out the chip-select on which NAND exists */
> while (cs < GPMC_CS_NUM) {
> u32 ret = 0;
> @@ -599,6 +602,12 @@ static void __init devkit8000_flash_init(void)
>
> if (nandcs < GPMC_CS_NUM) {
> devkit8000_nand_data.cs = nandcs;
> + err = gpmc_cs_request(devkit8000_nand_data.cs,
> + NAND_IO_SIZE, &devkit8000_nand_data.phys_base);
> + if (err < 0) {
> + dev_err(dev, "Cannot request GPMC CS\n");
> + return;
> + }
>
> printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> if (platform_device_register(&devkit8000_nand_device) < 0)
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index becaebe..d54719d
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -374,6 +374,9 @@ static void __init omap3beagle_flash_init(void)
> u8 cs = 0;
> u8 nandcs = GPMC_CS_NUM + 1;
>
> + struct device *dev = &omap3beagle_nand_device.dev;
> + int err = 0;
> +
> /* find out the chip-select on which NAND exists */
> while (cs < GPMC_CS_NUM) {
> u32 ret = 0;
> @@ -395,6 +398,12 @@ static void __init omap3beagle_flash_init(void)
>
> if (nandcs < GPMC_CS_NUM) {
> omap3beagle_nand_data.cs = nandcs;
> + err = gpmc_cs_request(omap3beagle_nand_data.cs,
> + NAND_IO_SIZE, &omap3beagle_nand_data.phys_base);
> + if (err < 0) {
> + dev_err(dev, "Cannot request GPMC CS\n");
> + return;
> + }
>
> printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> if (platform_device_register(&omap3beagle_nand_device) < 0)
> diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
> index d6f1b12..088a704
> --- a/arch/arm/mach-omap2/board-omap3touchbook.c
> +++ b/arch/arm/mach-omap2/board-omap3touchbook.c
> @@ -456,6 +456,9 @@ static void __init omap3touchbook_flash_init(void)
> u8 cs = 0;
> u8 nandcs = GPMC_CS_NUM + 1;
>
> + struct device *dev = &omap3touchbook_nand_device.dev;
> + int err = 0;
> +
> /* find out the chip-select on which NAND exists */
> while (cs < GPMC_CS_NUM) {
> u32 ret = 0;
> @@ -477,6 +480,12 @@ static void __init omap3touchbook_flash_init(void)
>
> if (nandcs < GPMC_CS_NUM) {
> omap3touchbook_nand_data.cs = nandcs;
> + err = gpmc_cs_request(omap3touchbook_nand_data.cs,
> + NAND_IO_SIZE, &omap3touchbook_nand_data.phys_base);
> + if (err < 0) {
> + dev_err(dev, "Cannot request GPMC CS\n");
> + return;
> + }
>
> printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> if (platform_device_register(&omap3touchbook_nand_device) < 0)
> diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
> index d843a0a..d6658b5
> --- a/arch/arm/mach-omap2/board-overo.c
> +++ b/arch/arm/mach-omap2/board-overo.c
> @@ -236,6 +236,8 @@ static void __init overo_flash_init(void)
> {
> u8 cs = 0;
> u8 nandcs = GPMC_CS_NUM + 1;
> + struct device *dev = &overo_nand_device.dev;
> + int err = 0;
>
> /* find out the chip-select on which NAND exists */
> while (cs < GPMC_CS_NUM) {
> @@ -258,6 +260,12 @@ static void __init overo_flash_init(void)
>
> if (nandcs < GPMC_CS_NUM) {
> overo_nand_data.cs = nandcs;
> + err = gpmc_cs_request(overo_nand_data.cs,
> + NAND_IO_SIZE, &overo_nand_data.phys_base);
> + if (err < 0) {
> + dev_err(dev, "Cannot request GPMC CS\n");
> + return;
> + }
>
> printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> if (platform_device_register(&overo_nand_device) < 0)
--
Sincerely yours,
Mike.
More information about the linux-mtd
mailing list