public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] OMAP3 Beagle: add nand support
@ 2008-06-01  6:38 Steve Sakoman
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Sakoman @ 2008-06-01  6:38 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org

From: Steve Sakoman <steve@sakoman.com>

Add nand support to omap3beagle

Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/mach-omap2/Makefile                  |    3
 arch/arm/mach-omap2/board-omap3beagle-flash.c |  119 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-omap3beagle.c       |    1
 include/asm-arm/arch-omap/board-omap3beagle.h |    2
 4 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 13d0043..d582b8f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -44,7 +44,8 @@ obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
 					   board-omap3evm-flash.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)		+= board-omap3beagle.o \
 					   usb-musb.o usb-ehci.o \
-					   hsmmc.o
+					   hsmmc.o \
+					   board-omap3beagle-flash.o
 obj-$(CONFIG_MACH_OMAP_LDP)		+= board-ldp.o \
 					   hsmmc.o \
 					   usb-musb.o
diff --git a/arch/arm/mach-omap2/board-omap3beagle-flash.c
b/arch/arm/mach-omap2/board-omap3beagle-flash.c
new file mode 100644
index 0000000..5346df0
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3beagle-flash.c
@@ -0,0 +1,119 @@
+/*
+ * board-omap3beagle-flash.c
+ *
+ * Copyright (c) 2008 Texas Instruments
+ *
+ * Modified from board-omap3evm-flash.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/nand.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#include <asm/mach/flash.h>
+#include <asm/arch/board.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/nand.h>
+
+#define GPMC_CS0_BASE  0x60
+#define GPMC_CS_SIZE   0x30
+
+static struct mtd_partition omap3beagle_nand_partitions[] = {
+	/* All the partition sizes are listed in terms of NAND block size */
+	{
+		.name		= "X-Loader",
+		.offset		= 0,
+		.size		= 4*(64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
+		.size		= 15*(64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot Env",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */
+		.size		= 1*(64 * 2048),
+	},
+	{
+		.name		= "Kernel",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
+		.size		= 32*(64 * 2048),
+	},
+	{
+		.name		= "File System",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x680000 */
+		.size		= MTDPART_SIZ_FULL,
+	},
+};
+
+static struct omap_nand_platform_data omap3beagle_nand_data = {
+	.parts		= omap3beagle_nand_partitions,
+	.nr_parts	= ARRAY_SIZE(omap3beagle_nand_partitions),
+	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
+	.nand_setup	= NULL,
+	.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,
+};
+
+
+void __init omap3beagle_flash_init(void)
+{
+	u8 cs = 0;
+	u8 nandcs = GPMC_CS_NUM + 1;
+
+	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
+
+	/* find out the chip-select on which NAND exists */
+	while (cs < GPMC_CS_NUM) {
+		u32 ret = 0;
+		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+
+		if ((ret & 0xC00) == 0x800) {
+			printk(KERN_INFO "Found NAND on CS%d\n", cs);
+			if (nandcs > GPMC_CS_NUM)
+				nandcs = cs;
+		}
+		cs++;
+	}
+
+	if (nandcs > GPMC_CS_NUM) {
+		printk(KERN_INFO "NAND: Unable to find configuration "
+				 "in GPMC\n ");
+		return;
+	}
+
+	if (nandcs < GPMC_CS_NUM) {
+		omap3beagle_nand_data.cs = nandcs;
+		omap3beagle_nand_data.gpmc_cs_baseaddr = (void *)
+			(gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
+		omap3beagle_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
+		if (platform_device_register(&omap3beagle_nand_device) < 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 c992cc7..99e042e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -94,6 +94,7 @@ static void __init omap3_beagle_init(void)
 	hsmmc_init();
 	usb_musb_init();
 	usb_ehci_init();
+	omap3beagle_flash_init();
 }

 arch_initcall(omap3_beagle_i2c_init);
diff --git a/include/asm-arm/arch-omap/board-omap3beagle.h
b/include/asm-arm/arch-omap/board-omap3beagle.h
index 46dff31..26ecfb8 100644
--- a/include/asm-arm/arch-omap/board-omap3beagle.h
+++ b/include/asm-arm/arch-omap/board-omap3beagle.h
@@ -29,5 +29,7 @@
 #ifndef __ASM_ARCH_OMAP3_BEAGLE_H
 #define __ASM_ARCH_OMAP3_BEAGLE_H

+extern void omap3beagle_flash_init(void);
+
 #endif /* __ASM_ARCH_OMAP3_BEAGLE_H */

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

* [PATCH 2/3] OMAP3 Beagle: add nand support
@ 2008-06-11 18:19 Steve Sakoman
  2008-08-04 14:56 ` Koen Kooi
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Sakoman @ 2008-06-11 18:19 UTC (permalink / raw)
  To: linux-omap; +Cc: Steve Sakoman

Add nand support to omap3beagle

Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/mach-omap2/Makefile                  |    3 
 arch/arm/mach-omap2/board-omap3beagle-flash.c |  119 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-omap3beagle.c       |    1 
 include/asm-arm/arch-omap/board-omap3beagle.h |    2 
 4 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 13d0043..d582b8f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -44,7 +44,8 @@ obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
 					   board-omap3evm-flash.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)		+= board-omap3beagle.o \
 					   usb-musb.o usb-ehci.o \
-					   hsmmc.o
+					   hsmmc.o \
+					   board-omap3beagle-flash.o
 obj-$(CONFIG_MACH_OMAP_LDP)		+= board-ldp.o \
 					   hsmmc.o \
 					   usb-musb.o
diff --git a/arch/arm/mach-omap2/board-omap3beagle-flash.c b/arch/arm/mach-omap2/board-omap3beagle-flash.c
new file mode 100644
index 0000000..5346df0
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3beagle-flash.c
@@ -0,0 +1,119 @@
+/*
+ * board-omap3beagle-flash.c
+ *
+ * Copyright (c) 2008 Texas Instruments
+ *
+ * Modified from board-omap3evm-flash.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/nand.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#include <asm/mach/flash.h>
+#include <asm/arch/board.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/nand.h>
+
+#define GPMC_CS0_BASE  0x60
+#define GPMC_CS_SIZE   0x30
+
+static struct mtd_partition omap3beagle_nand_partitions[] = {
+	/* All the partition sizes are listed in terms of NAND block size */
+	{
+		.name		= "X-Loader",
+		.offset		= 0,
+		.size		= 4*(64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
+		.size		= 15*(64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot Env",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */
+		.size		= 1*(64 * 2048),
+	},
+	{
+		.name		= "Kernel",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
+		.size		= 32*(64 * 2048),
+	},
+	{
+		.name		= "File System",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x680000 */
+		.size		= MTDPART_SIZ_FULL,
+	},
+};
+
+static struct omap_nand_platform_data omap3beagle_nand_data = {
+	.parts		= omap3beagle_nand_partitions,
+	.nr_parts	= ARRAY_SIZE(omap3beagle_nand_partitions),
+	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
+	.nand_setup	= NULL,
+	.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,
+};
+
+
+void __init omap3beagle_flash_init(void)
+{
+	u8 cs = 0;
+	u8 nandcs = GPMC_CS_NUM + 1;
+
+	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
+
+	/* find out the chip-select on which NAND exists */
+	while (cs < GPMC_CS_NUM) {
+		u32 ret = 0;
+		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+
+		if ((ret & 0xC00) == 0x800) {
+			printk(KERN_INFO "Found NAND on CS%d\n", cs);
+			if (nandcs > GPMC_CS_NUM)
+				nandcs = cs;
+		}
+		cs++;
+	}
+
+	if (nandcs > GPMC_CS_NUM) {
+		printk(KERN_INFO "NAND: Unable to find configuration "
+				 "in GPMC\n ");
+		return;
+	}
+
+	if (nandcs < GPMC_CS_NUM) {
+		omap3beagle_nand_data.cs = nandcs;
+		omap3beagle_nand_data.gpmc_cs_baseaddr = (void *)
+			(gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
+		omap3beagle_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
+
+		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
+		if (platform_device_register(&omap3beagle_nand_device) < 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 c992cc7..99e042e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -94,6 +94,7 @@ static void __init omap3_beagle_init(void)
 	hsmmc_init();
 	usb_musb_init();
 	usb_ehci_init();
+	omap3beagle_flash_init();
 }
 
 arch_initcall(omap3_beagle_i2c_init);
diff --git a/include/asm-arm/arch-omap/board-omap3beagle.h b/include/asm-arm/arch-omap/board-omap3beagle.h
index 46dff31..26ecfb8 100644
--- a/include/asm-arm/arch-omap/board-omap3beagle.h
+++ b/include/asm-arm/arch-omap/board-omap3beagle.h
@@ -29,5 +29,7 @@
 #ifndef __ASM_ARCH_OMAP3_BEAGLE_H
 #define __ASM_ARCH_OMAP3_BEAGLE_H
 
+extern void omap3beagle_flash_init(void);
+
 #endif /* __ASM_ARCH_OMAP3_BEAGLE_H */
 

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

* Re: [PATCH 2/3] OMAP3 Beagle: add nand support
  2008-06-11 18:19 [PATCH 2/3] OMAP3 Beagle: add nand support Steve Sakoman
@ 2008-08-04 14:56 ` Koen Kooi
  2008-08-05  9:09   ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Koen Kooi @ 2008-08-04 14:56 UTC (permalink / raw)
  To: linux-omap

[-- Attachment #1: Type: text/plain, Size: 5732 bytes --]

Can this patch go in as well today?

regards,

Koen

Op 11 jun 2008, om 20:19 heeft Steve Sakoman het volgende geschreven:

> Add nand support to omap3beagle
>
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
> arch/arm/mach-omap2/Makefile                  |    3
> arch/arm/mach-omap2/board-omap3beagle-flash.c |  119 ++++++++++++++++ 
> ++++++++++
> arch/arm/mach-omap2/board-omap3beagle.c       |    1
> include/asm-arm/arch-omap/board-omap3beagle.h |    2
> 4 files changed, 124 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/ 
> Makefile
> index 13d0043..d582b8f 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -44,7 +44,8 @@ obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> 					   board-omap3evm-flash.o
> obj-$(CONFIG_MACH_OMAP3_BEAGLE)		+= board-omap3beagle.o \
> 					   usb-musb.o usb-ehci.o \
> -					   hsmmc.o
> +					   hsmmc.o \
> +					   board-omap3beagle-flash.o
> obj-$(CONFIG_MACH_OMAP_LDP)		+= board-ldp.o \
> 					   hsmmc.o \
> 					   usb-musb.o
> diff --git a/arch/arm/mach-omap2/board-omap3beagle-flash.c b/arch/ 
> arm/mach-omap2/board-omap3beagle-flash.c
> new file mode 100644
> index 0000000..5346df0
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3beagle-flash.c
> @@ -0,0 +1,119 @@
> +/*
> + * board-omap3beagle-flash.c
> + *
> + * Copyright (c) 2008 Texas Instruments
> + *
> + * Modified from board-omap3evm-flash.c
> + *
> + * This program is free software; you can redistribute it and/or  
> modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <linux/mtd/nand.h>
> +#include <linux/types.h>
> +#include <linux/io.h>
> +
> +#include <asm/mach/flash.h>
> +#include <asm/arch/board.h>
> +#include <asm/arch/gpmc.h>
> +#include <asm/arch/nand.h>
> +
> +#define GPMC_CS0_BASE  0x60
> +#define GPMC_CS_SIZE   0x30
> +
> +static struct mtd_partition omap3beagle_nand_partitions[] = {
> +	/* All the partition sizes are listed in terms of NAND block size */
> +	{
> +		.name		= "X-Loader",
> +		.offset		= 0,
> +		.size		= 4*(64 * 2048),
> +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
> +	},
> +	{
> +		.name		= "U-Boot",
> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
> +		.size		= 15*(64 * 2048),
> +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
> +	},
> +	{
> +		.name		= "U-Boot Env",
> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */
> +		.size		= 1*(64 * 2048),
> +	},
> +	{
> +		.name		= "Kernel",
> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
> +		.size		= 32*(64 * 2048),
> +	},
> +	{
> +		.name		= "File System",
> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x680000 */
> +		.size		= MTDPART_SIZ_FULL,
> +	},
> +};
> +
> +static struct omap_nand_platform_data omap3beagle_nand_data = {
> +	.parts		= omap3beagle_nand_partitions,
> +	.nr_parts	= ARRAY_SIZE(omap3beagle_nand_partitions),
> +	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
> +	.nand_setup	= NULL,
> +	.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,
> +};
> +
> +
> +void __init omap3beagle_flash_init(void)
> +{
> +	u8 cs = 0;
> +	u8 nandcs = GPMC_CS_NUM + 1;
> +
> +	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
> +
> +	/* find out the chip-select on which NAND exists */
> +	while (cs < GPMC_CS_NUM) {
> +		u32 ret = 0;
> +		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
> +
> +		if ((ret & 0xC00) == 0x800) {
> +			printk(KERN_INFO "Found NAND on CS%d\n", cs);
> +			if (nandcs > GPMC_CS_NUM)
> +				nandcs = cs;
> +		}
> +		cs++;
> +	}
> +
> +	if (nandcs > GPMC_CS_NUM) {
> +		printk(KERN_INFO "NAND: Unable to find configuration "
> +				 "in GPMC\n ");
> +		return;
> +	}
> +
> +	if (nandcs < GPMC_CS_NUM) {
> +		omap3beagle_nand_data.cs = nandcs;
> +		omap3beagle_nand_data.gpmc_cs_baseaddr = (void *)
> +			(gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
> +		omap3beagle_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
> +
> +		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
> +		if (platform_device_register(&omap3beagle_nand_device) < 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 c992cc7..99e042e 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -94,6 +94,7 @@ static void __init omap3_beagle_init(void)
> 	hsmmc_init();
> 	usb_musb_init();
> 	usb_ehci_init();
> +	omap3beagle_flash_init();
> }
>
> arch_initcall(omap3_beagle_i2c_init);
> diff --git a/include/asm-arm/arch-omap/board-omap3beagle.h b/include/ 
> asm-arm/arch-omap/board-omap3beagle.h
> index 46dff31..26ecfb8 100644
> --- a/include/asm-arm/arch-omap/board-omap3beagle.h
> +++ b/include/asm-arm/arch-omap/board-omap3beagle.h
> @@ -29,5 +29,7 @@
> #ifndef __ASM_ARCH_OMAP3_BEAGLE_H
> #define __ASM_ARCH_OMAP3_BEAGLE_H
>
> +extern void omap3beagle_flash_init(void);
> +
> #endif /* __ASM_ARCH_OMAP3_BEAGLE_H */
>
> --
> 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
>


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

* Re: [PATCH 2/3] OMAP3 Beagle: add nand support
  2008-08-04 14:56 ` Koen Kooi
@ 2008-08-05  9:09   ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2008-08-05  9:09 UTC (permalink / raw)
  To: Koen Kooi; +Cc: linux-omap

* Koen Kooi <k.kooi@student.utwente.nl> [080804 18:01]:
> Can this patch go in as well today?

Pushing the refreshed series posted by Dirk today.

Tony



> regards,
>
> Koen
>
> Op 11 jun 2008, om 20:19 heeft Steve Sakoman het volgende geschreven:
>
>> Add nand support to omap3beagle
>>
>> Signed-off-by: Steve Sakoman <steve@sakoman.com>
>> ---
>> arch/arm/mach-omap2/Makefile                  |    3
>> arch/arm/mach-omap2/board-omap3beagle-flash.c |  119 ++++++++++++++++ 
>> ++++++++++
>> arch/arm/mach-omap2/board-omap3beagle.c       |    1
>> include/asm-arm/arch-omap/board-omap3beagle.h |    2
>> 4 files changed, 124 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/ 
>> Makefile
>> index 13d0043..d582b8f 100644
>> --- a/arch/arm/mach-omap2/Makefile
>> +++ b/arch/arm/mach-omap2/Makefile
>> @@ -44,7 +44,8 @@ obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
>> 					   board-omap3evm-flash.o
>> obj-$(CONFIG_MACH_OMAP3_BEAGLE)		+= board-omap3beagle.o \
>> 					   usb-musb.o usb-ehci.o \
>> -					   hsmmc.o
>> +					   hsmmc.o \
>> +					   board-omap3beagle-flash.o
>> obj-$(CONFIG_MACH_OMAP_LDP)		+= board-ldp.o \
>> 					   hsmmc.o \
>> 					   usb-musb.o
>> diff --git a/arch/arm/mach-omap2/board-omap3beagle-flash.c b/arch/ 
>> arm/mach-omap2/board-omap3beagle-flash.c
>> new file mode 100644
>> index 0000000..5346df0
>> --- /dev/null
>> +++ b/arch/arm/mach-omap2/board-omap3beagle-flash.c
>> @@ -0,0 +1,119 @@
>> +/*
>> + * board-omap3beagle-flash.c
>> + *
>> + * Copyright (c) 2008 Texas Instruments
>> + *
>> + * Modified from board-omap3evm-flash.c
>> + *
>> + * This program is free software; you can redistribute it and/or  
>> modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/mtd/mtd.h>
>> +#include <linux/mtd/partitions.h>
>> +#include <linux/mtd/nand.h>
>> +#include <linux/types.h>
>> +#include <linux/io.h>
>> +
>> +#include <asm/mach/flash.h>
>> +#include <asm/arch/board.h>
>> +#include <asm/arch/gpmc.h>
>> +#include <asm/arch/nand.h>
>> +
>> +#define GPMC_CS0_BASE  0x60
>> +#define GPMC_CS_SIZE   0x30
>> +
>> +static struct mtd_partition omap3beagle_nand_partitions[] = {
>> +	/* All the partition sizes are listed in terms of NAND block size */
>> +	{
>> +		.name		= "X-Loader",
>> +		.offset		= 0,
>> +		.size		= 4*(64 * 2048),
>> +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
>> +	},
>> +	{
>> +		.name		= "U-Boot",
>> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
>> +		.size		= 15*(64 * 2048),
>> +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
>> +	},
>> +	{
>> +		.name		= "U-Boot Env",
>> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */
>> +		.size		= 1*(64 * 2048),
>> +	},
>> +	{
>> +		.name		= "Kernel",
>> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
>> +		.size		= 32*(64 * 2048),
>> +	},
>> +	{
>> +		.name		= "File System",
>> +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x680000 */
>> +		.size		= MTDPART_SIZ_FULL,
>> +	},
>> +};
>> +
>> +static struct omap_nand_platform_data omap3beagle_nand_data = {
>> +	.parts		= omap3beagle_nand_partitions,
>> +	.nr_parts	= ARRAY_SIZE(omap3beagle_nand_partitions),
>> +	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */
>> +	.nand_setup	= NULL,
>> +	.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,
>> +};
>> +
>> +
>> +void __init omap3beagle_flash_init(void)
>> +{
>> +	u8 cs = 0;
>> +	u8 nandcs = GPMC_CS_NUM + 1;
>> +
>> +	u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
>> +
>> +	/* find out the chip-select on which NAND exists */
>> +	while (cs < GPMC_CS_NUM) {
>> +		u32 ret = 0;
>> +		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
>> +
>> +		if ((ret & 0xC00) == 0x800) {
>> +			printk(KERN_INFO "Found NAND on CS%d\n", cs);
>> +			if (nandcs > GPMC_CS_NUM)
>> +				nandcs = cs;
>> +		}
>> +		cs++;
>> +	}
>> +
>> +	if (nandcs > GPMC_CS_NUM) {
>> +		printk(KERN_INFO "NAND: Unable to find configuration "
>> +				 "in GPMC\n ");
>> +		return;
>> +	}
>> +
>> +	if (nandcs < GPMC_CS_NUM) {
>> +		omap3beagle_nand_data.cs = nandcs;
>> +		omap3beagle_nand_data.gpmc_cs_baseaddr = (void *)
>> +			(gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
>> +		omap3beagle_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
>> +
>> +		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
>> +		if (platform_device_register(&omap3beagle_nand_device) < 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 c992cc7..99e042e 100644
>> --- a/arch/arm/mach-omap2/board-omap3beagle.c
>> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
>> @@ -94,6 +94,7 @@ static void __init omap3_beagle_init(void)
>> 	hsmmc_init();
>> 	usb_musb_init();
>> 	usb_ehci_init();
>> +	omap3beagle_flash_init();
>> }
>>
>> arch_initcall(omap3_beagle_i2c_init);
>> diff --git a/include/asm-arm/arch-omap/board-omap3beagle.h b/include/ 
>> asm-arm/arch-omap/board-omap3beagle.h
>> index 46dff31..26ecfb8 100644
>> --- a/include/asm-arm/arch-omap/board-omap3beagle.h
>> +++ b/include/asm-arm/arch-omap/board-omap3beagle.h
>> @@ -29,5 +29,7 @@
>> #ifndef __ASM_ARCH_OMAP3_BEAGLE_H
>> #define __ASM_ARCH_OMAP3_BEAGLE_H
>>
>> +extern void omap3beagle_flash_init(void);
>> +
>> #endif /* __ASM_ARCH_OMAP3_BEAGLE_H */
>>
>> --
>> 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] 4+ messages in thread

end of thread, other threads:[~2008-08-05  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-11 18:19 [PATCH 2/3] OMAP3 Beagle: add nand support Steve Sakoman
2008-08-04 14:56 ` Koen Kooi
2008-08-05  9:09   ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2008-06-01  6:38 Steve Sakoman

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