blob: 4cbc62db5b5dd5cd6a72da1c4efbdf2ec56b8aa2 [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>
lamikr284185c2006-06-26 16:16:08 -070040#include <asm/arch/mcbsp.h>
41#include <asm/arch/omap-alsa.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Tony Lindgren9b6553c2006-04-02 17:46:30 +010043static int innovator_keymap[] = {
44 KEY(0, 0, KEY_F1),
45 KEY(0, 3, KEY_DOWN),
46 KEY(1, 1, KEY_F2),
47 KEY(1, 2, KEY_RIGHT),
48 KEY(2, 0, KEY_F3),
49 KEY(2, 1, KEY_F4),
50 KEY(2, 2, KEY_UP),
51 KEY(3, 2, KEY_ENTER),
52 KEY(3, 3, KEY_LEFT),
53 0
54};
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056static struct mtd_partition innovator_partitions[] = {
57 /* bootloader (U-Boot, etc) in first sector */
58 {
59 .name = "bootloader",
60 .offset = 0,
61 .size = SZ_128K,
62 .mask_flags = MTD_WRITEABLE, /* force read-only */
63 },
64 /* bootloader params in the next sector */
65 {
66 .name = "params",
67 .offset = MTDPART_OFS_APPEND,
68 .size = SZ_128K,
69 .mask_flags = 0,
70 },
71 /* kernel */
72 {
73 .name = "kernel",
74 .offset = MTDPART_OFS_APPEND,
75 .size = SZ_2M,
76 .mask_flags = 0
77 },
78 /* rest of flash1 is a file system */
79 {
80 .name = "rootfs",
81 .offset = MTDPART_OFS_APPEND,
82 .size = SZ_16M - SZ_2M - 2 * SZ_128K,
83 .mask_flags = 0
84 },
85 /* file system */
86 {
87 .name = "filesystem",
88 .offset = MTDPART_OFS_APPEND,
89 .size = MTDPART_SIZ_FULL,
90 .mask_flags = 0
91 }
92};
93
94static struct flash_platform_data innovator_flash_data = {
95 .map_name = "cfi_probe",
96 .width = 2,
97 .parts = innovator_partitions,
98 .nr_parts = ARRAY_SIZE(innovator_partitions),
99};
100
101static struct resource innovator_flash_resource = {
102 .start = OMAP_CS0_PHYS,
103 .end = OMAP_CS0_PHYS + SZ_32M - 1,
104 .flags = IORESOURCE_MEM,
105};
106
107static struct platform_device innovator_flash_device = {
108 .name = "omapflash",
109 .id = 0,
110 .dev = {
111 .platform_data = &innovator_flash_data,
112 },
113 .num_resources = 1,
114 .resource = &innovator_flash_resource,
115};
116
lamikr284185c2006-06-26 16:16:08 -0700117#define DEFAULT_BITPERSAMPLE 16
118
119static struct omap_mcbsp_reg_cfg mcbsp_regs = {
120 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
121 .spcr1 = RINTM(3) | RRST,
122 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
123 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
124 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
125 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
126 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
127 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
128 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
129 .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
130 /*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */
131 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
132};
133
134static struct omap_alsa_codec_config alsa_config = {
135 .name = "OMAP Innovator AIC23",
136 .mcbsp_regs_alsa = &mcbsp_regs,
137 .codec_configure_dev = NULL, // aic23_configure,
138 .codec_set_samplerate = NULL, // aic23_set_samplerate,
139 .codec_clock_setup = NULL, // aic23_clock_setup,
140 .codec_clock_on = NULL, // aic23_clock_on,
141 .codec_clock_off = NULL, // aic23_clock_off,
142 .get_default_samplerate = NULL, // aic23_get_default_samplerate,
143};
144
145static struct platform_device innovator_mcbsp1_device = {
146 .name = "omap_alsa_mcbsp",
147 .id = 1,
148 .dev = {
149 .platform_data = &alsa_config,
150 },
151};
152
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100153static struct resource innovator_kp_resources[] = {
154 [0] = {
155 .start = INT_KEYBOARD,
156 .end = INT_KEYBOARD,
157 .flags = IORESOURCE_IRQ,
158 },
159};
160
161static struct omap_kp_platform_data innovator_kp_data = {
162 .rows = 8,
163 .cols = 8,
164 .keymap = innovator_keymap,
165};
166
167static struct platform_device innovator_kp_device = {
168 .name = "omap-keypad",
169 .id = -1,
170 .dev = {
171 .platform_data = &innovator_kp_data,
172 },
173 .num_resources = ARRAY_SIZE(innovator_kp_resources),
174 .resource = innovator_kp_resources,
175};
176
177
Tony Lindgren3179a012005-11-10 14:26:48 +0000178#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
David Brownellc15e5d12006-06-26 16:16:09 -0700180#include <linux/spi/spi.h>
181#include <linux/spi/ads7846.h>
182
183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184/* Only FPGA needs to be mapped here. All others are done with ioremap */
185static struct map_desc innovator1510_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +0100186 {
187 .virtual = OMAP1510_FPGA_BASE,
188 .pfn = __phys_to_pfn(OMAP1510_FPGA_START),
189 .length = OMAP1510_FPGA_SIZE,
190 .type = MT_DEVICE
191 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192};
193
194static struct resource innovator1510_smc91x_resources[] = {
195 [0] = {
196 .start = OMAP1510_FPGA_ETHR_START, /* Physical */
197 .end = OMAP1510_FPGA_ETHR_START + 0xf,
198 .flags = IORESOURCE_MEM,
199 },
200 [1] = {
201 .start = OMAP1510_INT_ETHER,
202 .end = OMAP1510_INT_ETHER,
203 .flags = IORESOURCE_IRQ,
204 },
205};
206
207static struct platform_device innovator1510_smc91x_device = {
208 .name = "smc91x",
209 .id = 0,
210 .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
211 .resource = innovator1510_smc91x_resources,
212};
213
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100214static struct platform_device innovator1510_lcd_device = {
215 .name = "lcd_inn1510",
216 .id = -1,
217};
218
David Brownellc15e5d12006-06-26 16:16:09 -0700219static struct platform_device innovator1510_spi_device = {
220 .name = "spi_inn1510",
221 .id = -1,
222};
223
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224static struct platform_device *innovator1510_devices[] __initdata = {
225 &innovator_flash_device,
226 &innovator1510_smc91x_device,
lamikr284185c2006-06-26 16:16:08 -0700227 &innovator_mcbsp1_device,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100228 &innovator_kp_device,
229 &innovator1510_lcd_device,
David Brownellc15e5d12006-06-26 16:16:09 -0700230 &innovator1510_spi_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231};
232
David Brownellc15e5d12006-06-26 16:16:09 -0700233static int innovator_get_pendown_state(void)
234{
235 return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
236}
237
238static const struct ads7846_platform_data innovator1510_ts_info = {
239 .model = 7846,
240 .vref_delay_usecs = 100, /* internal, no capacitor */
241 .x_plate_ohms = 419,
242 .y_plate_ohms = 486,
243 .get_pendown_state = innovator_get_pendown_state,
244};
245
246static struct spi_board_info __initdata innovator1510_boardinfo[] = { {
247 /* FPGA (bus "10") CS0 has an ads7846e */
248 .modalias = "ads7846",
249 .platform_data = &innovator1510_ts_info,
250 .irq = OMAP1510_INT_FPGA_TS,
251 .max_speed_hz = 120000 /* max sample rate at 3V */
252 * 26 /* command + data + overhead */,
253 .bus_num = 10,
254 .chip_select = 0,
255} };
256
Tony Lindgren3179a012005-11-10 14:26:48 +0000257#endif /* CONFIG_ARCH_OMAP15XX */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258
259#ifdef CONFIG_ARCH_OMAP16XX
260
261static struct resource innovator1610_smc91x_resources[] = {
262 [0] = {
263 .start = INNOVATOR1610_ETHR_START, /* Physical */
264 .end = INNOVATOR1610_ETHR_START + 0xf,
265 .flags = IORESOURCE_MEM,
266 },
267 [1] = {
268 .start = OMAP_GPIO_IRQ(0),
269 .end = OMAP_GPIO_IRQ(0),
270 .flags = IORESOURCE_IRQ,
271 },
272};
273
274static struct platform_device innovator1610_smc91x_device = {
275 .name = "smc91x",
276 .id = 0,
277 .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
278 .resource = innovator1610_smc91x_resources,
279};
280
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100281static struct platform_device innovator1610_lcd_device = {
282 .name = "inn1610_lcd",
283 .id = -1,
284};
285
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286static struct platform_device *innovator1610_devices[] __initdata = {
287 &innovator_flash_device,
288 &innovator1610_smc91x_device,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100289 &innovator_kp_device,
290 &innovator1610_lcd_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291};
292
293#endif /* CONFIG_ARCH_OMAP16XX */
294
295static void __init innovator_init_smc91x(void)
296{
297 if (cpu_is_omap1510()) {
298 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
299 OMAP1510_FPGA_RST);
300 udelay(750);
301 } else {
302 if ((omap_request_gpio(0)) < 0) {
303 printk("Error requesting gpio 0 for smc91x irq\n");
304 return;
305 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 }
307}
308
309void innovator_init_irq(void)
310{
Tony Lindgren87bd63f2006-02-08 22:06:46 +0000311 omap1_init_common_hw();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 omap_init_irq();
313 omap_gpio_init();
Tony Lindgren3179a012005-11-10 14:26:48 +0000314#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 if (cpu_is_omap1510()) {
316 omap1510_fpga_init_irq();
317 }
318#endif
319 innovator_init_smc91x();
320}
321
Tony Lindgren3179a012005-11-10 14:26:48 +0000322#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323static struct omap_usb_config innovator1510_usb_config __initdata = {
324 /* for bundled non-standard host and peripheral cables */
325 .hmc_mode = 4,
326
327 .register_host = 1,
328 .pins[1] = 6,
329 .pins[2] = 6, /* Conflicts with UART2 */
330
331 .register_dev = 1,
332 .pins[0] = 2,
333};
Tony Lindgren3179a012005-11-10 14:26:48 +0000334
335static struct omap_lcd_config innovator1510_lcd_config __initdata = {
Tony Lindgren3179a012005-11-10 14:26:48 +0000336 .ctrl_name = "internal",
337};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338#endif
339
340#ifdef CONFIG_ARCH_OMAP16XX
341static struct omap_usb_config h2_usb_config __initdata = {
342 /* usb1 has a Mini-AB port and external isp1301 transceiver */
343 .otg = 2,
344
345#ifdef CONFIG_USB_GADGET_OMAP
346 .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled
347 // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback)
348#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
349 /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
350 .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled
351#endif
352
353 .pins[1] = 3,
354};
Tony Lindgren3179a012005-11-10 14:26:48 +0000355
356static struct omap_lcd_config innovator1610_lcd_config __initdata = {
Tony Lindgren3179a012005-11-10 14:26:48 +0000357 .ctrl_name = "internal",
358};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359#endif
360
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100361static struct omap_mmc_config innovator_mmc_config __initdata = {
362 .mmc [0] = {
363 .enabled = 1,
364 .wire4 = 1,
365 .wp_pin = OMAP_MPUIO(3),
366 .power_pin = -1, /* FPGA F3 UIO42 */
367 .switch_pin = -1, /* FPGA F4 UIO43 */
368 },
369};
370
Tony Lindgren3179a012005-11-10 14:26:48 +0000371static struct omap_uart_config innovator_uart_config __initdata = {
372 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
373};
374
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375static struct omap_board_config_kernel innovator_config[] = {
376 { OMAP_TAG_USB, NULL },
Tony Lindgren3179a012005-11-10 14:26:48 +0000377 { OMAP_TAG_LCD, NULL },
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100378 { OMAP_TAG_MMC, &innovator_mmc_config },
Tony Lindgren3179a012005-11-10 14:26:48 +0000379 { OMAP_TAG_UART, &innovator_uart_config },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380};
381
382static void __init innovator_init(void)
383{
Tony Lindgren3179a012005-11-10 14:26:48 +0000384#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 if (cpu_is_omap1510()) {
386 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
David Brownellc15e5d12006-06-26 16:16:09 -0700387 spi_register_board_info(innovator1510_boardinfo,
388 ARRAY_SIZE(innovator1510_boardinfo));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 }
390#endif
391#ifdef CONFIG_ARCH_OMAP16XX
392 if (!cpu_is_omap1510()) {
393 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
394 }
395#endif
396
Tony Lindgren3179a012005-11-10 14:26:48 +0000397#ifdef CONFIG_ARCH_OMAP15XX
398 if (cpu_is_omap1510()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 innovator_config[0].data = &innovator1510_usb_config;
Tony Lindgren3179a012005-11-10 14:26:48 +0000400 innovator_config[1].data = &innovator1510_lcd_config;
401 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402#endif
403#ifdef CONFIG_ARCH_OMAP16XX
Tony Lindgren3179a012005-11-10 14:26:48 +0000404 if (cpu_is_omap1610()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 innovator_config[0].data = &h2_usb_config;
Tony Lindgren3179a012005-11-10 14:26:48 +0000406 innovator_config[1].data = &innovator1610_lcd_config;
407 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408#endif
409 omap_board_config = innovator_config;
410 omap_board_config_size = ARRAY_SIZE(innovator_config);
Tony Lindgren3179a012005-11-10 14:26:48 +0000411 omap_serial_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412}
413
414static void __init innovator_map_io(void)
415{
Tony Lindgren87bd63f2006-02-08 22:06:46 +0000416 omap1_map_common_io();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
Tony Lindgren3179a012005-11-10 14:26:48 +0000418#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 if (cpu_is_omap1510()) {
420 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
421 udelay(10); /* Delay needed for FPGA */
422
423 /* Dump the Innovator FPGA rev early - useful info for support. */
424 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
425 fpga_read(OMAP1510_FPGA_REV_HIGH),
426 fpga_read(OMAP1510_FPGA_REV_LOW),
427 fpga_read(OMAP1510_FPGA_BOARD_REV));
428 }
429#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430}
431
432MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100433 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100434 .phys_io = 0xfff00000,
435 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
436 .boot_params = 0x10000100,
437 .map_io = innovator_map_io,
438 .init_irq = innovator_init_irq,
439 .init_machine = innovator_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 .timer = &omap_timer,
441MACHINE_END