This source file includes following definitions.
- msp_usb_setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_GADGET)
27
28 #include <linux/init.h>
29 #include <linux/ioport.h>
30 #include <linux/platform_device.h>
31
32 #include <asm/mipsregs.h>
33
34 #include <msp_regs.h>
35 #include <msp_int.h>
36 #include <msp_prom.h>
37 #include <msp_usb.h>
38
39
40 #if defined(CONFIG_USB_EHCI_HCD)
41 static struct resource msp_usbhost0_resources[] = {
42 [0] = {
43 .start = MSP_USB0_HS_START,
44 .end = MSP_USB0_HS_END,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = MSP_INT_USB,
49 .end = MSP_INT_USB,
50 .flags = IORESOURCE_IRQ,
51 },
52 [2] = {
53 .start = MSP_USB0_MAB_START,
54 .end = MSP_USB0_MAB_END,
55 .flags = IORESOURCE_MEM,
56 },
57 [3] = {
58 .start = MSP_USB0_ID_START,
59 .end = MSP_USB0_ID_END,
60 .flags = IORESOURCE_MEM,
61 },
62 };
63
64 static u64 msp_usbhost0_dma_mask = 0xffffffffUL;
65
66 static struct mspusb_device msp_usbhost0_device = {
67 .dev = {
68 .name = "pmcmsp-ehci",
69 .id = 0,
70 .dev = {
71 .dma_mask = &msp_usbhost0_dma_mask,
72 .coherent_dma_mask = 0xffffffffUL,
73 },
74 .num_resources = ARRAY_SIZE(msp_usbhost0_resources),
75 .resource = msp_usbhost0_resources,
76 },
77 };
78 #endif
79
80 #if defined(CONFIG_USB_GADGET)
81 static struct resource msp_usbdev0_resources[] = {
82 [0] = {
83 .start = MSP_USB0_HS_START,
84 .end = MSP_USB0_HS_END,
85 .flags = IORESOURCE_MEM,
86 },
87 [1] = {
88 .start = MSP_INT_USB,
89 .end = MSP_INT_USB,
90 .flags = IORESOURCE_IRQ,
91 },
92 [2] = {
93 .start = MSP_USB0_MAB_START,
94 .end = MSP_USB0_MAB_END,
95 .flags = IORESOURCE_MEM,
96 },
97 [3] = {
98 .start = MSP_USB0_ID_START,
99 .end = MSP_USB0_ID_END,
100 .flags = IORESOURCE_MEM,
101 },
102 };
103
104 static u64 msp_usbdev_dma_mask = 0xffffffffUL;
105
106
107 static struct mspusb_device msp_usbdev0_device = {
108 .dev = {
109 .name = "msp71xx_udc",
110 .id = 0,
111 .dev = {
112 .dma_mask = &msp_usbdev_dma_mask,
113 .coherent_dma_mask = 0xffffffffUL,
114 },
115 .num_resources = ARRAY_SIZE(msp_usbdev0_resources),
116 .resource = msp_usbdev0_resources,
117 },
118 };
119 #endif
120
121 static int __init msp_usb_setup(void)
122 {
123 char *strp;
124 char envstr[32];
125 struct platform_device *msp_devs[NUM_USB_DEVS];
126 unsigned int val;
127
128
129
130
131
132
133
134
135
136 snprintf(&envstr[0], sizeof(envstr), "usbmode");
137
138
139 val = 1;
140
141
142 strp = prom_getenv(&envstr[0]);
143 if (strp) {
144
145 if (!strcmp(strp, "device"))
146 val = 0;
147 }
148
149 if (val) {
150 #if defined(CONFIG_USB_EHCI_HCD)
151 msp_devs[0] = &msp_usbhost0_device.dev;
152 ppfinit("platform add USB HOST done %s.\n", msp_devs[0]->name);
153 #else
154 ppfinit("%s: echi_hcd not supported\n", __FILE__);
155 #endif
156 } else {
157 #if defined(CONFIG_USB_GADGET)
158
159 msp_devs[0] = &msp_usbdev0_device.dev;
160 ppfinit("platform add USB DEVICE done %s.\n"
161 , msp_devs[0]->name);
162 #else
163 ppfinit("%s: usb_gadget not supported\n", __FILE__);
164 #endif
165 }
166
167 platform_add_devices(msp_devs, ARRAY_SIZE(msp_devs));
168
169 return 0;
170 }
171
172 subsys_initcall(msp_usb_setup);
173 #endif