]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ARM: OMAP: omap24xx Flash support
authorKomal Shah <komal_shah802003@yahoo.com>
Fri, 30 Sep 2005 10:43:00 +0000 (13:43 +0300)
committerTony Lindgren <tony@atomide.com>
Fri, 30 Sep 2005 10:43:00 +0000 (13:43 +0300)
Flash support for OMAP24xx

Signed-off-by: Komal Shah <komal_shah802003@yahoo.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-h4.c
drivers/mtd/maps/omap_nor.c
include/asm-arm/arch-omap/board-h4.h

index c9b7b2766ac33b9b6c285cbb643787e95de1c3e0..d4a5aa6a5c90272792f572a495a008cfc6b48ce9 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/mach/flash.h>
 
 #include <asm/arch/gpio.h>
 #include <asm/arch/mux.h>
 #include <asm/io.h>
 #include <asm/delay.h>
 
+static struct mtd_partition h4_partitions[] = {
+       /* bootloader (U-Boot, etc) in first sector */
+       {
+             .name             = "bootloader",
+             .offset           = 0,
+             .size             = SZ_128K,
+             .mask_flags       = MTD_WRITEABLE, /* force read-only */
+       },
+       /* bootloader params in the next sector */
+       {
+             .name             = "params",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_128K,
+             .mask_flags       = 0,
+       },
+       /* kernel */
+       {
+             .name             = "kernel",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_2M,
+             .mask_flags       = 0
+       },
+       /* file system */
+       {
+             .name             = "filesystem",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = MTDPART_SIZ_FULL,
+             .mask_flags       = 0
+       }
+};
+
+static struct flash_platform_data h4_flash_data = {
+       .map_name       = "cfi_probe",
+       .width          = 2,
+       .parts          = h4_partitions,
+       .nr_parts       = ARRAY_SIZE(h4_partitions),
+};
+
+static struct resource h4_flash_resource = {
+       .start          = H4_CS0_BASE,
+       .end            = H4_CS0_BASE + SZ_64M - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device h4_flash_device = {
+       .name           = "omapflash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &h4_flash_data,
+       },
+       .num_resources  = 1,
+       .resource       = &h4_flash_resource,
+};
+
 static struct resource h4_smc91x_resources[] = {
        [0] = {
                .start  = OMAP24XX_ETHR_START,          /* Physical */
@@ -51,6 +108,7 @@ static struct platform_device h4_smc91x_device = {
 
 static struct platform_device *h4_devices[] __initdata = {
        &h4_smc91x_device,
+       &h4_flash_device,
 };
 
 static inline void __init h4_init_smc91x(void)
index b17bca657daf53599d8e8328ee1110b08cb50e95..0fc8c103dbaeb355eca102fe06bac641bc7cdfa6 100644 (file)
@@ -59,12 +59,14 @@ static void omap_set_vpp(struct map_info *map, int enable)
 {
        static int      count;
 
-       if (enable) {
-               if (count++ == 0)
-                       OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP;
-       } else {
-               if (count && (--count == 0))
-                       OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP;
+       if (!cpu_is_omap24xx()) {
+               if (enable) {
+                       if (count++ == 0)
+                               OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP;
+               } else {
+                       if (count && (--count == 0))
+                               OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP;
+               }
        }
 }
 
index d64ee9211eeddc63fbb888421f01157f72f382a1..0c54a96a823d1af26427dec597ede8fa0f56615b 100644 (file)
@@ -34,5 +34,7 @@
 #define OMAP24XX_ETHR_START             0x08000300
 #define OMAP24XX_ETHR_GPIO_IRQ         92
 
+#define H4_CS0_BASE                 0x04000000
+
 #endif /*  __ASM_ARCH_OMAP_H4_H */