public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] [ARM] OMAP: Adding Support for 2K nand page support for omap2430
@ 2007-07-27 17:10 sshahrom
  2007-08-17  0:27 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: sshahrom @ 2007-07-27 17:10 UTC (permalink / raw)
  To: linux-omap-open-source


Hello,
Following patches would add support for 2k Page nand with Enabled HW ECC on omap2430 v4.0. It has been Tested with Micron Nand. The Patch is against 2.6.22 linux-omap.git tree. As Always all the comments are welcomed.

Signed-off-by: Shahrom Sharif-Kashani <sshahrom@micron.com>


:100644 100644 1e8492a... 0000000... M	arch/arm/mach-omap2/board-2430sdp-flash.c

diff --git a/arch/arm/mach-omap2/board-2430sdp-flash.c b/arch/arm/mach-omap2/board-2430sdp-flash.c
index 1e8492a..a8c9340 100644
--- a/arch/arm/mach-omap2/board-2430sdp-flash.c
+++ b/arch/arm/mach-omap2/board-2430sdp-flash.c
@@ -20,10 +20,64 @@
 #include <asm/arch/onenand.h>
 #include <asm/arch/board.h>
 #include <asm/arch/gpmc.h>
+#include <asm/arch/nand.h>
 
 #define ONENAND_MAP 0x20000000
 #define GPMC_OFF_CONFIG1_0 0x60
 
+enum fsType {
+	NAND = 0,
+	NOR,
+	ONENAND,
+	UNKNOWN=-1
+};
+
+static enum fsType flashType = NAND;
+
+static struct mtd_partition nand_partitions[] = {
+	{
+		.name		= "X-Loader",
+		.offset		= 0,
+		.size		= 4*(64*2048),  /* 0-3 blks reserved.
+						   Mandated by ROM code */
+		.mask_flags	= MTD_WRITEABLE	/* force read-only */
+	},
+	{
+		.name		= "U-Boot",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		=  4*(64*2048),
+		.mask_flags	= MTD_WRITEABLE	/* force read-only */
+	},
+	{
+		.name		= "U-Boot Environment",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= 2*(64*2048),
+	},
+	{
+		.name		= "Kernel",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= 32*(64*2048),		/* 4*1M */
+	},
+	{
+		.name		= "File System",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= MTDPART_SIZ_FULL,
+	},
+};
+static struct omap_nand_platform_data sdp_nand_data = {
+	.parts		= nand_partitions,
+	.nr_parts	= ARRAY_SIZE(nand_partitions),
+	.dma_channel	= -1,	/* disable DMA in OMAP OneNAND driver */
+};
+
+static struct platform_device sdp_nand_device = {
+	.name		= "omap2-nand",
+	.id		= -1,
+	.dev = {
+		.platform_data = &sdp_nand_data,
+	},
+};
+
 static struct mtd_partition onenand_partitions[] = {
 	{
 		.name		= "(OneNAND)X-Loader",
@@ -82,29 +136,50 @@ void __init sdp2430_flash_init(void)
 		gpmc_cs_base_add =
 			(gpmc_base_add + GPMC_OFF_CONFIG1_0 + (cs*0x30));
 
-		/* xloader/Uboot would have programmed the oneNAND
+		/* xloader/Uboot would have programmed the NAND/oneNAND
 		 * base address for us This is a ugly hack. The proper
 		 * way of doing this is to pass the setup of u-boot up
 		 * to kernel using kernel params - something on the
-		 * lines of machineID. Check if oneNAND is
+		 * lines of machineID. Check if Nand/oneNAND is
 		 * configured */
+		ret = __raw_readl(gpmc_cs_base_add + GPMC_CS_CONFIG1);
+		if ((ret & 0xC00) == (0x800)) {
+			/* Found it!! */
+			printk("NAND: Found NAND on CS %d \n",cs);
+			flashType = NAND; 
+			break;
+		}
 		ret = __raw_readl(gpmc_cs_base_add + GPMC_CS_CONFIG7);
 		if ((ret & 0x3F) == (ONENAND_MAP >> 24)) {
 			/* Found it!! */
+			flashType = ONENAND;
 			break;
 		}
 		cs++;
 	}
 	if (cs >= GPMC_CS_NUM) {
-		printk("OneNAND: Unable to find oneNAND configuration in GPMC "
+		printk("MTD: Unable to find MTD configuration in GPMC "
 		       " - not registering.\n");
 		return;
 	}
 
+	if (flashType == NAND) {
+		sdp_nand_data.cs             = cs;
+		sdp_nand_data.gpmcCsBaseAddr = gpmc_cs_base_add;
+		sdp_nand_data.gpmcBaseAddr   = gpmc_base_add;
+
+		if (platform_device_register(&sdp_nand_device) < 0) {
+			printk(KERN_ERR "Unable to register NAND device\n");
+			return;
+		}
+	}
+
+	if (flashType == ONENAND) {
 	sdp_onenand_data.cs = cs;
 
 	if (platform_device_register(&sdp_onenand_device) < 0) {
 		printk(KERN_ERR "Unable to register OneNAND device\n");
 		return;
 	}
+	}
 }

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

* Re: [PATCH 1/3] [ARM] OMAP: Adding Support for 2K nand page support for omap2430
  2007-07-27 17:10 [PATCH 1/3] [ARM] OMAP: Adding Support for 2K nand page support for omap2430 sshahrom
@ 2007-08-17  0:27 ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2007-08-17  0:27 UTC (permalink / raw)
  To: sshahrom; +Cc: linux-omap-open-source

sshahrom@micron.com wrote:
> Hello,
> Following patches would add support for 2k Page nand with Enabled HW ECC on omap2430 v4.0. It has been Tested with Micron Nand. The Patch is against 2.6.22 linux-omap.git tree. As Always all the comments are welcomed.
> 

Shahrom,

Have you done any testing with your driver with the NAND part on the
2430SDP-v5.0 boards?

Using your driver, the chip is probed/reported correctly (see boot
excerpt below), but the I can't seem to use the MTD tools to work with
any of the partitions?

For example, flash_info gives: 'Device /dev/mtdX has 0 erase regions'
for each partition on the NAND device.  And trying a flash_erase gives
'File open error'.

Any ideas?

Kevin


[...]
omap2-nand driver initializing


NAND device: Manufacturer ID: 0xec, Chip ID: 0x46 (Samsung NAND 64MiB
1,8V 16-bi

t)


2048 byte HW ECC not possible on 512 byte page size, fallback to SW ECC


Creating 5 MTD partitions on "omap2-nand":


0x00000000-0x00080000 : "X-Loader"


0x00080000-0x00100000 : "U-Boot"


0x00100000-0x00140000 : "U-Boot Environment"


0x00140000-0x00540000 : "Kernel"


0x00540000-0x04000000 : "File System"
[...]

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

end of thread, other threads:[~2007-08-17  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 17:10 [PATCH 1/3] [ARM] OMAP: Adding Support for 2K nand page support for omap2430 sshahrom
2007-08-17  0:27 ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox