linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand
       [not found]       ` <1273652243-6303-4-git-send-email-s-ghorai@ti.com>
@ 2010-05-12  8:30         ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2010-05-12  8:30 UTC (permalink / raw)
  To: Sukumar Ghorai; +Cc: tony, sakoman, linux-omap, linux-mtd, Artem.Bityutskiy

[Sukumar Ghorai wrote:
> From: Sukumar Ghorai <s-ghorai@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@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.

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

* [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand
  2010-05-12  9:48     ` [PATCH 2/3] omap3 nand: cleanup for not to use GPMC virtual address Sukumar Ghorai
@ 2010-05-12  9:48       ` Sukumar Ghorai
  0 siblings, 0 replies; 2+ messages in thread
From: Sukumar Ghorai @ 2010-05-12  9:48 UTC (permalink / raw)
  To: linux-omap; +Cc: Artem.Bityutskiy, tony, sakoman, linux-mtd, Sukumar Ghorai

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@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;
 
 		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-		if (platform_device_register(&omap3touchbook_nand_device) < 0)
+		if (gpmc_nand_init(&omap3touchbook_nand_data) < 0)
 			printk(KERN_ERR "Unable to register NAND device\n");
 	}
 }
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index d843a0a..627edd3
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -217,21 +217,6 @@ static struct omap_nand_platform_data overo_nand_data = {
 	.dma_channel = -1,	/* disable DMA in OMAP NAND driver */
 };
 
-static struct resource overo_nand_resource = {
-	.flags		= IORESOURCE_MEM,
-};
-
-static struct platform_device overo_nand_device = {
-	.name		= "omap2-nand",
-	.id		= -1,
-	.dev		= {
-		.platform_data	= &overo_nand_data,
-	},
-	.num_resources	= 1,
-	.resource	= &overo_nand_resource,
-};
-
-
 static void __init overo_flash_init(void)
 {
 	u8 cs = 0;
@@ -260,7 +245,7 @@ static void __init overo_flash_init(void)
 		overo_nand_data.cs = nandcs;
 
 		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-		if (platform_device_register(&overo_nand_device) < 0)
+		if (gpmc_nand_init(&overo_nand_data) < 0)
 			printk(KERN_ERR "Unable to register NAND device\n");
 	}
 }

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

end of thread, other threads:[~2010-05-12  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <[Sukumar Ghorai <s-ghorai@ti.com>
     [not found] ` <1273652243-6303-1-git-send-email-s-ghorai@ti.com>
     [not found]   ` <1273652243-6303-2-git-send-email-s-ghorai@ti.com>
     [not found]     ` <1273652243-6303-3-git-send-email-s-ghorai@ti.com>
     [not found]       ` <1273652243-6303-4-git-send-email-s-ghorai@ti.com>
2010-05-12  8:30         ` [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand Mike Rapoport
     [not found] <Sukumar Ghorai <s-ghorai@ti.com>
2010-05-12  9:48 ` [PATCH 0/3] omap3 nand: cleanup exiting platform related code Sukumar Ghorai
2010-05-12  9:48   ` [PATCH 1/3] omap3: GPMC register definition at common location Sukumar Ghorai
2010-05-12  9:48     ` [PATCH 2/3] omap3 nand: cleanup for not to use GPMC virtual address Sukumar Ghorai
2010-05-12  9:48       ` [PATCH 3/3] omap3 nand: fix issue in board file to detect the nand Sukumar Ghorai

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