usb: musb: gadget: remove remaining DMA ifdeferry

Commit fb91cddc54 ("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: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe Balbi 2015-08-06 10:47:16 -05:00
parent adab43396e
commit 03840fad00

View file

@ -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)
} }
} }
#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)
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)
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)
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)
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)
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;