Re: [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand
[Sukumar Ghorai wrote: From: Sukumar Ghorai s-gho...@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-gho...@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
[PATCH 3/3] omap3 nand: fix issue in board file to detect the nand
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-gho...@ti.com --- arch/arm/mach-omap2/board-cm-t35.c | 16 +--- arch/arm/mach-omap2/board-devkit8000.c | 16 +--- arch/arm/mach-omap2/board-omap3beagle.c| 16 +--- arch/arm/mach-omap2/board-omap3touchbook.c | 16 +--- arch/arm/mach-omap2/board-overo.c | 17 + 5 files changed, 5 insertions(+), 76 deletions(-) diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index fb23122..0544294 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c @@ -224,23 +224,9 @@ static struct omap_nand_platform_data cm_t35_nand_data = { }; -static struct resource cm_t35_nand_resource = { - .flags = IORESOURCE_MEM, -}; - -static struct platform_device cm_t35_nand_device = { - .name = omap2-nand, - .id = -1, - .num_resources = 1, - .resource = cm_t35_nand_resource, - .dev= { - .platform_data = cm_t35_nand_data, - }, -}; - static void __init cm_t35_init_nand(void) { - if (platform_device_register(cm_t35_nand_device) 0) + if (gpmc_nand_init(cm_t35_nand_data) 0) pr_err(CM-T35: Unable to register NAND device\n); } #else diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index be50d18..a6fcb48 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c @@ -101,20 +101,6 @@ static struct omap_nand_platform_data devkit8000_nand_data = { .dma_channel= -1, /* disable DMA in OMAP NAND driver */ }; -static struct resource devkit8000_nand_resource = { - .flags = IORESOURCE_MEM, -}; - -static struct platform_device devkit8000_nand_device = { - .name = omap2-nand, - .id = -1, - .dev= { - .platform_data = devkit8000_nand_data, - }, - .num_resources = 1, - .resource = devkit8000_nand_resource, -}; - static struct omap2_hsmmc_info mmc[] = { { .mmc= 1, @@ -601,7 +587,7 @@ static void __init devkit8000_flash_init(void) devkit8000_nand_data.cs = nandcs; printk(KERN_INFO Registering NAND on CS%d\n, nandcs); - if (platform_device_register(devkit8000_nand_device) 0) + if (gpmc_nand_init(devkit8000_nand_data) 0) printk(KERN_ERR Unable to register NAND device\n); } } diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index becaebe..bf31b7c --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -89,20 +89,6 @@ static struct omap_nand_platform_data omap3beagle_nand_data = { .dev_ready = NULL, }; -static struct resource omap3beagle_nand_resource = { - .flags = IORESOURCE_MEM, -}; - -static struct platform_device omap3beagle_nand_device = { - .name = omap2-nand, - .id = -1, - .dev= { - .platform_data = omap3beagle_nand_data, - }, - .num_resources = 1, - .resource = omap3beagle_nand_resource, -}; - #include sdram-micron-mt46h32m32lf-6.h static struct omap2_hsmmc_info mmc[] = { @@ -397,7 +383,7 @@ static void __init omap3beagle_flash_init(void) omap3beagle_nand_data.cs = nandcs; printk(KERN_INFO Registering NAND on CS%d\n, nandcs); - if (platform_device_register(omap3beagle_nand_device) 0) + if (gpmc_nand_init(omap3beagle_nand_data) 0) printk(KERN_ERR Unable to register NAND device\n); } } diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index d6f1b12..e8ad30c --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c @@ -103,20 +103,6 @@ static struct omap_nand_platform_data omap3touchbook_nand_data = { .dev_ready = NULL, }; -static struct resource omap3touchbook_nand_resource = { - .flags = IORESOURCE_MEM, -}; - -static struct platform_device omap3touchbook_nand_device = { - .name = omap2-nand, - .id = -1, - .dev= { - .platform_data = omap3touchbook_nand_data, - }, - .num_resources = 1, - .resource = omap3touchbook_nand_resource, -}; - #include sdram-micron-mt46h32m32lf-6.h static struct omap2_hsmmc_info mmc[] = { @@ -479,7 +465,7 @@ static void __init omap3touchbook_flash_init(void) omap3touchbook_nand_data.cs = nandcs;