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