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