[v2,04/12] dmaengine: fsl-edma: remove v3 from enum edma_version

Message ID 20230529200453.1423796-5-Frank.Li@nxp.com
State New
Headers
Series dmaengine: edma: add freescale edma v3 support |

Commit Message

Frank Li May 29, 2023, 8:04 p.m. UTC
  The new IP of edma refers to version 3 in the hardware documentation.
However, the presence of "v3" in the code is merely a software indication
to differentiate between certain chips. To prevent confusion in the
future, this commit removes "v3" from the enum edma_version.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-edma-common.c | 2 +-
 drivers/dma/fsl-edma-common.h | 2 +-
 drivers/dma/fsl-edma-main.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Peng Fan (OSS) May 31, 2023, 6:50 a.m. UTC | #1
On 5/30/2023 4:04 AM, Frank Li wrote:
>   static struct fsl_edma_drvdata imx7ulp_data = {
> -       .version = v3,
> +       .version = v1,

This may confuse people.How about for hardware
version >= v3, use new flag as yours?

Regards,
Peng.
  
Frank Li May 31, 2023, 12:50 p.m. UTC | #2
On Wed, May 31, 2023 at 02:50:57PM +0800, Peng Fan wrote:
> 
> 
> On 5/30/2023 4:04 AM, Frank Li wrote:
> >   static struct fsl_edma_drvdata imx7ulp_data = {
> > -       .version = v3,
> > +       .version = v1,
> 
> This may confuse people.How about for hardware
> version >= v3, use new flag as yours?

I can use drvflags to distinguish. I checked spec, 7ULP called eDMA2.
Okay, let me change to check drvflags.

Anyways, we should align version with hardware IP version, or not
use it at all.

Frank

> 
> Regards,
> Peng.
  

Patch

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 10dcc1435d37..e5c7497c1ff3 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -120,7 +120,7 @@  void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan,
 	muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux];
 	slot = EDMAMUX_CHCFG_SOURCE(slot);
 
-	if (fsl_chan->edma->drvdata->version == v3)
+	if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_CONFIG32)
 		mux_configure32(fsl_chan, muxaddr, ch_off, slot, enable);
 	else
 		mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable);
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index db137a8c558d..2f13e687a721 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -141,11 +141,11 @@  struct fsl_edma_desc {
 enum edma_version {
 	v1, /* 32ch, Vybrid, mpc57x, etc */
 	v2, /* 64ch Coldfire */
-	v3, /* 32ch, i.mx7ulp */
 };
 
 #define FSL_EDMA_DRV_HAS_DMACLK		BIT(0)
 #define FSL_EDMA_DRV_MUX_SWAP		BIT(1)
+#define FSL_EDMA_DRV_CONFIG32		BIT(2)
 struct fsl_edma_drvdata {
 	enum edma_version	version;
 	u32			dmamuxs;
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index f5cf95d185f8..31531b8bde78 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -238,9 +238,9 @@  static struct fsl_edma_drvdata ls1028a_data = {
 };
 
 static struct fsl_edma_drvdata imx7ulp_data = {
-	.version = v3,
+	.version = v1,
 	.dmamuxs = 1,
-	.flags = FSL_EDMA_DRV_HAS_DMACLK,
+	.flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_CONFIG32,
 	.setup_irq = fsl_edma2_irq_init,
 };