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