From c3bbba96a6b92f99bcccc6503e9c1bc558dd8a45 Mon Sep 17 00:00:00 2001 From: Komal Shah Date: Mon, 3 Oct 2005 10:25:18 +0300 Subject: [PATCH] [PATCH] ARM: OMAP: omap24xx Flash support Flash support for OMAP24xx Signed-off-by: Komal Shah Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/board-h4.c | 58 ++++++++++++++++++++++++++++ drivers/mtd/maps/omap_nor.c | 14 ++++--- include/asm-arm/arch-omap/board-h4.h | 2 + 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index c9b7b2766ac..d4a5aa6a5c9 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c @@ -14,11 +14,14 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -29,6 +32,60 @@ #include #include +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) diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index b17bca657da..0fc8c103dba 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c @@ -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; + } } } diff --git a/include/asm-arm/arch-omap/board-h4.h b/include/asm-arm/arch-omap/board-h4.h index d64ee9211ee..0c54a96a823 100644 --- a/include/asm-arm/arch-omap/board-h4.h +++ b/include/asm-arm/arch-omap/board-h4.h @@ -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 */ -- 2.41.0