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