Commit cc6d3ff3 authored by Kevin Hilman's avatar Kevin Hilman

ARM: DaVinci: Add NOR flash support using MTD physmap layer

Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
parent 7dcab67c
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
#include <linux/usb_musb.h> #include <linux/usb_musb.h>
#endif #endif
...@@ -54,6 +57,61 @@ ...@@ -54,6 +57,61 @@
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include "clock.h" #include "clock.h"
static struct mtd_partition davinci_evm_partitions[] = {
/* bootloader (U-Boot, etc) in first 4 sectors */
{
.name = "bootloader",
.offset = 0,
.size = 4 * SZ_64K,
.mask_flags = MTD_WRITEABLE, /* force read-only */
},
/* bootloader params in the next 1 sectors */
{
.name = "params",
.offset = MTDPART_OFS_APPEND,
.size = SZ_64K,
.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 physmap_flash_data davinci_evm_flash_data = {
.width = 2,
.parts = davinci_evm_partitions,
.nr_parts = ARRAY_SIZE(davinci_evm_partitions),
};
/* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
* limits addresses to 16M, so using addresses past 16M will wrap */
static struct resource davinci_evm_flash_resource = {
.start = DAVINCI_CS0_PHYS,
.end = DAVINCI_CS0_PHYS + SZ_16M - 1,
.flags = IORESOURCE_MEM,
};
static struct platform_device davinci_evm_flash_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &davinci_evm_flash_data,
},
.num_resources = 1,
.resource = &davinci_evm_flash_resource,
};
/* /*
* USB * USB
*/ */
...@@ -121,6 +179,10 @@ static inline void setup_usb(void) ...@@ -121,6 +179,10 @@ static inline void setup_usb(void)
#define setup_usb(void) do {} while(0) #define setup_usb(void) do {} while(0)
#endif /* CONFIG_USB_MUSB_HDRC */ #endif /* CONFIG_USB_MUSB_HDRC */
static struct platform_device *davinci_evm_devices[] __initdata = {
&davinci_evm_flash_device,
};
static void board_init(void) static void board_init(void)
{ {
board_setup_psc(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSMSTR, 1); board_setup_psc(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSMSTR, 1);
...@@ -144,6 +206,9 @@ davinci_evm_map_io(void) ...@@ -144,6 +206,9 @@ davinci_evm_map_io(void)
static __init void davinci_evm_init(void) static __init void davinci_evm_init(void)
{ {
platform_add_devices(davinci_evm_devices,
ARRAY_SIZE(davinci_evm_devices));
davinci_serial_init(); davinci_serial_init();
setup_usb(); setup_usb();
} }
......
...@@ -127,4 +127,7 @@ ...@@ -127,4 +127,7 @@
#define DAVINCI_LPSC_GEM 39 // GEM LPSC #define DAVINCI_LPSC_GEM 39 // GEM LPSC
#define DAVINCI_LPSC_IMCOP 40 // IMCOP LPSC #define DAVINCI_LPSC_IMCOP 40 // IMCOP LPSC
/* NOR Flash base address set to CS0 by default */
#define DAVINCI_CS0_PHYS 0x02000000
#endif /* __ASM_ARCH_HARDWARE_H */ #endif /* __ASM_ARCH_HARDWARE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment