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