Skip to contentSkip to conversation

dmaengine: zynqmp_dma: Bug fixes

PATCH Applied Kedareswara rao Appana 2 participants 6 messages Dec 7, 2017 – Dec 18, 2017

Subsystems (2)

v2 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover dmaengine: zynqmp_dma: Bug fixes

This patch series does the below
--> Fixes kernel doc format style issues.
--> Fixes warings in the driver.
--> Fixes issues with overflow interrupt.
--> Fixes race condition in the probe.

This patch series got created on top of the below patch "dmaengine: zynqmp_dma: Add runtime pm support"

Changes for v2:
--> New patch added "dmaengine: zynqmp_dma: Fix race condition in the probe" to the series.

Kedareswara rao Appana (4):
dmaengine: zynqmp_dma: Fix kernel doc-format
dmaengine: zynqmp_dma: Fix warning variable 'val' set but not used
dmaengine: zynqmp_dma: Fix issues with overflow interrupt
dmaengine: zynqmp_dma: Fix race condition in the probe

 drivers/dma/xilinx/zynqmp_dma.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/4 dmaengine: zynqmp_dma: Fix kernel doc-format

This patch fixes the below kernel doc warnings drivers/dma/xilinx/zynqmp_dma.c:552: info: Scanning doc for zynqmp_dma_device_config drivers/dma/xilinx/zynqmp_dma.c:558: warning: No description found for return value of 'zynqmp_dma_device_config' drivers/dma/xilinx/zynqmp_dma.c:649: info: Scanning doc for zynqmp_dma_free_descriptors drivers/dma/xilinx/zynqmp_dma.c:653: warning: No description found for parameter 'chan'
drivers/dma/xilinx/zynqmp_dma.c:653: warning: Excess function parameter 'dchan' description in 'zynqmp_dma_free_descriptors'

---
Changes for v2:
--> None.

 drivers/dma/xilinx/zynqmp_dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/xilinx/zynqmp_dma.c +3 -1
index 4fa14bf..4376e4a 100644
@@ -552,6 +552,8 @@ static void zynqmp_dma_config(struct zynqmp_dma_chan *chan)
  * zynqmp_dma_device_config - Zynqmp dma device configuration
  * @dchan: DMA channel
  * @config: DMA device config
+ *
+ * Return: 0 always
  */
 static int zynqmp_dma_device_config(struct dma_chan *dchan,
 				    struct dma_slave_config *config)
@@ -647,7 +649,7 @@ static void zynqmp_dma_issue_pending(struct dma_chan *dchan)
 
 /**
  * zynqmp_dma_free_descriptors - Free channel descriptors
- * @dchan: DMA channel pointer
+ * @chan: ZynqMP DMA channel pointer
  */
 static void zynqmp_dma_free_descriptors(struct zynqmp_dma_chan *chan)
 {
#2 lore raw

PATCH v2 2/4 dmaengine: zynqmp_dma: Fix warning variable 'val' set but not used

In reply to Kedareswara rao Appana

This patch fixes the below warning

drivers/dma/xilinx/zynqmp_dma.c: In function 'zynqmp_dma_handle_ovfl_int':
drivers/dma/xilinx/zynqmp_dma.c:522:6: warning: variable 'val' set but not used [-Wunused-but-set-variable]

---
Changes for v2:
--> None.

 drivers/dma/xilinx/zynqmp_dma.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/xilinx/zynqmp_dma.c +2 -4
index 4376e4a..b9b5c0a 100644
@@ -524,12 +524,10 @@ static void zynqmp_dma_start(struct zynqmp_dma_chan *chan)
  */
 static void zynqmp_dma_handle_ovfl_int(struct zynqmp_dma_chan *chan, u32 status)
 {
-	u32 val;
-
 	if (status & ZYNQMP_DMA_IRQ_DST_ACCT_ERR)
-		val = readl(chan->regs + ZYNQMP_DMA_IRQ_DST_ACCT);
+		readl(chan->regs + ZYNQMP_DMA_IRQ_DST_ACCT);
 	if (status & ZYNQMP_DMA_IRQ_SRC_ACCT_ERR)
-		val = readl(chan->regs + ZYNQMP_DMA_IRQ_SRC_ACCT);
+		readl(chan->regs + ZYNQMP_DMA_IRQ_SRC_ACCT);
 }
 
 static void zynqmp_dma_config(struct zynqmp_dma_chan *chan)
#3 lore raw

PATCH v2 3/4 dmaengine: zynqmp_dma: Fix issues with overflow interrupt

In reply to Kedareswara rao Appana

This patch fixes the below issues.
--> Need to clear the channel data count register
when overflow interrupts occurs.
--> Reduce the log level from _info to _dbg when
overflow interrupt occurs.

---
Changes for v2:
--> None.

 drivers/dma/xilinx/zynqmp_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/dma/xilinx/zynqmp_dma.c +5 -1
index b9b5c0a..a297a26 100644
@@ -48,6 +48,7 @@
 #define ZYNQMP_DMA_SRC_START_MSB	0x15C
 #define ZYNQMP_DMA_DST_START_LSB	0x160
 #define ZYNQMP_DMA_DST_START_MSB	0x164
+#define ZYNQMP_DMA_TOTAL_BYTE		0x188
 #define ZYNQMP_DMA_RATE_CTRL		0x18C
 #define ZYNQMP_DMA_IRQ_SRC_ACCT		0x190
 #define ZYNQMP_DMA_IRQ_DST_ACCT		0x194
@@ -513,6 +514,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
 static void zynqmp_dma_start(struct zynqmp_dma_chan *chan)
 {
 	writel(ZYNQMP_DMA_INT_EN_DEFAULT_MASK, chan->regs + ZYNQMP_DMA_IER);
+	writel(0, chan->regs + ZYNQMP_DMA_TOTAL_BYTE);
 	chan->idle = false;
 	writel(ZYNQMP_DMA_ENABLE, chan->regs + ZYNQMP_DMA_CTRL2);
 }
@@ -524,6 +526,8 @@ static void zynqmp_dma_start(struct zynqmp_dma_chan *chan)
  */
 static void zynqmp_dma_handle_ovfl_int(struct zynqmp_dma_chan *chan, u32 status)
 {
+	if (status & ZYNQMP_DMA_BYTE_CNT_OVRFL)
+		writel(0, chan->regs + ZYNQMP_DMA_TOTAL_BYTE);
 	if (status & ZYNQMP_DMA_IRQ_DST_ACCT_ERR)
 		readl(chan->regs + ZYNQMP_DMA_IRQ_DST_ACCT);
 	if (status & ZYNQMP_DMA_IRQ_SRC_ACCT_ERR)
@@ -724,7 +728,7 @@ static irqreturn_t zynqmp_dma_irq_handler(int irq, void *data)
 
 	if (status & ZYNQMP_DMA_INT_OVRFL) {
 		zynqmp_dma_handle_ovfl_int(chan, status);
-		dev_info(chan->dev, "Channel %p overflow interrupt\n", chan);
+		dev_dbg(chan->dev, "Channel %p overflow interrupt\n", chan);
 		ret = IRQ_HANDLED;
 	}
 
#4 lore raw

PATCH v2 4/4 dmaengine: zynqmp_dma: Fix race condition in the probe

In reply to Kedareswara rao Appana

Incase of interrupt property is not present,
Driver is trying to free an invalid irq,
This patch fixes it by adding a check before freeing the irq.

---
Changes for v2:
--> New patch.

 drivers/dma/xilinx/zynqmp_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/xilinx/zynqmp_dma.c +2 -1
index a297a26..f146458 100644
@@ -851,7 +851,8 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
 	if (!chan)
 		return;
 
-	devm_free_irq(chan->zdev->dev, chan->irq, chan);
+	if (chan->irq)
+		devm_free_irq(chan->zdev->dev, chan->irq, chan);
 	tasklet_kill(&chan->tasklet);
 	list_del(&chan->common.device_node);
 }
Applied
#5 lore raw
In reply to Kedareswara rao Appana
Quoted 5 lines · Kedareswara rao Appana

This patch series does the below
--> Fixes kernel doc format style issues.
--> Fixes warings in the driver.
--> Fixes issues with overflow interrupt.
--> Fixes race condition in the probe.

Applied, thanks

Signature · 1 line
~Vinod