1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25
26#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
27# if defined(CONFIG_CPU_MONAHANS) || defined(CONFIG_CPU_PXA27X)
28
29#include <asm/arch/pxa-regs.h>
30#include <asm/io.h>
31#include <usb.h>
32
33int usb_cpu_init(void)
34{
35#if defined(CONFIG_CPU_MONAHANS)
36
37 writel(readl(CKENA) | CKENA_2_USBHOST | CKENA_20_UDC, CKENA);
38 udelay(100);
39#endif
40#if defined(CONFIG_CPU_PXA27X)
41
42 writel(readl(CKEN) | CKEN10_USBHOST, CKEN);
43#endif
44
45#if defined(CONFIG_CPU_MONAHANS)
46
47 writel(0x3000c, UP2OCR);
48#endif
49
50 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
51 mdelay(11);
52 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
53
54 writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
55 while (readl(UHCHR) & UHCHR_FSBIR)
56 udelay(1);
57
58#if defined(CONFIG_CPU_MONAHANS) || defined(CONFIG_PXA27X)
59 writel(readl(UHCHR) & ~UHCHR_SSEP0, UHCHR);
60#endif
61#if defined(CONFIG_CPU_PXA27X)
62 writel(readl(UHCHR) & ~UHCHR_SSEP2, UHCHR);
63#endif
64 writel(readl(UHCHR) & ~(UHCHR_SSEP1 | UHCHR_SSE), UHCHR);
65
66 return 0;
67}
68
69int usb_cpu_stop(void)
70{
71 writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
72 udelay(11);
73 writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
74
75 writel(readl(UHCCOMS) | UHCCOMS_HCR, UHCCOMS);
76 udelay(10);
77
78#if defined(CONFIG_CPU_MONAHANS) || defined(CONFIG_PXA27X)
79 writel(readl(UHCHR) | UHCHR_SSEP0, UHCHR);
80#endif
81#if defined(CONFIG_CPU_PXA27X)
82 writel(readl(UHCHR) | UHCHR_SSEP2, UHCHR);
83#endif
84 writel(readl(UHCHR) | UHCHR_SSEP1 | UHCHR_SSE, UHCHR);
85
86#if defined(CONFIG_CPU_MONAHANS)
87
88 writel(readl(CKENA) & ~(CKENA_2_USBHOST | CKENA_20_UDC), CKENA);
89 udelay(100);
90#endif
91#if defined(CONFIG_CPU_PXA27X)
92
93 writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
94#endif
95
96 return 0;
97}
98
99int usb_cpu_init_fail(void)
100{
101 return usb_cpu_stop();
102}
103
104# endif
105#endif
106