blob: e90c137a4cf315cbf70ec3959d74090d4554643e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Tony Lindgrendbdf9ced2005-07-10 19:58:11 +01002 * linux/arch/arm/mach-omap1/board-innovator.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
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>
Russell Kingd052d1b2005-10-29 19:07:23 +010021#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/delay.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
Tony Lindgren9b6553c2006-04-02 17:46:30 +010025#include <linux/input.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#include <asm/hardware.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/flash.h>
31#include <asm/mach/map.h>
32
Tony Lindgren7c38cf02005-09-08 23:07:38 +010033#include <asm/arch/mux.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <asm/arch/fpga.h>
35#include <asm/arch/gpio.h>
36#include <asm/arch/tc.h>
37#include <asm/arch/usb.h>
Tony Lindgren9b6553c2006-04-02 17:46:30 +010038#include <asm/arch/keypad.h>
Tony Lindgrend48af152005-07-10 19:58:17 +010039#include <asm/arch/common.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Tony Lindgren9b6553c2006-04-02 17:46:30 +010041static int innovator_keymap[] = {
42 KEY(0, 0, KEY_F1),
43 KEY(0, 3, KEY_DOWN),
44 KEY(1, 1, KEY_F2),
45 KEY(1, 2, KEY_RIGHT),
46 KEY(2, 0, KEY_F3),
47 KEY(2, 1, KEY_F4),
48 KEY(2, 2, KEY_UP),
49 KEY(3, 2, KEY_ENTER),
50 KEY(3, 3, KEY_LEFT),
51 0
52};
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054static struct mtd_partition innovator_partitions[] = {
55 /* bootloader (U-Boot, etc) in first sector */
56 {
57 .name = "bootloader",
58 .offset = 0,
59 .size = SZ_128K,
60 .mask_flags = MTD_WRITEABLE, /* force read-only */
61 },
62 /* bootloader params in the next sector */
63 {
64 .name = "params",
65 .offset = MTDPART_OFS_APPEND,
66 .size = SZ_128K,
67 .mask_flags = 0,
68 },
69 /* kernel */
70 {
71 .name = "kernel",
72 .offset = MTDPART_OFS_APPEND,
73 .size = SZ_2M,
74 .mask_flags = 0
75 },
76 /* rest of flash1 is a file system */
77 {
78 .name = "rootfs",
79 .offset = MTDPART_OFS_APPEND,
80 .size = SZ_16M - SZ_2M - 2 * SZ_128K,
81 .mask_flags = 0
82 },
83 /* file system */
84 {
85 .name = "filesystem",
86 .offset = MTDPART_OFS_APPEND,
87 .size = MTDPART_SIZ_FULL,
88 .mask_flags = 0
89 }
90};
91
92static struct flash_platform_data innovator_flash_data = {
93 .map_name = "cfi_probe",
94 .width = 2,
95 .parts = innovator_partitions,
96 .nr_parts = ARRAY_SIZE(innovator_partitions),
97};
98
99static struct resource innovator_flash_resource = {
100 .start = OMAP_CS0_PHYS,
101 .end = OMAP_CS0_PHYS + SZ_32M - 1,
102 .flags = IORESOURCE_MEM,
103};
104
105static struct platform_device innovator_flash_device = {
106 .name = "omapflash",
107 .id = 0,
108 .dev = {
109 .platform_data = &innovator_flash_data,
110 },
111 .num_resources = 1,
112 .resource = &innovator_flash_resource,
113};
114
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100115static struct resource innovator_kp_resources[] = {
116 [0] = {
117 .start = INT_KEYBOARD,
118 .end = INT_KEYBOARD,
119 .flags = IORESOURCE_IRQ,
120 },
121};
122
123static struct omap_kp_platform_data innovator_kp_data = {
124 .rows = 8,
125 .cols = 8,
126 .keymap = innovator_keymap,
127};
128
129static struct platform_device innovator_kp_device = {
130 .name = "omap-keypad",
131 .id = -1,
132 .dev = {
133 .platform_data = &innovator_kp_data,
134 },
135 .num_resources = ARRAY_SIZE(innovator_kp_resources),
136 .resource = innovator_kp_resources,
137};
138
139
Tony Lindgren3179a012005-11-10 14:26:48 +0000140#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142/* Only FPGA needs to be mapped here. All others are done with ioremap */
143static struct map_desc innovator1510_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +0100144 {
145 .virtual = OMAP1510_FPGA_BASE,
146 .pfn = __phys_to_pfn(OMAP1510_FPGA_START),
147 .length = OMAP1510_FPGA_SIZE,
148 .type = MT_DEVICE
149 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150};
151
152static struct resource innovator1510_smc91x_resources[] = {
153 [0] = {
154 .start = OMAP1510_FPGA_ETHR_START, /* Physical */
155 .end = OMAP1510_FPGA_ETHR_START + 0xf,
156 .flags = IORESOURCE_MEM,
157 },
158 [1] = {
159 .start = OMAP1510_INT_ETHER,
160 .end = OMAP1510_INT_ETHER,
161 .flags = IORESOURCE_IRQ,
162 },
163};
164
165static struct platform_device innovator1510_smc91x_device = {
166 .name = "smc91x",
167 .id = 0,
168 .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
169 .resource = innovator1510_smc91x_resources,
170};
171
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100172static struct platform_device innovator1510_lcd_device = {
173 .name = "lcd_inn1510",
174 .id = -1,
175};
176
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177static struct platform_device *innovator1510_devices[] __initdata = {
178 &innovator_flash_device,
179 &innovator1510_smc91x_device,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100180 &innovator_kp_device,
181 &innovator1510_lcd_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182};
183
Tony Lindgren3179a012005-11-10 14:26:48 +0000184#endif /* CONFIG_ARCH_OMAP15XX */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
186#ifdef CONFIG_ARCH_OMAP16XX
187
188static struct resource innovator1610_smc91x_resources[] = {
189 [0] = {
190 .start = INNOVATOR1610_ETHR_START, /* Physical */
191 .end = INNOVATOR1610_ETHR_START + 0xf,
192 .flags = IORESOURCE_MEM,
193 },
194 [1] = {
195 .start = OMAP_GPIO_IRQ(0),
196 .end = OMAP_GPIO_IRQ(0),
197 .flags = IORESOURCE_IRQ,
198 },
199};
200
201static struct platform_device innovator1610_smc91x_device = {
202 .name = "smc91x",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
205 .resource = innovator1610_smc91x_resources,
206};
207
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100208static struct platform_device innovator1610_lcd_device = {
209 .name = "inn1610_lcd",
210 .id = -1,
211};
212
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213static struct platform_device *innovator1610_devices[] __initdata = {
214 &innovator_flash_device,
215 &innovator1610_smc91x_device,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100216 &innovator_kp_device,
217 &innovator1610_lcd_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218};
219
220#endif /* CONFIG_ARCH_OMAP16XX */
221
222static void __init innovator_init_smc91x(void)
223{
224 if (cpu_is_omap1510()) {
225 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
226 OMAP1510_FPGA_RST);
227 udelay(750);
228 } else {
229 if ((omap_request_gpio(0)) < 0) {
230 printk("Error requesting gpio 0 for smc91x irq\n");
231 return;
232 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 }
234}
235
236void innovator_init_irq(void)
237{
Tony Lindgren87bd63f2006-02-08 22:06:46 +0000238 omap1_init_common_hw();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 omap_init_irq();
240 omap_gpio_init();
Tony Lindgren3179a012005-11-10 14:26:48 +0000241#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 if (cpu_is_omap1510()) {
243 omap1510_fpga_init_irq();
244 }
245#endif
246 innovator_init_smc91x();
247}
248
Tony Lindgren3179a012005-11-10 14:26:48 +0000249#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250static struct omap_usb_config innovator1510_usb_config __initdata = {
251 /* for bundled non-standard host and peripheral cables */
252 .hmc_mode = 4,
253
254 .register_host = 1,
255 .pins[1] = 6,
256 .pins[2] = 6, /* Conflicts with UART2 */
257
258 .register_dev = 1,
259 .pins[0] = 2,
260};
Tony Lindgren3179a012005-11-10 14:26:48 +0000261
262static struct omap_lcd_config innovator1510_lcd_config __initdata = {
Tony Lindgren3179a012005-11-10 14:26:48 +0000263 .ctrl_name = "internal",
264};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265#endif
266
267#ifdef CONFIG_ARCH_OMAP16XX
268static struct omap_usb_config h2_usb_config __initdata = {
269 /* usb1 has a Mini-AB port and external isp1301 transceiver */
270 .otg = 2,
271
272#ifdef CONFIG_USB_GADGET_OMAP
273 .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled
274 // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback)
275#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
276 /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
277 .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled
278#endif
279
280 .pins[1] = 3,
281};
Tony Lindgren3179a012005-11-10 14:26:48 +0000282
283static struct omap_lcd_config innovator1610_lcd_config __initdata = {
Tony Lindgren3179a012005-11-10 14:26:48 +0000284 .ctrl_name = "internal",
285};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286#endif
287
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100288static struct omap_mmc_config innovator_mmc_config __initdata = {
289 .mmc [0] = {
290 .enabled = 1,
291 .wire4 = 1,
292 .wp_pin = OMAP_MPUIO(3),
293 .power_pin = -1, /* FPGA F3 UIO42 */
294 .switch_pin = -1, /* FPGA F4 UIO43 */
295 },
296};
297
Tony Lindgren3179a012005-11-10 14:26:48 +0000298static struct omap_uart_config innovator_uart_config __initdata = {
299 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
300};
301
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302static struct omap_board_config_kernel innovator_config[] = {
303 { OMAP_TAG_USB, NULL },
Tony Lindgren3179a012005-11-10 14:26:48 +0000304 { OMAP_TAG_LCD, NULL },
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100305 { OMAP_TAG_MMC, &innovator_mmc_config },
Tony Lindgren3179a012005-11-10 14:26:48 +0000306 { OMAP_TAG_UART, &innovator_uart_config },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307};
308
309static void __init innovator_init(void)
310{
Tony Lindgren3179a012005-11-10 14:26:48 +0000311#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 if (cpu_is_omap1510()) {
313 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
314 }
315#endif
316#ifdef CONFIG_ARCH_OMAP16XX
317 if (!cpu_is_omap1510()) {
318 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
319 }
320#endif
321
Tony Lindgren3179a012005-11-10 14:26:48 +0000322#ifdef CONFIG_ARCH_OMAP15XX
323 if (cpu_is_omap1510()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 innovator_config[0].data = &innovator1510_usb_config;
Tony Lindgren3179a012005-11-10 14:26:48 +0000325 innovator_config[1].data = &innovator1510_lcd_config;
326 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327#endif
328#ifdef CONFIG_ARCH_OMAP16XX
Tony Lindgren3179a012005-11-10 14:26:48 +0000329 if (cpu_is_omap1610()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 innovator_config[0].data = &h2_usb_config;
Tony Lindgren3179a012005-11-10 14:26:48 +0000331 innovator_config[1].data = &innovator1610_lcd_config;
332 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333#endif
334 omap_board_config = innovator_config;
335 omap_board_config_size = ARRAY_SIZE(innovator_config);
Tony Lindgren3179a012005-11-10 14:26:48 +0000336 omap_serial_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337}
338
339static void __init innovator_map_io(void)
340{
Tony Lindgren87bd63f2006-02-08 22:06:46 +0000341 omap1_map_common_io();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342
Tony Lindgren3179a012005-11-10 14:26:48 +0000343#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 if (cpu_is_omap1510()) {
345 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
346 udelay(10); /* Delay needed for FPGA */
347
348 /* Dump the Innovator FPGA rev early - useful info for support. */
349 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
350 fpga_read(OMAP1510_FPGA_REV_HIGH),
351 fpga_read(OMAP1510_FPGA_REV_LOW),
352 fpga_read(OMAP1510_FPGA_BOARD_REV));
353 }
354#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355}
356
357MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100358 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100359 .phys_io = 0xfff00000,
360 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
361 .boot_params = 0x10000100,
362 .map_io = innovator_map_io,
363 .init_irq = innovator_init_irq,
364 .init_machine = innovator_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 .timer = &omap_timer,
366MACHINE_END