brcm47xx: 2.6.28 was accidentally committed with the old (and conceptually broken...
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 037-gumstix-pxa270-usb-host.patch
1 --- a/arch/arm/mach-pxa/gumstix.c
2 +++ b/arch/arm/mach-pxa/gumstix.c
3 @@ -22,6 +22,7 @@
4 #include <asm/mach-types.h>
5 #include <asm/mach/arch.h>
6 #include <asm/mach/irq.h>
7 +#include <asm/arch/ohci.h>
8 #include <asm/arch/udc.h>
9 #include <asm/arch/mmc.h>
10 #include <asm/arch/pxa-regs.h>
11 @@ -178,9 +179,34 @@ static struct platform_device *devices[]
12 &gum_audio_device,
13 };
14
15 +#ifdef CONFIG_ARCH_GUMSTIX_VERDEX
16 +static int gumstix_ohci_init(struct device *dev)
17 +{
18 + /* setup Port1 GPIO pin. */
19 + //pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
20 + //pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
21 +
22 + // Turn on port 2 in host mode
23 + UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
24 +
25 + UHCHR = (UHCHR) &
26 + ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
27 +
28 + return 0;
29 +}
30 +
31 +static struct pxaohci_platform_data gumstix_ohci_platform_data = {
32 + .port_mode = PMM_PERPORT_MODE,
33 + .init = gumstix_ohci_init,
34 +};
35 +#endif
36 +
37 static void __init gumstix_init(void)
38 {
39 pxa_set_mci_info(&gumstix_mci_platform_data);
40 +#ifdef CONFIG_ARCH_GUMSTIX_VERDEX
41 + pxa_set_ohci_info(&gumstix_ohci_platform_data);
42 +#endif
43 pxa_set_udc_info(&gumstix_udc_info);
44 #if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) | defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) | defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
45 set_pxa_fb_info(&gumstix_fb_info);
46 --- a/drivers/usb/gadget/ether.c
47 +++ b/drivers/usb/gadget/ether.c
48 @@ -260,6 +260,8 @@ MODULE_PARM_DESC(host_addr, "Host Ethern
49
50 #ifdef CONFIG_USB_GADGET_PXA27X
51 #define DEV_CONFIG_CDC
52 +extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget,
53 + struct usb_endpoint_descriptor *desc,int config,int interface,int alt);
54 #endif
55
56 #ifdef CONFIG_USB_GADGET_S3C2410
57 @@ -482,15 +484,15 @@ eth_config = {
58 #ifdef CONFIG_USB_ETH_RNDIS
59 static struct usb_config_descriptor
60 rndis_config = {
61 - .bLength = sizeof rndis_config,
62 + .bLength = sizeof rndis_config,
63 .bDescriptorType = USB_DT_CONFIG,
64
65 /* compute wTotalLength on the fly */
66 - .bNumInterfaces = 2,
67 + .bNumInterfaces = 2,
68 .bConfigurationValue = DEV_RNDIS_CONFIG_VALUE,
69 - .iConfiguration = STRING_RNDIS,
70 + .iConfiguration = STRING_RNDIS,
71 .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
72 - .bMaxPower = 50,
73 + .bMaxPower = 50,
74 };
75 #endif
76
77 @@ -532,15 +534,15 @@ control_intf = {
78 #ifdef CONFIG_USB_ETH_RNDIS
79 static const struct usb_interface_descriptor
80 rndis_control_intf = {
81 - .bLength = sizeof rndis_control_intf,
82 + .bLength = sizeof rndis_control_intf,
83 .bDescriptorType = USB_DT_INTERFACE,
84
85 .bInterfaceNumber = 0,
86 - .bNumEndpoints = 1,
87 + .bNumEndpoints = 1,
88 .bInterfaceClass = USB_CLASS_COMM,
89 .bInterfaceSubClass = USB_CDC_SUBCLASS_ACM,
90 .bInterfaceProtocol = USB_CDC_ACM_PROTO_VENDOR,
91 - .iInterface = STRING_RNDIS_CONTROL,
92 + .iInterface = STRING_RNDIS_CONTROL,
93 };
94 #endif
95
96 @@ -1342,7 +1344,7 @@ static void rndis_response_complete (str
97
98 static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req)
99 {
100 - struct eth_dev *dev = ep->driver_data;
101 + struct eth_dev *dev = ep->driver_data;
102 int status;
103
104 /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */
105 @@ -1578,7 +1580,7 @@ done_set_intf:
106
107 /* return the result */
108 buf = rndis_get_next_response (dev->rndis_config,
109 - &value);
110 + &value);
111 if (buf) {
112 memcpy (req->buf, buf, value);
113 req->complete = rndis_response_complete;
114 @@ -2064,7 +2066,7 @@ static void eth_req_free (struct usb_ep
115 static void
116 rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req)
117 {
118 - struct eth_dev *dev = ep->driver_data;
119 + struct eth_dev *dev = ep->driver_data;
120
121 if (req->status || req->actual != req->length)
122 DEBUG (dev,
123 @@ -2415,7 +2417,27 @@ eth_bind (struct usb_gadget *gadget)
124
125 /* all we really need is bulk IN/OUT */
126 usb_ep_autoconfig_reset (gadget);
127 +#ifdef CONFIG_USB_GADGET_PXA27X
128 +#ifdef CONFIG_USB_ETH_RNDIS
129 + in_ep = pxa27x_ep_config (gadget, &fs_source_desc,
130 + DEV_RNDIS_CONFIG_VALUE,
131 + (int)rndis_data_intf.bInterfaceNumber,
132 + (int)rndis_data_intf.bAlternateSetting);
133 +#elif defined(DEV_CONFIG_CDC)
134 + in_ep = pxa27x_ep_config (gadget, &fs_source_desc,
135 + DEV_CONFIG_VALUE,
136 + (int)data_intf.bInterfaceNumber,
137 + (int)data_intf.bAlternateSetting);
138 +#elif defined(DEV_CONFIG_SUBSET)
139 + in_ep = pxa27x_ep_config (gadget, &fs_source_desc,
140 + DEV_CONFIG_VALUE,
141 + (int)subset_data_intf.bInterfaceNumber,
142 + (int)subset_data_intf.bAlternateSetting);
143 +
144 +#endif //CONFIG_USB_ETH_RNDIS
145 +#else
146 in_ep = usb_ep_autoconfig (gadget, &fs_source_desc);
147 +#endif //CONFIG_USB_GADGET_PXA27X
148 if (!in_ep) {
149 autoconf_fail:
150 dev_err (&gadget->dev,
151 @@ -2425,7 +2447,26 @@ autoconf_fail:
152 }
153 in_ep->driver_data = in_ep; /* claim */
154
155 +#ifdef CONFIG_USB_GADGET_PXA27X
156 +#ifdef CONFIG_USB_ETH_RNDIS
157 + out_ep = pxa27x_ep_config (gadget, &fs_sink_desc,
158 + DEV_RNDIS_CONFIG_VALUE,
159 + (int)rndis_data_intf.bInterfaceNumber,
160 + (int)rndis_data_intf.bAlternateSetting);
161 +#elif defined(DEV_CONFIG_CDC)
162 + out_ep = pxa27x_ep_config (gadget, &fs_sink_desc,
163 + DEV_CONFIG_VALUE,
164 + (int)data_intf.bInterfaceNumber,
165 + (int)data_intf.bAlternateSetting);
166 +#elif defined(DEV_CONFIG_SUBSET)
167 + out_ep = pxa27x_ep_config (gadget, &fs_sink_desc,
168 + DEV_CONFIG_VALUE,
169 + (int)subset_data_intf.bInterfaceNumber,
170 + (int)subset_data_intf.bAlternateSetting);
171 +#endif //CONFIG_USB_ETH_RNDIS
172 +#else
173 out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc);
174 +#endif //CONFIG_USB_GADGET_PXA27X
175 if (!out_ep)
176 goto autoconf_fail;
177 out_ep->driver_data = out_ep; /* claim */
178 @@ -2435,7 +2476,22 @@ autoconf_fail:
179 * Since some hosts expect one, try to allocate one anyway.
180 */
181 if (cdc || rndis) {
182 +#ifdef CONFIG_USB_GADGET_PXA27X
183 +#ifdef CONFIG_USB_ETH_RNDIS
184 + status_ep = pxa27x_ep_config (gadget, &fs_status_desc,
185 + DEV_RNDIS_CONFIG_VALUE,
186 + (int)rndis_control_intf.bInterfaceNumber,
187 + (int)rndis_control_intf.bAlternateSetting);
188 +#elif defined(DEV_CONFIG_CDC)
189 + status_ep = pxa27x_ep_config (gadget, &fs_status_desc,
190 + DEV_CONFIG_VALUE,
191 + (int)control_intf.bInterfaceNumber,
192 + (int)control_intf.bAlternateSetting);
193 +
194 +#endif //CONFIG_USB_ETH_RNDIS
195 +#else
196 status_ep = usb_ep_autoconfig (gadget, &fs_status_desc);
197 +#endif //CONFIG_USB_GADGET_PXA27X
198 if (status_ep) {
199 status_ep->driver_data = status_ep; /* claim */
200 } else if (rndis) {
201 @@ -2444,11 +2500,13 @@ autoconf_fail:
202 gadget->name);
203 return -ENODEV;
204 #ifdef DEV_CONFIG_CDC
205 +#ifndef CONFIG_USB_GADGET_PXA27X
206 /* pxa25x only does CDC subset; often used with RNDIS */
207 } else if (cdc) {
208 control_intf.bNumEndpoints = 0;
209 /* FIXME remove endpoint from descriptor list */
210 #endif
211 +#endif
212 }
213 }
214 #endif
215 --- a/drivers/usb/gadget/file_storage.c
216 +++ b/drivers/usb/gadget/file_storage.c
217 @@ -280,6 +280,12 @@ MODULE_LICENSE("Dual BSD/GPL");
218 #define DRIVER_PRODUCT_ID 0xa4a5 // Linux-USB File-backed Storage Gadget
219
220
221 +
222 +#ifdef CONFIG_USB_GADGET_PXA27X
223 +extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget,
224 + struct usb_endpoint_descriptor *desc,int config,int interface,int alt);
225 +#endif
226 +
227 /*
228 * This driver assumes self-powered hardware and has no way for users to
229 * trigger remote wakeup. It uses autoconfiguration to select endpoints
230 @@ -3920,20 +3926,32 @@ static int __init fsg_bind(struct usb_ga
231
232 /* Find all the endpoints we will use */
233 usb_ep_autoconfig_reset(gadget);
234 +#ifdef CONFIG_USB_GADGET_PXA27X
235 + ep = pxa27x_ep_config(gadget, &fs_bulk_in_desc, CONFIG_VALUE, 0, 0);
236 +#else
237 ep = usb_ep_autoconfig(gadget, &fs_bulk_in_desc);
238 +#endif
239 if (!ep)
240 goto autoconf_fail;
241 ep->driver_data = fsg; // claim the endpoint
242 fsg->bulk_in = ep;
243
244 +#ifdef CONFIG_USB_GADGET_PXA27X
245 + ep = pxa27x_ep_config(gadget, &fs_bulk_out_desc, CONFIG_VALUE, 0, 0);
246 +#else
247 ep = usb_ep_autoconfig(gadget, &fs_bulk_out_desc);
248 +#endif
249 if (!ep)
250 goto autoconf_fail;
251 ep->driver_data = fsg; // claim the endpoint
252 fsg->bulk_out = ep;
253
254 if (transport_is_cbi()) {
255 +#ifdef CONFIG_USB_GADGET_PXA27X
256 + ep = pxa27x_ep_config(gadget, &fs_intr_in_desc, CONFIG_VALUE, 0, 0);
257 +#else
258 ep = usb_ep_autoconfig(gadget, &fs_intr_in_desc);
259 +#endif
260 if (!ep)
261 goto autoconf_fail;
262 ep->driver_data = fsg; // claim the endpoint
263 @@ -4063,6 +4081,7 @@ autoconf_fail:
264 rc = -ENOTSUPP;
265
266 out:
267 + ERROR(fsg, "cleaning up on the way out\n");
268 fsg->state = FSG_STATE_TERMINATED; // The thread is dead
269 fsg_unbind(gadget);
270 close_all_backing_files(fsg);
271 --- a/drivers/usb/gadget/serial.c
272 +++ b/drivers/usb/gadget/serial.c
273 @@ -126,6 +126,10 @@ static int debug = 1;
274 #define GS_LOG2_NOTIFY_INTERVAL 5 /* 1 << 5 == 32 msec */
275 #define GS_NOTIFY_MAXPACKET 8
276
277 +#ifdef CONFIG_USB_GADGET_PXA27X
278 +extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget,
279 + struct usb_endpoint_descriptor *desc,int config,int interface,int alt);
280 +#endif
281
282 /* Structures */
283
284 @@ -1378,20 +1382,32 @@ static int __init gs_bind(struct usb_gad
285
286 usb_ep_autoconfig_reset(gadget);
287
288 +#ifdef CONFIG_USB_GADGET_PXA27X
289 + ep = pxa27x_ep_config(gadget, &gs_fullspeed_in_desc, use_acm ? GS_ACM_CONFIG_ID : GS_BULK_CONFIG_ID, gs_bulk_interface_desc.bInterfaceNumber, gs_bulk_interface_desc.bAlternateSetting);
290 +#else
291 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc);
292 +#endif
293 if (!ep)
294 goto autoconf_fail;
295 EP_IN_NAME = ep->name;
296 ep->driver_data = ep; /* claim the endpoint */
297
298 +#ifdef CONFIG_USB_GADGET_PXA27X
299 + ep = pxa27x_ep_config(gadget, &gs_fullspeed_out_desc, use_acm ? GS_ACM_CONFIG_ID : GS_BULK_CONFIG_ID, gs_bulk_interface_desc.bInterfaceNumber, gs_bulk_interface_desc.bAlternateSetting);
300 +#else
301 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc);
302 +#endif
303 if (!ep)
304 goto autoconf_fail;
305 EP_OUT_NAME = ep->name;
306 ep->driver_data = ep; /* claim the endpoint */
307
308 if (use_acm) {
309 +#ifdef CONFIG_USB_GADGET_PXA27X
310 + ep = pxa27x_ep_config(gadget, &gs_fullspeed_notify_desc, GS_BULK_CONFIG_ID, gs_control_interface_desc.bInterfaceNumber, gs_control_interface_desc.bAlternateSetting);
311 +#else
312 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc);
313 +#endif
314 if (!ep) {
315 printk(KERN_ERR "gs_bind: cannot run ACM on %s\n", gadget->name);
316 goto autoconf_fail;
317 --- a/drivers/usb/gadget/zero.c
318 +++ b/drivers/usb/gadget/zero.c
319 @@ -212,6 +212,11 @@ module_param (loopdefault, bool, S_IRUGO
320 #define STRING_SOURCE_SINK 250
321 #define STRING_LOOPBACK 251
322
323 +#ifdef CONFIG_USB_GADGET_PXA27X
324 +extern struct usb_ep* pxa27x_ep_config(struct usb_gadget *gadget,
325 + struct usb_endpoint_descriptor *desc,int config,int interface,int alt);
326 +#endif
327 +
328 /*
329 * This device advertises two configurations; these numbers work
330 * on a pxa250 as well as more flexible hardware.
331 @@ -1155,7 +1160,11 @@ zero_bind (struct usb_gadget *gadget)
332 * but there may also be important quirks to address.
333 */
334 usb_ep_autoconfig_reset (gadget);
335 +#ifdef CONFIG_USB_GADGET_PXA27X
336 + ep = pxa27x_ep_config(gadget, &fs_source_desc, CONFIG_SOURCE_SINK, source_sink_intf.bInterfaceNumber, source_sink_intf.bAlternateSetting);
337 +#else
338 ep = usb_ep_autoconfig (gadget, &fs_source_desc);
339 +#endif
340 if (!ep) {
341 autoconf_fail:
342 printk (KERN_ERR "%s: can't autoconfigure on %s\n",
343 @@ -1164,8 +1173,12 @@ autoconf_fail:
344 }
345 EP_IN_NAME = ep->name;
346 ep->driver_data = ep; /* claim */
347 -
348 +
349 +#ifdef CONFIG_USB_GADGET_PXA27X
350 + ep = pxa27x_ep_config(gadget, &fs_sink_desc, CONFIG_SOURCE_SINK, source_sink_intf.bInterfaceNumber, source_sink_intf.bAlternateSetting);
351 +#else
352 ep = usb_ep_autoconfig (gadget, &fs_sink_desc);
353 +#endif
354 if (!ep)
355 goto autoconf_fail;
356 EP_OUT_NAME = ep->name;
This page took 0.055574 seconds and 5 git commands to generate.