Skip to contentSkip to conversation

serial: fsl_lpuart: add DMA support

PATCH Superseded Yuan Yao 3 participants 6 messages Feb 14, 2014

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Yuan Yao

author
#0 lore raw

v5 cover serial: fsl_lpuart: add DMA support

Changed in v5:
- Revoke move dma properties from dtsi to dts.
- Change the explanations for dmas, dma-names in document.
- Change the description for [PATCH 3] serial: fsl_lpuart: documented the clock requirement.

Changed in v4:
- Move dma properties from dtsi to dts.
- Cancle the macro(SERIAL_FSL_LPUART_DMA) .
- Separate the document for clocks which undocumented before into a single patch.
- Change some explanations in document(clocks, clock-names, dmas, dma-names).
- Change "lpuart-tx" and "lpuart-rx" to "tx" and "rx".

Changed in v3:
- Use the streaming DMA API for receive.
- Add the macro(SERIAL_FSL_LPUART_DMA) and dts node propertie for whether using the dma.
- Adjust some coding style.

Changed in v2:
- Add eDMA support for lpuart receive.
- Use dma_mapping_error test dma_map_single.
- Change some names of variable.
- Fix some bugs.

Added in v1:
- Add device tree bindings for lupart eDMA support.
- Add eDMA support for lpuart send.

author
#1 lore raw

PATCH v5 1/3 ARM: dts: vf610: lpuart: Add eDMA support

Add lpuart dts node properties for eDMA support, them depend on the eDMA driver.

---
 arch/arm/boot/dts/vf610.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vf610.dtsi +12 -0
index 365e0fa..8f523b0 100644
@@ -94,6 +94,9 @@
 				interrupts = <0 61 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_UART0>;
 				clock-names = "ipg";
+				dmas = <&edma0 0 2>,
+					<&edma0 0 3>;
+				dma-names = "rx","tx";
 				status = "disabled";
 			};
 
@@ -103,6 +106,9 @@
 				interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_UART1>;
 				clock-names = "ipg";
+				dmas = <&edma0 0 4>,
+					<&edma0 0 5>;
+				dma-names = "rx","tx";
 				status = "disabled";
 			};
 
@@ -112,6 +118,9 @@
 				interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_UART2>;
 				clock-names = "ipg";
+				dmas = <&edma0 0 6>,
+					<&edma0 0 7>;
+				dma-names = "rx","tx";
 				status = "disabled";
 			};
 
@@ -121,6 +130,9 @@
 				interrupts = <0 64 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clks VF610_CLK_UART3>;
 				clock-names = "ipg";
+				dmas = <&edma0 0 8>,
+					<&edma0 0 9>;
+				dma-names = "rx","tx";
 				status = "disabled";
 			};
 
Signature · 1 line
1.8.4
author
#2 lore raw

PATCH v5 2/3 serial: fsl_lpuart: add DMA support

In reply to Yuan Yao

Add dma support for lpuart. This function depend on DMA driver. You can turn on it by write both the dmas and dma-name properties in dts node.

---
 .../devicetree/bindings/serial/fsl-lpuart.txt      |  19 +-
 drivers/tty/serial/fsl_lpuart.c                    | 430 ++++++++++++++++++++-
 2 files changed, 433 insertions(+), 16 deletions(-)
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +18 -4
index 6fd1dd1..6e1cbbf 100644
@@ -5,10 +5,24 @@ Required properties:
 - reg : Address and length of the register set for the device
 - interrupts : Should contain uart interrupt
 
+Optional properties:
+- dmas: List of two DMA specifiers, using a three-cell specifier for each channel.
+	a phandle plus two integer cells. The three cells in order are:
+	1.A phandle pointing to the DMA controller.
+	2.specifies the channel group(DMAMUX) in which this request can be multiplexed,
+	3.specifies the request source.
+- dma-names: Contains one identifier string for each DMA specifier in the dmas property.
+	"tx" for the transmit channel, "rx" for the receive channel.
+
+Note: Optional properties for DMA support. Write them both or both not.
+
 Example:
 
 uart0: serial at 40027000 {
-	       compatible = "fsl,vf610-lpuart";
-	       reg = <0x40027000 0x1000>;
-	       interrupts = <0 61 0x00>;
-       };
+		compatible = "fsl,vf610-lpuart";
+		reg = <0x40027000 0x1000>;
+		interrupts = <0 61 0x00>;
+		dmas = <&edma0 0 2>,
+			<&edma0 0 3>;
+		dma-names = "rx","tx";
+	};
drivers/tty/serial/fsl_lpuart.c +418 -12

507 lines not on this page · raw message

Signature · 1 line
1.8.4
#3 lore raw

PATCH v5 2/3 serial: fsl_lpuart: add DMA support

Quoted 14 lines · Yuan Yao

Add dma support for lpuart. This function depend on DMA driver. You can turn on it by write both the dmas and dma-name properties in dts node.

---
 .../devicetree/bindings/serial/fsl-lpuart.txt      |  19 +-
 drivers/tty/serial/fsl_lpuart.c                    | 430 ++++++++++++++++++++-
 2 files changed, 433 insertions(+), 16 deletions(-)
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +0 -0
index 6fd1dd1..6e1cbbf 100644

Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 13

Quoted 9 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +6 -0
@@ -5,10 +5,24 @@ Required properties:
 - reg : Address and length of the register set for the device
 - interrupts : Should contain uart interrupt
 
+Optional properties:
+- dmas: List of two DMA specifiers, using a three-cell specifier for each channel.
+       a phandle plus two integer cells. The three cells in order are:
+       1.A phandle pointing to the DMA controller.
+       2.specifies the channel group(DMAMUX) in which this request can be multiplexed,
+       3.specifies the request source.

The precise format of a dma-specifier is up to the DMA binding. Why does the client binding care?

Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 18

Quoted 5 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +5 -0
+- dma-names: Contains one identifier string for each DMA specifier in the dmas property.
+       "tx" for the transmit channel, "rx" for the receive channel.
+
+Note: Optional properties for DMA support. Write them both or both not.
+

All you need is something like:

dmas: A list of two dma specifiers, one for each entry in dma-names
dma-names: should contain "tx" and "rx".

Thanks,
Mark.

author
#4 lore raw

PATCH v5 3/3 serial: fsl_lpuart: documented the clock requirement.

In reply to Yuan Yao

This is a correction to the documentation. It was previously required but not documented.

---
 Documentation/devicetree/bindings/serial/fsl-lpuart.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +4 -0
index 6e1cbbf..9666f97 100644
@@ -4,6 +4,8 @@ Required properties:
 - compatible : Should be "fsl,<soc>-lpuart"
 - reg : Address and length of the register set for the device
 - interrupts : Should contain uart interrupt
+- clocks : phandle + clock specifier pairs, one for each entry in clock-names
+- clock-names : should contain: "ipg" - the uart clock
 
 Optional properties:
 - dmas: List of two DMA specifiers, using a three-cell specifier for each channel.
@@ -22,6 +24,8 @@ uart0: serial at 40027000 {
 		compatible = "fsl,vf610-lpuart";
 		reg = <0x40027000 0x1000>;
 		interrupts = <0 61 0x00>;
+		clocks = <&clks VF610_CLK_UART0>;
+		clock-names = "ipg";
 		dmas = <&edma0 0 2>,
 			<&edma0 0 3>;
 		dma-names = "rx","tx";
Signature · 1 line
1.8.4
#5 lore raw

v5 cover serial: fsl_lpuart: add DMA support

In reply to Yuan Yao
Quoted 4 lines · On Friday 14 February 2014 15:27:16 Yuan Yao wrote:

Changed in v5:
- Revoke move dma properties from dtsi to dts.
- Change the explanations for dmas, dma-names in document.
- Change the description for [PATCH 3] serial: fsl_lpuart: documented the clock requirement.

Whole series

Quoted 22 lines

Changed in v4:
- Move dma properties from dtsi to dts.
- Cancle the macro(SERIAL_FSL_LPUART_DMA) .
- Separate the document for clocks which undocumented before into a single patch.
- Change some explanations in document(clocks, clock-names, dmas, dma-names).
- Change "lpuart-tx" and "lpuart-rx" to "tx" and "rx".

Changed in v3:
- Use the streaming DMA API for receive.
- Add the macro(SERIAL_FSL_LPUART_DMA) and dts node propertie for whether using the dma.
- Adjust some coding style.

Changed in v2:
- Add eDMA support for lpuart receive.
- Use dma_mapping_error test dma_map_single.
- Change some names of variable.
- Fix some bugs.

Added in v1:
- Add device tree bindings for lupart eDMA support.
- Add eDMA support for lpuart send.