Skip to contentSkip to conversation

dmaengine: APM X-Gene SoC DMA engine driver support

PATCH Superseded Rameshwar Prasad Sahu 2 participants 9 messages Jan 19, 2015 1 message not in the archive

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover dmaengine: APM X-Gene SoC DMA engine driver support

This patch set implements the APM X-Gene SoC DMA driver support to offload the DMA operations such as memory copy(memcpy), scatter gathering.

---

Rameshwar Prasad Sahu (3):
dmaengine: Add support for APM X-Gene SoC DMA engine driver
arm64: dts: Add APM X-Gene DMA device and DMA clock DTS nodes
Documentation: dma: Add APM X-Gene SoC DMA engine driver documentation

 .../devicetree/bindings/dma/apm-xgene-dma.txt      |   49 +
 arch/arm64/boot/dts/apm/apm-storm.dtsi             |   28 +
 drivers/dma/Kconfig                                |    8 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/xgene-dma.c                            | 1566 ++++++++++++++++++++
 5 files changed, 1652 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/apm-xgene-dma.txt
 create mode 100644 drivers/dma/xgene-dma.c

--
1.8.2.1

#1 lore raw

PATCH v3 1/3 dmaengine: Add support for APM X-Gene SoC DMA engine driver

This patch implements the APM X-Gene SoC DMA engine driver. The APM X-Gene SoC DMA engine consists of 4 DMA channels for performing DMA operations. These DMA operations include memory copy and scatter gathering offload.

---
 drivers/dma/Kconfig     |    8 +
 drivers/dma/Makefile    |    1 +
 drivers/dma/xgene-dma.c | 1566 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1575 insertions(+)
 create mode 100644 drivers/dma/xgene-dma.c
drivers/dma/Kconfig +8 -0
index f2b2c4e..251ce60 100644
@@ -416,6 +416,14 @@ config NBPFAXI_DMA
 	help
 	  Support for "Type-AXI" NBPF DMA IPs from Renesas
 
+config XGENE_DMA
+	tristate "APM X-Gene DMA support"
+	depends on ARCH_XGENE
+	select DMA_ENGINE
+	select ASYNC_TX_ENABLE_CHANNEL_SWITCH
+	help
+	  Enable support for the APM X-Gene SoC DMA engine.
+
 config DMA_ENGINE
 	bool
 
drivers/dma/Makefile +1 -0
index 2022b54..0567e69 100644
@@ -50,3 +50,4 @@ obj-y += xilinx/
 obj-$(CONFIG_INTEL_MIC_X100_DMA) += mic_x100_dma.o
 obj-$(CONFIG_NBPFAXI_DMA) += nbpfaxi.o
 obj-$(CONFIG_DMA_SUN6I) += sun6i-dma.o
+obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
drivers/dma/xgene-dma.c new file +1566 -0

1,566 lines not on this page · raw message

--
1.8.2.1

#3 lore raw

PATCH v3 2/3 arm64: dts: Add APM X-Gene DMA device and DMA clock DTS nodes

In reply to Rameshwar Prasad Sahu

This patch adds the device tree node for APM X-Gene SoC DMA controller and DMA clock.

---
 arch/arm64/boot/dts/apm/apm-storm.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/apm/apm-storm.dtsi +28 -0
index f1ad9c2..e20da23 100644
@@ -103,6 +103,9 @@
 		#size-cells = <2>;
 		ranges;
 
+		/* DDR range is 42-bit addressing */
+		dma-ranges = <0x40 0x0 0x40 0x0 0x1ff 0xffffffff>;
+
 		clocks {
 			#address-cells = <2>;
 			#size-cells = <2>;
@@ -352,6 +355,15 @@
 				reg-names = "csr-reg";
 				clock-output-names = "pcie4clk";
 			};
+
+			dmaclk: dmaclk at 1f27c000 {
+				compatible = "apm,xgene-device-clock";
+				#clock-cells = <1>;
+				clocks = <&socplldiv2 0>;
+				reg = <0x0 0x1f27c000 0x0 0x1000>;
+				reg-names = "csr-reg";
+				clock-output-names = "dmaclk";
+			};
 		};
 
 		pcie0: pcie at 1f2b0000 {
@@ -656,5 +668,21 @@
 			interrupts = <0x0 0x41 0x4>;
 			clocks = <&rngpkaclk 0>;
 		};
+
+		dma: dma at 1f270000 {
+			compatible = "apm,xgene-dma";
+			device_type = "dma";
+			reg = <0x0 0x1f270000 0x0 0x10000>,
+			      <0x0 0x1f200000 0x0 0x10000>,
+			      <0x0 0x1b008000 0x0 0x2000>;
+			reg-names = "dma_csr", "ring_csr", "ring_cmd";
+			interrupts = <0x0 0x82 0x4>,
+				     <0x0 0xb8 0x4>,
+				     <0x0 0xb9 0x4>,
+				     <0x0 0xba 0x4>,
+				     <0x0 0xbb 0x4>;
+			dma-coherent;
+			clocks = <&dmaclk 0>;
+		};
 	};
 };

--
1.8.2.1

#8 lore raw

PATCH v3 3/3 Documentation: dma: Add APM X-Gene SoC DMA engine driver documentation

In reply to Rameshwar Prasad Sahu

This patch adds device tree binding for APM X-Gene SoC DMA engine driver.

---
 .../devicetree/bindings/dma/apm-xgene-dma.txt      | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/apm-xgene-dma.txt
Documentation/devicetree/bindings/dma/apm-xgene-dma.txt new file +49 -0
new file mode 100644
index 0000000..c661cc6
@@ -0,0 +1,49 @@
+Applied Micro X-Gene SoC DMA nodes
+
+DMA nodes are defined to describe on-chip DMA interfaces in
+APM X-Gene SoC.
+
+Required properties for DMA interfaces:
+- compatible: Should be "apm,xgene-dma".
+- device_type: set to "dma".
+- reg: Address and length of the register set for the device.
+  It contains the information of registers in the same order
+  as described by reg-names.
+- reg-names: Should contain the register set names.
+  - "dma_csr": DMA control and status register address space.
+  - "ring_csr": Descriptor ring control and status register
+                address space.
+  - "ring_cmd": Descriptor ring command register address space.
+- interrupts: DMA has 5 interrupts sources. 1st interrupt is
+  DMA error reporting interrupt. 2nd, 3rd, 4th and 5th interrupts
+  are completion interrupts for each DMA channels.
+- clocks: Reference to the clock entry.
+
+Optional properties:
+- dma-coherent : Present if dma operations are coherent
+
+Example:
+	dmaclk: dmaclk at 1f27c000 {
+		compatible = "apm,xgene-device-clock";
+		#clock-cells = <1>;
+		clocks = <&socplldiv2 0>;
+		reg = <0x0 0x1f27c000 0x0 0x1000>;
+		reg-names = "csr-reg";
+		clock-output-names = "dmaclk";
+	};
+
+	dma: dma at 1f270000 {
+		compatible = "apm,xgene-dma";
+		device_type = "dma";
+		reg = <0x0 0x1f270000 0x0 0x10000>,
+		      <0x0 0x1f200000 0x0 0x10000>,
+		      <0x0 0x1b008000 0x0 0x2000>;
+		reg-names = "dma_csr", "ring_csr", "ring_cmd";
+		interrupts = <0x0 0xb8 0x4>,
+			     <0x0 0xb9 0x4>,
+			     <0x0 0xba 0x4>,
+			     <0x0 0xbb 0x4>,
+			     <0x0 0x82 0x4>;
+		dma-coherent;
+		clocks = <&dmaclk 0>;
+	};

--
1.8.2.1

#4 lore raw

Re: [PATCH v3 2/3] arm64: dts: Add APM X-Gene DMA device and DMA clock DTS nodes

In reply to Rameshwar Prasad Sahu

arch/arm64/boot/dts/apm/apm-storm.dtsi line 109

Quoted 12 lines · On Monday 19 January 2015 18:11:08 Rameshwar Prasad Sahu wrote:
arch/arm64/boot/dts/apm/apm-storm.dtsi +3 -0
index f1ad9c2..e20da23 100644
@@ -103,6 +103,9 @@
                #size-cells = <2>;
                ranges;
 
+               /* DDR range is 42-bit addressing */
+               dma-ranges = <0x40 0x0 0x40 0x0 0x1ff 0xffffffff>;
+
 

The comment above is misleading, and the value is wrong. I assume you copied these from the AMD patch that introduced the respective property.

The value should be

	dma-ranges = <0x40 0x0 0x40 0x0 0x200 0>;

to say that any DMA to physical addresses from 0 to 0x3f.ffffffff is disallowed and dma to physical addresses from 0x40.00000000 to 0x23f.ffffffff is allowed and gets translated using an identity mapping.

I also see that on Mustang, all memory is outside of this range, which is a bit suspicious, while your PCI memory space is included.

It would be best to match the numbers up with your data sheet.

Arnd

Acked-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dmaengine: Add support for APM X-Gene SoC DMA engine driver

In reply to Rameshwar Prasad Sahu
Quoted 7 lines · On Monday 19 January 2015 18:11:07 Rameshwar Prasad Sahu wrote:

This patch implements the APM X-Gene SoC DMA engine driver. The APM X-Gene SoC DMA engine consists of 4 DMA channels for performing DMA operations. These DMA operations include memory copy and scatter gathering offload.

#6 lore raw

Re: [PATCH v3 2/3] arm64: dts: Add APM X-Gene DMA device and DMA clock DTS nodes

In reply to a message not in the archive

Thanks,
with regards,
Ram

Quoted 75 lines · Rameshwar Sahu

Hi Arnd,

Thanks,
with regards,
Ram

Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · On Monday 19 January 2015 18:11:08 Rameshwar Prasad Sahu wrote:
arch/arm64/boot/dts/apm/apm-storm.dtsi +0 -0
index f1ad9c2..e20da23 100644
@@ -103,6 +103,9 @@
                #size-cells = <2>;
                ranges;
 
Quoted 8 lines

arch/arm64/boot/dts/apm/apm-storm.dtsi

Quoted 4 lines
arch/arm64/boot/dts/apm/apm-storm.dtsi +3 -0
+               /* DDR range is 42-bit addressing */
+               dma-ranges = <0x40 0x0 0x40 0x0 0x1ff 0xffffffff>;
+
 

The comment above is misleading, and the value is wrong. I assume you

copied these from the AMD patch that introduced the respective property.

I referred this patch from AMD only.

Quoted 5 lines

The value should be

        dma-ranges = <0x40 0x0 0x40 0x0 0x200 0>;

then it should be :

dma-ranges = <0x40 0x0 0x40 0x0 0x400 0>;

Quoted 6 lines

to say that any DMA to physical addresses from 0 to 0x3f.ffffffff is disallowed and dma to physical addresses from 0x40.00000000 to 0x23f.ffffffff is allowed and gets translated using an identity mapping.

I also see that on Mustang, all memory is outside of this range,

Do you mean all other device controller node in DT here?? Basically these are all device controller memory, as what I understood is dma-ranges tells about DDR ranges like start address of DDR and length.

Quoted 13 lines

which is a bit suspicious, while your PCI memory space is included.

It would be best to match the numbers up with your data sheet.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH v3 2/3] arm64: dts: Add APM X-Gene DMA device and DMA clock DTS nodes

In reply to a message not in the archive
Quoted 7 lines · On Monday 19 January 2015 20:11:22 Rameshwar Sahu wrote:
Quoted 6 lines

The value should be

        dma-ranges = <0x40 0x0 0x40 0x0 0x200 0>;
Quoted 6 lines

then it should be :

dma-ranges = <0x40 0x0 0x40 0x0 0x400 0>;

to say that any DMA to physical addresses from 0 to 0x3f.ffffffff

No, the property above is for a bus that extends from 0x40.00000000 to 0x43f.ffffffff

The first tuple is the address that is used for the local bus, the second one is the address that it gets translated to on the parent bus, and the third tuple is the length.

Quoted 11 lines
Quoted 6 lines

is disallowed and dma to physical addresses from 0x40.00000000 to 0x23f.ffffffff is allowed and gets translated using an identity mapping.

I also see that on Mustang, all memory is outside of this range,

Do you mean all other device controller node in DT here?? Basically these are all device controller memory, as what I understood is dma-ranges tells about DDR ranges like start address of DDR and length.

It has absolutely nothing to do with where the DDR memory resides, only which addresses are valid on a particular bus, like the ranges property for the opposite direction. This is usually set up in some control register for the bus, and you should use the same value here.

Arnd