Skip to contentSkip to conversation

serial: fsl_lpuart: add DMA support

PATCH Superseded Yuan Yao 3 participants 11 messages Jan 22, 2014 – Feb 11, 2014

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Yuan Yao

author
#0 lore raw

v4 cover serial: fsl_lpuart: add DMA support

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 v4 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-twr.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boot/dts/vf610-twr.dts +3 -0
index 80db14e..4149ed6 100644
@@ -101,5 +101,8 @@
 &uart1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_uart1>;
+	dmas = <&edma0 0 4>,
+		<&edma0 0 5>;
+	dma-names = "rx","tx";
 	status = "okay";
 };
Signature · 1 line
1.8.4
author
#2 lore raw

PATCH v4 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 +15 -4
index 6fd1dd1..6e1cbbf 100644
@@ -5,10 +5,21 @@ Required properties:
 - reg : Address and length of the register set for the device
 - interrupts : Should contain uart interrupt
 
+Optional properties:
+- dmas: Generic dma devicetree binding as described
+	in Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names: Two dmas have to be defined, "rx" and "tx".
+	An ordered list of channel names affiliated to the above.
+
+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 v4 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 12

Quoted 8 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +5 -0
@@ -5,10 +5,21 @@ Required properties:
 - reg : Address and length of the register set for the device
 - interrupts : Should contain uart interrupt
 
+Optional properties:
+- dmas: Generic dma devicetree binding as described
+       in Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names: Two dmas have to be defined, "rx" and "tx".
+       An ordered list of channel names affiliated to the above.

Please describe dmas in terms of dma-names (as with the patch describing clocks and clock-names).

It would be nice to describe the type of the dmas property, but I see that we have a propblem with inconsistent terminology in the area of ${THING}-specifiers, so I'll try to get that cleaned up separately.

Cheers,
Mark.

author
#4 lore raw

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

In reply to Yuan Yao

It was previously required but not documented.
Add the text to the binding along with the new "dmas" addition.

---
 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: Generic dma devicetree binding as described
@@ -19,6 +21,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

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

Quoted 22 lines · Yuan Yao

It was previously required but not documented.
Add the text to the binding along with the new "dmas" addition.

---
 Documentation/devicetree/bindings/serial/fsl-lpuart.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2 -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: Generic dma devicetree binding as described

Documentation/devicetree/bindings/serial/fsl-lpuart.txt uart0: serial at 40027000 { · line 28

Quoted 8 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2 -0
@@ -19,6 +21,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";

As this was a previous requirement, and this is a correction to the documentation rather than a binding change:

Thanks,
Mark.

#6 lore raw

v4 cover serial: fsl_lpuart: add DMA support

In reply to Yuan Yao
Quoted 2 lines · Yuan Yao

Changed in v4:
- Move dma properties from dtsi to dts.

Why this change? DMA is a SoC level resource rather than board one.

Shawn

author
#7 lore raw

v4 cover serial: fsl_lpuart: add DMA support

Hi, Shawn

Here I just want the DMA be a selectable property for each board. Is it suitable?

Quoted 16 lines

-----Original Message-----
From: Shawn Guo [mailto:shawn.guo at linaro.org]
Sent: Monday, January 27, 2014 3:50 PM
To: Yuan Yao-B46683
Cc: gregkh at linuxfoundation.org; linux at arm.linux.org.uk; arnd at arndb.de; mark.rutland at arm.com; linux-arm-kernel at lists.infradead.org; linux- serial at vger.kernel.org
Subject: Re: [PATCH v4 0/3] serial: fsl_lpuart: add DMA support

Quoted 2 lines · Yuan Yao

Changed in v4:
- Move dma properties from dtsi to dts.

Why this change? DMA is a SoC level resource rather than board one.

Shawn

#8 lore raw

v4 cover serial: fsl_lpuart: add DMA support

Quoted 4 lines · Yao Yuan

Hi, Shawn

Here I just want the DMA be a selectable property for each board. Is it suitable?

No, it's not. Just like IRQ line, DMA channel is a SoC level resource. It should just be there once the SoC is out there. Nothing to do with board level configuration.

Shawn

Quoted 18 lines
Quoted 17 lines

-----Original Message-----
From: Shawn Guo [mailto:[email protected]]
Sent: Monday, January 27, 2014 3:50 PM
To: Yuan Yao-B46683
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v4 0/3] serial: fsl_lpuart: add DMA support

Quoted 2 lines · Yuan Yao

Changed in v4:
- Move dma properties from dtsi to dts.

Why this change? DMA is a SoC level resource rather than board one.

Shawn

author
#9 lore raw

v4 cover serial: fsl_lpuart: add DMA support

Quoted 12 lines

-----Original Message-----
From: Shawn Guo [mailto:shawn.guo at linaro.org]
Sent: Tuesday, February 11, 2014 11:00 AM
To: Yuan Yao-B46683
Cc: gregkh at linuxfoundation.org; linux at arm.linux.org.uk; arnd at arndb.de; mark.rutland at arm.com; linux-arm-kernel at lists.infradead.org; linux- serial at vger.kernel.org
Subject: Re: [PATCH v4 0/3] serial: fsl_lpuart: add DMA support

Quoted 2 lines · Yao Yuan

Hi, Shawn

Quoted 8 lines
Quoted 2 lines

Here I just want the DMA be a selectable property for each board. Is it suitable?

No, it's not. Just like IRQ line, DMA channel is a SoC level resource. It should just be there once the SoC is out there. Nothing to do with board level configuration.

Shawn

Here I also have a confusion.
IRQ is must. But DMA isn't very necessary.
How to deal with if one board is need DMA but another is not need? You mean if DMA is be support once all of them must use dma as first?

--
Best Regards,
YuanYao

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines

-----Original Message-----
From: Shawn Guo [mailto:shawn.guo at linaro.org]
Sent: Monday, January 27, 2014 3:50 PM
To: Yuan Yao-B46683
Cc: gregkh at linuxfoundation.org; linux at arm.linux.org.uk; arnd at arndb.de; mark.rutland at arm.com;
linux-arm-kernel at lists.infradead.org; linux- serial at vger.kernel.org
Subject: Re: [PATCH v4 0/3] serial: fsl_lpuart: add DMA support

Quoted 2 lines · Yuan Yao

Changed in v4:
- Move dma properties from dtsi to dts.

Why this change? DMA is a SoC level resource rather than board one.

Shawn

#10 lore raw

v4 cover serial: fsl_lpuart: add DMA support

Quoted 4 lines · Yao Yuan

Here I also have a confusion.
IRQ is must. But DMA isn't very necessary.
How to deal with if one board is need DMA but another is not need? You mean if DMA is be support once all of them must use dma as first?

That's the point. Why whether using DMA or not is a board decision? The DMA resource should be defined at SoC level from the beginning just like IO and interrupt resource. And using DMA or PIO should be a decision made by device driver not device tree.

Shawn