Commit fc525751 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

usb: musb: Use is_cppi_enabled() and tusb_dma_omap() instead of the ifdef

This patch makes use of the two function is_cppi_enabled() and
tusb_dma_omap() instead of the ifdef for the proper DMA implementation
setup code. It basically shifts the code right by one indention level
and adds a few line breaks once the chars are crossed.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent eff196ad
...@@ -357,27 +357,30 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -357,27 +357,30 @@ static void txstate(struct musb *musb, struct musb_request *req)
} }
} }
#elif defined(CONFIG_USB_TI_CPPI_DMA) #endif
if (is_cppi_enabled()) {
/* 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);
csr |= MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE | csr |= MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE |
MUSB_TXCSR_MODE; MUSB_TXCSR_MODE;
musb_writew(epio, MUSB_TXCSR, musb_writew(epio, MUSB_TXCSR, (MUSB_TXCSR_P_WZC_BITS &
(MUSB_TXCSR_P_WZC_BITS & ~MUSB_TXCSR_P_UNDERRUN) ~MUSB_TXCSR_P_UNDERRUN) | csr);
| csr);
/* ensure writebuffer is empty */ /* ensure writebuffer is empty */
csr = musb_readw(epio, MUSB_TXCSR); csr = musb_readw(epio, MUSB_TXCSR);
/* NOTE host side sets DMAENAB later than this; both are /*
* OK since the transfer dma glue (between CPPI and Mentor * NOTE host side sets DMAENAB later than this; both are
* fifos) just tells CPPI it could start. Data only moves * OK since the transfer dma glue (between CPPI and
* to the USB TX fifo when both fifos are ready. * Mentor fifos) just tells CPPI it could start. Data
* only moves to the USB TX fifo when both fifos are
* ready.
*/ */
/*
/* "mode" is irrelevant here; handle terminating ZLPs like * "mode" is irrelevant here; handle terminating ZLPs
* PIO does, since the hardware RNDIS mode seems unreliable * like PIO does, since the hardware RNDIS mode seems
* except for the last-packet-is-already-short case. * unreliable except for the
* last-packet-is-already-short case.
*/ */
use_dma = use_dma && c->channel_program( use_dma = use_dma && c->channel_program(
musb_ep->dma, musb_ep->packet_sz, musb_ep->dma, musb_ep->packet_sz,
...@@ -391,13 +394,12 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -391,13 +394,12 @@ static void txstate(struct musb *musb, struct musb_request *req)
musb_writew(epio, MUSB_TXCSR, csr); musb_writew(epio, MUSB_TXCSR, csr);
/* invariant: prequest->buf is non-null */ /* invariant: prequest->buf is non-null */
} }
#elif defined(CONFIG_USB_TUSB_OMAP_DMA) } else if (tusb_dma_omap())
use_dma = use_dma && c->channel_program( use_dma = use_dma && c->channel_program(
musb_ep->dma, musb_ep->packet_sz, musb_ep->dma, musb_ep->packet_sz,
request->zero, request->zero,
request->dma + request->actual, request->dma + request->actual,
request_size); request_size);
#endif
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment