diff options
author | Tony Lindgren <tony@atomide.com> | 2010-07-05 09:31:30 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-07-05 09:31:30 -0400 |
commit | dd0cdd888251d0d62df417d6859e74e57146c13f (patch) | |
tree | 1ecfce96253efc5dbcd4b96eb52ed3f359f77442 /arch/arm/plat-omap/usb.c | |
parent | 98093839307cbf1a0d5cb50b495d14a78b755ed9 (diff) |
omap: Move omap1 USB platform init code into mach-omap1/usb.c
Move omap1 FS USB platform init code into mach-omap1/usb.c
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/usb.c')
-rw-r--r-- | arch/arm/plat-omap/usb.c | 535 |
1 files changed, 0 insertions, 535 deletions
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c index 27b471ce11a0..f3570884883e 100644 --- a/arch/arm/plat-omap/usb.c +++ b/arch/arm/plat-omap/usb.c | |||
@@ -22,434 +22,13 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/types.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/init.h> | 25 | #include <linux/init.h> |
28 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
29 | #include <linux/usb/otg.h> | ||
30 | #include <linux/io.h> | 27 | #include <linux/io.h> |
31 | 28 | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/system.h> | ||
34 | #include <mach/hardware.h> | ||
35 | |||
36 | #include <plat/control.h> | ||
37 | #include <plat/mux.h> | ||
38 | #include <plat/usb.h> | 29 | #include <plat/usb.h> |
39 | #include <plat/board.h> | 30 | #include <plat/board.h> |
40 | 31 | ||
41 | #define INT_USB_IRQ_GEN IH2_BASE + 20 | ||
42 | #define INT_USB_IRQ_NISO IH2_BASE + 30 | ||
43 | #define INT_USB_IRQ_ISO IH2_BASE + 29 | ||
44 | #define INT_USB_IRQ_HGEN INT_USB_HHC_1 | ||
45 | #define INT_USB_IRQ_OTG IH2_BASE + 8 | ||
46 | |||
47 | /* These routines should handle the standard chip-specific modes | ||
48 | * for usb0/1/2 ports, covering basic mux and transceiver setup. | ||
49 | * | ||
50 | * Some board-*.c files will need to set up additional mux options, | ||
51 | * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup. | ||
52 | */ | ||
53 | |||
54 | /* TESTED ON: | ||
55 | * - 1611B H2 (with usb1 mini-AB) using standard Mini-B or OTG cables | ||
56 | * - 5912 OSK OHCI (with usb0 standard-A), standard A-to-B cables | ||
57 | * - 5912 OSK UDC, with *nonstandard* A-to-A cable | ||
58 | * - 1510 Innovator UDC with bundled usb0 cable | ||
59 | * - 1510 Innovator OHCI with bundled usb1/usb2 cable | ||
60 | * - 1510 Innovator OHCI with custom usb0 cable, feeding 5V VBUS | ||
61 | * - 1710 custom development board using alternate pin group | ||
62 | * - 1710 H3 (with usb1 mini-AB) using standard Mini-B or OTG cables | ||
63 | */ | ||
64 | |||
65 | /*-------------------------------------------------------------------------*/ | ||
66 | |||
67 | #if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP15XX) | ||
68 | |||
69 | static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device) | ||
70 | { | ||
71 | u32 syscon1 = 0; | ||
72 | |||
73 | if (nwires == 0) { | ||
74 | if (!cpu_is_omap15xx()) { | ||
75 | u32 l; | ||
76 | |||
77 | /* pulldown D+/D- */ | ||
78 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
79 | l &= ~(3 << 1); | ||
80 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
81 | } | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | if (is_device) { | ||
86 | if (cpu_is_omap7xx()) { | ||
87 | omap_cfg_reg(AA17_7XX_USB_DM); | ||
88 | omap_cfg_reg(W16_7XX_USB_PU_EN); | ||
89 | omap_cfg_reg(W17_7XX_USB_VBUSI); | ||
90 | omap_cfg_reg(W18_7XX_USB_DMCK_OUT); | ||
91 | omap_cfg_reg(W19_7XX_USB_DCRST); | ||
92 | } else | ||
93 | omap_cfg_reg(W4_USB_PUEN); | ||
94 | } | ||
95 | |||
96 | if (nwires == 2) { | ||
97 | u32 l; | ||
98 | |||
99 | // omap_cfg_reg(P9_USB_DP); | ||
100 | // omap_cfg_reg(R8_USB_DM); | ||
101 | |||
102 | if (cpu_is_omap15xx()) { | ||
103 | /* This works on 1510-Innovator */ | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /* NOTES: | ||
108 | * - peripheral should configure VBUS detection! | ||
109 | * - only peripherals may use the internal D+/D- pulldowns | ||
110 | * - OTG support on this port not yet written | ||
111 | */ | ||
112 | |||
113 | /* Don't do this for omap7xx -- it causes USB to not work correctly */ | ||
114 | if (!cpu_is_omap7xx()) { | ||
115 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
116 | l &= ~(7 << 4); | ||
117 | if (!is_device) | ||
118 | l |= (3 << 1); | ||
119 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
120 | } | ||
121 | |||
122 | return 3 << 16; | ||
123 | } | ||
124 | |||
125 | /* alternate pin config, external transceiver */ | ||
126 | if (cpu_is_omap15xx()) { | ||
127 | printk(KERN_ERR "no usb0 alt pin config on 15xx\n"); | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | omap_cfg_reg(V6_USB0_TXD); | ||
132 | omap_cfg_reg(W9_USB0_TXEN); | ||
133 | omap_cfg_reg(W5_USB0_SE0); | ||
134 | if (nwires != 3) | ||
135 | omap_cfg_reg(Y5_USB0_RCV); | ||
136 | |||
137 | /* NOTE: SPEED and SUSP aren't configured here. OTG hosts | ||
138 | * may be able to use I2C requests to set those bits along | ||
139 | * with VBUS switching and overcurrent detection. | ||
140 | */ | ||
141 | |||
142 | if (nwires != 6) { | ||
143 | u32 l; | ||
144 | |||
145 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
146 | l &= ~CONF_USB2_UNI_R; | ||
147 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
148 | } | ||
149 | |||
150 | switch (nwires) { | ||
151 | case 3: | ||
152 | syscon1 = 2; | ||
153 | break; | ||
154 | case 4: | ||
155 | syscon1 = 1; | ||
156 | break; | ||
157 | case 6: | ||
158 | syscon1 = 3; | ||
159 | { | ||
160 | u32 l; | ||
161 | |||
162 | omap_cfg_reg(AA9_USB0_VP); | ||
163 | omap_cfg_reg(R9_USB0_VM); | ||
164 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
165 | l |= CONF_USB2_UNI_R; | ||
166 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
167 | } | ||
168 | break; | ||
169 | default: | ||
170 | printk(KERN_ERR "illegal usb%d %d-wire transceiver\n", | ||
171 | 0, nwires); | ||
172 | } | ||
173 | return syscon1 << 16; | ||
174 | } | ||
175 | |||
176 | static u32 __init omap_usb1_init(unsigned nwires) | ||
177 | { | ||
178 | u32 syscon1 = 0; | ||
179 | |||
180 | if (!cpu_is_omap15xx() && nwires != 6) { | ||
181 | u32 l; | ||
182 | |||
183 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
184 | l &= ~CONF_USB1_UNI_R; | ||
185 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
186 | } | ||
187 | if (nwires == 0) | ||
188 | return 0; | ||
189 | |||
190 | /* external transceiver */ | ||
191 | omap_cfg_reg(USB1_TXD); | ||
192 | omap_cfg_reg(USB1_TXEN); | ||
193 | if (nwires != 3) | ||
194 | omap_cfg_reg(USB1_RCV); | ||
195 | |||
196 | if (cpu_is_omap15xx()) { | ||
197 | omap_cfg_reg(USB1_SEO); | ||
198 | omap_cfg_reg(USB1_SPEED); | ||
199 | // SUSP | ||
200 | } else if (cpu_is_omap1610() || cpu_is_omap5912()) { | ||
201 | omap_cfg_reg(W13_1610_USB1_SE0); | ||
202 | omap_cfg_reg(R13_1610_USB1_SPEED); | ||
203 | // SUSP | ||
204 | } else if (cpu_is_omap1710()) { | ||
205 | omap_cfg_reg(R13_1710_USB1_SE0); | ||
206 | // SUSP | ||
207 | } else { | ||
208 | pr_debug("usb%d cpu unrecognized\n", 1); | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | switch (nwires) { | ||
213 | case 2: | ||
214 | goto bad; | ||
215 | case 3: | ||
216 | syscon1 = 2; | ||
217 | break; | ||
218 | case 4: | ||
219 | syscon1 = 1; | ||
220 | break; | ||
221 | case 6: | ||
222 | syscon1 = 3; | ||
223 | omap_cfg_reg(USB1_VP); | ||
224 | omap_cfg_reg(USB1_VM); | ||
225 | if (!cpu_is_omap15xx()) { | ||
226 | u32 l; | ||
227 | |||
228 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
229 | l |= CONF_USB1_UNI_R; | ||
230 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
231 | } | ||
232 | break; | ||
233 | default: | ||
234 | bad: | ||
235 | printk(KERN_ERR "illegal usb%d %d-wire transceiver\n", | ||
236 | 1, nwires); | ||
237 | } | ||
238 | return syscon1 << 20; | ||
239 | } | ||
240 | |||
241 | static u32 __init omap_usb2_init(unsigned nwires, unsigned alt_pingroup) | ||
242 | { | ||
243 | u32 syscon1 = 0; | ||
244 | |||
245 | /* NOTE omap1 erratum: must leave USB2_UNI_R set if usb0 in use */ | ||
246 | if (alt_pingroup || nwires == 0) | ||
247 | return 0; | ||
248 | |||
249 | if (!cpu_is_omap15xx() && nwires != 6) { | ||
250 | u32 l; | ||
251 | |||
252 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
253 | l &= ~CONF_USB2_UNI_R; | ||
254 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
255 | } | ||
256 | |||
257 | /* external transceiver */ | ||
258 | if (cpu_is_omap15xx()) { | ||
259 | omap_cfg_reg(USB2_TXD); | ||
260 | omap_cfg_reg(USB2_TXEN); | ||
261 | omap_cfg_reg(USB2_SEO); | ||
262 | if (nwires != 3) | ||
263 | omap_cfg_reg(USB2_RCV); | ||
264 | /* there is no USB2_SPEED */ | ||
265 | } else if (cpu_is_omap16xx()) { | ||
266 | omap_cfg_reg(V6_USB2_TXD); | ||
267 | omap_cfg_reg(W9_USB2_TXEN); | ||
268 | omap_cfg_reg(W5_USB2_SE0); | ||
269 | if (nwires != 3) | ||
270 | omap_cfg_reg(Y5_USB2_RCV); | ||
271 | // FIXME omap_cfg_reg(USB2_SPEED); | ||
272 | } else { | ||
273 | pr_debug("usb%d cpu unrecognized\n", 1); | ||
274 | return 0; | ||
275 | } | ||
276 | // omap_cfg_reg(USB2_SUSP); | ||
277 | |||
278 | switch (nwires) { | ||
279 | case 2: | ||
280 | goto bad; | ||
281 | case 3: | ||
282 | syscon1 = 2; | ||
283 | break; | ||
284 | case 4: | ||
285 | syscon1 = 1; | ||
286 | break; | ||
287 | case 5: | ||
288 | goto bad; | ||
289 | case 6: | ||
290 | syscon1 = 3; | ||
291 | if (cpu_is_omap15xx()) { | ||
292 | omap_cfg_reg(USB2_VP); | ||
293 | omap_cfg_reg(USB2_VM); | ||
294 | } else { | ||
295 | u32 l; | ||
296 | |||
297 | omap_cfg_reg(AA9_USB2_VP); | ||
298 | omap_cfg_reg(R9_USB2_VM); | ||
299 | l = omap_readl(USB_TRANSCEIVER_CTRL); | ||
300 | l |= CONF_USB2_UNI_R; | ||
301 | omap_writel(l, USB_TRANSCEIVER_CTRL); | ||
302 | } | ||
303 | break; | ||
304 | default: | ||
305 | bad: | ||
306 | printk(KERN_ERR "illegal usb%d %d-wire transceiver\n", | ||
307 | 2, nwires); | ||
308 | } | ||
309 | return syscon1 << 24; | ||
310 | } | ||
311 | |||
312 | #else | ||
313 | #define omap_usb0_init NULL | ||
314 | #define omap_usb1_init NULL | ||
315 | #define omap_usb2_init NULL | ||
316 | #endif | ||
317 | |||
318 | /*-------------------------------------------------------------------------*/ | ||
319 | |||
320 | #ifdef CONFIG_USB_GADGET_OMAP | ||
321 | |||
322 | static struct resource udc_resources[] = { | ||
323 | /* order is significant! */ | ||
324 | { /* registers */ | ||
325 | .start = UDC_BASE, | ||
326 | .end = UDC_BASE + 0xff, | ||
327 | .flags = IORESOURCE_MEM, | ||
328 | }, { /* general IRQ */ | ||
329 | .start = INT_USB_IRQ_GEN, | ||
330 | .flags = IORESOURCE_IRQ, | ||
331 | }, { /* PIO IRQ */ | ||
332 | .start = INT_USB_IRQ_NISO, | ||
333 | .flags = IORESOURCE_IRQ, | ||
334 | }, { /* SOF IRQ */ | ||
335 | .start = INT_USB_IRQ_ISO, | ||
336 | .flags = IORESOURCE_IRQ, | ||
337 | }, | ||
338 | }; | ||
339 | |||
340 | static u64 udc_dmamask = ~(u32)0; | ||
341 | |||
342 | static struct platform_device udc_device = { | ||
343 | .name = "omap_udc", | ||
344 | .id = -1, | ||
345 | .dev = { | ||
346 | .dma_mask = &udc_dmamask, | ||
347 | .coherent_dma_mask = 0xffffffff, | ||
348 | }, | ||
349 | .num_resources = ARRAY_SIZE(udc_resources), | ||
350 | .resource = udc_resources, | ||
351 | }; | ||
352 | |||
353 | static inline void udc_device_init(struct omap_usb_config *pdata) | ||
354 | { | ||
355 | pdata->udc_device = &udc_device; | ||
356 | } | ||
357 | |||
358 | #else | ||
359 | |||
360 | static inline void udc_device_init(struct omap_usb_config *pdata) | ||
361 | { | ||
362 | } | ||
363 | |||
364 | #endif | ||
365 | |||
366 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
367 | |||
368 | /* The dmamask must be set for OHCI to work */ | ||
369 | static u64 ohci_dmamask = ~(u32)0; | ||
370 | |||
371 | static struct resource ohci_resources[] = { | ||
372 | { | ||
373 | .start = OMAP_OHCI_BASE, | ||
374 | .end = OMAP_OHCI_BASE + 0xff, | ||
375 | .flags = IORESOURCE_MEM, | ||
376 | }, | ||
377 | { | ||
378 | .start = INT_USB_IRQ_HGEN, | ||
379 | .flags = IORESOURCE_IRQ, | ||
380 | }, | ||
381 | }; | ||
382 | |||
383 | static struct platform_device ohci_device = { | ||
384 | .name = "ohci", | ||
385 | .id = -1, | ||
386 | .dev = { | ||
387 | .dma_mask = &ohci_dmamask, | ||
388 | .coherent_dma_mask = 0xffffffff, | ||
389 | }, | ||
390 | .num_resources = ARRAY_SIZE(ohci_resources), | ||
391 | .resource = ohci_resources, | ||
392 | }; | ||
393 | |||
394 | static inline void ohci_device_init(struct omap_usb_config *pdata) | ||
395 | { | ||
396 | pdata->ohci_device = &ohci_device; | ||
397 | } | ||
398 | |||
399 | #else | ||
400 | |||
401 | static inline void ohci_device_init(struct omap_usb_config *pdata) | ||
402 | { | ||
403 | } | ||
404 | |||
405 | #endif | ||
406 | |||
407 | #if defined(CONFIG_USB_OTG) && defined(CONFIG_ARCH_OMAP_OTG) | ||
408 | |||
409 | static struct resource otg_resources[] = { | ||
410 | /* order is significant! */ | ||
411 | { | ||
412 | .start = OTG_BASE, | ||
413 | .end = OTG_BASE + 0xff, | ||
414 | .flags = IORESOURCE_MEM, | ||
415 | }, { | ||
416 | .start = INT_USB_IRQ_OTG, | ||
417 | .flags = IORESOURCE_IRQ, | ||
418 | }, | ||
419 | }; | ||
420 | |||
421 | static struct platform_device otg_device = { | ||
422 | .name = "omap_otg", | ||
423 | .id = -1, | ||
424 | .num_resources = ARRAY_SIZE(otg_resources), | ||
425 | .resource = otg_resources, | ||
426 | }; | ||
427 | |||
428 | static inline void otg_device_init(struct omap_usb_config *pdata) | ||
429 | { | ||
430 | pdata->otg_device = &otg_device; | ||
431 | } | ||
432 | |||
433 | #else | ||
434 | |||
435 | static inline void otg_device_init(struct omap_usb_config *pdata) | ||
436 | { | ||
437 | } | ||
438 | |||
439 | #endif | ||
440 | |||
441 | /*-------------------------------------------------------------------------*/ | ||
442 | |||
443 | // FIXME correct answer depends on hmc_mode, | ||
444 | // as does (on omap1) any nonzero value for config->otg port number | ||
445 | #ifdef CONFIG_USB_GADGET_OMAP | ||
446 | #define is_usb0_device(config) 1 | ||
447 | #else | ||
448 | #define is_usb0_device(config) 0 | ||
449 | #endif | ||
450 | |||
451 | /*-------------------------------------------------------------------------*/ | ||
452 | |||
453 | #ifdef CONFIG_ARCH_OMAP_OTG | 32 | #ifdef CONFIG_ARCH_OMAP_OTG |
454 | 33 | ||
455 | void __init | 34 | void __init |
@@ -524,12 +103,6 @@ omap_otg_init(struct omap_usb_config *config) | |||
524 | 103 | ||
525 | syscon &= ~DEV_IDLE_EN; | 104 | syscon &= ~DEV_IDLE_EN; |
526 | udc_device->dev.platform_data = config; | 105 | udc_device->dev.platform_data = config; |
527 | /* IRQ numbers for omap7xx */ | ||
528 | if(cpu_is_omap7xx()) { | ||
529 | udc_resources[1].start = INT_7XX_USB_GENI; | ||
530 | udc_resources[2].start = INT_7XX_USB_NON_ISO; | ||
531 | udc_resources[3].start = INT_7XX_USB_ISO; | ||
532 | } | ||
533 | status = platform_device_register(udc_device); | 106 | status = platform_device_register(udc_device); |
534 | if (status) | 107 | if (status) |
535 | pr_debug("can't register UDC device, %d\n", status); | 108 | pr_debug("can't register UDC device, %d\n", status); |
@@ -542,8 +115,6 @@ omap_otg_init(struct omap_usb_config *config) | |||
542 | 115 | ||
543 | syscon &= ~HST_IDLE_EN; | 116 | syscon &= ~HST_IDLE_EN; |
544 | ohci_device->dev.platform_data = config; | 117 | ohci_device->dev.platform_data = config; |
545 | if (cpu_is_omap7xx()) | ||
546 | ohci_resources[1].start = INT_7XX_USB_HHC_1; | ||
547 | status = platform_device_register(ohci_device); | 118 | status = platform_device_register(ohci_device); |
548 | if (status) | 119 | if (status) |
549 | pr_debug("can't register OHCI device, %d\n", status); | 120 | pr_debug("can't register OHCI device, %d\n", status); |
@@ -556,8 +127,6 @@ omap_otg_init(struct omap_usb_config *config) | |||
556 | 127 | ||
557 | syscon &= ~OTG_IDLE_EN; | 128 | syscon &= ~OTG_IDLE_EN; |
558 | otg_device->dev.platform_data = config; | 129 | otg_device->dev.platform_data = config; |
559 | if (cpu_is_omap7xx()) | ||
560 | otg_resources[1].start = INT_7XX_USB_OTG; | ||
561 | status = platform_device_register(otg_device); | 130 | status = platform_device_register(otg_device); |
562 | if (status) | 131 | if (status) |
563 | pr_debug("can't register OTG device, %d\n", status); | 132 | pr_debug("can't register OTG device, %d\n", status); |
@@ -572,107 +141,3 @@ omap_otg_init(struct omap_usb_config *config) | |||
572 | #else | 141 | #else |
573 | void omap_otg_init(struct omap_usb_config *config) {} | 142 | void omap_otg_init(struct omap_usb_config *config) {} |
574 | #endif | 143 | #endif |
575 | |||
576 | /*-------------------------------------------------------------------------*/ | ||
577 | |||
578 | #ifdef CONFIG_ARCH_OMAP15XX | ||
579 | |||
580 | /* ULPD_DPLL_CTRL */ | ||
581 | #define DPLL_IOB (1 << 13) | ||
582 | #define DPLL_PLL_ENABLE (1 << 4) | ||
583 | #define DPLL_LOCK (1 << 0) | ||
584 | |||
585 | /* ULPD_APLL_CTRL */ | ||
586 | #define APLL_NDPLL_SWITCH (1 << 0) | ||
587 | |||
588 | |||
589 | static void __init omap_1510_usb_init(struct omap_usb_config *config) | ||
590 | { | ||
591 | unsigned int val; | ||
592 | u16 w; | ||
593 | |||
594 | config->usb0_init(config->pins[0], is_usb0_device(config)); | ||
595 | config->usb1_init(config->pins[1]); | ||
596 | config->usb2_init(config->pins[2], 0); | ||
597 | |||
598 | val = omap_readl(MOD_CONF_CTRL_0) & ~(0x3f << 1); | ||
599 | val |= (config->hmc_mode << 1); | ||
600 | omap_writel(val, MOD_CONF_CTRL_0); | ||
601 | |||
602 | printk("USB: hmc %d", config->hmc_mode); | ||
603 | if (config->pins[0]) | ||
604 | printk(", usb0 %d wires%s", config->pins[0], | ||
605 | is_usb0_device(config) ? " (dev)" : ""); | ||
606 | if (config->pins[1]) | ||
607 | printk(", usb1 %d wires", config->pins[1]); | ||
608 | if (config->pins[2]) | ||
609 | printk(", usb2 %d wires", config->pins[2]); | ||
610 | printk("\n"); | ||
611 | |||
612 | /* use DPLL for 48 MHz function clock */ | ||
613 | pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL), | ||
614 | omap_readw(ULPD_DPLL_CTRL), omap_readw(ULPD_SOFT_REQ)); | ||
615 | |||
616 | w = omap_readw(ULPD_APLL_CTRL); | ||
617 | w &= ~APLL_NDPLL_SWITCH; | ||
618 | omap_writew(w, ULPD_APLL_CTRL); | ||
619 | |||
620 | w = omap_readw(ULPD_DPLL_CTRL); | ||
621 | w |= DPLL_IOB | DPLL_PLL_ENABLE; | ||
622 | omap_writew(w, ULPD_DPLL_CTRL); | ||
623 | |||
624 | w = omap_readw(ULPD_SOFT_REQ); | ||
625 | w |= SOFT_UDC_REQ | SOFT_DPLL_REQ; | ||
626 | omap_writew(w, ULPD_SOFT_REQ); | ||
627 | |||
628 | while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) | ||
629 | cpu_relax(); | ||
630 | |||
631 | #ifdef CONFIG_USB_GADGET_OMAP | ||
632 | if (config->register_dev) { | ||
633 | int status; | ||
634 | |||
635 | udc_device.dev.platform_data = config; | ||
636 | status = platform_device_register(&udc_device); | ||
637 | if (status) | ||
638 | pr_debug("can't register UDC device, %d\n", status); | ||
639 | /* udc driver gates 48MHz by D+ pullup */ | ||
640 | } | ||
641 | #endif | ||
642 | |||
643 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
644 | if (config->register_host) { | ||
645 | int status; | ||
646 | |||
647 | ohci_device.dev.platform_data = config; | ||
648 | status = platform_device_register(&ohci_device); | ||
649 | if (status) | ||
650 | pr_debug("can't register OHCI device, %d\n", status); | ||
651 | /* hcd explicitly gates 48MHz */ | ||
652 | } | ||
653 | #endif | ||
654 | } | ||
655 | |||
656 | #else | ||
657 | static inline void omap_1510_usb_init(struct omap_usb_config *config) {} | ||
658 | #endif | ||
659 | |||
660 | /*-------------------------------------------------------------------------*/ | ||
661 | |||
662 | void __init omap_usb_init(struct omap_usb_config *pdata) | ||
663 | { | ||
664 | pdata->usb0_init = omap_usb0_init; | ||
665 | pdata->usb1_init = omap_usb1_init; | ||
666 | pdata->usb2_init = omap_usb2_init; | ||
667 | udc_device_init(pdata); | ||
668 | ohci_device_init(pdata); | ||
669 | otg_device_init(pdata); | ||
670 | |||
671 | if (cpu_is_omap7xx() || cpu_is_omap16xx()) | ||
672 | omap_otg_init(pdata); | ||
673 | else if (cpu_is_omap15xx()) | ||
674 | omap_1510_usb_init(pdata); | ||
675 | else | ||
676 | printk(KERN_ERR "USB: No init for your chip yet\n"); | ||
677 | } | ||
678 | |||