]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP3 EVM: add onenand flash support
authorSteve Sakoman <steve@sakoman.com>
Mon, 28 Apr 2008 23:29:14 +0000 (16:29 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 2 May 2008 23:06:37 +0000 (16:06 -0700)
Add onenand support for OMAP3 EVM

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Acked-by: Syed Mohammed Khasim <khasim@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/board-omap3evm-flash.c [new file with mode: 0644]
arch/arm/mach-omap2/board-omap3evm.c
include/asm-arm/arch-omap/board-omap3evm.h

index 3b8d194b0225e6bdca8070352b3b71d9a218a0cd..552664c73d99d28011f5d654f8a7fa2bc8e7ac85 100644 (file)
@@ -39,7 +39,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP)               += board-3430sdp.o \
                                           board-3430sdp-flash.o
 obj-$(CONFIG_MACH_OMAP3EVM)            += board-omap3evm.o \
                                           hsmmc.o \
-                                          usb-musb.o usb-ehci.o
+                                          usb-musb.o usb-ehci.o \
+                                          board-omap3evm-flash.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)                += board-omap3beagle.o \
                                           usb-musb.o usb-ehci.o \
                                           hsmmc.o
diff --git a/arch/arm/mach-omap2/board-omap3evm-flash.c b/arch/arm/mach-omap2/board-omap3evm-flash.c
new file mode 100644 (file)
index 0000000..109d8f2
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * board-omap3evm-flash.c
+ *
+ * Copyright (c) 2008 Texas Instruments,
+ *
+ * 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/mtd/onenand_regs.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#include <asm/mach/flash.h>
+#include <asm/arch/onenand.h>
+#include <asm/arch/board.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/nand.h>
+
+static int omap3evm_onenand_setup(void __iomem *);
+
+static struct mtd_partition omap3evm_onenand_partitions[] = {
+       {
+               .name           = "xloader",
+               .offset         = 0,
+               .size           = 4*(64*2048),
+               .mask_flags     = MTD_WRITEABLE
+       },
+       {
+               .name           = "uboot",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           =  15*(64*2048),
+               .mask_flags     = MTD_WRITEABLE
+       },
+       {
+               .name           = "params",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           = 1*(64*2048),
+       },
+       {
+               .name           = "linux",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           = 40*(64*2048),
+       },
+       {
+               .name           = "jffs2",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           = MTDPART_SIZ_FULL,
+       },
+};
+
+static struct omap_onenand_platform_data omap3evm_onenand_data = {
+       .parts = omap3evm_onenand_partitions,
+       .nr_parts = ARRAY_SIZE(omap3evm_onenand_partitions),
+       .onenand_setup = omap3evm_onenand_setup,
+       .dma_channel    = -1,   /* disable DMA in OMAP OneNAND driver */
+};
+
+static struct platform_device omap3evm_onenand_device = {
+       .name           = "omap2-onenand",
+       .id             = -1,
+       .dev = {
+               .platform_data = &omap3evm_onenand_data,
+       },
+};
+
+/*
+ *      omap3evm_onenand_setup - Set the onenand sync mode
+ *      @onenand_base:  The onenand base address in GPMC memory map
+ *
+ */
+
+static int omap3evm_onenand_setup(void __iomem *onenand_base)
+       {
+       /* nothing is required to be setup for onenand as of now */
+       return 0;
+}
+
+void __init omap3evm_flash_init(void)
+{
+       u8              cs = 0;
+       u8              onenandcs = GPMC_CS_NUM + 1;
+
+       while (cs < GPMC_CS_NUM) {
+               u32 ret = 0;
+               ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
+
+               /*
+               * xloader/Uboot would have programmed the 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))
+                       onenandcs = cs;
+               cs++;
+       }
+       if (onenandcs > GPMC_CS_NUM) {
+               printk(KERN_INFO "OneNAND: Unable to find configuration "
+                               " in GPMC\n ");
+               return;
+       }
+
+       if (onenandcs < GPMC_CS_NUM) {
+               omap3evm_onenand_data.cs = onenandcs;
+               if (platform_device_register(&omap3evm_onenand_device) < 0)
+                       printk(KERN_ERR "Unable to register OneNAND device\n");
+       }
+}
+
index 5fafcdb0e3db857a3e3bd4609070241e249a5519..152e8af88e5c26365b9146e249bc434f15eb8c5d 100644 (file)
@@ -71,6 +71,7 @@ static void __init omap3_evm_init(void)
        hsmmc_init();
        usb_musb_init();
        usb_ehci_init();
+       omap3evm_flash_init();
 }
 
 arch_initcall(omap3_evm_i2c_init);
index c90ffc0199709a434759f2ffc8e5230396164a5b..c8f2446b7df419cbcbe3744eb9536927d12ad271 100644 (file)
 #ifndef __ASM_ARCH_OMAP3_EVM_H
 #define __ASM_ARCH_OMAP3_EVM_H
 
+extern void omap3evm_flash_init(void);
+
 #define TWL4030_IRQNUM         INT_34XX_SYS_NIRQ
 
+#define ONENAND_MAP            0x20000000
+
 #endif /* __ASM_ARCH_OMAP3_EVM_H */