VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   30 Branches   50 Tags
author: Samin Guo <samin.guo@starfivetech.com> 2021-11-17 14:50:45 +0800 committer: Emil Renner Berthing <emil.renner.berthing@canonical.com> 2023-07-20 20:53:37 +0200 commit: 84d5ed0d2b091ed06fe14e37224325538a1f1f5e parent: 3a23cf74d06d280dc9ca179299b7bfab3f9aaa64
Commit Summary:
dmaengine: dw-axi-dmac: Handle xfer start while non-idle
Diffstat:
2 files changed, 11 insertions, 1 deletion
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 6937cc0c0b65..f71105de7e65 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -382,11 +382,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);
@@ -1028,6 +1030,14 @@ static noinline void axi_chan_handle_err(struct axi_dma_chan *chan, u32 status)
 			axi_chan_name(chan));
 		goto out;
 	}
+	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);
 
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
index eb267cb24f67..10d96a423bb2 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -50,6 +50,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;
 };