提交 03840fad 编写于 作者: F Felipe Balbi

usb: musb: gadget: remove remaining DMA ifdeferry

Commit fb91cddc ("usb: musb: Remove DMA
ifdef for musb_gadget.c short_packet") tried
to remove DMA ifdeferry from musb_gadget.c
but ended up leaving some around.

Remove them so that when building kernels with
all DMA engines enabled, we don't end up trying
to allocte channels twice.
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 adab4339
...@@ -313,8 +313,7 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -313,8 +313,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
/* MUSB_TXCSR_P_ISO is still set correctly */ /* MUSB_TXCSR_P_ISO is still set correctly */
#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_UX500_DMA) if (musb_dma_inventra(musb) || musb_dma_ux500(musb)) {
{
if (request_size < musb_ep->packet_sz) if (request_size < musb_ep->packet_sz)
musb_ep->dma->desired_mode = 0; musb_ep->dma->desired_mode = 0;
else else
...@@ -365,7 +364,6 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -365,7 +364,6 @@ static void txstate(struct musb *musb, struct musb_request *req)
} }
} }
#endif
if (is_cppi_enabled(musb)) { if (is_cppi_enabled(musb)) {
/* program endpoint CSR first, then setup DMA */ /* program endpoint CSR first, then setup DMA */
csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY); csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY);
...@@ -641,8 +639,10 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -641,8 +639,10 @@ static void rxstate(struct musb *musb, struct musb_request *req)
use_mode_1 = 0; use_mode_1 = 0;
if (request->actual < request->length) { if (request->actual < request->length) {
#ifdef CONFIG_USB_INVENTRA_DMA if (!is_buffer_mapped(req))
if (is_buffer_mapped(req)) { goto buffer_aint_mapped;
if (musb_dma_inventra(musb)) {
struct dma_controller *c; struct dma_controller *c;
struct dma_channel *channel; struct dma_channel *channel;
int use_dma = 0; int use_dma = 0;
...@@ -716,8 +716,8 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -716,8 +716,8 @@ static void rxstate(struct musb *musb, struct musb_request *req)
if (use_dma) if (use_dma)
return; return;
} }
#elif defined(CONFIG_USB_UX500_DMA)
if ((is_buffer_mapped(req)) && if ((musb_dma_ux500(musb)) &&
(request->actual < request->length)) { (request->actual < request->length)) {
struct dma_controller *c; struct dma_controller *c;
...@@ -765,7 +765,6 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -765,7 +765,6 @@ static void rxstate(struct musb *musb, struct musb_request *req)
return; return;
} }
#endif /* Mentor's DMA */
len = request->length - request->actual; len = request->length - request->actual;
dev_dbg(musb->controller, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n", dev_dbg(musb->controller, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n",
...@@ -775,8 +774,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -775,8 +774,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
fifo_count = min_t(unsigned, len, fifo_count); fifo_count = min_t(unsigned, len, fifo_count);
#ifdef CONFIG_USB_TUSB_OMAP_DMA if (tusb_dma_omap(musb)) {
if (tusb_dma_omap(musb) && is_buffer_mapped(req)) {
struct dma_controller *c = musb->dma_controller; struct dma_controller *c = musb->dma_controller;
struct dma_channel *channel = musb_ep->dma; struct dma_channel *channel = musb_ep->dma;
u32 dma_addr = request->dma + request->actual; u32 dma_addr = request->dma + request->actual;
...@@ -790,23 +788,22 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -790,23 +788,22 @@ static void rxstate(struct musb *musb, struct musb_request *req)
if (ret) if (ret)
return; return;
} }
#endif
/* /*
* Unmap the dma buffer back to cpu if dma channel * Unmap the dma buffer back to cpu if dma channel
* programming fails. This buffer is mapped if the * programming fails. This buffer is mapped if the
* channel allocation is successful * channel allocation is successful
*/ */
if (is_buffer_mapped(req)) { unmap_dma_buffer(req, musb);
unmap_dma_buffer(req, musb);
/*
/* * Clear DMAENAB and AUTOCLEAR for the
* Clear DMAENAB and AUTOCLEAR for the * PIO mode transfer
* PIO mode transfer */
*/ csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR);
csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR); musb_writew(epio, MUSB_RXCSR, csr);
musb_writew(epio, MUSB_RXCSR, csr);
}
buffer_aint_mapped:
musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *)
(request->buf + request->actual)); (request->buf + request->actual));
request->actual += fifo_count; request->actual += fifo_count;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册