Skip to contentSkip to conversation

dmaengine: fsl-qdma: fixed the source/destination descriptior format

PATCH Superseded Peng Ma 2 participants 5 messages Apr 19, 2019 – Apr 29, 2019 dmaengine

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peng Ma

author
#0 lore raw

PATCH 1/1 dmaengine: fsl-qdma: fixed the source/destination descriptior format

CMD of Source/Destination descriptior format should be lower of struct fsl_qdma_engine number data address.

---
 drivers/dma/fsl-qdma.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/dma/fsl-qdma.c +18 -11
index aa1d0ae..542765a 100644
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS		20
 #define QDMA_CCDF_OFFSET		20
+#define QDMA_SDDF_CMD(x)		(((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT		1500
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val)
+{
+	sddf->data = QDMA_SDDF_CMD(val);
+}
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)
 {
@@ -341,6 +348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan)
 static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 				      dma_addr_t dst, dma_addr_t src, u32 len)
 {
+	u32 cmd;
 	struct fsl_qdma_format *sdf, *ddf;
 	struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
 
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 
 	memset(fsl_comp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE);
 	memset(fsl_comp->desc_virt_addr, 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
 	/* Head Command Descriptor(Frame Descriptor) */
 	qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16);
 	qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf));
@@ -369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 	/* This entry is the last entry. */
 	qdma_csgf_set_f(csgf_dest, len);
 	/* Descriptor Buffer */
-	sdf->data =
-		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
-	ddf->data =
-		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
-	ddf->data |=
-		cpu_to_le64(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
+	qdma_sddf_set_cmd(sdf, cmd);
+
+	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
+	cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+	qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*
@@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id)
 
 	intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
-	if (intr) {
+	if (intr)
 		dev_err(fsl_qdma->dma_dev.dev, "DMA transaction error!\n");
-		return IRQ_NONE;
-	}
 
 	qdma_writel(fsl_qdma, FSL_QDMA_DEDR_CLEAR, status + FSL_QDMA_DEDR);
 	return IRQ_HANDLED;
maintainer
#1 lore raw
Quoted 1 line · Peng Ma

CMD of Source/Destination descriptior format should be lower of

s/descriptior/descriptor

Quoted 72 lines

struct fsl_qdma_engine number data address.

---
 drivers/dma/fsl-qdma.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/dma/fsl-qdma.c +17 -8
index aa1d0ae..542765a 100644
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS		20
 #define QDMA_CCDF_OFFSET		20
+#define QDMA_SDDF_CMD(x)		(((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT		1500
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val)
+{
+	sddf->data = QDMA_SDDF_CMD(val);
+}
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)
 {
@@ -341,6 +348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan *chan)
 static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 				      dma_addr_t dst, dma_addr_t src, u32 len)
 {
+	u32 cmd;
 	struct fsl_qdma_format *sdf, *ddf;
 	struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
 
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 
 	memset(fsl_comp->virt_addr, 0, FSL_QDMA_COMMAND_BUFFER_SIZE);
 	memset(fsl_comp->desc_virt_addr, 0, FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
 	/* Head Command Descriptor(Frame Descriptor) */
 	qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16);
 	qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf));
@@ -369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,
 	/* This entry is the last entry. */
 	qdma_csgf_set_f(csgf_dest, len);
 	/* Descriptor Buffer */
-	sdf->data =
-		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
-	ddf->data =
-		cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-			    FSL_QDMA_CMD_RWTTYPE_OFFSET);
-	ddf->data |=
-		cpu_to_le64(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
+	qdma_sddf_set_cmd(sdf, cmd);
+
+	cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+			  FSL_QDMA_CMD_RWTTYPE_OFFSET);
+	cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC << FSL_QDMA_CMD_LWC_OFFSET);
+	qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id) · line 707

Quoted 8 lines
drivers/dma/fsl-qdma.c +1 -3
@@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id)
 
 	intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
-	if (intr) {
+	if (intr)
 		dev_err(fsl_qdma->dma_dev.dev, "DMA transaction error!\n");
-		return IRQ_NONE;
-	}

this seems unrelated can you explain?

Quoted 5 lines
drivers/dma/fsl-qdma.c +0 -0
 	qdma_writel(fsl_qdma, FSL_QDMA_DEDR_CLEAR, status + FSL_QDMA_DEDR);
 	return IRQ_HANDLED;
Signature · 1 line
1.7.1
author
#2 lore raw

Hi Vinod,

Thanks your comments.
Please see my comments inline.

Best Regards,
Peng

Quoted 9 lines

-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: 2019年4月26日 19:51
To: Peng Ma <[email protected]>
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH] dmaengine: fsl-qdma: fixed the source/destination descriptior format

Quoted 7 lines

Caution: EXT Email

Quoted 1 line · Peng Ma

CMD of Source/Destination descriptior format should be lower of

s/descriptior/descriptor

[Peng Ma] Got it.

Quoted 82 lines
Quoted 20 lines

struct fsl_qdma_engine number data address.

---
 drivers/dma/fsl-qdma.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/dma/fsl-qdma.c index renamed from drivers/dma/fsl-qdma.c +0 -0

aa1d0ae..542765a 100644

drivers/dma/fsl-qdma.c +1 -0
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS             20
 #define QDMA_CCDF_OFFSET             20
+#define QDMA_SDDF_CMD(x)             (((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT          1500

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 223

Quoted 9 lines
drivers/dma/fsl-qdma.c +4 -0
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val) {
+     sddf->data = QDMA_SDDF_CMD(val); }
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)  { @@

-341,6

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 225

Quoted 2 lines
drivers/dma/fsl-qdma.c +1 -0
+348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan
 *chan)  static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp

*fsl_comp,

Quoted 1 line

dma_addr_t dst, dma_addr_t

src,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct · line 363

Quoted 9 lines

u32 len) {

drivers/dma/fsl-qdma.c +1 -0
+     u32 cmd;
      struct fsl_qdma_format *sdf, *ddf;
      struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct
 fsl_qdma_comp *fsl_comp,
 
      memset(fsl_comp->virt_addr, 0,

FSL_QDMA_COMMAND_BUFFER_SIZE);

Quoted 7 lines
drivers/dma/fsl-qdma.c +1 -0
      memset(fsl_comp->desc_virt_addr, 0,
 FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
      /* Head Command Descriptor(Frame Descriptor) */

qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf)); @@
-369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct

fsl_qdma_comp *fsl_comp,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 11 lines
      /* This entry is the last entry. */
      qdma_csgf_set_f(csgf_dest, len);
      /* Descriptor Buffer */
drivers/dma/fsl-qdma.c +0 -8
-     sdf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data |=
-             cpu_to_le64(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 7 lines
drivers/dma/fsl-qdma.c +7 -0
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     qdma_sddf_set_cmd(sdf, cmd);
+
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

Quoted 9 lines
drivers/dma/fsl-qdma.c +1 -0
+     qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*
@@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int
 irq, void *dev_id)
 
      intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
Quoted 9 lines

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id)

Quoted 3 lines
drivers/dma/fsl-qdma.c +1 -1
-     if (intr) {
+     if (intr)
              dev_err(fsl_qdma->dma_dev.dev, "DMA transaction

error!\n");

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id) · line 707

Quoted 2 lines
drivers/dma/fsl-qdma.c +0 -2
-             return IRQ_NONE;
-     }

this seems unrelated can you explain?

[Peng Ma] This is an added improvement. When an error occurs we should clean the error reg then to return. I forgot to explain it on comments. Should I add this changed to the comments?

Quoted 9 lines

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int · line 716

Quoted 2 lines
drivers/dma/fsl-qdma.c +0 -0
      qdma_writel(fsl_qdma, FSL_QDMA_DEDR_CLEAR, status +

FSL_QDMA_DEDR);

Quoted 3 lines
drivers/dma/fsl-qdma.c +0 -1
      return IRQ_HANDLED;
--

1.7.1

--
~Vinod

maintainer
#3 lore raw
Quoted 111 lines · Peng Ma

Hi Vinod,

Thanks your comments.
Please see my comments inline.

Best Regards,
Peng

Quoted 9 lines

-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: 2019年4月26日 19:51
To: Peng Ma <[email protected]>
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH] dmaengine: fsl-qdma: fixed the source/destination descriptior format

Quoted 7 lines

Caution: EXT Email

Quoted 1 line · Peng Ma

CMD of Source/Destination descriptior format should be lower of

s/descriptior/descriptor

[Peng Ma] Got it.

Quoted 86 lines
Quoted 20 lines

struct fsl_qdma_engine number data address.

---
 drivers/dma/fsl-qdma.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/dma/fsl-qdma.c index renamed from drivers/dma/fsl-qdma.c +0 -0

aa1d0ae..542765a 100644

drivers/dma/fsl-qdma.c +1 -0
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS             20
 #define QDMA_CCDF_OFFSET             20
+#define QDMA_SDDF_CMD(x)             (((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT          1500

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 223

Quoted 9 lines
drivers/dma/fsl-qdma.c +4 -0
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val) {
+     sddf->data = QDMA_SDDF_CMD(val); }
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)  { @@

-341,6

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 225

Quoted 2 lines
drivers/dma/fsl-qdma.c +1 -0
+348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan
 *chan)  static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp

*fsl_comp,

Quoted 1 line

dma_addr_t dst, dma_addr_t

src,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct · line 363

Quoted 9 lines

u32 len) {

drivers/dma/fsl-qdma.c +1 -0
+     u32 cmd;
      struct fsl_qdma_format *sdf, *ddf;
      struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src, *csgf_dest;
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct
 fsl_qdma_comp *fsl_comp,
 
      memset(fsl_comp->virt_addr, 0,

FSL_QDMA_COMMAND_BUFFER_SIZE);

Quoted 7 lines
drivers/dma/fsl-qdma.c +1 -0
      memset(fsl_comp->desc_virt_addr, 0,
 FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
      /* Head Command Descriptor(Frame Descriptor) */

qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf)); @@
-369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct

fsl_qdma_comp *fsl_comp,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 11 lines
      /* This entry is the last entry. */
      qdma_csgf_set_f(csgf_dest, len);
      /* Descriptor Buffer */
drivers/dma/fsl-qdma.c +0 -8
-     sdf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data |=
-             cpu_to_le64(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 7 lines
drivers/dma/fsl-qdma.c +7 -0
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     qdma_sddf_set_cmd(sdf, cmd);
+
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int · line 715

Quoted 12 lines
drivers/dma/fsl-qdma.c +2 -1
+     qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*
@@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int
 irq, void *dev_id)
 
      intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
-     if (intr) {
+     if (intr)
              dev_err(fsl_qdma->dma_dev.dev, "DMA transaction

error!\n");

Quoted 7 lines
Quoted 5 lines

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int irq, void *dev_id) · line 707

Quoted 2 lines
drivers/dma/fsl-qdma.c +0 -2
-             return IRQ_NONE;
-     }

this seems unrelated can you explain?

[Peng Ma] This is an added improvement. When an error occurs we should clean the error reg then to return. I forgot to explain it on comments. Should I add this changed to the comments?

Yes and you should make it a separate patch. A patch should do only 1 thing!

author
#4 lore raw
Quoted 128 lines

-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: 2019年4月29日 13:16
To: Peng Ma <[email protected]>
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; [email protected]
Subject: Re: [EXT] Re: [PATCH] dmaengine: fsl-qdma: fixed the source/destination descriptior format

Caution: EXT Email

Quoted 17 lines · Peng Ma

Hi Vinod,

Thanks your comments.
Please see my comments inline.

Best Regards,
Peng

Quoted 9 lines

-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: 2019年4月26日 19:51
To: Peng Ma <[email protected]>
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH] dmaengine: fsl-qdma: fixed the source/destination descriptior format

Quoted 42 lines
Quoted 7 lines

Caution: EXT Email

Quoted 1 line · Peng Ma

CMD of Source/Destination descriptior format should be lower of

s/descriptior/descriptor

[Peng Ma] Got it.

Quoted 34 lines
Quoted 20 lines

struct fsl_qdma_engine number data address.

---
 drivers/dma/fsl-qdma.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/dma/fsl-qdma.c index renamed from drivers/dma/fsl-qdma.c +0 -0

aa1d0ae..542765a 100644

drivers/dma/fsl-qdma.c +1 -0
@@ -113,6 +113,7 @@
 /* Field definition for Descriptor offset */
 #define QDMA_CCDF_STATUS             20
 #define QDMA_CCDF_OFFSET             20
+#define QDMA_SDDF_CMD(x)             (((u64)(x)) << 32)
 
 /* Field definition for safe loop count*/
 #define FSL_QDMA_HALT_COUNT          1500

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 223

Quoted 9 lines
drivers/dma/fsl-qdma.c +4 -0
@@ -214,6 +215,12 @@ struct fsl_qdma_engine {
 
 };
 
+static inline void
+qdma_sddf_set_cmd(struct fsl_qdma_format *sddf, u32 val) {
+     sddf->data = QDMA_SDDF_CMD(val); }
+
 static inline u64
 qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)  { @@

-341,6

drivers/dma/fsl-qdma.c struct fsl_qdma_engine { · line 225

Quoted 2 lines
drivers/dma/fsl-qdma.c +1 -0
+348,7 @@ static void fsl_qdma_free_chan_resources(struct dma_chan
 *chan)  static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp

*fsl_comp,

Quoted 1 line

dma_addr_t dst,

dma_addr_t

Quoted 56 lines
Quoted 56 lines

src,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct · line 363

Quoted 10 lines

u32 len) {
+ u32 cmd;
struct fsl_qdma_format *sdf, *ddf;
struct fsl_qdma_format *ccdf, *csgf_desc, *csgf_src,
*csgf_dest;

drivers/dma/fsl-qdma.c +0 -0
@@ -353,6 +361,7 @@ static void fsl_qdma_comp_fill_memcpy(struct
 fsl_qdma_comp *fsl_comp,
 
      memset(fsl_comp->virt_addr, 0,

FSL_QDMA_COMMAND_BUFFER_SIZE);

Quoted 7 lines
drivers/dma/fsl-qdma.c +1 -0
      memset(fsl_comp->desc_virt_addr, 0,
 FSL_QDMA_DESCRIPTOR_BUFFER_SIZE);
+
      /* Head Command Descriptor(Frame Descriptor) */

qdma_desc_addr_set64(ccdf, fsl_comp->bus_addr + 16); qdma_ccdf_set_format(ccdf, qdma_ccdf_get_offset(ccdf)); @@
-369,14 +378,14 @@ static void fsl_qdma_comp_fill_memcpy(struct

fsl_qdma_comp *fsl_comp,

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 11 lines
      /* This entry is the last entry. */
      qdma_csgf_set_f(csgf_dest, len);
      /* Descriptor Buffer */
drivers/dma/fsl-qdma.c +0 -8
-     sdf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data =
-             cpu_to_le64(FSL_QDMA_CMD_RWTTYPE <<
-                         FSL_QDMA_CMD_RWTTYPE_OFFSET);
-     ddf->data |=
-             cpu_to_le64(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

drivers/dma/fsl-qdma.c static void fsl_qdma_comp_fill_memcpy(struct fsl_qdma_comp *fsl_comp,

Quoted 7 lines
drivers/dma/fsl-qdma.c +7 -0
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     qdma_sddf_set_cmd(sdf, cmd);
+
+     cmd = cpu_to_le32(FSL_QDMA_CMD_RWTTYPE <<
+                       FSL_QDMA_CMD_RWTTYPE_OFFSET);
+     cmd |= cpu_to_le32(FSL_QDMA_CMD_LWC <<

FSL_QDMA_CMD_LWC_OFFSET);

drivers/dma/fsl-qdma.c static irqreturn_t fsl_qdma_error_handler(int · line 715

Quoted 12 lines
drivers/dma/fsl-qdma.c +2 -1
+     qdma_sddf_set_cmd(ddf, cmd);
 }
 
 /*
@@ -701,10 +710,8 @@ static irqreturn_t fsl_qdma_error_handler(int
 irq, void *dev_id)
 
      intr = qdma_readl(fsl_qdma, status + FSL_QDMA_DEDR);
 
-     if (intr) {
+     if (intr)
              dev_err(fsl_qdma->dma_dev.dev, "DMA transaction

error!\n");

Quoted 2 lines
drivers/dma/fsl-qdma.c +0 -2
-             return IRQ_NONE;
-     }
Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

this seems unrelated can you explain?

[Peng Ma] This is an added improvement. When an error occurs we should

clean the error reg then to return.

Quoted 1 line

I forgot to explain it on comments. Should I add this changed to the

comments?

Yes and you should make it a separate patch. A patch should do only 1 thing!

[Peng Ma] OK, Got it, thanks.
Best Regards,
Peng

Quoted 2 lines

--
~Vinod