dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes
@ 2019-09-26 10:50 Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 1/4] dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer Radhey Shyam Pandey
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-26 10:50 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, Radhey Shyam Pandey

This patchset fixes axidma simple mode 64-bit transfer.
It clears vdma control registers before update, in probe
use devm_platform API and remove clk_get error in case of
EPROBE_DEFER.  

Radhey Shyam Pandey (4):
  dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer
  dmaengine: xilinx_dma: Fix control reg update in
    vdma_channel_set_config
  dmaengine: xilinx_dma: use devm_platform_ioremap_resource()
  dmaengine: xilinx_dma: Remove clk_get error message for probe defer

 drivers/dma/xilinx/xilinx_dma.c |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH -next 1/4] dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer
  2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
@ 2019-09-26 10:50 ` Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 2/4] dmaengine: xilinx_dma: Fix control reg update in vdma_channel_set_config Radhey Shyam Pandey
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-26 10:50 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, Radhey Shyam Pandey

In AXI DMA simple mode also pass MSB bits of source and destination
address to xilinx_write function. It fixes simple AXI DMA operation
mode using 64-bit addressing.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index e7dc3c4..1fbe025 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -1354,7 +1354,8 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan)
 					   node);
 		hw = &segment->hw;
 
-		xilinx_write(chan, XILINX_DMA_REG_SRCDSTADDR, hw->buf_addr);
+		xilinx_write(chan, XILINX_DMA_REG_SRCDSTADDR,
+			     xilinx_prep_dma_addr_t(hw->buf_addr));
 
 		/* Start the transfer */
 		dma_ctrl_write(chan, XILINX_DMA_REG_BTT,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -next 2/4] dmaengine: xilinx_dma: Fix control reg update in vdma_channel_set_config
  2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 1/4] dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer Radhey Shyam Pandey
@ 2019-09-26 10:50 ` Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 3/4] dmaengine: xilinx_dma: use devm_platform_ioremap_resource() Radhey Shyam Pandey
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-26 10:50 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, Radhey Shyam Pandey

In vdma_channel_set_config clear the delay, frame count and master mask
before updating their new values. It avoids programming incorrect state
when input parameters are different from default.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Acked-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 1fbe025..5d56f1e 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -68,6 +68,9 @@
 #define XILINX_DMA_DMACR_CIRC_EN		BIT(1)
 #define XILINX_DMA_DMACR_RUNSTOP		BIT(0)
 #define XILINX_DMA_DMACR_FSYNCSRC_MASK		GENMASK(6, 5)
+#define XILINX_DMA_DMACR_DELAY_MASK		GENMASK(31, 24)
+#define XILINX_DMA_DMACR_FRAME_COUNT_MASK	GENMASK(23, 16)
+#define XILINX_DMA_DMACR_MASTER_MASK		GENMASK(11, 8)
 
 #define XILINX_DMA_REG_DMASR			0x0004
 #define XILINX_DMA_DMASR_EOL_LATE_ERR		BIT(15)
@@ -2118,8 +2121,10 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
 	chan->config.gen_lock = cfg->gen_lock;
 	chan->config.master = cfg->master;
 
+	dmacr &= ~XILINX_DMA_DMACR_GENLOCK_EN;
 	if (cfg->gen_lock && chan->genlock) {
 		dmacr |= XILINX_DMA_DMACR_GENLOCK_EN;
+		dmacr &= ~XILINX_DMA_DMACR_MASTER_MASK;
 		dmacr |= cfg->master << XILINX_DMA_DMACR_MASTER_SHIFT;
 	}
 
@@ -2135,11 +2140,13 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
 	chan->config.delay = cfg->delay;
 
 	if (cfg->coalesc <= XILINX_DMA_DMACR_FRAME_COUNT_MAX) {
+		dmacr &= ~XILINX_DMA_DMACR_FRAME_COUNT_MASK;
 		dmacr |= cfg->coalesc << XILINX_DMA_DMACR_FRAME_COUNT_SHIFT;
 		chan->config.coalesc = cfg->coalesc;
 	}
 
 	if (cfg->delay <= XILINX_DMA_DMACR_DELAY_MAX) {
+		dmacr &= ~XILINX_DMA_DMACR_DELAY_MASK;
 		dmacr |= cfg->delay << XILINX_DMA_DMACR_DELAY_SHIFT;
 		chan->config.delay = cfg->delay;
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -next 3/4] dmaengine: xilinx_dma: use devm_platform_ioremap_resource()
  2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 1/4] dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer Radhey Shyam Pandey
  2019-09-26 10:50 ` [PATCH -next 2/4] dmaengine: xilinx_dma: Fix control reg update in vdma_channel_set_config Radhey Shyam Pandey
@ 2019-09-26 10:50 ` Radhey Shyam Pandey
  2019-09-26 10:51 ` [PATCH -next 4/4] dmaengine: xilinx_dma: Remove clk_get error message for probe defer Radhey Shyam Pandey
  2019-10-15 10:12 ` [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Vinod Koul
  4 siblings, 0 replies; 6+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-26 10:50 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, Radhey Shyam Pandey

Replace the chain of platform_get_resource() and devm_ioremap_resource()
with devm_platform_ioremap_resource(). It simplifies the flow and there
is no functional change.

Fixes below cocinelle warning-
WARNING: Use devm_platform_ioremap_resource for xdev -> regs

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 5d56f1e..bc9979d 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2612,7 +2612,6 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 	struct device_node *node = pdev->dev.of_node;
 	struct xilinx_dma_device *xdev;
 	struct device_node *child, *np = pdev->dev.of_node;
-	struct resource *io;
 	u32 num_frames, addr_width, len_width;
 	int i, err;
 
@@ -2638,8 +2637,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 		return err;
 
 	/* Request and map I/O memory */
-	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	xdev->regs = devm_ioremap_resource(&pdev->dev, io);
+	xdev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(xdev->regs))
 		return PTR_ERR(xdev->regs);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -next 4/4] dmaengine: xilinx_dma: Remove clk_get error message for probe defer
  2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
                   ` (2 preceding siblings ...)
  2019-09-26 10:50 ` [PATCH -next 3/4] dmaengine: xilinx_dma: use devm_platform_ioremap_resource() Radhey Shyam Pandey
@ 2019-09-26 10:51 ` Radhey Shyam Pandey
  2019-10-15 10:12 ` [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Vinod Koul
  4 siblings, 0 replies; 6+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-26 10:51 UTC (permalink / raw)
  To: vkoul, dan.j.williams, michal.simek, nick.graumann,
	andrea.merello, appana.durga.rao, mcgrof
  Cc: dmaengine, linux-kernel, Radhey Shyam Pandey

In dma probe, the driver checks for devm_clk_get return and print error
message in the failing case. However for -EPROBE_DEFER this message is
confusing so avoid it.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index bc9979d..440f2ce 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2194,7 +2194,9 @@ static int axidma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
 	*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
 	if (IS_ERR(*axi_clk)) {
 		err = PTR_ERR(*axi_clk);
-		dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n", err);
+		if (err != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n",
+				err);
 		return err;
 	}
 
@@ -2259,14 +2261,18 @@ static int axicdma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
 	*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
 	if (IS_ERR(*axi_clk)) {
 		err = PTR_ERR(*axi_clk);
-		dev_err(&pdev->dev, "failed to get axi_clk (%d)\n", err);
+		if (err != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "failed to get axi_clk (%d)\n",
+				err);
 		return err;
 	}
 
 	*dev_clk = devm_clk_get(&pdev->dev, "m_axi_aclk");
 	if (IS_ERR(*dev_clk)) {
 		err = PTR_ERR(*dev_clk);
-		dev_err(&pdev->dev, "failed to get dev_clk (%d)\n", err);
+		if (err != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "failed to get dev_clk (%d)\n",
+				err);
 		return err;
 	}
 
@@ -2299,7 +2305,9 @@ static int axivdma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
 	*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
 	if (IS_ERR(*axi_clk)) {
 		err = PTR_ERR(*axi_clk);
-		dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n", err);
+		if (err != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n",
+				err);
 		return err;
 	}
 
@@ -2321,7 +2329,8 @@ static int axivdma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
 
 	err = clk_prepare_enable(*axi_clk);
 	if (err) {
-		dev_err(&pdev->dev, "failed to enable axi_clk (%d)\n", err);
+		dev_err(&pdev->dev, "failed to enable axi_clk (%d)\n",
+			err);
 		return err;
 	}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes
  2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
                   ` (3 preceding siblings ...)
  2019-09-26 10:51 ` [PATCH -next 4/4] dmaengine: xilinx_dma: Remove clk_get error message for probe defer Radhey Shyam Pandey
@ 2019-10-15 10:12 ` Vinod Koul
  4 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2019-10-15 10:12 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: dan.j.williams, michal.simek, nick.graumann, andrea.merello,
	appana.durga.rao, mcgrof, dmaengine, linux-kernel

On 26-09-19, 16:20, Radhey Shyam Pandey wrote:
> This patchset fixes axidma simple mode 64-bit transfer.
> It clears vdma control registers before update, in probe
> use devm_platform API and remove clk_get error in case of
> EPROBE_DEFER.  

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-15 10:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 10:50 [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Radhey Shyam Pandey
2019-09-26 10:50 ` [PATCH -next 1/4] dmaengine: xilinx_dma: Fix 64-bit simple AXIDMA transfer Radhey Shyam Pandey
2019-09-26 10:50 ` [PATCH -next 2/4] dmaengine: xilinx_dma: Fix control reg update in vdma_channel_set_config Radhey Shyam Pandey
2019-09-26 10:50 ` [PATCH -next 3/4] dmaengine: xilinx_dma: use devm_platform_ioremap_resource() Radhey Shyam Pandey
2019-09-26 10:51 ` [PATCH -next 4/4] dmaengine: xilinx_dma: Remove clk_get error message for probe defer Radhey Shyam Pandey
2019-10-15 10:12 ` [PATCH -next 0/4] dmaengine: xilinx_dma: Minor functional fixes Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).