staging: octeon-usb: program DMA engine based on transfer direction
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 22 Mar 2015 15:37:51 +0000 (17:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Mar 2015 12:47:11 +0000 (13:47 +0100)
Program DMA engine based on transfer direction. We are only transferring
to one direction at a time.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index 1ec70eb490d14825afde310c24758e143263951c..a8c467ff4204add2ba6d4afccd21a6e925fadf6f 100644 (file)
@@ -1636,8 +1636,9 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel,
                                     usbc_haintmsk.u32);
        }
 
-       /* Setup the locations the DMA engines use  */
+       /* Setup the location the DMA engine uses. */
        {
+               uint64_t reg;
                uint64_t dma_address = transaction->buffer +
                                        transaction->actual_bytes;
 
@@ -1646,12 +1647,11 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel,
                                        transaction->iso_packets[0].offset +
                                        transaction->actual_bytes;
 
-               cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
-                                       channel * 8,
-                                   dma_address);
-               cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) +
-                                       channel * 8,
-                                   dma_address);
+               if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)
+                       reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index);
+               else
+                       reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index);
+               cvmx_write64_uint64(reg + channel * 8, dma_address);
        }
 
        /* Setup both the size of the transfer and the SPLIT characteristics */