vserver 1.9.3
[linux-2.6.git] / arch / arm / mach-omap / board-innovator.c
1 /*
2  * linux/arch/arm/mach-omap/board-innovator.c
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>
21 #include <linux/device.h>
22 #include <linux/delay.h>
23
24 #include <asm/hardware.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28
29 #include <asm/arch/clocks.h>
30 #include <asm/arch/gpio.h>
31 #include <asm/arch/fpga.h>
32 #include <asm/arch/usb.h>
33
34 #include "common.h"
35
36 extern void __init omap_init_time(void);
37
38 #ifdef CONFIG_ARCH_OMAP1510
39
40 extern int omap_gpio_init(void);
41
42 /* Only FPGA needs to be mapped here. All others are done with ioremap */
43 static struct map_desc innovator1510_io_desc[] __initdata = {
44 { OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
45         MT_DEVICE },
46 };
47
48 static struct resource innovator1510_smc91x_resources[] = {
49         [0] = {
50                 .start  = OMAP1510_FPGA_ETHR_START,     /* Physical */
51                 .end    = OMAP1510_FPGA_ETHR_START + 16,
52                 .flags  = IORESOURCE_MEM,
53         },
54         [1] = {
55                 .start  = OMAP1510_INT_ETHER,
56                 .end    = OMAP1510_INT_ETHER,
57                 .flags  = IORESOURCE_IRQ,
58         },
59 };
60
61 static struct platform_device innovator1510_smc91x_device = {
62         .name           = "smc91x",
63         .id             = 0,
64         .num_resources  = ARRAY_SIZE(innovator1510_smc91x_resources),
65         .resource       = innovator1510_smc91x_resources,
66 };
67
68 static struct platform_device *innovator1510_devices[] __initdata = {
69         &innovator1510_smc91x_device,
70 };
71
72 #endif /* CONFIG_ARCH_OMAP1510 */
73
74 #ifdef CONFIG_ARCH_OMAP1610
75
76 static struct map_desc innovator1610_io_desc[] __initdata = {
77 { OMAP1610_ETHR_BASE, OMAP1610_ETHR_START, OMAP1610_ETHR_SIZE,MT_DEVICE },
78 { OMAP1610_NOR_FLASH_BASE, OMAP1610_NOR_FLASH_START, OMAP1610_NOR_FLASH_SIZE,
79         MT_DEVICE },
80 };
81
82 static struct resource innovator1610_smc91x_resources[] = {
83         [0] = {
84                 .start  = OMAP1610_ETHR_START,          /* Physical */
85                 .end    = OMAP1610_ETHR_START + SZ_4K,
86                 .flags  = IORESOURCE_MEM,
87         },
88         [1] = {
89                 .start  = 0,                            /* Really GPIO 0 */
90                 .end    = 0,
91                 .flags  = IORESOURCE_IRQ,
92         },
93 };
94
95 static struct platform_device innovator1610_smc91x_device = {
96         .name           = "smc91x",
97         .id             = 0,
98         .num_resources  = ARRAY_SIZE(innovator1610_smc91x_resources),
99         .resource       = innovator1610_smc91x_resources,
100 };
101
102 static struct platform_device *innovator1610_devices[] __initdata = {
103         &innovator1610_smc91x_device,
104 };
105
106 #endif /* CONFIG_ARCH_OMAP1610 */
107
108 void innovator_init_irq(void)
109 {
110         omap_init_irq();
111 #ifdef CONFIG_ARCH_OMAP1510
112         if (cpu_is_omap1510()) {
113                 omap_gpio_init();
114                 omap1510_fpga_init_irq();
115         }
116 #endif
117 }
118
119 #ifdef CONFIG_ARCH_OMAP1510
120 static struct omap_usb_config innovator1510_usb_config __initdata = {
121         /* has usb host and device, but no Mini-AB port */
122         .register_host  = 1,
123         .register_dev   = 1,
124         /* Assume bad Innovator wiring; Use internal host only with custom cable */
125         .hmc_mode       = 16,
126         .pins[0]        = 2,
127 };
128 #endif
129
130 #ifdef CONFIG_ARCH_OMAP1610
131 static struct omap_usb_config h2_usb_config __initdata = {
132         /* usb1 has a Mini-AB port and external isp1301 transceiver */
133         .otg            = 2,
134
135 #ifdef  CONFIG_USB_GADGET_OMAP
136         .hmc_mode       = 19,   // 0:host(off) 1:dev|otg 2:disabled
137         // .hmc_mode    = 21,   // 0:host(off) 1:dev(loopback) 2:host(loopback)
138 #elif   defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
139         /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
140         .hmc_mode       = 20,   // 1:dev|otg(off) 1:host 2:disabled
141 #endif
142
143         .pins[1]        = 3,
144 };
145 #endif
146
147 static struct omap_board_config_kernel innovator_config[] = {
148         { OMAP_TAG_USB,         NULL },
149 };
150
151 static void __init innovator_init(void)
152 {
153 #ifdef CONFIG_ARCH_OMAP1510
154         if (cpu_is_omap1510()) {
155                 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
156         }
157 #endif
158 #ifdef CONFIG_ARCH_OMAP1610
159         if (!cpu_is_omap1510()) {
160                 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
161         }
162 #endif
163
164 #ifdef CONFIG_ARCH_OMAP1510
165         if (cpu_is_omap1510())
166                 innovator_config[0].data = &innovator1510_usb_config;
167 #endif
168 #ifdef CONFIG_ARCH_OMAP1610
169         if (cpu_is_omap1610())
170                 innovator_config[0].data = &h2_usb_config;
171 #endif
172         omap_board_config = innovator_config;
173         omap_board_config_size = ARRAY_SIZE(innovator_config);
174 }
175
176 static void __init innovator_map_io(void)
177 {
178         omap_map_io();
179
180 #ifdef CONFIG_ARCH_OMAP1510
181         if (cpu_is_omap1510()) {
182                 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
183                 udelay(10);     /* Delay needed for FPGA */
184
185                 /* Dump the Innovator FPGA rev early - useful info for support. */
186                 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
187                        fpga_read(OMAP1510_FPGA_REV_HIGH),
188                        fpga_read(OMAP1510_FPGA_REV_LOW),
189                        fpga_read(OMAP1510_FPGA_BOARD_REV));
190         }
191 #endif
192 #ifdef CONFIG_ARCH_OMAP1610
193         if (!cpu_is_omap1510()) {
194                 iotable_init(innovator1610_io_desc, ARRAY_SIZE(innovator1610_io_desc));
195         }
196 #endif
197 }
198
199 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
200         MAINTAINER("MontaVista Software, Inc.")
201         BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
202         BOOT_PARAMS(0x10000100)
203         MAPIO(innovator_map_io)
204         INITIRQ(innovator_init_irq)
205         INIT_MACHINE(innovator_init)
206         INITTIME(omap_init_time)
207 MACHINE_END