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