Skip to content

Commit

Permalink
dmaengine: dw-axi-dmac: Handle xfer start while non-idle
Browse files Browse the repository at this point in the history
Signed-off-by: Samin Guo <[email protected]>
Signed-off-by: Curry Zhang <[email protected]>
  • Loading branch information
SaminGuo authored and esmil committed Dec 27, 2021
1 parent 15f35d6 commit 8661504
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,13 @@ static void axi_chan_block_xfer_start(struct axi_dma_chan *chan,
u32 irq_mask;
u8 lms = 0; /* Select AXI0 master for LLI fetching */

chan->is_err = false;
if (unlikely(axi_chan_is_hw_enable(chan))) {
dev_err(chan2dev(chan), "%s is non-idle!\n",
axi_chan_name(chan));

return;
axi_chan_disable(chan);
chan->is_err = true;
}

axi_dma_enable(chan->chip);
Expand Down Expand Up @@ -1013,6 +1015,14 @@ static noinline void axi_chan_handle_err(struct axi_dma_chan *chan, u32 status)

/* The bad descriptor currently is in the head of vc list */
vd = vchan_next_desc(&chan->vc);
if (chan->is_err) {
struct axi_dma_desc *desc = vd_to_axi_desc(vd);

axi_chan_block_xfer_start(chan, desc);
chan->is_err = false;
goto out;
}

/* Remove the completed descriptor from issued list */
list_del(&vd->node);

Expand All @@ -1027,6 +1037,7 @@ static noinline void axi_chan_handle_err(struct axi_dma_chan *chan, u32 status)
/* Try to restart the controller */
axi_chan_start_first_queued(chan);

out:
spin_unlock_irqrestore(&chan->vc.lock, flags);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/dma/dw-axi-dmac/dw-axi-dmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct axi_dma_chan {
struct dma_slave_config config;
enum dma_transfer_direction direction;
bool cyclic;
bool is_err;
/* these other elements are all protected by vc.lock */
bool is_paused;
};
Expand Down

0 comments on commit 8661504

Please sign in to comment.