Commit 3cb45ca2 authored by David Brownell's avatar David Brownell Committed by Linus Torvalds

[PATCH] USB: net2280 patch: control-out fix, minor cleanups

The main thing this fixes is making the control-OUT path work.
Drivers like RNDIS and DFU need it; this should resolve one
bug report.  It also has some minor cleanups.
parent cf573b0f
...@@ -20,10 +20,12 @@ ...@@ -20,10 +20,12 @@
* short OUT transfers happen.) Drivers can use the req->no_interrupt * short OUT transfers happen.) Drivers can use the req->no_interrupt
* hint to completely eliminate some IRQs, if a later IRQ is guaranteed * hint to completely eliminate some IRQs, if a later IRQ is guaranteed
* and DMA chaining is enabled. * and DMA chaining is enabled.
*
* Note that almost all the errata workarounds here are only needed for
* rev1 chips. Rev1a silicon (0110) fixes almost all of them.
*/ */
// #define NET2280_DMA_OUT_WORKAROUND #define USE_DMA_CHAINING
// #define USE_DMA_CHAINING
/* /*
...@@ -180,6 +182,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -180,6 +182,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
* kicking in the "toggle-irrelevant" mode. * kicking in the "toggle-irrelevant" mode.
*/ */
tmp = USB_ENDPOINT_XFER_BULK; tmp = USB_ENDPOINT_XFER_BULK;
} else if (tmp == USB_ENDPOINT_XFER_BULK) {
/* catch some particularly blatant driver bugs */
if ((dev->gadget.speed == USB_SPEED_HIGH
&& max != 512)
|| (dev->gadget.speed == USB_SPEED_FULL
&& max > 64))
return -ERANGE;
} }
ep->is_iso = (tmp == USB_ENDPOINT_XFER_ISOC) ? 1 : 0; ep->is_iso = (tmp == USB_ENDPOINT_XFER_ISOC) ? 1 : 0;
tmp <<= ENDPOINT_TYPE; tmp <<= ENDPOINT_TYPE;
...@@ -252,9 +261,6 @@ static int handshake (u32 *ptr, u32 mask, u32 done, int usec) ...@@ -252,9 +261,6 @@ static int handshake (u32 *ptr, u32 mask, u32 done, int usec)
udelay (1); udelay (1);
usec--; usec--;
} while (usec > 0); } while (usec > 0);
#ifdef DEBUG
if (done == 0) dump_stack (); /* ignore out_flush timeout */
#endif
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -917,6 +923,8 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) ...@@ -917,6 +923,8 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags)
*/ */
if (read_fifo (ep, req)) { if (read_fifo (ep, req)) {
done (ep, req, 0); done (ep, req, 0);
if (ep->num == 0)
allow_status (ep);
/* don't queue it */ /* don't queue it */
req = 0; req = 0;
} else } else
...@@ -1194,9 +1202,12 @@ net2280_set_halt (struct usb_ep *_ep, int value) ...@@ -1194,9 +1202,12 @@ net2280_set_halt (struct usb_ep *_ep, int value)
VDEBUG (ep->dev, "%s %s halt\n", _ep->name, value ? "set" : "clear"); VDEBUG (ep->dev, "%s %s halt\n", _ep->name, value ? "set" : "clear");
/* set/clear, then synch memory views with the device */ /* set/clear, then synch memory views with the device */
if (value) if (value) {
set_halt (ep); if (ep->num == 0)
ep->dev->protocol_stall = 1;
else else
set_halt (ep);
} else
clear_halt (ep); clear_halt (ep);
(void) readl (&ep->regs->ep_rsp); (void) readl (&ep->regs->ep_rsp);
...@@ -2042,6 +2053,7 @@ static void handle_ep_small (struct net2280_ep *ep) ...@@ -2042,6 +2053,7 @@ static void handle_ep_small (struct net2280_ep *ep)
* can decide to stall ep0 after that done() returns, * can decide to stall ep0 after that done() returns,
* from non-irq context * from non-irq context
*/ */
if (!ep->stopped)
allow_status (ep); allow_status (ep);
req = 0; req = 0;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment