]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: musb: cppi41: Detect aborted transfers in cppi41_dma_callback()
authorAlexandre Bailon <abailon@baylibre.com>
Tue, 7 Feb 2017 04:53:52 +0000 (22:53 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2017 12:35:05 +0000 (13:35 +0100)
Update cppi41_dma_callback() to detect an aborted transfer.
This was not required before because cppi41_dma_callback() was only
invoked on transfer completion.
In order to make CPPI 4.1 driver more generic, cppi41_dma_callback()
will be invoked after a transfer abort in order to let the MUSB driver
perform some action such as acknowledge the interrupt that may be fired
during a teardown.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_cppi41.c

index f7d3d27fd2c1ec9563f7e55dc1f0a2b4bc089ef3..1fe7eaeb097b924f01f5662452809a84dd6c93d9 100644 (file)
@@ -99,7 +99,8 @@ static bool musb_is_tx_fifo_empty(struct musb_hw_ep *hw_ep)
        return true;
 }
 
-static void cppi41_dma_callback(void *private_data);
+static void cppi41_dma_callback(void *private_data,
+                               const struct dmaengine_result *result);
 
 static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel)
 {
@@ -154,7 +155,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel)
                if (WARN_ON(!dma_desc))
                        return;
 
-               dma_desc->callback = cppi41_dma_callback;
+               dma_desc->callback_result = cppi41_dma_callback;
                dma_desc->callback_param = &cppi41_channel->channel;
                cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
                trace_musb_cppi41_cont(cppi41_channel);
@@ -204,7 +205,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer)
        return ret;
 }
 
-static void cppi41_dma_callback(void *private_data)
+static void cppi41_dma_callback(void *private_data,
+                               const struct dmaengine_result *result)
 {
        struct dma_channel *channel = private_data;
        struct cppi41_dma_channel *cppi41_channel = channel->private_data;
@@ -221,6 +223,9 @@ static void cppi41_dma_callback(void *private_data)
        if (controller->controller.dma_callback)
                controller->controller.dma_callback(&controller->controller);
 
+       if (result->result == DMA_TRANS_ABORTED)
+               return;
+
        spin_lock_irqsave(&musb->lock, flags);
 
        dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie,
@@ -403,7 +408,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
        if (!dma_desc)
                return false;
 
-       dma_desc->callback = cppi41_dma_callback;
+       dma_desc->callback_result = cppi41_dma_callback;
        dma_desc->callback_param = channel;
        cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
        cppi41_channel->channel.rx_packet_done = false;