diff mbox

[v2] USB: musb: Prevent Transmit Buffer Descriptor corruption

Message ID 4CFEAA69.4030503@seektech.com (mailing list archive)
State Superseded
Headers show

Commit Message

Paul Stuart Dec. 7, 2010, 9:43 p.m. UTC
None
diff mbox

Patch

--- a/drivers/usb/musb/cppi_dma.c	2010-12-06 20:09:04.000000000 -0800
+++ b/drivers/usb/musb/cppi_dma.c	2010-12-07 11:22:04.000000000 -0800
@@ -625,6 +625,14 @@  cppi_next_tx_segment(struct musb *musb, 
 	 * size; for RNDIS there _is_ only that last packet.
 	 */
 	for (i = 0; i < n_bds; ) {
+
+		/* wait for DMA to release ownership of this bd */
+		if (unlikely(bd->hw_options & CPPI_OWN_SET)) {
+			do {
+				cpu_relax();
+			} while (bd->hw_options & CPPI_OWN_SET);
+		}
+		
 		if (++i < n_bds && bd->next)
 			bd->hw_next = bd->next->dma;
 		else