* [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
@ 2008-08-26 10:41 vimal singh
2008-09-11 0:11 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: vimal singh @ 2008-08-26 10:41 UTC (permalink / raw)
To: linux-omap
From: Teerth Reddy <teerth@ti.com>
This patch adds NAND support on 3430sdp board
Signed-off-by: Teerth Reddy <teerth@ti.com>
---
arch/arm/mach-omap2/board-3430sdp-flash.c | 88 ++++++++++++++++++++++++++++--
arch/arm/plat-omap/include/mach/gpmc.h | 10 +++
2 files changed, 93 insertions(+), 5 deletions(-)
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp-flash.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp-flash.c
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp-flash.c
@@ -24,6 +24,7 @@
#include <mach/onenand.h>
#include <mach/board.h>
#include <mach/gpmc.h>
+#include <mach/nand.h>
static struct mtd_partition sdp_nor_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
@@ -137,6 +138,61 @@ static int sdp_onenand_setup(void __iome
/* Onenand setup does nothing at present */
return 0;
}
+
+static struct mtd_partition sdp_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = "X-Loader-NAND",
+ .offset = 0,
+ .size = 4 * (64 * 2048),
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "U-Boot-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
+ .size = 4 * (64 * 2048),
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "Boot Env-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
+ .size = 2 * (64 * 2048),
+ },
+ {
+ .name = "Kernel-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x140000 */
+ .size = 32 * (64 * 2048),
+ },
+ {
+ .name = "File System - NAND",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x540000 */
+ },
+};
+
+static struct omap_nand_platform_data sdp_nand_data = {
+ .parts = sdp_nand_partitions,
+ .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
+ .nand_setup = NULL,
+ .dma_channel = -1, /* disable DMA in OMAP NAND driver */
+ .dev_ready = NULL,
+};
+
+static struct resource sdp_nand_resource = {
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device sdp_nand_device = {
+ .name = "omap2-nand",
+ .id = 0,
+ .dev = {
+ .platform_data = &sdp_nand_data,
+ },
+ .num_resources = 1,
+ .resource = &sdp_nand_resource,
+};
+
+
/**
* sdp3430_flash_init - Identify devices connected to GPMC and register.
*
@@ -145,7 +201,11 @@ static int sdp_onenand_setup(void __iome
void __init sdp3430_flash_init(void)
{
u8 cs = 0;
+ u8 nandcs = GPMC_CS_NUM + 1;
u8 onenandcs = GPMC_CS_NUM + 1;
+ unsigned long gpmc_base_add;
+
+ gpmc_base_add = OMAP34XX_GPMC_VIRT;
/* Configure start address and size of NOR device */
if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
@@ -163,25 +223,43 @@ void __init sdp3430_flash_init(void)
while (cs < GPMC_CS_NUM) {
u32 ret = 0;
- ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
/*
- * 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 configured
*/
- if ((ret & 0x3F) == (ONENAND_MAP >> 24))
+ if ((ret & 0xC00) == 0x800) {
+ /* Found it!! */
+ if (nandcs > GPMC_CS_NUM)
+ nandcs = cs;
+ } else {
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ if ((ret & 0x3F) == (ONENAND_MAP >> 24))
onenandcs = cs;
+ }
cs++;
}
- if (onenandcs > GPMC_CS_NUM) {
- printk(KERN_INFO "OneNAND: Unable to find configuration "
+ if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) {
+ printk(KERN_INFO "NAND/OneNAND: Unable to find configuration "
" in GPMC\n ");
return;
}
+ if (nandcs < GPMC_CS_NUM) {
+ sdp_nand_data.cs = nandcs;
+ sdp_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
+ GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE);
+ sdp_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+ if (platform_device_register(&sdp_nand_device) < 0) {
+ printk(KERN_ERR "Unable to register NAND device\n");
+ }
+ }
+
if (onenandcs < GPMC_CS_NUM) {
sdp_onenand_data.cs = onenandcs;
if (platform_device_register(&sdp_onenand_device) < 0)
Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/gpmc.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/gpmc.h
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/gpmc.h
@@ -25,8 +25,18 @@
#define GPMC_CS_NAND_ADDRESS 0x20
#define GPMC_CS_NAND_DATA 0x24
+/*
+ * The following gpmc registers are being used by
+ * nand driver and hence is defined here.
+ * TBD: Move them to gpmc.c by providing appropriate
+ * methods to read and write into these registers
+ */
+#define GPMC_IRQSTATUS 0x18
#define GPMC_CONFIG 0x50
#define GPMC_STATUS 0x54
+#define GPMC_CS0_BASE 0x60
+#define GPMC_CS_SIZE 0x30
+
#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-08-26 10:41 [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430 vimal singh
@ 2008-09-11 0:11 ` Tony Lindgren
0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2008-09-11 0:11 UTC (permalink / raw)
To: vimal singh; +Cc: linux-omap
* vimal singh <vimalsingh@ti.com> [080826 03:42]:
> From: Teerth Reddy <teerth@ti.com>
>
> This patch adds NAND support on 3430sdp board
>
> Signed-off-by: Teerth Reddy <teerth@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp-flash.c | 88 ++++++++++++++++++++++++++++--
> arch/arm/plat-omap/include/mach/gpmc.h | 10 +++
> 2 files changed, 93 insertions(+), 5 deletions(-)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp-flash.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp-flash.c
> +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp-flash.c
> @@ -24,6 +24,7 @@
> #include <mach/onenand.h>
> #include <mach/board.h>
> #include <mach/gpmc.h>
> +#include <mach/nand.h>
>
> static struct mtd_partition sdp_nor_partitions[] = {
> /* bootloader (U-Boot, etc) in first sector */
> @@ -137,6 +138,61 @@ static int sdp_onenand_setup(void __iome
> /* Onenand setup does nothing at present */
> return 0;
> }
> +
> +static struct mtd_partition sdp_nand_partitions[] = {
> + /* All the partition sizes are listed in terms of NAND block size */
> + {
> + .name = "X-Loader-NAND",
> + .offset = 0,
> + .size = 4 * (64 * 2048),
> + .mask_flags = MTD_WRITEABLE, /* force read-only */
> + },
> + {
> + .name = "U-Boot-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
> + .size = 4 * (64 * 2048),
> + .mask_flags = MTD_WRITEABLE, /* force read-only */
> + },
> + {
> + .name = "Boot Env-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
> + .size = 2 * (64 * 2048),
> + },
> + {
> + .name = "Kernel-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x140000 */
> + .size = 32 * (64 * 2048),
> + },
> + {
> + .name = "File System - NAND",
> + .size = MTDPART_SIZ_FULL,
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x540000 */
> + },
> +};
> +
Can you please update this to use the SZ_.. defines for .size as done
now for sdp_nor_partitions?
Thanks,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <41054.192.168.10.89.1219747319.squirrel@dbdmail.itg.ti.com>]
* [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
[not found] <41054.192.168.10.89.1219747319.squirrel@dbdmail.itg.ti.com>
@ 2008-09-11 5:59 ` vimal singh
2008-09-11 6:21 ` David Brownell
[not found] ` <33923.192.168.10.89.1221112795.squirrel@dbdmail.itg.ti.com>
1 sibling, 1 reply; 10+ messages in thread
From: vimal singh @ 2008-09-11 5:59 UTC (permalink / raw)
To: tony; +Cc: linux-omap
Hi,
Below is the updated patch after fixing Tony's comment.
From: Teerth Reddy <teerth@ti.com>
This patch adds NAND support on 3430sdp board
[VS: updated for SZ_.. macros]
Signed-off-by: Teerth Reddy <teerth@ti.com>
Signed-off-by: Vimal Singh <vimal.singh@ti.com>
---
arch/arm/mach-omap2/board-3430sdp-flash.c | 88 ++++++++++++++++++++++++++++--
arch/arm/plat-omap/include/mach/gpmc.h | 10 +++
2 files changed, 93 insertions(+), 5 deletions(-)
Index: linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c
===================================================================
---
linux-omap-2.6_27_08_2008.orig/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-08-27
11:40:26.000000000 +0530
+++
linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-09-11
11:10:44.000000000 +0530
@@ -24,6 +24,7 @@
#include <mach/onenand.h>
#include <mach/board.h>
#include <mach/gpmc.h>
+#include <mach/nand.h>
static struct mtd_partition sdp_nor_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
@@ -137,6 +138,61 @@
/* Onenand setup does nothing at present */
return 0;
}
+
+static struct mtd_partition sdp_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = "X-Loader-NAND",
+ .offset = 0,
+ .size = SZ_512K,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "U-Boot-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
+ .size = SZ_512K,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "Boot Env-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
+ .size = SZ_256K,
+ },
+ {
+ .name = "Kernel-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x140000 */
+ .size = SZ_4M,
+ },
+ {
+ .name = "File System - NAND",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x540000 */
+ },
+};
+
+static struct omap_nand_platform_data sdp_nand_data = {
+ .parts = sdp_nand_partitions,
+ .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
+ .nand_setup = NULL,
+ .dma_channel = -1, /* disable DMA in OMAP NAND driver */
+ .dev_ready = NULL,
+};
+
+static struct resource sdp_nand_resource = {
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device sdp_nand_device = {
+ .name = "omap2-nand",
+ .id = 0,
+ .dev = {
+ .platform_data = &sdp_nand_data,
+ },
+ .num_resources = 1,
+ .resource = &sdp_nand_resource,
+};
+
+
/**
* sdp3430_flash_init - Identify devices connected to GPMC and register.
*
@@ -145,7 +201,11 @@
void __init sdp3430_flash_init(void)
{
u8 cs = 0;
+ u8 nandcs = GPMC_CS_NUM + 1;
u8 onenandcs = GPMC_CS_NUM + 1;
+ unsigned long gpmc_base_add;
+
+ gpmc_base_add = OMAP34XX_GPMC_VIRT;
/* Configure start address and size of NOR device */
if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
@@ -163,25 +223,43 @@
while (cs < GPMC_CS_NUM) {
u32 ret = 0;
- ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
/*
- * 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 configured
*/
- if ((ret & 0x3F) == (ONENAND_MAP >> 24))
+ if ((ret & 0xC00) == 0x800) {
+ /* Found it!! */
+ if (nandcs > GPMC_CS_NUM)
+ nandcs = cs;
+ } else {
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ if ((ret & 0x3F) == (ONENAND_MAP >> 24))
onenandcs = cs;
+ }
cs++;
}
- if (onenandcs > GPMC_CS_NUM) {
- printk(KERN_INFO "OneNAND: Unable to find configuration "
+ if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) {
+ printk(KERN_INFO "NAND/OneNAND: Unable to find configuration "
" in GPMC\n ");
return;
}
+ if (nandcs < GPMC_CS_NUM) {
+ sdp_nand_data.cs = nandcs;
+ sdp_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
+ GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE);
+ sdp_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+ if (platform_device_register(&sdp_nand_device) < 0) {
+ printk(KERN_ERR "Unable to register NAND device\n");
+ }
+ }
+
if (onenandcs < GPMC_CS_NUM) {
sdp_onenand_data.cs = onenandcs;
if (platform_device_register(&sdp_onenand_device) < 0)
Index: linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h
===================================================================
---
linux-omap-2.6_27_08_2008.orig/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
11:40:27.000000000 +0530
+++ linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
15:21:22.000000000 +0530
@@ -25,8 +25,18 @@
#define GPMC_CS_NAND_ADDRESS 0x20
#define GPMC_CS_NAND_DATA 0x24
+/*
+ * The following gpmc registers are being used by
+ * nand driver and hence is defined here.
+ * TBD: Move them to gpmc.c by providing appropriate
+ * methods to read and write into these registers
+ */
+#define GPMC_IRQSTATUS 0x18
#define GPMC_CONFIG 0x50
#define GPMC_STATUS 0x54
+#define GPMC_CS0_BASE 0x60
+#define GPMC_CS_SIZE 0x30
+
#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-09-11 5:59 ` vimal singh
@ 2008-09-11 6:21 ` David Brownell
2008-09-11 8:50 ` Singh, Vimal
0 siblings, 1 reply; 10+ messages in thread
From: David Brownell @ 2008-09-11 6:21 UTC (permalink / raw)
To: vimal singh; +Cc: tony, linux-omap
On Wednesday 10 September 2008, vimal singh wrote:
> [VS: updated for SZ_.. macros]
> + /* All the partition sizes are listed in terms of NAND block size
> ...
> + .size = SZ_512K,
> ...
> + .size = SZ_512K,
> ...
But now they're not "in terms of NAND block size".
Wouldn't it be better to use either 4 * SZ_128K or 4 * NAND_BLOCK_SIZE?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-09-11 6:21 ` David Brownell
@ 2008-09-11 8:50 ` Singh, Vimal
2008-09-11 9:31 ` David Brownell
0 siblings, 1 reply; 10+ messages in thread
From: Singh, Vimal @ 2008-09-11 8:50 UTC (permalink / raw)
To: David Brownell; +Cc: tony@atomide.com, linux-omap@vger.kernel.org
> > + /* All the partition sizes are listed in terms of NAND block size
> > ...
> > + .size = SZ_512K,
> > ...
> > + .size = SZ_512K,
> > ...
>
> But now they're not "in terms of NAND block size".
Agree.
>
> Wouldn't it be better to use either 4 * SZ_128K or 4 * NAND_BLOCK_SIZE?
4 * NAND_BLOCK_SIZE looks much better. I'll send patch after updating for this.
I will define NAND_BLOCK_SIZE as:
#define NAND_BLOCK_SIZE 64 * NAND_MAX_PAGESIZE
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-09-11 8:50 ` Singh, Vimal
@ 2008-09-11 9:31 ` David Brownell
0 siblings, 0 replies; 10+ messages in thread
From: David Brownell @ 2008-09-11 9:31 UTC (permalink / raw)
To: Singh, Vimal; +Cc: tony@atomide.com, linux-omap@vger.kernel.org
On Thursday 11 September 2008, Singh, Vimal wrote:
> I will define NAND_BLOCK_SIZE as:
> #define NAND_BLOCK_SIZE 64 * NAND_MAX_PAGESIZE
Never define such things without parentheses ...
Also, that looks wrong as well as sub-optimal. Current NAND chips
can have page sizes up to 4 KB (right?), so I think "MAX" isn't
what you would want (even if it never grows again).
I'd just use SZ_128K for NAND_BLOCK_SIZE, and avoid the confusion.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <33923.192.168.10.89.1221112795.squirrel@dbdmail.itg.ti.com>]
* [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
[not found] ` <33923.192.168.10.89.1221112795.squirrel@dbdmail.itg.ti.com>
@ 2008-09-11 10:06 ` vimal singh
2008-10-06 11:20 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: vimal singh @ 2008-09-11 10:06 UTC (permalink / raw)
To: linux-omap
From: Teerth Reddy <teerth@ti.com>
This patch adds NAND support on 3430sdp board
[VS: updated for NAND_BLOCK_SIZE macros]
Signed-off-by: Teerth Reddy <teerth@ti.com>
Signed-off-by: Vimal Singh <vimal.singh@ti.com>
---
arch/arm/mach-omap2/board-3430sdp-flash.c | 87 ++++++++++++++++++++++++++++--
arch/arm/plat-omap/include/mach/gpmc.h | 10 +++
include/linux/mtd/nand.h | 2
3 files changed, 93 insertions(+), 6 deletions(-)
Index: linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c
===================================================================
---
linux-omap-2.6_27_08_2008.orig/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-08-27
11:40:26.000000000 +0530
+++
linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-09-11
15:21:10.000000000 +0530
@@ -24,6 +24,7 @@
#include <mach/onenand.h>
#include <mach/board.h>
#include <mach/gpmc.h>
+#include <mach/nand.h>
static struct mtd_partition sdp_nor_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
@@ -137,6 +138,61 @@
/* Onenand setup does nothing at present */
return 0;
}
+
+static struct mtd_partition sdp_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = "X-Loader-NAND",
+ .offset = 0,
+ .size = 4 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "U-Boot-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
+ .size = 4 * NAND_BLOCK_SIZE,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ .name = "Boot Env-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
+ .size = 2 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = "Kernel-NAND",
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x140000 */
+ .size = 32 * NAND_BLOCK_SIZE,
+ },
+ {
+ .name = "File System - NAND",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_APPEND, /* Offset = 0x540000 */
+ },
+};
+
+static struct omap_nand_platform_data sdp_nand_data = {
+ .parts = sdp_nand_partitions,
+ .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
+ .nand_setup = NULL,
+ .dma_channel = -1, /* disable DMA in OMAP NAND driver */
+ .dev_ready = NULL,
+};
+
+static struct resource sdp_nand_resource = {
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device sdp_nand_device = {
+ .name = "omap2-nand",
+ .id = 0,
+ .dev = {
+ .platform_data = &sdp_nand_data,
+ },
+ .num_resources = 1,
+ .resource = &sdp_nand_resource,
+};
+
+
/**
* sdp3430_flash_init - Identify devices connected to GPMC and register.
*
@@ -145,7 +201,11 @@
void __init sdp3430_flash_init(void)
{
u8 cs = 0;
+ u8 nandcs = GPMC_CS_NUM + 1;
u8 onenandcs = GPMC_CS_NUM + 1;
+ unsigned long gpmc_base_add;
+
+ gpmc_base_add = OMAP34XX_GPMC_VIRT;
/* Configure start address and size of NOR device */
if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
@@ -163,25 +223,42 @@
while (cs < GPMC_CS_NUM) {
u32 ret = 0;
- ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
/*
- * 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 configured
*/
- if ((ret & 0x3F) == (ONENAND_MAP >> 24))
+ if ((ret & 0xC00) == 0x800) {
+ /* Found it!! */
+ if (nandcs > GPMC_CS_NUM)
+ nandcs = cs;
+ } else {
+ ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+ if ((ret & 0x3F) == (ONENAND_MAP >> 24))
onenandcs = cs;
+ }
cs++;
}
- if (onenandcs > GPMC_CS_NUM) {
- printk(KERN_INFO "OneNAND: Unable to find configuration "
+ if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) {
+ printk(KERN_INFO "NAND/OneNAND: Unable to find configuration "
" in GPMC\n ");
return;
}
+ if (nandcs < GPMC_CS_NUM) {
+ sdp_nand_data.cs = nandcs;
+ sdp_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
+ GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE);
+ sdp_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+ if (platform_device_register(&sdp_nand_device) < 0)
+ printk(KERN_ERR "Unable to register NAND device\n");
+ }
+
if (onenandcs < GPMC_CS_NUM) {
sdp_onenand_data.cs = onenandcs;
if (platform_device_register(&sdp_onenand_device) < 0)
Index: linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h
===================================================================
---
linux-omap-2.6_27_08_2008.orig/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
11:40:27.000000000 +0530
+++ linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
15:21:22.000000000 +0530
@@ -25,8 +25,18 @@
#define GPMC_CS_NAND_ADDRESS 0x20
#define GPMC_CS_NAND_DATA 0x24
+/*
+ * The following gpmc registers are being used by
+ * nand driver and hence is defined here.
+ * TBD: Move them to gpmc.c by providing appropriate
+ * methods to read and write into these registers
+ */
+#define GPMC_IRQSTATUS 0x18
#define GPMC_CONFIG 0x50
#define GPMC_STATUS 0x54
+#define GPMC_CS0_BASE 0x60
+#define GPMC_CS_SIZE 0x30
+
#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
Index: linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h
===================================================================
--- linux-omap-2.6_27_08_2008.orig/include/linux/mtd/nand.h 2008-09-11
12:18:05.000000000 +0530
+++ linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h 2008-09-11
15:04:31.000000000 +0530
@@ -45,7 +45,7 @@
*/
#define NAND_MAX_OOBSIZE 64
#define NAND_MAX_PAGESIZE 2048
-
+#define NAND_BLOCK_SIZE SZ_128K
/*
* Constants for hardware specific CLE/ALE/NCE function
*
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-09-11 10:06 ` vimal singh
@ 2008-10-06 11:20 ` Tony Lindgren
2008-10-06 16:37 ` David Brownell
0 siblings, 1 reply; 10+ messages in thread
From: Tony Lindgren @ 2008-10-06 11:20 UTC (permalink / raw)
To: vimal singh; +Cc: linux-omap
* vimal singh <vimalsingh@ti.com> [080911 13:07]:
> From: Teerth Reddy <teerth@ti.com>
>
> This patch adds NAND support on 3430sdp board
>
> [VS: updated for NAND_BLOCK_SIZE macros]
Pushing today.
Tony
> Signed-off-by: Teerth Reddy <teerth@ti.com>
> Signed-off-by: Vimal Singh <vimal.singh@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp-flash.c | 87 ++++++++++++++++++++++++++++--
> arch/arm/plat-omap/include/mach/gpmc.h | 10 +++
> include/linux/mtd/nand.h | 2
> 3 files changed, 93 insertions(+), 6 deletions(-)
>
> Index: linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c
> ===================================================================
> ---
> linux-omap-2.6_27_08_2008.orig/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-08-27
> 11:40:26.000000000 +0530
> +++
> linux-omap-2.6_27_08_2008/arch/arm/mach-omap2/board-3430sdp-flash.c 2008-09-11
> 15:21:10.000000000 +0530
> @@ -24,6 +24,7 @@
> #include <mach/onenand.h>
> #include <mach/board.h>
> #include <mach/gpmc.h>
> +#include <mach/nand.h>
>
> static struct mtd_partition sdp_nor_partitions[] = {
> /* bootloader (U-Boot, etc) in first sector */
> @@ -137,6 +138,61 @@
> /* Onenand setup does nothing at present */
> return 0;
> }
> +
> +static struct mtd_partition sdp_nand_partitions[] = {
> + /* All the partition sizes are listed in terms of NAND block size */
> + {
> + .name = "X-Loader-NAND",
> + .offset = 0,
> + .size = 4 * NAND_BLOCK_SIZE,
> + .mask_flags = MTD_WRITEABLE, /* force read-only */
> + },
> + {
> + .name = "U-Boot-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
> + .size = 4 * NAND_BLOCK_SIZE,
> + .mask_flags = MTD_WRITEABLE, /* force read-only */
> + },
> + {
> + .name = "Boot Env-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
> + .size = 2 * NAND_BLOCK_SIZE,
> + },
> + {
> + .name = "Kernel-NAND",
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x140000 */
> + .size = 32 * NAND_BLOCK_SIZE,
> + },
> + {
> + .name = "File System - NAND",
> + .size = MTDPART_SIZ_FULL,
> + .offset = MTDPART_OFS_APPEND, /* Offset = 0x540000 */
> + },
> +};
> +
> +static struct omap_nand_platform_data sdp_nand_data = {
> + .parts = sdp_nand_partitions,
> + .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
> + .nand_setup = NULL,
> + .dma_channel = -1, /* disable DMA in OMAP NAND driver */
> + .dev_ready = NULL,
> +};
> +
> +static struct resource sdp_nand_resource = {
> + .flags = IORESOURCE_MEM,
> +};
> +
> +static struct platform_device sdp_nand_device = {
> + .name = "omap2-nand",
> + .id = 0,
> + .dev = {
> + .platform_data = &sdp_nand_data,
> + },
> + .num_resources = 1,
> + .resource = &sdp_nand_resource,
> +};
> +
> +
> /**
> * sdp3430_flash_init - Identify devices connected to GPMC and register.
> *
> @@ -145,7 +201,11 @@
> void __init sdp3430_flash_init(void)
> {
> u8 cs = 0;
> + u8 nandcs = GPMC_CS_NUM + 1;
> u8 onenandcs = GPMC_CS_NUM + 1;
> + unsigned long gpmc_base_add;
> +
> + gpmc_base_add = OMAP34XX_GPMC_VIRT;
>
> /* Configure start address and size of NOR device */
> if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
> @@ -163,25 +223,42 @@
>
> while (cs < GPMC_CS_NUM) {
> u32 ret = 0;
> - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
> + ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
>
> /*
> - * 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 configured
> */
> - if ((ret & 0x3F) == (ONENAND_MAP >> 24))
> + if ((ret & 0xC00) == 0x800) {
> + /* Found it!! */
> + if (nandcs > GPMC_CS_NUM)
> + nandcs = cs;
> + } else {
> + ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
> + if ((ret & 0x3F) == (ONENAND_MAP >> 24))
> onenandcs = cs;
> + }
> cs++;
> }
> - if (onenandcs > GPMC_CS_NUM) {
> - printk(KERN_INFO "OneNAND: Unable to find configuration "
> + if ((nandcs > GPMC_CS_NUM) && (onenandcs > GPMC_CS_NUM)) {
> + printk(KERN_INFO "NAND/OneNAND: Unable to find configuration "
> " in GPMC\n ");
> return;
> }
>
> + if (nandcs < GPMC_CS_NUM) {
> + sdp_nand_data.cs = nandcs;
> + sdp_nand_data.gpmc_cs_baseaddr = (void *)(gpmc_base_add +
> + GPMC_CS0_BASE + nandcs*GPMC_CS_SIZE);
> + sdp_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
> +
> + if (platform_device_register(&sdp_nand_device) < 0)
> + printk(KERN_ERR "Unable to register NAND device\n");
> + }
> +
> if (onenandcs < GPMC_CS_NUM) {
> sdp_onenand_data.cs = onenandcs;
> if (platform_device_register(&sdp_onenand_device) < 0)
> Index: linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h
> ===================================================================
> ---
> linux-omap-2.6_27_08_2008.orig/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
> 11:40:27.000000000 +0530
> +++ linux-omap-2.6_27_08_2008/arch/arm/plat-omap/include/mach/gpmc.h 2008-08-27
> 15:21:22.000000000 +0530
> @@ -25,8 +25,18 @@
> #define GPMC_CS_NAND_ADDRESS 0x20
> #define GPMC_CS_NAND_DATA 0x24
>
> +/*
> + * The following gpmc registers are being used by
> + * nand driver and hence is defined here.
> + * TBD: Move them to gpmc.c by providing appropriate
> + * methods to read and write into these registers
> + */
> +#define GPMC_IRQSTATUS 0x18
> #define GPMC_CONFIG 0x50
> #define GPMC_STATUS 0x54
> +#define GPMC_CS0_BASE 0x60
> +#define GPMC_CS_SIZE 0x30
> +
>
> #define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
> #define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
> Index: linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h
> ===================================================================
> --- linux-omap-2.6_27_08_2008.orig/include/linux/mtd/nand.h 2008-09-11
> 12:18:05.000000000 +0530
> +++ linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h 2008-09-11
> 15:04:31.000000000 +0530
> @@ -45,7 +45,7 @@
> */
> #define NAND_MAX_OOBSIZE 64
> #define NAND_MAX_PAGESIZE 2048
> -
> +#define NAND_BLOCK_SIZE SZ_128K
> /*
> * Constants for hardware specific CLE/ALE/NCE function
> *
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-10-06 11:20 ` Tony Lindgren
@ 2008-10-06 16:37 ` David Brownell
2008-10-07 5:28 ` Singh, Vimal
0 siblings, 1 reply; 10+ messages in thread
From: David Brownell @ 2008-10-06 16:37 UTC (permalink / raw)
To: Tony Lindgren, vimal singh; +Cc: linux-omap
On Monday 06 October 2008, Tony Lindgren wrote:
> > --- linux-omap-2.6_27_08_2008.orig/include/linux/mtd/nand.h
> > +++ linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h
> > @@ -45,7 +45,7 @@
> > */
> > #define NAND_MAX_OOBSIZE 64
> > #define NAND_MAX_PAGESIZE 2048
> > -
> > +#define NAND_BLOCK_SIZE SZ_128K
> > /*
This is specific to 3430 SDP though ... there are plenty
of other NAND block sizes in the world.
Suggest moving this definition to board-3430sdp-flash.c
where it's relevant.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430
2008-10-06 16:37 ` David Brownell
@ 2008-10-07 5:28 ` Singh, Vimal
0 siblings, 0 replies; 10+ messages in thread
From: Singh, Vimal @ 2008-10-07 5:28 UTC (permalink / raw)
To: David Brownell, Tony Lindgren; +Cc: linux-omap@vger.kernel.org
On Modday 06 October 2008, Devid Brownell wrote:
> On Monday 06 October 2008, Tony Lindgren wrote:
> > > --- linux-omap-2.6_27_08_2008.orig/include/linux/mtd/nand.h
> > > +++ linux-omap-2.6_27_08_2008/include/linux/mtd/nand.h
> > > @@ -45,7 +45,7 @@
> > > */
> > > #define NAND_MAX_OOBSIZE 64
> > > #define NAND_MAX_PAGESIZE 2048
> > > -
> > > +#define NAND_BLOCK_SIZE SZ_128K
> > > /*
>
> This is specific to 3430 SDP though ... there are plenty
> of other NAND block sizes in the world.
>
> Suggest moving this definition to board-3430sdp-flash.c
> where it's relevant.
Agree. I will send a patch to move it.
...
vimal
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-10-07 5:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 10:41 [RESENDING][PATCH 1/2]OMAP3 NAND: Add NAND support on OMAP3430 vimal singh
2008-09-11 0:11 ` Tony Lindgren
[not found] <41054.192.168.10.89.1219747319.squirrel@dbdmail.itg.ti.com>
2008-09-11 5:59 ` vimal singh
2008-09-11 6:21 ` David Brownell
2008-09-11 8:50 ` Singh, Vimal
2008-09-11 9:31 ` David Brownell
[not found] ` <33923.192.168.10.89.1221112795.squirrel@dbdmail.itg.ti.com>
2008-09-11 10:06 ` vimal singh
2008-10-06 11:20 ` Tony Lindgren
2008-10-06 16:37 ` David Brownell
2008-10-07 5:28 ` Singh, Vimal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox