Skip to contentSkip to conversation

DMA: mv_xor: Add a device_control function

PATCH New Andrew Lunn 3 participants 8 messages Nov 18, 2012 – Nov 19, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 DMA: mv_xor: Add a device_control function

The dmatest module for DMA engines calls

device_control(dtc->chan, DMA_TERMINATE_ALL, 0);

after completing the tests. The documentation in include/linux/dmaengine.h suggests this function is optional and dma_async_device_register() also does not BUG_ON() when not passed a function. However, dmatest is not the only code in the kernel unconditionally calling device_control. So add an implementation indicating all operations are not implemented.

---

This patch depends on the refactoring/DT patches from Thomas.

 drivers/dma/mv_xor.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/dma/mv_xor.c +9 -0
index d645d43..944d7fe 100644
@@ -1089,6 +1089,14 @@ static int __devexit mv_xor_channel_remove(struct mv_xor_chan *mv_chan)
 	return 0;
 }
 
+/* This driver does not implement any of the optional DMA operations. */
+static int
+mv_xor_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
+	       unsigned long arg)
+{
+	return -ENOSYS;
+}
+
 static struct mv_xor_chan * __devinit
 mv_xor_channel_add(struct mv_xor_device *xordev,
 		   struct platform_device *pdev,
@@ -1129,6 +1137,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
 	dma_dev->device_free_chan_resources = mv_xor_free_chan_resources;
 	dma_dev->device_tx_status = mv_xor_status;
 	dma_dev->device_issue_pending = mv_xor_issue_pending;
+	dma_dev->device_control = mv_xor_control;
 	dma_dev->dev = &pdev->dev;
 
 	/* set prep routines based on capability */
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

 arch/arm/boot/dts/kirkwood.dtsi   |   38 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c |    6 ++----
 2 files changed, 40 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 4e5b815..e0ba79d 100644
@@ -77,6 +77,44 @@
 			status = "okay";
 		};
 
+		xor at 60800 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60800 0x100
+			       0x60A00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <5>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <6>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
+		xor at 60900 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60900 0x100
+			       0xd0B00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <7>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <8>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
 		sata at 80000 {
 			compatible = "marvell,orion-sata";
 			reg = <0x80000 0x5000>;
arch/arm/mach-kirkwood/board-dt.c +2 -4
index d94872f..e62f10de 100644
@@ -34,6 +34,8 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
 	OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
 	OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060800, "mv_xor.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060900, "mv_xor.1", NULL),
 	{},
 };
 
@@ -56,10 +58,6 @@ static void __init kirkwood_dt_init(void)
 	/* Setup root of clk tree */
 	kirkwood_clk_init();
 
-	/* internal devices that every board has */
-	kirkwood_xor0_init();
-	kirkwood_xor1_init();
-
 #ifdef CONFIG_KEXEC
 	kexec_reinit = kirkwood_enable_pcie;
 #endif
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

Andrew,

Quoted 9 lines · Andrew Lunn

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

My XOR patch set already depended on the previous clock series from Gregory, so I'm going to rebase it on top of your clock series. Would you mind sharing with me the version of this patch that works on top of your clock patch set?

I guess it's just the removal of the auxdata, and addition of

	clocks = <&gate_clk 8>;

for the first XOR engine, and:

	clocks = <&gate_clk 16>;

for the second XOR engine.

If this is correct, I'll integrate your patch in my XOR patches so that you'll get a complete pull request with all the related XOR changes.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

Quoted 9 lines · Thomas Petazzoni

Andrew,

Quoted 6 lines · Andrew Lunn

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

Quoted 8 lines
Quoted 3 lines

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

My XOR patch set already depended on the previous clock series from Gregory, so I'm going to rebase it on top of your clock series. Would you mind sharing with me the version of this patch that works on top of your clock patch set?

Hi Thomas

I never create the patch for on top of my clock series.

Quoted 9 lines

I guess it's just the removal of the auxdata, and addition of

	clocks = <&gate_clk 8>;

for the first XOR engine, and:

	clocks = <&gate_clk 16>;

for the second XOR engine.

Correct.

Quoted 3 lines

If this is correct, I'll integrate your patch in my XOR patches so that you'll get a complete pull request with all the related XOR changes.

O.K.

We probably need a new ACK from Mike Turquette for the updated clock patches.

Andrew

#4 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

In reply to Andrew Lunn
Quoted 68 lines · Andrew Lunn

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

 arch/arm/boot/dts/kirkwood.dtsi   |   38 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c |    6 ++----
 2 files changed, 40 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 4e5b815..e0ba79d 100644
@@ -77,6 +77,44 @@
 			status = "okay";
 		};
 
+		xor at 60800 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60800 0x100
+			       0x60A00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <5>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <6>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
+		xor at 60900 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60900 0x100
+			       0xd0B00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <7>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <8>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
 		sata at 80000 {
 			compatible = "marvell,orion-sata";
 			reg = <0x80000 0x5000>;
arch/arm/mach-kirkwood/board-dt.c +0 -0
index d94872f..e62f10de 100644

arch/arm/mach-kirkwood/board-dt.c struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { · line 38

Quoted 5 lines
arch/arm/mach-kirkwood/board-dt.c +2 -0
@@ -34,6 +34,8 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
 	OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
 	OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060800, "mv_xor.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060900, "mv_xor.1", NULL),

This conflicts with the earlier clock work. I'll be pushing mvebu/dt in a bit, could you please rebase these two patches against that?

thx,

Jason.

#5 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

Quoted 69 lines · Jason Cooper
Quoted 68 lines · Andrew Lunn

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

 arch/arm/boot/dts/kirkwood.dtsi   |   38 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c |    6 ++----
 2 files changed, 40 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 4e5b815..e0ba79d 100644
@@ -77,6 +77,44 @@
 			status = "okay";
 		};
 
+		xor at 60800 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60800 0x100
+			       0x60A00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <5>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <6>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
+		xor at 60900 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60900 0x100
+			       0xd0B00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <7>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <8>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
 		sata at 80000 {
 			compatible = "marvell,orion-sata";
 			reg = <0x80000 0x5000>;
arch/arm/mach-kirkwood/board-dt.c +0 -0
index d94872f..e62f10de 100644
@@ -34,6 +34,8 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
Quoted 8 lines

arch/arm/mach-kirkwood/board-dt.c struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { · line 38

Quoted 5 lines
arch/arm/mach-kirkwood/board-dt.c +2 -0
 	OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
 	OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
 	OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060800, "mv_xor.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060900, "mv_xor.1", NULL),

This conflicts with the earlier clock work. I'll be pushing mvebu/dt in a bit, could you please rebase these two patches against that?

Thomas has a v2 in the works which should solve that and Sebastians comments.

Andrew

#6 lore raw

PATCH v2 2/2 ARM: Kirkwood: Convert XOR instantiation to DT.

Quoted 79 lines · Andrew Lunn
Quoted 69 lines · Jason Cooper
Quoted 68 lines · Andrew Lunn

Use DT to describe the two XOR DMA engines on Kirkwood. Remove the C code initialization.

---

These patches depend on the refactoring/DT patches from Thomas and NOT the clock patches from me. With the clock patches, a slight different patch is needed, specifying a clocks property in DT and no auxdata.

 arch/arm/boot/dts/kirkwood.dtsi   |   38 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c |    6 ++----
 2 files changed, 40 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +38 -0
index 4e5b815..e0ba79d 100644
@@ -77,6 +77,44 @@
 			status = "okay";
 		};
 
+		xor at 60800 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60800 0x100
+			       0x60A00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <5>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <6>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
+		xor at 60900 {
+			compatible = "marvell,orion-xor";
+			reg = <0x60900 0x100
+			       0xd0B00 0x100>;
+			status = "okay";
+
+			xor00 {
+			      interrupts = <7>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			};
+			xor01 {
+			      interrupts = <8>;
+			      dmacap,memcpy;
+			      dmacap,xor;
+			      dmacap,memset;
+			};
+		};
+
 		sata at 80000 {
 			compatible = "marvell,orion-sata";
 			reg = <0x80000 0x5000>;
arch/arm/mach-kirkwood/board-dt.c +0 -0
index d94872f..e62f10de 100644
@@ -34,6 +34,8 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
Quoted 8 lines

arch/arm/mach-kirkwood/board-dt.c struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { · line 38

Quoted 5 lines
arch/arm/mach-kirkwood/board-dt.c +2 -0
 	OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
 	OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
 	OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060800, "mv_xor.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-xor", 0xf1060900, "mv_xor.1", NULL),

This conflicts with the earlier clock work. I'll be pushing mvebu/dt in a bit, could you please rebase these two patches against that?

Quoted 1 line

Thomas has a v2 in the works which should solve that and Sebastians comments.

Cool, thx.

Jason.

#7 lore raw

PATCH v2 1/2 DMA: mv_xor: Add a device_control function

In reply to Andrew Lunn

Andrew,

Quoted 4 lines · Andrew Lunn

The dmatest module for DMA engines calls

device_control(dtc->chan, DMA_TERMINATE_ALL, 0);

Quoted 8 lines

after completing the tests. The documentation in include/linux/dmaengine.h suggests this function is optional and dma_async_device_register() also does not BUG_ON() when not passed a function. However, dmatest is not the only code in the kernel unconditionally calling device_control. So add an implementation indicating all operations are not implemented.

Thanks, I have applied your patch and made it part of the XOR patch set I have, for which I intend to send a pull request to you tomorrow.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com