]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-omap1/board-innovator.c
Merge 'acpi-2.6.12' branch into to-akpm
[karo-tx-linux.git] / arch / arm / mach-omap1 / board-innovator.c
1 /*
2  * linux/arch/arm/mach-omap1/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 #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
32 #include <asm/arch/fpga.h>
33 #include <asm/arch/gpio.h>
34 #include <asm/arch/tc.h>
35 #include <asm/arch/usb.h>
36 #include <asm/arch/common.h>
37
38 static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
39
40 static struct mtd_partition innovator_partitions[] = {
41         /* bootloader (U-Boot, etc) in first sector */
42         {
43               .name             = "bootloader",
44               .offset           = 0,
45               .size             = SZ_128K,
46               .mask_flags       = MTD_WRITEABLE, /* force read-only */
47         },
48         /* bootloader params in the next sector */
49         {
50               .name             = "params",
51               .offset           = MTDPART_OFS_APPEND,
52               .size             = SZ_128K,
53               .mask_flags       = 0,
54         },
55         /* kernel */
56         {
57               .name             = "kernel",
58               .offset           = MTDPART_OFS_APPEND,
59               .size             = SZ_2M,
60               .mask_flags       = 0
61         },
62         /* rest of flash1 is a file system */
63         {
64               .name             = "rootfs",
65               .offset           = MTDPART_OFS_APPEND,
66               .size             = SZ_16M - SZ_2M - 2 * SZ_128K,
67               .mask_flags       = 0
68         },
69         /* file system */
70         {
71               .name             = "filesystem",
72               .offset           = MTDPART_OFS_APPEND,
73               .size             = MTDPART_SIZ_FULL,
74               .mask_flags       = 0
75         }
76 };
77
78 static struct flash_platform_data innovator_flash_data = {
79         .map_name       = "cfi_probe",
80         .width          = 2,
81         .parts          = innovator_partitions,
82         .nr_parts       = ARRAY_SIZE(innovator_partitions),
83 };
84
85 static struct resource innovator_flash_resource = {
86         .start          = OMAP_CS0_PHYS,
87         .end            = OMAP_CS0_PHYS + SZ_32M - 1,
88         .flags          = IORESOURCE_MEM,
89 };
90
91 static struct platform_device innovator_flash_device = {
92         .name           = "omapflash",
93         .id             = 0,
94         .dev            = {
95                 .platform_data  = &innovator_flash_data,
96         },
97         .num_resources  = 1,
98         .resource       = &innovator_flash_resource,
99 };
100
101 #ifdef CONFIG_ARCH_OMAP1510
102
103 /* Only FPGA needs to be mapped here. All others are done with ioremap */
104 static struct map_desc innovator1510_io_desc[] __initdata = {
105 { OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
106         MT_DEVICE },
107 };
108
109 static struct resource innovator1510_smc91x_resources[] = {
110         [0] = {
111                 .start  = OMAP1510_FPGA_ETHR_START,     /* Physical */
112                 .end    = OMAP1510_FPGA_ETHR_START + 0xf,
113                 .flags  = IORESOURCE_MEM,
114         },
115         [1] = {
116                 .start  = OMAP1510_INT_ETHER,
117                 .end    = OMAP1510_INT_ETHER,
118                 .flags  = IORESOURCE_IRQ,
119         },
120 };
121
122 static struct platform_device innovator1510_smc91x_device = {
123         .name           = "smc91x",
124         .id             = 0,
125         .num_resources  = ARRAY_SIZE(innovator1510_smc91x_resources),
126         .resource       = innovator1510_smc91x_resources,
127 };
128
129 static struct platform_device *innovator1510_devices[] __initdata = {
130         &innovator_flash_device,
131         &innovator1510_smc91x_device,
132 };
133
134 #endif /* CONFIG_ARCH_OMAP1510 */
135
136 #ifdef CONFIG_ARCH_OMAP16XX
137
138 static struct resource innovator1610_smc91x_resources[] = {
139         [0] = {
140                 .start  = INNOVATOR1610_ETHR_START,             /* Physical */
141                 .end    = INNOVATOR1610_ETHR_START + 0xf,
142                 .flags  = IORESOURCE_MEM,
143         },
144         [1] = {
145                 .start  = OMAP_GPIO_IRQ(0),
146                 .end    = OMAP_GPIO_IRQ(0),
147                 .flags  = IORESOURCE_IRQ,
148         },
149 };
150
151 static struct platform_device innovator1610_smc91x_device = {
152         .name           = "smc91x",
153         .id             = 0,
154         .num_resources  = ARRAY_SIZE(innovator1610_smc91x_resources),
155         .resource       = innovator1610_smc91x_resources,
156 };
157
158 static struct platform_device *innovator1610_devices[] __initdata = {
159         &innovator_flash_device,
160         &innovator1610_smc91x_device,
161 };
162
163 #endif /* CONFIG_ARCH_OMAP16XX */
164
165 static void __init innovator_init_smc91x(void)
166 {
167         if (cpu_is_omap1510()) {
168                 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
169                            OMAP1510_FPGA_RST);
170                 udelay(750);
171         } else {
172                 if ((omap_request_gpio(0)) < 0) {
173                         printk("Error requesting gpio 0 for smc91x irq\n");
174                         return;
175                 }
176                 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
177         }
178 }
179
180 void innovator_init_irq(void)
181 {
182         omap_init_irq();
183         omap_gpio_init();
184 #ifdef CONFIG_ARCH_OMAP1510
185         if (cpu_is_omap1510()) {
186                 omap1510_fpga_init_irq();
187         }
188 #endif
189         innovator_init_smc91x();
190 }
191
192 #ifdef CONFIG_ARCH_OMAP1510
193 static struct omap_usb_config innovator1510_usb_config __initdata = {
194         /* for bundled non-standard host and peripheral cables */
195         .hmc_mode       = 4,
196
197         .register_host  = 1,
198         .pins[1]        = 6,
199         .pins[2]        = 6,            /* Conflicts with UART2 */
200
201         .register_dev   = 1,
202         .pins[0]        = 2,
203 };
204 #endif
205
206 #ifdef CONFIG_ARCH_OMAP16XX
207 static struct omap_usb_config h2_usb_config __initdata = {
208         /* usb1 has a Mini-AB port and external isp1301 transceiver */
209         .otg            = 2,
210
211 #ifdef  CONFIG_USB_GADGET_OMAP
212         .hmc_mode       = 19,   // 0:host(off) 1:dev|otg 2:disabled
213         // .hmc_mode    = 21,   // 0:host(off) 1:dev(loopback) 2:host(loopback)
214 #elif   defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
215         /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
216         .hmc_mode       = 20,   // 1:dev|otg(off) 1:host 2:disabled
217 #endif
218
219         .pins[1]        = 3,
220 };
221 #endif
222
223 static struct omap_board_config_kernel innovator_config[] = {
224         { OMAP_TAG_USB,         NULL },
225 };
226
227 static void __init innovator_init(void)
228 {
229 #ifdef CONFIG_ARCH_OMAP1510
230         if (cpu_is_omap1510()) {
231                 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
232         }
233 #endif
234 #ifdef CONFIG_ARCH_OMAP16XX
235         if (!cpu_is_omap1510()) {
236                 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
237         }
238 #endif
239
240 #ifdef CONFIG_ARCH_OMAP1510
241         if (cpu_is_omap1510())
242                 innovator_config[0].data = &innovator1510_usb_config;
243 #endif
244 #ifdef CONFIG_ARCH_OMAP16XX
245         if (cpu_is_omap1610())
246                 innovator_config[0].data = &h2_usb_config;
247 #endif
248         omap_board_config = innovator_config;
249         omap_board_config_size = ARRAY_SIZE(innovator_config);
250 }
251
252 static void __init innovator_map_io(void)
253 {
254         omap_map_common_io();
255
256 #ifdef CONFIG_ARCH_OMAP1510
257         if (cpu_is_omap1510()) {
258                 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
259                 udelay(10);     /* Delay needed for FPGA */
260
261                 /* Dump the Innovator FPGA rev early - useful info for support. */
262                 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
263                        fpga_read(OMAP1510_FPGA_REV_HIGH),
264                        fpga_read(OMAP1510_FPGA_REV_LOW),
265                        fpga_read(OMAP1510_FPGA_BOARD_REV));
266         }
267 #endif
268         omap_serial_init(innovator_serial_ports);
269 }
270
271 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
272         /* Maintainer: MontaVista Software, Inc. */
273         .phys_ram       = 0x10000000,
274         .phys_io        = 0xfff00000,
275         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
276         .boot_params    = 0x10000100,
277         .map_io         = innovator_map_io,
278         .init_irq       = innovator_init_irq,
279         .init_machine   = innovator_init,
280         .timer          = &omap_timer,
281 MACHINE_END