Commit | Line | Data |
---|---|---|
7c6337e2 KH |
1 | /* |
2 | * TI DaVinci EVM board support | |
3 | * | |
4 | * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> | |
5 | * | |
6 | * 2007 (c) MontaVista Software, Inc. This file is licensed under | |
7 | * the terms of the GNU General Public License version 2. This program | |
8 | * is licensed "as is" without any warranty of any kind, whether express | |
9 | * or implied. | |
10 | */ | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/module.h> | |
13 | #include <linux/init.h> | |
14 | #include <linux/dma-mapping.h> | |
15 | #include <linux/platform_device.h> | |
16 | #include <linux/mtd/mtd.h> | |
17 | #include <linux/mtd/partitions.h> | |
18 | #include <linux/mtd/physmap.h> | |
19 | ||
20 | #include <asm/setup.h> | |
21 | #include <asm/io.h> | |
22 | #include <asm/mach-types.h> | |
a09e64fb | 23 | #include <mach/hardware.h> |
7c6337e2 KH |
24 | |
25 | #include <asm/mach/arch.h> | |
26 | #include <asm/mach/map.h> | |
27 | #include <asm/mach/flash.h> | |
28 | ||
a09e64fb | 29 | #include <mach/common.h> |
7c6337e2 KH |
30 | |
31 | /* other misc. init functions */ | |
32 | void __init davinci_psc_init(void); | |
33 | void __init davinci_irq_init(void); | |
34 | void __init davinci_map_common_io(void); | |
3e062b07 | 35 | void __init davinci_init_common_hw(void); |
7c6337e2 KH |
36 | |
37 | /* NOR Flash base address set to CS0 by default */ | |
38 | #define NOR_FLASH_PHYS 0x02000000 | |
39 | ||
40 | static struct mtd_partition davinci_evm_partitions[] = { | |
41 | /* bootloader (U-Boot, etc) in first 4 sectors */ | |
42 | { | |
43 | .name = "bootloader", | |
44 | .offset = 0, | |
45 | .size = 4 * SZ_64K, | |
46 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
47 | }, | |
48 | /* bootloader params in the next 1 sectors */ | |
49 | { | |
50 | .name = "params", | |
51 | .offset = MTDPART_OFS_APPEND, | |
52 | .size = SZ_64K, | |
53 | .mask_flags = 0, | |
54 | }, | |
55 | /* kernel */ | |
56 | { | |
57 | .name = "kernel", | |
58 | .offset = MTDPART_OFS_APPEND, | |
59 | .size = SZ_2M, | |
60 | .mask_flags = 0 | |
61 | }, | |
62 | /* file system */ | |
63 | { | |
64 | .name = "filesystem", | |
65 | .offset = MTDPART_OFS_APPEND, | |
66 | .size = MTDPART_SIZ_FULL, | |
67 | .mask_flags = 0 | |
68 | } | |
69 | }; | |
70 | ||
71 | static struct physmap_flash_data davinci_evm_flash_data = { | |
72 | .width = 2, | |
73 | .parts = davinci_evm_partitions, | |
74 | .nr_parts = ARRAY_SIZE(davinci_evm_partitions), | |
75 | }; | |
76 | ||
77 | /* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF | |
78 | * limits addresses to 16M, so using addresses past 16M will wrap */ | |
79 | static struct resource davinci_evm_flash_resource = { | |
80 | .start = NOR_FLASH_PHYS, | |
81 | .end = NOR_FLASH_PHYS + SZ_16M - 1, | |
82 | .flags = IORESOURCE_MEM, | |
83 | }; | |
84 | ||
85 | static struct platform_device davinci_evm_flash_device = { | |
86 | .name = "physmap-flash", | |
87 | .id = 0, | |
88 | .dev = { | |
89 | .platform_data = &davinci_evm_flash_data, | |
90 | }, | |
91 | .num_resources = 1, | |
92 | .resource = &davinci_evm_flash_resource, | |
93 | }; | |
94 | ||
95 | static struct platform_device *davinci_evm_devices[] __initdata = { | |
96 | &davinci_evm_flash_device, | |
97 | }; | |
98 | ||
99 | static void __init | |
100 | davinci_evm_map_io(void) | |
101 | { | |
102 | davinci_map_common_io(); | |
103 | } | |
104 | ||
105 | static __init void davinci_evm_init(void) | |
106 | { | |
107 | davinci_psc_init(); | |
108 | ||
109 | #if defined(CONFIG_BLK_DEV_DAVINCI) || defined(CONFIG_BLK_DEV_DAVINCI_MODULE) | |
110 | printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, " | |
111 | "but share pins.\n\t Disable IDE for NOR support.\n"); | |
112 | #endif | |
113 | ||
114 | platform_add_devices(davinci_evm_devices, | |
115 | ARRAY_SIZE(davinci_evm_devices)); | |
116 | } | |
117 | ||
118 | static __init void davinci_evm_irq_init(void) | |
119 | { | |
3e062b07 | 120 | davinci_init_common_hw(); |
7c6337e2 KH |
121 | davinci_irq_init(); |
122 | } | |
123 | ||
124 | MACHINE_START(DAVINCI_EVM, "DaVinci EVM") | |
125 | /* Maintainer: MontaVista Software <source@mvista.com> */ | |
126 | .phys_io = IO_PHYS, | |
127 | .io_pg_offst = (io_p2v(IO_PHYS) >> 18) & 0xfffc, | |
128 | .boot_params = (DAVINCI_DDR_BASE + 0x100), | |
129 | .map_io = davinci_evm_map_io, | |
130 | .init_irq = davinci_evm_irq_init, | |
131 | .timer = &davinci_timer, | |
132 | .init_machine = davinci_evm_init, | |
133 | MACHINE_END |