Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / arm / mach-omap2 / usb-host.c
blob89ae29847c59c11254f15a84e907c61018f70765
1 /*
2 * usb-host.c - OMAP USB Host
4 * This file will contain the board specific details for the
5 * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards
7 * Copyright (C) 2007-2011 Texas Instruments
8 * Author: Vikram Pandita <vikram.pandita@ti.com>
9 * Author: Keshava Munegowda <keshava_mgowda@ti.com>
11 * Generalization by:
12 * Felipe Balbi <balbi@ti.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/types.h>
20 #include <linux/errno.h>
21 #include <linux/delay.h>
22 #include <linux/platform_device.h>
23 #include <linux/slab.h>
24 #include <linux/dma-mapping.h>
26 #include <asm/io.h>
28 #include <mach/hardware.h>
29 #include <mach/irqs.h>
30 #include <plat/usb.h>
32 #include "mux.h"
34 #ifdef CONFIG_MFD_OMAP_USB_HOST
36 #define OMAP_USBHS_DEVICE "usbhs-omap"
38 static struct resource usbhs_resources[] = {
40 .name = "uhh",
41 .flags = IORESOURCE_MEM,
44 .name = "tll",
45 .flags = IORESOURCE_MEM,
48 .name = "ehci",
49 .flags = IORESOURCE_MEM,
52 .name = "ehci-irq",
53 .flags = IORESOURCE_IRQ,
56 .name = "ohci",
57 .flags = IORESOURCE_MEM,
60 .name = "ohci-irq",
61 .flags = IORESOURCE_IRQ,
65 static struct platform_device usbhs_device = {
66 .name = OMAP_USBHS_DEVICE,
67 .id = 0,
68 .num_resources = ARRAY_SIZE(usbhs_resources),
69 .resource = usbhs_resources,
72 static struct usbhs_omap_platform_data usbhs_data;
73 static struct ehci_hcd_omap_platform_data ehci_data;
74 static struct ohci_hcd_omap_platform_data ohci_data;
76 /* MUX settings for EHCI pins */
78 * setup_ehci_io_mux - initialize IO pad mux for USBHOST
80 static void setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
82 switch (port_mode[0]) {
83 case OMAP_EHCI_PORT_MODE_PHY:
84 omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT);
85 omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT);
86 omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN);
87 omap_mux_init_signal("hsusb1_nxt", OMAP_PIN_INPUT_PULLDOWN);
88 omap_mux_init_signal("hsusb1_data0", OMAP_PIN_INPUT_PULLDOWN);
89 omap_mux_init_signal("hsusb1_data1", OMAP_PIN_INPUT_PULLDOWN);
90 omap_mux_init_signal("hsusb1_data2", OMAP_PIN_INPUT_PULLDOWN);
91 omap_mux_init_signal("hsusb1_data3", OMAP_PIN_INPUT_PULLDOWN);
92 omap_mux_init_signal("hsusb1_data4", OMAP_PIN_INPUT_PULLDOWN);
93 omap_mux_init_signal("hsusb1_data5", OMAP_PIN_INPUT_PULLDOWN);
94 omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN);
95 omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN);
96 break;
97 case OMAP_EHCI_PORT_MODE_TLL:
98 omap_mux_init_signal("hsusb1_tll_stp",
99 OMAP_PIN_INPUT_PULLUP);
100 omap_mux_init_signal("hsusb1_tll_clk",
101 OMAP_PIN_INPUT_PULLDOWN);
102 omap_mux_init_signal("hsusb1_tll_dir",
103 OMAP_PIN_INPUT_PULLDOWN);
104 omap_mux_init_signal("hsusb1_tll_nxt",
105 OMAP_PIN_INPUT_PULLDOWN);
106 omap_mux_init_signal("hsusb1_tll_data0",
107 OMAP_PIN_INPUT_PULLDOWN);
108 omap_mux_init_signal("hsusb1_tll_data1",
109 OMAP_PIN_INPUT_PULLDOWN);
110 omap_mux_init_signal("hsusb1_tll_data2",
111 OMAP_PIN_INPUT_PULLDOWN);
112 omap_mux_init_signal("hsusb1_tll_data3",
113 OMAP_PIN_INPUT_PULLDOWN);
114 omap_mux_init_signal("hsusb1_tll_data4",
115 OMAP_PIN_INPUT_PULLDOWN);
116 omap_mux_init_signal("hsusb1_tll_data5",
117 OMAP_PIN_INPUT_PULLDOWN);
118 omap_mux_init_signal("hsusb1_tll_data6",
119 OMAP_PIN_INPUT_PULLDOWN);
120 omap_mux_init_signal("hsusb1_tll_data7",
121 OMAP_PIN_INPUT_PULLDOWN);
122 break;
123 case OMAP_USBHS_PORT_MODE_UNUSED:
124 /* FALLTHROUGH */
125 default:
126 break;
129 switch (port_mode[1]) {
130 case OMAP_EHCI_PORT_MODE_PHY:
131 omap_mux_init_signal("hsusb2_stp", OMAP_PIN_OUTPUT);
132 omap_mux_init_signal("hsusb2_clk", OMAP_PIN_OUTPUT);
133 omap_mux_init_signal("hsusb2_dir", OMAP_PIN_INPUT_PULLDOWN);
134 omap_mux_init_signal("hsusb2_nxt", OMAP_PIN_INPUT_PULLDOWN);
135 omap_mux_init_signal("hsusb2_data0",
136 OMAP_PIN_INPUT_PULLDOWN);
137 omap_mux_init_signal("hsusb2_data1",
138 OMAP_PIN_INPUT_PULLDOWN);
139 omap_mux_init_signal("hsusb2_data2",
140 OMAP_PIN_INPUT_PULLDOWN);
141 omap_mux_init_signal("hsusb2_data3",
142 OMAP_PIN_INPUT_PULLDOWN);
143 omap_mux_init_signal("hsusb2_data4",
144 OMAP_PIN_INPUT_PULLDOWN);
145 omap_mux_init_signal("hsusb2_data5",
146 OMAP_PIN_INPUT_PULLDOWN);
147 omap_mux_init_signal("hsusb2_data6",
148 OMAP_PIN_INPUT_PULLDOWN);
149 omap_mux_init_signal("hsusb2_data7",
150 OMAP_PIN_INPUT_PULLDOWN);
151 break;
152 case OMAP_EHCI_PORT_MODE_TLL:
153 omap_mux_init_signal("hsusb2_tll_stp",
154 OMAP_PIN_INPUT_PULLUP);
155 omap_mux_init_signal("hsusb2_tll_clk",
156 OMAP_PIN_INPUT_PULLDOWN);
157 omap_mux_init_signal("hsusb2_tll_dir",
158 OMAP_PIN_INPUT_PULLDOWN);
159 omap_mux_init_signal("hsusb2_tll_nxt",
160 OMAP_PIN_INPUT_PULLDOWN);
161 omap_mux_init_signal("hsusb2_tll_data0",
162 OMAP_PIN_INPUT_PULLDOWN);
163 omap_mux_init_signal("hsusb2_tll_data1",
164 OMAP_PIN_INPUT_PULLDOWN);
165 omap_mux_init_signal("hsusb2_tll_data2",
166 OMAP_PIN_INPUT_PULLDOWN);
167 omap_mux_init_signal("hsusb2_tll_data3",
168 OMAP_PIN_INPUT_PULLDOWN);
169 omap_mux_init_signal("hsusb2_tll_data4",
170 OMAP_PIN_INPUT_PULLDOWN);
171 omap_mux_init_signal("hsusb2_tll_data5",
172 OMAP_PIN_INPUT_PULLDOWN);
173 omap_mux_init_signal("hsusb2_tll_data6",
174 OMAP_PIN_INPUT_PULLDOWN);
175 omap_mux_init_signal("hsusb2_tll_data7",
176 OMAP_PIN_INPUT_PULLDOWN);
177 break;
178 case OMAP_USBHS_PORT_MODE_UNUSED:
179 /* FALLTHROUGH */
180 default:
181 break;
184 switch (port_mode[2]) {
185 case OMAP_EHCI_PORT_MODE_PHY:
186 printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
187 break;
188 case OMAP_EHCI_PORT_MODE_TLL:
189 omap_mux_init_signal("hsusb3_tll_stp",
190 OMAP_PIN_INPUT_PULLUP);
191 omap_mux_init_signal("hsusb3_tll_clk",
192 OMAP_PIN_INPUT_PULLDOWN);
193 omap_mux_init_signal("hsusb3_tll_dir",
194 OMAP_PIN_INPUT_PULLDOWN);
195 omap_mux_init_signal("hsusb3_tll_nxt",
196 OMAP_PIN_INPUT_PULLDOWN);
197 omap_mux_init_signal("hsusb3_tll_data0",
198 OMAP_PIN_INPUT_PULLDOWN);
199 omap_mux_init_signal("hsusb3_tll_data1",
200 OMAP_PIN_INPUT_PULLDOWN);
201 omap_mux_init_signal("hsusb3_tll_data2",
202 OMAP_PIN_INPUT_PULLDOWN);
203 omap_mux_init_signal("hsusb3_tll_data3",
204 OMAP_PIN_INPUT_PULLDOWN);
205 omap_mux_init_signal("hsusb3_tll_data4",
206 OMAP_PIN_INPUT_PULLDOWN);
207 omap_mux_init_signal("hsusb3_tll_data5",
208 OMAP_PIN_INPUT_PULLDOWN);
209 omap_mux_init_signal("hsusb3_tll_data6",
210 OMAP_PIN_INPUT_PULLDOWN);
211 omap_mux_init_signal("hsusb3_tll_data7",
212 OMAP_PIN_INPUT_PULLDOWN);
213 break;
214 case OMAP_USBHS_PORT_MODE_UNUSED:
215 /* FALLTHROUGH */
216 default:
217 break;
220 return;
223 static void setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
225 switch (port_mode[0]) {
226 case OMAP_EHCI_PORT_MODE_PHY:
227 omap_mux_init_signal("usbb1_ulpiphy_stp",
228 OMAP_PIN_OUTPUT);
229 omap_mux_init_signal("usbb1_ulpiphy_clk",
230 OMAP_PIN_INPUT_PULLDOWN);
231 omap_mux_init_signal("usbb1_ulpiphy_dir",
232 OMAP_PIN_INPUT_PULLDOWN);
233 omap_mux_init_signal("usbb1_ulpiphy_nxt",
234 OMAP_PIN_INPUT_PULLDOWN);
235 omap_mux_init_signal("usbb1_ulpiphy_dat0",
236 OMAP_PIN_INPUT_PULLDOWN);
237 omap_mux_init_signal("usbb1_ulpiphy_dat1",
238 OMAP_PIN_INPUT_PULLDOWN);
239 omap_mux_init_signal("usbb1_ulpiphy_dat2",
240 OMAP_PIN_INPUT_PULLDOWN);
241 omap_mux_init_signal("usbb1_ulpiphy_dat3",
242 OMAP_PIN_INPUT_PULLDOWN);
243 omap_mux_init_signal("usbb1_ulpiphy_dat4",
244 OMAP_PIN_INPUT_PULLDOWN);
245 omap_mux_init_signal("usbb1_ulpiphy_dat5",
246 OMAP_PIN_INPUT_PULLDOWN);
247 omap_mux_init_signal("usbb1_ulpiphy_dat6",
248 OMAP_PIN_INPUT_PULLDOWN);
249 omap_mux_init_signal("usbb1_ulpiphy_dat7",
250 OMAP_PIN_INPUT_PULLDOWN);
251 break;
252 case OMAP_EHCI_PORT_MODE_TLL:
253 omap_mux_init_signal("usbb1_ulpitll_stp",
254 OMAP_PIN_INPUT_PULLUP);
255 omap_mux_init_signal("usbb1_ulpitll_clk",
256 OMAP_PIN_INPUT_PULLDOWN);
257 omap_mux_init_signal("usbb1_ulpitll_dir",
258 OMAP_PIN_INPUT_PULLDOWN);
259 omap_mux_init_signal("usbb1_ulpitll_nxt",
260 OMAP_PIN_INPUT_PULLDOWN);
261 omap_mux_init_signal("usbb1_ulpitll_dat0",
262 OMAP_PIN_INPUT_PULLDOWN);
263 omap_mux_init_signal("usbb1_ulpitll_dat1",
264 OMAP_PIN_INPUT_PULLDOWN);
265 omap_mux_init_signal("usbb1_ulpitll_dat2",
266 OMAP_PIN_INPUT_PULLDOWN);
267 omap_mux_init_signal("usbb1_ulpitll_dat3",
268 OMAP_PIN_INPUT_PULLDOWN);
269 omap_mux_init_signal("usbb1_ulpitll_dat4",
270 OMAP_PIN_INPUT_PULLDOWN);
271 omap_mux_init_signal("usbb1_ulpitll_dat5",
272 OMAP_PIN_INPUT_PULLDOWN);
273 omap_mux_init_signal("usbb1_ulpitll_dat6",
274 OMAP_PIN_INPUT_PULLDOWN);
275 omap_mux_init_signal("usbb1_ulpitll_dat7",
276 OMAP_PIN_INPUT_PULLDOWN);
277 break;
278 case OMAP_USBHS_PORT_MODE_UNUSED:
279 default:
280 break;
282 switch (port_mode[1]) {
283 case OMAP_EHCI_PORT_MODE_PHY:
284 omap_mux_init_signal("usbb2_ulpiphy_stp",
285 OMAP_PIN_OUTPUT);
286 omap_mux_init_signal("usbb2_ulpiphy_clk",
287 OMAP_PIN_INPUT_PULLDOWN);
288 omap_mux_init_signal("usbb2_ulpiphy_dir",
289 OMAP_PIN_INPUT_PULLDOWN);
290 omap_mux_init_signal("usbb2_ulpiphy_nxt",
291 OMAP_PIN_INPUT_PULLDOWN);
292 omap_mux_init_signal("usbb2_ulpiphy_dat0",
293 OMAP_PIN_INPUT_PULLDOWN);
294 omap_mux_init_signal("usbb2_ulpiphy_dat1",
295 OMAP_PIN_INPUT_PULLDOWN);
296 omap_mux_init_signal("usbb2_ulpiphy_dat2",
297 OMAP_PIN_INPUT_PULLDOWN);
298 omap_mux_init_signal("usbb2_ulpiphy_dat3",
299 OMAP_PIN_INPUT_PULLDOWN);
300 omap_mux_init_signal("usbb2_ulpiphy_dat4",
301 OMAP_PIN_INPUT_PULLDOWN);
302 omap_mux_init_signal("usbb2_ulpiphy_dat5",
303 OMAP_PIN_INPUT_PULLDOWN);
304 omap_mux_init_signal("usbb2_ulpiphy_dat6",
305 OMAP_PIN_INPUT_PULLDOWN);
306 omap_mux_init_signal("usbb2_ulpiphy_dat7",
307 OMAP_PIN_INPUT_PULLDOWN);
308 break;
309 case OMAP_EHCI_PORT_MODE_TLL:
310 omap_mux_init_signal("usbb2_ulpitll_stp",
311 OMAP_PIN_INPUT_PULLUP);
312 omap_mux_init_signal("usbb2_ulpitll_clk",
313 OMAP_PIN_INPUT_PULLDOWN);
314 omap_mux_init_signal("usbb2_ulpitll_dir",
315 OMAP_PIN_INPUT_PULLDOWN);
316 omap_mux_init_signal("usbb2_ulpitll_nxt",
317 OMAP_PIN_INPUT_PULLDOWN);
318 omap_mux_init_signal("usbb2_ulpitll_dat0",
319 OMAP_PIN_INPUT_PULLDOWN);
320 omap_mux_init_signal("usbb2_ulpitll_dat1",
321 OMAP_PIN_INPUT_PULLDOWN);
322 omap_mux_init_signal("usbb2_ulpitll_dat2",
323 OMAP_PIN_INPUT_PULLDOWN);
324 omap_mux_init_signal("usbb2_ulpitll_dat3",
325 OMAP_PIN_INPUT_PULLDOWN);
326 omap_mux_init_signal("usbb2_ulpitll_dat4",
327 OMAP_PIN_INPUT_PULLDOWN);
328 omap_mux_init_signal("usbb2_ulpitll_dat5",
329 OMAP_PIN_INPUT_PULLDOWN);
330 omap_mux_init_signal("usbb2_ulpitll_dat6",
331 OMAP_PIN_INPUT_PULLDOWN);
332 omap_mux_init_signal("usbb2_ulpitll_dat7",
333 OMAP_PIN_INPUT_PULLDOWN);
334 break;
335 case OMAP_USBHS_PORT_MODE_UNUSED:
336 default:
337 break;
341 static void setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
343 switch (port_mode[0]) {
344 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
345 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
346 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
347 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
348 omap_mux_init_signal("mm1_rxdp",
349 OMAP_PIN_INPUT_PULLDOWN);
350 omap_mux_init_signal("mm1_rxdm",
351 OMAP_PIN_INPUT_PULLDOWN);
352 /* FALLTHROUGH */
353 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
354 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
355 omap_mux_init_signal("mm1_rxrcv",
356 OMAP_PIN_INPUT_PULLDOWN);
357 /* FALLTHROUGH */
358 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
359 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
360 omap_mux_init_signal("mm1_txen_n", OMAP_PIN_OUTPUT);
361 /* FALLTHROUGH */
362 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
363 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
364 omap_mux_init_signal("mm1_txse0",
365 OMAP_PIN_INPUT_PULLDOWN);
366 omap_mux_init_signal("mm1_txdat",
367 OMAP_PIN_INPUT_PULLDOWN);
368 break;
369 case OMAP_USBHS_PORT_MODE_UNUSED:
370 /* FALLTHROUGH */
371 default:
372 break;
374 switch (port_mode[1]) {
375 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
376 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
377 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
378 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
379 omap_mux_init_signal("mm2_rxdp",
380 OMAP_PIN_INPUT_PULLDOWN);
381 omap_mux_init_signal("mm2_rxdm",
382 OMAP_PIN_INPUT_PULLDOWN);
383 /* FALLTHROUGH */
384 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
385 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
386 omap_mux_init_signal("mm2_rxrcv",
387 OMAP_PIN_INPUT_PULLDOWN);
388 /* FALLTHROUGH */
389 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
390 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
391 omap_mux_init_signal("mm2_txen_n", OMAP_PIN_OUTPUT);
392 /* FALLTHROUGH */
393 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
394 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
395 omap_mux_init_signal("mm2_txse0",
396 OMAP_PIN_INPUT_PULLDOWN);
397 omap_mux_init_signal("mm2_txdat",
398 OMAP_PIN_INPUT_PULLDOWN);
399 break;
400 case OMAP_USBHS_PORT_MODE_UNUSED:
401 /* FALLTHROUGH */
402 default:
403 break;
405 switch (port_mode[2]) {
406 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
407 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
408 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
409 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
410 omap_mux_init_signal("mm3_rxdp",
411 OMAP_PIN_INPUT_PULLDOWN);
412 omap_mux_init_signal("mm3_rxdm",
413 OMAP_PIN_INPUT_PULLDOWN);
414 /* FALLTHROUGH */
415 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
416 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
417 omap_mux_init_signal("mm3_rxrcv",
418 OMAP_PIN_INPUT_PULLDOWN);
419 /* FALLTHROUGH */
420 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
421 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
422 omap_mux_init_signal("mm3_txen_n", OMAP_PIN_OUTPUT);
423 /* FALLTHROUGH */
424 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
425 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
426 omap_mux_init_signal("mm3_txse0",
427 OMAP_PIN_INPUT_PULLDOWN);
428 omap_mux_init_signal("mm3_txdat",
429 OMAP_PIN_INPUT_PULLDOWN);
430 break;
431 case OMAP_USBHS_PORT_MODE_UNUSED:
432 /* FALLTHROUGH */
433 default:
434 break;
438 static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
440 switch (port_mode[0]) {
441 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
442 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
443 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
444 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
445 omap_mux_init_signal("usbb1_mm_rxdp",
446 OMAP_PIN_INPUT_PULLDOWN);
447 omap_mux_init_signal("usbb1_mm_rxdm",
448 OMAP_PIN_INPUT_PULLDOWN);
450 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
451 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
452 omap_mux_init_signal("usbb1_mm_rxrcv",
453 OMAP_PIN_INPUT_PULLDOWN);
455 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
456 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
457 omap_mux_init_signal("usbb1_mm_txen",
458 OMAP_PIN_INPUT_PULLDOWN);
461 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
462 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
463 omap_mux_init_signal("usbb1_mm_txdat",
464 OMAP_PIN_INPUT_PULLDOWN);
465 omap_mux_init_signal("usbb1_mm_txse0",
466 OMAP_PIN_INPUT_PULLDOWN);
467 break;
469 case OMAP_USBHS_PORT_MODE_UNUSED:
470 default:
471 break;
474 switch (port_mode[1]) {
475 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
476 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
477 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
478 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
479 omap_mux_init_signal("usbb2_mm_rxdp",
480 OMAP_PIN_INPUT_PULLDOWN);
481 omap_mux_init_signal("usbb2_mm_rxdm",
482 OMAP_PIN_INPUT_PULLDOWN);
484 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
485 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
486 omap_mux_init_signal("usbb2_mm_rxrcv",
487 OMAP_PIN_INPUT_PULLDOWN);
489 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
490 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
491 omap_mux_init_signal("usbb2_mm_txen",
492 OMAP_PIN_INPUT_PULLDOWN);
495 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
496 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
497 omap_mux_init_signal("usbb2_mm_txdat",
498 OMAP_PIN_INPUT_PULLDOWN);
499 omap_mux_init_signal("usbb2_mm_txse0",
500 OMAP_PIN_INPUT_PULLDOWN);
501 break;
503 case OMAP_USBHS_PORT_MODE_UNUSED:
504 default:
505 break;
509 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
511 int i;
513 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
514 usbhs_data.port_mode[i] = pdata->port_mode[i];
515 ohci_data.port_mode[i] = pdata->port_mode[i];
516 ehci_data.port_mode[i] = pdata->port_mode[i];
517 ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
518 ehci_data.regulator[i] = pdata->regulator[i];
520 ehci_data.phy_reset = pdata->phy_reset;
521 ohci_data.es2_compatibility = pdata->es2_compatibility;
522 usbhs_data.ehci_data = &ehci_data;
523 usbhs_data.ohci_data = &ohci_data;
525 if (cpu_is_omap34xx()) {
526 usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE;
527 usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
528 usbhs_resources[1].start = OMAP34XX_USBTLL_BASE;
529 usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
530 usbhs_resources[2].start = OMAP34XX_EHCI_BASE;
531 usbhs_resources[2].end = OMAP34XX_EHCI_BASE + SZ_1K - 1;
532 usbhs_resources[3].start = INT_34XX_EHCI_IRQ;
533 usbhs_resources[4].start = OMAP34XX_OHCI_BASE;
534 usbhs_resources[4].end = OMAP34XX_OHCI_BASE + SZ_1K - 1;
535 usbhs_resources[5].start = INT_34XX_OHCI_IRQ;
536 setup_ehci_io_mux(pdata->port_mode);
537 setup_ohci_io_mux(pdata->port_mode);
538 } else if (cpu_is_omap44xx()) {
539 usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE;
540 usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
541 usbhs_resources[1].start = OMAP44XX_USBTLL_BASE;
542 usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
543 usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE;
544 usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
545 usbhs_resources[3].start = OMAP44XX_IRQ_EHCI;
546 usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE;
547 usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
548 usbhs_resources[5].start = OMAP44XX_IRQ_OHCI;
549 setup_4430ehci_io_mux(pdata->port_mode);
550 setup_4430ohci_io_mux(pdata->port_mode);
553 if (platform_device_add_data(&usbhs_device,
554 &usbhs_data, sizeof(usbhs_data)) < 0) {
555 printk(KERN_ERR "USBHS platform_device_add_data failed\n");
556 goto init_end;
559 if (platform_device_register(&usbhs_device) < 0)
560 printk(KERN_ERR "USBHS platform_device_register failed\n");
562 init_end:
563 return;
566 #else
568 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
572 #endif