Commit d93c8ad6 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB gadget: net2280: dmachain off, zlp pio ok

This patch has two small fixes for issues that people
reported to me yesterday:

  - One of the out-of-tree drivers sees odd things
    happening when dma chaining is enabled.  (The
    in-tree drivers seem fine with it.)  So disable
    for now; it's easily enabled if needed.

  - Zero Length Packets (ZLPs):

     * Should now read/write ok with PIO.

     * On DMA endpoints, explicit ZLPs need PIO.
       Until they do, don't allow queuing zero length
       buffers onto DMA endpoints.
parent de32e901
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
* either DMA (default) or PIO (use_dma=n) used for ep-{a,b,c,d}. Testing * either DMA (default) or PIO (use_dma=n) used for ep-{a,b,c,d}. Testing
* with "ttcp" (and the "ether.c" driver) behaves nicely too. * with "ttcp" (and the "ether.c" driver) behaves nicely too.
* *
* DMA is enabled by default, and drivers using transfer queues will use * DMA is enabled by default. Drivers using transfer queues might use
* DMA chaining to remove IRQ latencies between transfers. (Except when * DMA chaining to remove IRQ latencies between transfers. (Except when
* 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.
*/ */
// #define NET2280_DMA_OUT_WORKAROUND // #define NET2280_DMA_OUT_WORKAROUND
#define USE_DMA_CHAINING // #define USE_DMA_CHAINING
/* /*
...@@ -614,11 +615,6 @@ read_fifo (struct net2280_ep *ep, struct net2280_request *req) ...@@ -614,11 +615,6 @@ read_fifo (struct net2280_ep *ep, struct net2280_request *req)
} }
req->req.actual += count; req->req.actual += count;
/* FIXME we seem to be getting these w/o ZLPs; why? */
if (req->req.actual == 0 && req->req.length != 0) {
VDEBUG (ep->dev, "%s pio out -- bogus zlp?\n", ep->ep.name);
return 0;
}
is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0); is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0);
VDEBUG (ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n", VDEBUG (ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n",
...@@ -856,6 +852,10 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) ...@@ -856,6 +852,10 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags)
if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)
return -ESHUTDOWN; return -ESHUTDOWN;
/* FIXME implement PIO fallback for ZLPs with DMA */
if (ep->dma && _req->length == 0)
return -EOPNOTSUPP;
/* set up dma mapping in case the caller didn't */ /* set up dma mapping in case the caller didn't */
if (ep->dma && _req->dma == DMA_ADDR_INVALID) { if (ep->dma && _req->dma == DMA_ADDR_INVALID) {
_req->dma = pci_map_single (dev->pdev, _req->buf, _req->length, _req->dma = pci_map_single (dev->pdev, _req->buf, _req->length,
......
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