Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
dbdf9ced | 2 | * linux/arch/arm/mach-omap1/board-innovator.c |
1da177e4 LT |
3 | * |
4 | * Board specific inits for OMAP-1510 and OMAP-1610 Innovator | |
5 | * | |
6 | * Copyright (C) 2001 RidgeRun, Inc. | |
7 | * Author: Greg Lonnon <glonnon@ridgerun.com> | |
8 | * | |
9 | * Copyright (C) 2002 MontaVista Software, Inc. | |
10 | * | |
11 | * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6 | |
12 | * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com> | |
13 | * | |
14 | * This program is free software; you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License version 2 as | |
16 | * published by the Free Software Foundation. | |
17 | */ | |
18 | ||
19 | #include <linux/kernel.h> | |
20 | #include <linux/init.h> | |
d052d1be | 21 | #include <linux/platform_device.h> |
1da177e4 LT |
22 | #include <linux/delay.h> |
23 | #include <linux/mtd/mtd.h> | |
24 | #include <linux/mtd/partitions.h> | |
25 | ||
26 | #include <asm/hardware.h> | |
27 | #include <asm/mach-types.h> | |
28 | #include <asm/mach/arch.h> | |
29 | #include <asm/mach/flash.h> | |
30 | #include <asm/mach/map.h> | |
31 | ||
7c38cf02 | 32 | #include <asm/arch/mux.h> |
1da177e4 LT |
33 | #include <asm/arch/fpga.h> |
34 | #include <asm/arch/gpio.h> | |
35 | #include <asm/arch/tc.h> | |
36 | #include <asm/arch/usb.h> | |
d48af15e | 37 | #include <asm/arch/common.h> |
1da177e4 LT |
38 | |
39 | static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; | |
40 | ||
41 | static struct mtd_partition innovator_partitions[] = { | |
42 | /* bootloader (U-Boot, etc) in first sector */ | |
43 | { | |
44 | .name = "bootloader", | |
45 | .offset = 0, | |
46 | .size = SZ_128K, | |
47 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
48 | }, | |
49 | /* bootloader params in the next sector */ | |
50 | { | |
51 | .name = "params", | |
52 | .offset = MTDPART_OFS_APPEND, | |
53 | .size = SZ_128K, | |
54 | .mask_flags = 0, | |
55 | }, | |
56 | /* kernel */ | |
57 | { | |
58 | .name = "kernel", | |
59 | .offset = MTDPART_OFS_APPEND, | |
60 | .size = SZ_2M, | |
61 | .mask_flags = 0 | |
62 | }, | |
63 | /* rest of flash1 is a file system */ | |
64 | { | |
65 | .name = "rootfs", | |
66 | .offset = MTDPART_OFS_APPEND, | |
67 | .size = SZ_16M - SZ_2M - 2 * SZ_128K, | |
68 | .mask_flags = 0 | |
69 | }, | |
70 | /* file system */ | |
71 | { | |
72 | .name = "filesystem", | |
73 | .offset = MTDPART_OFS_APPEND, | |
74 | .size = MTDPART_SIZ_FULL, | |
75 | .mask_flags = 0 | |
76 | } | |
77 | }; | |
78 | ||
79 | static struct flash_platform_data innovator_flash_data = { | |
80 | .map_name = "cfi_probe", | |
81 | .width = 2, | |
82 | .parts = innovator_partitions, | |
83 | .nr_parts = ARRAY_SIZE(innovator_partitions), | |
84 | }; | |
85 | ||
86 | static struct resource innovator_flash_resource = { | |
87 | .start = OMAP_CS0_PHYS, | |
88 | .end = OMAP_CS0_PHYS + SZ_32M - 1, | |
89 | .flags = IORESOURCE_MEM, | |
90 | }; | |
91 | ||
92 | static struct platform_device innovator_flash_device = { | |
93 | .name = "omapflash", | |
94 | .id = 0, | |
95 | .dev = { | |
96 | .platform_data = &innovator_flash_data, | |
97 | }, | |
98 | .num_resources = 1, | |
99 | .resource = &innovator_flash_resource, | |
100 | }; | |
101 | ||
102 | #ifdef CONFIG_ARCH_OMAP1510 | |
103 | ||
104 | /* Only FPGA needs to be mapped here. All others are done with ioremap */ | |
105 | static struct map_desc innovator1510_io_desc[] __initdata = { | |
9fe133b1 DS |
106 | { |
107 | .virtual = OMAP1510_FPGA_BASE, | |
108 | .pfn = __phys_to_pfn(OMAP1510_FPGA_START), | |
109 | .length = OMAP1510_FPGA_SIZE, | |
110 | .type = MT_DEVICE | |
111 | } | |
1da177e4 LT |
112 | }; |
113 | ||
114 | static struct resource innovator1510_smc91x_resources[] = { | |
115 | [0] = { | |
116 | .start = OMAP1510_FPGA_ETHR_START, /* Physical */ | |
117 | .end = OMAP1510_FPGA_ETHR_START + 0xf, | |
118 | .flags = IORESOURCE_MEM, | |
119 | }, | |
120 | [1] = { | |
121 | .start = OMAP1510_INT_ETHER, | |
122 | .end = OMAP1510_INT_ETHER, | |
123 | .flags = IORESOURCE_IRQ, | |
124 | }, | |
125 | }; | |
126 | ||
127 | static struct platform_device innovator1510_smc91x_device = { | |
128 | .name = "smc91x", | |
129 | .id = 0, | |
130 | .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources), | |
131 | .resource = innovator1510_smc91x_resources, | |
132 | }; | |
133 | ||
134 | static struct platform_device *innovator1510_devices[] __initdata = { | |
135 | &innovator_flash_device, | |
136 | &innovator1510_smc91x_device, | |
137 | }; | |
138 | ||
139 | #endif /* CONFIG_ARCH_OMAP1510 */ | |
140 | ||
141 | #ifdef CONFIG_ARCH_OMAP16XX | |
142 | ||
143 | static struct resource innovator1610_smc91x_resources[] = { | |
144 | [0] = { | |
145 | .start = INNOVATOR1610_ETHR_START, /* Physical */ | |
146 | .end = INNOVATOR1610_ETHR_START + 0xf, | |
147 | .flags = IORESOURCE_MEM, | |
148 | }, | |
149 | [1] = { | |
150 | .start = OMAP_GPIO_IRQ(0), | |
151 | .end = OMAP_GPIO_IRQ(0), | |
152 | .flags = IORESOURCE_IRQ, | |
153 | }, | |
154 | }; | |
155 | ||
156 | static struct platform_device innovator1610_smc91x_device = { | |
157 | .name = "smc91x", | |
158 | .id = 0, | |
159 | .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources), | |
160 | .resource = innovator1610_smc91x_resources, | |
161 | }; | |
162 | ||
163 | static struct platform_device *innovator1610_devices[] __initdata = { | |
164 | &innovator_flash_device, | |
165 | &innovator1610_smc91x_device, | |
166 | }; | |
167 | ||
168 | #endif /* CONFIG_ARCH_OMAP16XX */ | |
169 | ||
170 | static void __init innovator_init_smc91x(void) | |
171 | { | |
172 | if (cpu_is_omap1510()) { | |
173 | fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, | |
174 | OMAP1510_FPGA_RST); | |
175 | udelay(750); | |
176 | } else { | |
177 | if ((omap_request_gpio(0)) < 0) { | |
178 | printk("Error requesting gpio 0 for smc91x irq\n"); | |
179 | return; | |
180 | } | |
1da177e4 LT |
181 | } |
182 | } | |
183 | ||
184 | void innovator_init_irq(void) | |
185 | { | |
186 | omap_init_irq(); | |
187 | omap_gpio_init(); | |
188 | #ifdef CONFIG_ARCH_OMAP1510 | |
189 | if (cpu_is_omap1510()) { | |
190 | omap1510_fpga_init_irq(); | |
191 | } | |
192 | #endif | |
193 | innovator_init_smc91x(); | |
194 | } | |
195 | ||
196 | #ifdef CONFIG_ARCH_OMAP1510 | |
197 | static struct omap_usb_config innovator1510_usb_config __initdata = { | |
198 | /* for bundled non-standard host and peripheral cables */ | |
199 | .hmc_mode = 4, | |
200 | ||
201 | .register_host = 1, | |
202 | .pins[1] = 6, | |
203 | .pins[2] = 6, /* Conflicts with UART2 */ | |
204 | ||
205 | .register_dev = 1, | |
206 | .pins[0] = 2, | |
207 | }; | |
208 | #endif | |
209 | ||
210 | #ifdef CONFIG_ARCH_OMAP16XX | |
211 | static struct omap_usb_config h2_usb_config __initdata = { | |
212 | /* usb1 has a Mini-AB port and external isp1301 transceiver */ | |
213 | .otg = 2, | |
214 | ||
215 | #ifdef CONFIG_USB_GADGET_OMAP | |
216 | .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled | |
217 | // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback) | |
218 | #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
219 | /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ | |
220 | .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled | |
221 | #endif | |
222 | ||
223 | .pins[1] = 3, | |
224 | }; | |
225 | #endif | |
226 | ||
7c38cf02 TL |
227 | static struct omap_mmc_config innovator_mmc_config __initdata = { |
228 | .mmc [0] = { | |
229 | .enabled = 1, | |
230 | .wire4 = 1, | |
231 | .wp_pin = OMAP_MPUIO(3), | |
232 | .power_pin = -1, /* FPGA F3 UIO42 */ | |
233 | .switch_pin = -1, /* FPGA F4 UIO43 */ | |
234 | }, | |
235 | }; | |
236 | ||
1da177e4 LT |
237 | static struct omap_board_config_kernel innovator_config[] = { |
238 | { OMAP_TAG_USB, NULL }, | |
7c38cf02 | 239 | { OMAP_TAG_MMC, &innovator_mmc_config }, |
1da177e4 LT |
240 | }; |
241 | ||
242 | static void __init innovator_init(void) | |
243 | { | |
244 | #ifdef CONFIG_ARCH_OMAP1510 | |
245 | if (cpu_is_omap1510()) { | |
246 | platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices)); | |
247 | } | |
248 | #endif | |
249 | #ifdef CONFIG_ARCH_OMAP16XX | |
250 | if (!cpu_is_omap1510()) { | |
251 | platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices)); | |
252 | } | |
253 | #endif | |
254 | ||
255 | #ifdef CONFIG_ARCH_OMAP1510 | |
256 | if (cpu_is_omap1510()) | |
257 | innovator_config[0].data = &innovator1510_usb_config; | |
258 | #endif | |
259 | #ifdef CONFIG_ARCH_OMAP16XX | |
260 | if (cpu_is_omap1610()) | |
261 | innovator_config[0].data = &h2_usb_config; | |
262 | #endif | |
263 | omap_board_config = innovator_config; | |
264 | omap_board_config_size = ARRAY_SIZE(innovator_config); | |
265 | } | |
266 | ||
267 | static void __init innovator_map_io(void) | |
268 | { | |
d48af15e | 269 | omap_map_common_io(); |
1da177e4 LT |
270 | |
271 | #ifdef CONFIG_ARCH_OMAP1510 | |
272 | if (cpu_is_omap1510()) { | |
273 | iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); | |
274 | udelay(10); /* Delay needed for FPGA */ | |
275 | ||
276 | /* Dump the Innovator FPGA rev early - useful info for support. */ | |
277 | printk("Innovator FPGA Rev %d.%d Board Rev %d\n", | |
278 | fpga_read(OMAP1510_FPGA_REV_HIGH), | |
279 | fpga_read(OMAP1510_FPGA_REV_LOW), | |
280 | fpga_read(OMAP1510_FPGA_BOARD_REV)); | |
281 | } | |
282 | #endif | |
283 | omap_serial_init(innovator_serial_ports); | |
284 | } | |
285 | ||
286 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") | |
e9dea0c6 RK |
287 | /* Maintainer: MontaVista Software, Inc. */ |
288 | .phys_ram = 0x10000000, | |
289 | .phys_io = 0xfff00000, | |
290 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | |
291 | .boot_params = 0x10000100, | |
292 | .map_io = innovator_map_io, | |
293 | .init_irq = innovator_init_irq, | |
294 | .init_machine = innovator_init, | |
1da177e4 LT |
295 | .timer = &omap_timer, |
296 | MACHINE_END |