2 * linux/arch/arm/mach-omap1/board-innovator.c
4 * Board specific inits for OMAP-1510 and OMAP-1610 Innovator
6 * Copyright (C) 2001 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
9 * Copyright (C) 2002 MontaVista Software, Inc.
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>
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.
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/delay.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/input.h>
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>
33 #include <asm/arch/mux.h>
34 #include <asm/arch/fpga.h>
35 #include <asm/arch/gpio.h>
36 #include <asm/arch/tc.h>
37 #include <asm/arch/usb.h>
38 #include <asm/arch/keypad.h>
39 #include <asm/arch/common.h>
40 #include <asm/arch/mcbsp.h>
41 #include <asm/arch/omap-alsa.h>
43 static int innovator_keymap[] = {
56 static struct mtd_partition innovator_partitions[] = {
57 /* bootloader (U-Boot, etc) in first sector */
62 .mask_flags = MTD_WRITEABLE, /* force read-only */
64 /* bootloader params in the next sector */
67 .offset = MTDPART_OFS_APPEND,
74 .offset = MTDPART_OFS_APPEND,
78 /* rest of flash1 is a file system */
81 .offset = MTDPART_OFS_APPEND,
82 .size = SZ_16M - SZ_2M - 2 * SZ_128K,
88 .offset = MTDPART_OFS_APPEND,
89 .size = MTDPART_SIZ_FULL,
94 static struct flash_platform_data innovator_flash_data = {
95 .map_name = "cfi_probe",
97 .parts = innovator_partitions,
98 .nr_parts = ARRAY_SIZE(innovator_partitions),
101 static struct resource innovator_flash_resource = {
102 .start = OMAP_CS0_PHYS,
103 .end = OMAP_CS0_PHYS + SZ_32M - 1,
104 .flags = IORESOURCE_MEM,
107 static struct platform_device innovator_flash_device = {
111 .platform_data = &innovator_flash_data,
114 .resource = &innovator_flash_resource,
117 #define DEFAULT_BITPERSAMPLE 16
119 static 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 */
134 static 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,
145 static struct platform_device innovator_mcbsp1_device = {
146 .name = "omap_alsa_mcbsp",
149 .platform_data = &alsa_config,
153 static struct resource innovator_kp_resources[] = {
155 .start = INT_KEYBOARD,
157 .flags = IORESOURCE_IRQ,
161 static struct omap_kp_platform_data innovator_kp_data = {
164 .keymap = innovator_keymap,
167 static struct platform_device innovator_kp_device = {
168 .name = "omap-keypad",
171 .platform_data = &innovator_kp_data,
173 .num_resources = ARRAY_SIZE(innovator_kp_resources),
174 .resource = innovator_kp_resources,
178 #ifdef CONFIG_ARCH_OMAP15XX
180 #include <linux/spi/spi.h>
181 #include <linux/spi/ads7846.h>
184 /* Only FPGA needs to be mapped here. All others are done with ioremap */
185 static struct map_desc innovator1510_io_desc[] __initdata = {
187 .virtual = OMAP1510_FPGA_BASE,
188 .pfn = __phys_to_pfn(OMAP1510_FPGA_START),
189 .length = OMAP1510_FPGA_SIZE,
194 static struct resource innovator1510_smc91x_resources[] = {
196 .start = OMAP1510_FPGA_ETHR_START, /* Physical */
197 .end = OMAP1510_FPGA_ETHR_START + 0xf,
198 .flags = IORESOURCE_MEM,
201 .start = OMAP1510_INT_ETHER,
202 .end = OMAP1510_INT_ETHER,
203 .flags = IORESOURCE_IRQ,
207 static struct platform_device innovator1510_smc91x_device = {
210 .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
211 .resource = innovator1510_smc91x_resources,
214 static struct platform_device innovator1510_lcd_device = {
215 .name = "lcd_inn1510",
219 static struct platform_device innovator1510_spi_device = {
220 .name = "spi_inn1510",
224 static struct platform_device *innovator1510_devices[] __initdata = {
225 &innovator_flash_device,
226 &innovator1510_smc91x_device,
227 &innovator_mcbsp1_device,
228 &innovator_kp_device,
229 &innovator1510_lcd_device,
230 &innovator1510_spi_device,
233 static int innovator_get_pendown_state(void)
235 return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
238 static const struct ads7846_platform_data innovator1510_ts_info = {
240 .vref_delay_usecs = 100, /* internal, no capacitor */
243 .get_pendown_state = innovator_get_pendown_state,
246 static 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 */,
257 #endif /* CONFIG_ARCH_OMAP15XX */
259 #ifdef CONFIG_ARCH_OMAP16XX
261 static struct resource innovator1610_smc91x_resources[] = {
263 .start = INNOVATOR1610_ETHR_START, /* Physical */
264 .end = INNOVATOR1610_ETHR_START + 0xf,
265 .flags = IORESOURCE_MEM,
268 .start = OMAP_GPIO_IRQ(0),
269 .end = OMAP_GPIO_IRQ(0),
270 .flags = IORESOURCE_IRQ,
274 static struct platform_device innovator1610_smc91x_device = {
277 .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
278 .resource = innovator1610_smc91x_resources,
281 static struct platform_device innovator1610_lcd_device = {
282 .name = "inn1610_lcd",
286 static struct platform_device *innovator1610_devices[] __initdata = {
287 &innovator_flash_device,
288 &innovator1610_smc91x_device,
289 &innovator_kp_device,
290 &innovator1610_lcd_device,
293 #endif /* CONFIG_ARCH_OMAP16XX */
295 static void __init innovator_init_smc91x(void)
297 if (cpu_is_omap1510()) {
298 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
302 if ((omap_request_gpio(0)) < 0) {
303 printk("Error requesting gpio 0 for smc91x irq\n");
309 void innovator_init_irq(void)
311 omap1_init_common_hw();
314 #ifdef CONFIG_ARCH_OMAP15XX
315 if (cpu_is_omap1510()) {
316 omap1510_fpga_init_irq();
319 innovator_init_smc91x();
322 #ifdef CONFIG_ARCH_OMAP15XX
323 static struct omap_usb_config innovator1510_usb_config __initdata = {
324 /* for bundled non-standard host and peripheral cables */
329 .pins[2] = 6, /* Conflicts with UART2 */
335 static struct omap_lcd_config innovator1510_lcd_config __initdata = {
336 .ctrl_name = "internal",
340 #ifdef CONFIG_ARCH_OMAP16XX
341 static struct omap_usb_config h2_usb_config __initdata = {
342 /* usb1 has a Mini-AB port and external isp1301 transceiver */
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
356 static struct omap_lcd_config innovator1610_lcd_config __initdata = {
357 .ctrl_name = "internal",
361 static struct omap_mmc_config innovator_mmc_config __initdata = {
365 .wp_pin = OMAP_MPUIO(3),
366 .power_pin = -1, /* FPGA F3 UIO42 */
367 .switch_pin = -1, /* FPGA F4 UIO43 */
371 static struct omap_uart_config innovator_uart_config __initdata = {
372 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
375 static struct omap_board_config_kernel innovator_config[] = {
376 { OMAP_TAG_USB, NULL },
377 { OMAP_TAG_LCD, NULL },
378 { OMAP_TAG_MMC, &innovator_mmc_config },
379 { OMAP_TAG_UART, &innovator_uart_config },
382 static void __init innovator_init(void)
384 #ifdef CONFIG_ARCH_OMAP15XX
385 if (cpu_is_omap1510()) {
386 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
387 spi_register_board_info(innovator1510_boardinfo,
388 ARRAY_SIZE(innovator1510_boardinfo));
391 #ifdef CONFIG_ARCH_OMAP16XX
392 if (!cpu_is_omap1510()) {
393 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
397 #ifdef CONFIG_ARCH_OMAP15XX
398 if (cpu_is_omap1510()) {
399 innovator_config[0].data = &innovator1510_usb_config;
400 innovator_config[1].data = &innovator1510_lcd_config;
403 #ifdef CONFIG_ARCH_OMAP16XX
404 if (cpu_is_omap1610()) {
405 innovator_config[0].data = &h2_usb_config;
406 innovator_config[1].data = &innovator1610_lcd_config;
409 omap_board_config = innovator_config;
410 omap_board_config_size = ARRAY_SIZE(innovator_config);
414 static void __init innovator_map_io(void)
416 omap1_map_common_io();
418 #ifdef CONFIG_ARCH_OMAP15XX
419 if (cpu_is_omap1510()) {
420 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
421 udelay(10); /* Delay needed for FPGA */
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));
432 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
433 /* Maintainer: MontaVista Software, Inc. */
434 .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,
440 .timer = &omap_timer,