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