Hello,
The following patch is against current gadget-2.4/drivers/usb/gadget/net2280.c
and addresses some issues with maxpacket isochronous endpoints.
- DMA "scatter/gather" (a.k.a. "ring", USE_DMA_CHAINING) mode
cannot be used for IN or OUT endpoints with non-0-mod-4 MPS
- write_fifo: must also explicitly "validate" max length isochronous
packets if maxpacket is not a multiple of 4 bytes.
- dma_done: print some info if being verbose
--Mark
===== net2280.c 1.26 vs edited =====
--- 1.26/drivers/usb/gadget/net2280.c Mon Nov 24 14:13:46 2003
+++ edited/net2280.c Tue Dec 2 16:09:10 2003
@@ -166,14 +166,16 @@
/* set speed-dependent max packet; may kick in high bandwidth */
set_idx_reg (dev->regs, REG_EP_MAXPKT (dev, ep->num), max);
+#ifdef USE_DMA_CHAINING
/* FIFO lines can't go to different packets. PIO is ok, so
* use it instead of troublesome (non-bulk) multi-packet DMA.
*/
- if (ep->is_in && ep->dma && (max % 4) != 0) {
- DEBUG (ep->dev, "%s, no IN dma for maxpacket %d\n",
+ if (ep->dma && (max % 4) != 0) {
+ DEBUG (ep->dev, "%s, no dma for maxpacket %d\n",
ep->ep.name, ep->ep.maxpacket);
ep->dma = 0;
}
+#endif
/* set type, direction, address; reset fifo counters */
writel ((1 << FIFO_FLUSH), &ep->regs->ep_stat);
@@ -541,8 +543,15 @@
count -= 4;
}
- /* last fifo entry is "short" unless we wrote a full packet */
- if (total < ep->ep.maxpacket) {
+ /* last fifo entry is "short" unless we wrote a full
+ * packet. must also explicitly "validate" max length
+ * isochronous packets if maxpacket is not a multiple of 4
+ * bytes.
+ */
+ if (total < ep->ep.maxpacket
+ || (ep->is_iso
+ && total == ep->ep.maxpacket
+ && (ep->ep.maxpacket % 4))) {
tmp = count ? get_unaligned ((u32 *)buf) : count;
cpu_to_le32s (&tmp);
set_fifo_bytecount (ep, count & 0x03);
@@ -977,6 +986,12 @@
)
{
req->req.actual = req->req.length - (DMA_BYTE_COUNT_MASK & dmacount);
+ VDEBUG (ep->dev, "%s %s dma (%s) %d bytes%s req %p\n",
+ ep->is_in ? "write" : "read",
+ ep->ep.name, ep->is_in ? "IN" : "OUT",
+ req->req.actual,
+ (req->req.actual < req->req.length) ? " (short)" : "",
+ req);
done (ep, req, status);
}
-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel