[RFC/PATCH 5/5] usb: musb: host: enable DMA for TX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@xxxxxxxxx>
---
 drivers/usb/musb/musb_host.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 8557e22..cd3fef6 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -460,9 +460,10 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qtd *qtd)
 		break;
 	default:
 start:
-		DBG(4, "Start TX%d %s\n", epnum, "pio");
-
-		musb_h_tx_start(hw_ep);
+		DBG(4, "Start TX%d %s\n", epnum,
+				hw_ep->tx_channel ? "dma" : "pio");
+		if (!hw_ep->tx_channel)
+			musb_h_tx_start(hw_ep);
 	}
 }
 
@@ -859,7 +860,9 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
 						qtd->type_reg);
 		}
 
-		if (can_bulk_split(musb, qtd->type))
+		if (is_dma_capable() && epnum && (start_dma(musb, qtd) == 0)) {
+			load_count = 0;
+		} else if (can_bulk_split(musb, qtd->type))
 			load_count = min((u32) hw_ep->max_packet_sz_tx,
 						len);
 		else
@@ -1129,6 +1132,7 @@ void musb_host_tx(struct musb *musb, u8 epnum)
 	struct urb		*urb = qtd->urb;
 	u32			status = 0;
 	void __iomem		*mbase = musb->mregs;
+	struct dma_channel	*dma = hw_ep->tx_channel;
 
 	musb_ep_select(mbase, epnum);
 	tx_csr = musb_readw(epio, MUSB_TXCSR);
@@ -1195,8 +1199,15 @@ void musb_host_tx(struct musb *musb, u8 epnum)
 		done = true;
 	}
 
+	if (dma && !status) {
+		musb->dma_controller->channel_abort(dma);
+		length = dma->actual_len;
+		stop_dma(musb, qtd);
+	}
+
 	if (!status || usb_pipeisoc(pipe)) {
-		length = qtd->segsize;
+		if (!dma)
+			length = qtd->segsize;
 		qtd->offset += length;
 
 		if (usb_pipeisoc(pipe)) {
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux