[PATCH v1 1/9] dmaengine: fsl-edma: move edma_request functions into drvdata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move fsl_edma_enable_request/fsl_edma_disable_request into drvdata so
that later edma3 could easily be added.

Signed-off-by: Robin Gong <yibin.gong@xxxxxxx>
---
 drivers/dma/fsl-edma-common.c | 13 +++++++------
 drivers/dma/fsl-edma-common.h |  3 +++
 drivers/dma/fsl-edma.c        | 10 ++++++++--
 drivers/dma/mcf-edma.c        |  2 ++
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 4550818..ef5294f0 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -42,7 +42,7 @@
 
 #define EDMA_TCD		0x1000
 
-static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan)
+void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan)
 {
 	struct edma_regs *regs = &fsl_chan->edma->regs;
 	u32 ch = fsl_chan->vchan.chan.chan_id;
@@ -58,6 +58,7 @@ static void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan)
 		iowrite8(ch, regs->serq);
 	}
 }
+EXPORT_SYMBOL_GPL(fsl_edma_enable_request);
 
 void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan)
 {
@@ -164,7 +165,7 @@ int fsl_edma_terminate_all(struct dma_chan *chan)
 	LIST_HEAD(head);
 
 	spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
-	fsl_edma_disable_request(fsl_chan);
+	fsl_chan->edma->drvdata->dis_req(fsl_chan);
 	fsl_chan->edesc = NULL;
 	fsl_chan->idle = true;
 	vchan_get_all_descriptors(&fsl_chan->vchan, &head);
@@ -181,7 +182,7 @@ int fsl_edma_pause(struct dma_chan *chan)
 
 	spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
 	if (fsl_chan->edesc) {
-		fsl_edma_disable_request(fsl_chan);
+		fsl_chan->edma->drvdata->dis_req(fsl_chan);
 		fsl_chan->status = DMA_PAUSED;
 		fsl_chan->idle = true;
 	}
@@ -197,7 +198,7 @@ int fsl_edma_resume(struct dma_chan *chan)
 
 	spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
 	if (fsl_chan->edesc) {
-		fsl_edma_enable_request(fsl_chan);
+		fsl_chan->edma->drvdata->en_req(fsl_chan);
 		fsl_chan->status = DMA_IN_PROGRESS;
 		fsl_chan->idle = false;
 	}
@@ -596,7 +597,7 @@ void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan)
 		return;
 	fsl_chan->edesc = to_fsl_edma_desc(vdesc);
 	fsl_edma_set_tcd_regs(fsl_chan, fsl_chan->edesc->tcd[0].vtcd);
-	fsl_edma_enable_request(fsl_chan);
+	fsl_chan->edma->drvdata->en_req(fsl_chan);
 	fsl_chan->status = DMA_IN_PROGRESS;
 	fsl_chan->idle = false;
 }
@@ -640,7 +641,7 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan)
 	LIST_HEAD(head);
 
 	spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
-	fsl_edma_disable_request(fsl_chan);
+	fsl_chan->edma->drvdata->dis_req(fsl_chan);
 	fsl_edma_chan_mux(fsl_chan, 0, false);
 	fsl_chan->edesc = NULL;
 	vchan_get_all_descriptors(&fsl_chan->vchan, &head);
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index ec11697..87c8d7a 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -150,6 +150,8 @@ struct fsl_edma_drvdata {
 	bool			mux_swap;
 	int			(*setup_irq)(struct platform_device *pdev,
 					     struct fsl_edma_engine *fsl_edma);
+	void			(*en_req)(struct fsl_edma_chan *fsl_chan);
+	void			(*dis_req)(struct fsl_edma_chan *fsl_chan);
 };
 
 struct fsl_edma_engine {
@@ -222,6 +224,7 @@ static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd)
 }
 
 void fsl_edma_disable_request(struct fsl_edma_chan *fsl_chan);
+void fsl_edma_enable_request(struct fsl_edma_chan *fsl_chan);
 void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan,
 			unsigned int slot, bool enable);
 void fsl_edma_free_desc(struct virt_dma_desc *vdesc);
diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c
index 90bb72a..95745636 100644
--- a/drivers/dma/fsl-edma.c
+++ b/drivers/dma/fsl-edma.c
@@ -83,7 +83,7 @@ static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id)
 
 	for (ch = 0; ch < fsl_edma->n_chans; ch++) {
 		if (err & (0x1 << ch)) {
-			fsl_edma_disable_request(&fsl_edma->chans[ch]);
+			fsl_edma->drvdata->dis_req(&fsl_edma->chans[ch]);
 			edma_writeb(fsl_edma, EDMA_CERR_CERR(ch), regs->cerr);
 			fsl_edma->chans[ch].status = DMA_ERROR;
 			fsl_edma->chans[ch].idle = true;
@@ -238,6 +238,8 @@ static struct fsl_edma_drvdata vf610_data = {
 	.version = v1,
 	.dmamuxs = DMAMUX_NR,
 	.setup_irq = fsl_edma_irq_init,
+	.en_req = fsl_edma_enable_request,
+	.dis_req = fsl_edma_disable_request,
 };
 
 static struct fsl_edma_drvdata ls1028a_data = {
@@ -245,6 +247,8 @@ static struct fsl_edma_drvdata ls1028a_data = {
 	.dmamuxs = DMAMUX_NR,
 	.mux_swap = true,
 	.setup_irq = fsl_edma_irq_init,
+	.en_req = fsl_edma_enable_request,
+	.dis_req = fsl_edma_disable_request,
 };
 
 static struct fsl_edma_drvdata imx7ulp_data = {
@@ -252,6 +256,8 @@ static struct fsl_edma_drvdata imx7ulp_data = {
 	.dmamuxs = 1,
 	.has_dmaclk = true,
 	.setup_irq = fsl_edma2_irq_init,
+	.en_req = fsl_edma_enable_request,
+	.dis_req = fsl_edma_disable_request,
 };
 
 static const struct of_device_id fsl_edma_dt_ids[] = {
@@ -444,7 +450,7 @@ static int fsl_edma_suspend_late(struct device *dev)
 		/* Make sure chan is idle or will force disable. */
 		if (unlikely(!fsl_chan->idle)) {
 			dev_warn(dev, "WARN: There is non-idle channel.");
-			fsl_edma_disable_request(fsl_chan);
+			fsl_edma->drvdata->dis_req(fsl_chan);
 			fsl_edma_chan_mux(fsl_chan, 0, false);
 		}
 
diff --git a/drivers/dma/mcf-edma.c b/drivers/dma/mcf-edma.c
index e12b754..50e6b9b 100644
--- a/drivers/dma/mcf-edma.c
+++ b/drivers/dma/mcf-edma.c
@@ -174,6 +174,8 @@ static void mcf_edma_irq_free(struct platform_device *pdev,
 static struct fsl_edma_drvdata mcf_data = {
 	.version = v2,
 	.setup_irq = mcf_edma_irq_init,
+	.en_req = fsl_edma_enable_request,
+	.dis_req = fsl_edma_disable_request,
 };
 
 static int mcf_edma_probe(struct platform_device *pdev)
-- 
2.7.4




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux