]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: musb: Use is_cppi_enabled() and tusb_dma_omap() instead of the ifdef
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 13 Aug 2013 17:38:23 +0000 (19:38 +0200)
committerFelipe Balbi <balbi@ti.com>
Tue, 13 Aug 2013 19:21:41 +0000 (14:21 -0500)
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: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/musb_gadget.c

index 96632f9e3eeb1cfb1d202676fc8092257590f62b..4376f51f5ef1b0b1b870d6a38bec99b8c5d38b76 100644 (file)
@@ -357,47 +357,49 @@ static void txstate(struct musb *musb, struct musb_request *req)
                        }
                }
 
-#elif defined(CONFIG_USB_TI_CPPI_DMA)
-               /* program endpoint CSR first, then setup DMA */
-               csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY);
-               csr |= MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE |
-                      MUSB_TXCSR_MODE;
-               musb_writew(epio, MUSB_TXCSR,
-                       (MUSB_TXCSR_P_WZC_BITS & ~MUSB_TXCSR_P_UNDERRUN)
-                               | csr);
-
-               /* ensure writebuffer is empty */
-               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
-                * 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
-                * PIO does, since the hardware RNDIS mode seems unreliable
-                * except for the last-packet-is-already-short case.
-                */
-               use_dma = use_dma && c->channel_program(
-                               musb_ep->dma, musb_ep->packet_sz,
-                               0,
-                               request->dma + request->actual,
-                               request_size);
-               if (!use_dma) {
-                       c->channel_release(musb_ep->dma);
-                       musb_ep->dma = NULL;
-                       csr &= ~MUSB_TXCSR_DMAENAB;
-                       musb_writew(epio, MUSB_TXCSR, csr);
-                       /* invariant: prequest->buf is non-null */
-               }
-#elif defined(CONFIG_USB_TUSB_OMAP_DMA)
-               use_dma = use_dma && c->channel_program(
-                               musb_ep->dma, musb_ep->packet_sz,
-                               request->zero,
-                               request->dma + request->actual,
-                               request_size);
 #endif
+               if (is_cppi_enabled()) {
+                       /* program endpoint CSR first, then setup DMA */
+                       csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY);
+                       csr |= MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE |
+                               MUSB_TXCSR_MODE;
+                       musb_writew(epio, MUSB_TXCSR, (MUSB_TXCSR_P_WZC_BITS &
+                                               ~MUSB_TXCSR_P_UNDERRUN) | csr);
+
+                       /* ensure writebuffer is empty */
+                       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 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 PIO does, since the hardware RNDIS mode seems
+                        * unreliable except for the
+                        * last-packet-is-already-short case.
+                        */
+                       use_dma = use_dma && c->channel_program(
+                                       musb_ep->dma, musb_ep->packet_sz,
+                                       0,
+                                       request->dma + request->actual,
+                                       request_size);
+                       if (!use_dma) {
+                               c->channel_release(musb_ep->dma);
+                               musb_ep->dma = NULL;
+                               csr &= ~MUSB_TXCSR_DMAENAB;
+                               musb_writew(epio, MUSB_TXCSR, csr);
+                               /* invariant: prequest->buf is non-null */
+                       }
+               } else if (tusb_dma_omap())
+                       use_dma = use_dma && c->channel_program(
+                                       musb_ep->dma, musb_ep->packet_sz,
+                                       request->zero,
+                                       request->dma + request->actual,
+                                       request_size);
        }
 #endif