ARM: dts: vf610: lpuart: Add eDMA support
Subsystems (2)
PATCH v3 1/2 ARM: dts: vf610: lpuart: Add eDMA support
Add lpuart dts node properties for eDMA support, them depend on the eDMA driver. See VF610_EDMA_MUXID0_UART*_*X macro on eDMA driver
--- arch/arm/boot/dts/vf610.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vf610.dtsi +12 -0
@@ -118,6 +118,9 @@ interrupts = <0 61 0x00>; clocks = <&clks VF610_CLK_UART0>; clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART0_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART0_RX>; status = "disabled"; };
@@ -127,6 +130,9 @@ interrupts = <0 62 0x04>; clocks = <&clks VF610_CLK_UART1>; clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART1_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART1_RX>; status = "disabled"; };
@@ -136,6 +142,9 @@ interrupts = <0 63 0x04>; clocks = <&clks VF610_CLK_UART2>; clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART2_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART2_RX>; status = "disabled"; };
@@ -145,6 +154,9 @@ interrupts = <0 64 0x04>; clocks = <&clks VF610_CLK_UART3>; clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART3_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART3_RX>; status = "disabled"; };
Signature · 1 line
1.8.4
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Add dma support for lpuart. This function depend on DMA driver.
You can turn on it by SERIAL_FSL_LPUART_DMA=y. And It works if dts node has dma properties.
--- .../devicetree/bindings/serial/fsl-lpuart.txt | 21 +- drivers/tty/serial/Kconfig | 7 + drivers/tty/serial/fsl_lpuart.c | 457 ++++++++++++++++++++- 3 files changed, 473 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +17 -4
@@ -4,11 +4,24 @@ 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 : from common clock binding: handle to uart clock +- clock-names : from common clock binding: Shall be "ipg" + +Optional properties: +- dma-names: Should contain "lpuart-tx" for transmit and "lpuart-rx" for receive channels +- dmas: Should contain dma specifiers for transmit and receive channels + +Note: Optional properties for DMA support, If need this properties is must. 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>; + clocks = <&clks VF610_CLK_UART0>; + clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART0_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART0_RX>; + };
drivers/tty/serial/Kconfig +7 -0
@@ -1509,6 +1509,13 @@ config SERIAL_FSL_LPUART_CONSOLE If you have enabled the lpuart serial port on the Freescale SoCs, you can make it the console by answering Y to this option. +config SERIAL_FSL_LPUART_DMA + bool "Freescale lpuart serial port dma support" + depends on FSL_EDMA=y && SERIAL_FSL_LPUART=y + help + DMA support for the on-chip lpuart on some Freescale SOCs, + you can turn on the dma support for lpuart by answering Y to this option. + config SERIAL_ST_ASC tristate "ST ASC serial port support" select SERIAL_CORE
drivers/tty/serial/fsl_lpuart.c +449 -8
544 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Quoted 4 lines · Yuan Yao
Add dma support for lpuart. This function depend on DMA driver.
You can turn on it by SERIAL_FSL_LPUART_DMA=y. And It works if dts node has dma properties.Signed-off-by Yuan Yao <[email protected]>
Most of the changes you did look good, but I have to say I'm not a fan of the #ifdef you added. I don't think you actually need to have the compile-time selection, and it would be best to just drop that part.
If you have a good reason to keep it, please change the code to more readable "if (IS_ENABLED(CONFIG_FSL_LPUART_DMA))" constructs. If you decide to do this, you will find that you need far fewer such conditionals because a lot of the code will automatically get dropped by the compiler.
Quoted 4 lines
uart0: serial at 40027000 {
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +0
-3- compatible = "fsl,vf610-lpuart"; - reg = <0x40027000 0x1000>; - interrupts = <0 61 0x00>;
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +9
-1- }; + compatible = "fsl,vf610-lpuart"; + reg = <0x40027000 0x1000>; + interrupts = <0 61 0x00>; + clocks = <&clks VF610_CLK_UART0>; + clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART0_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART0_RX>; + };
You still haven't addressed my comment about removing the VF610_EDMA_MUXID0_UART0_TX macros.
drivers/tty/serial/fsl_lpuart.c line 124
Quoted 6 lines
drivers/tty/serial/fsl_lpuart.c +5
-0+#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +#define DMA_MAXBURST 16 +#define DMA_MAXBURST_MASK (DMA_MAXBURST - 1) +#define FSL_UART_RX_DMA_BUFFER_SIZE 64 +#endif
For this part there was no need for the #ifdef to start with.
Quoted 18 lines
#define
DRIVER_NAME"fsl-lpuart"
#defineDEV_NAME"ttyLP"
#defineUART_NR6drivers/tty/serial/fsl_lpuart.c +11
-0@@ -121,6 +132,26 @@ struct lpuart_port {struct clk *clk;unsigned int txfifo_size;unsigned int rxfifo_size; + +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +bool lpuart_dma_use; +struct dma_chan *dma_tx_chan; +struct dma_chan *dma_rx_chan; +struct dma_async_tx_descriptor *dma_tx_desc; +struct dma_async_tx_descriptor *dma_rx_desc; +dma_addr_t dma_tx_buf_bus; +dma_addr_t dma_rx_buf_bus; +dma_cookie_t dma_tx_cookie; +dma_cookie_t dma_rx_cookie;
drivers/tty/serial/fsl_lpuart.c struct lpuart_port { · line 155
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +9
-0+unsigned char *dma_tx_buf_virt; +unsigned char *dma_rx_buf_virt; +unsigned int dma_tx_bytes; +unsigned int dma_rx_bytes; +int dma_tx_in_progress; +int dma_rx_in_progress; +unsigned int dma_rx_timeout; +struct timer_list lpuart_timer; +#endif };
This part will result in a slight increase in data size even if dma support is turned off at compile time.
Quoted 7 lines
drivers/tty/serial/fsl_lpuart.c +3
-0temp =readb (port->membase +UARTCR2 );writeb (temp |UARTCR2_TIE , port->membase +UARTCR2 ); +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +if (sport->lpuart_dma_use) { +if (!uart_circ_empty (xmit) && !sport->dma_tx_in_progress)
drivers/tty/serial/fsl_lpuart.c static inline void lpuart_transmit_buffer(struct lpuart_port *sport) · line 438
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +7
-0+ lpuart_prepare_tx(sport); + }else { +if (readb (port->membase +UARTSR1 ) &UARTSR1_TDRE ) +lpuart_transmit_buffer (sport); + } +#else if (readb (port->membase +UARTSR1 ) &UARTSR1_TDRE )lpuart_transmit_buffer (sport); +#endif }
So this can simply become
+ if (IS_ENABLED(CONFIG_SERIAL_FSL_LPUART_DMA) && sport->lpuart_dma_use) {
+ if (!uart_circ_empty(xmit) && !sport->dma_tx_in_progress)
+ lpuart_prepare_tx(sport);
+ } else {
+ if (readb(port->membase + UARTSR1) & UARTSR1_TDRE)
+ lpuart_trans mit_buffer(sport);
+ }
and the compiler will silently drop the lpuart_prepare_tx() function and everything it calls that isn't used elsewhere.
Quoted 4 lines
drivers/tty/serial/fsl_lpuart.c +4
-0+ +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +struct platform_device *pdev =to_platform_device (port->dev); +struct device_node *np = pdev->dev.of_node;
drivers/tty/serial/fsl_lpuart.c static void lpuart_setup_watermark(struct lpuart_port *sport) · line 810
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +10
-0+ +if (of_get_property (np,"dmas" ,NULL )) { + sport->lpuart_dma_use = true; +lpuart_dma_tx_request (port); +lpuart_dma_rx_request (port); + temp =readb (port->membase +UARTCR5 ); +writeb (temp |UARTCR5_TDMAS , port->membase +UARTCR5 ); + }else + sport->lpuart_dma_use = false; +#endif
Same here.
drivers/tty/serial/fsl_lpuart.c static int __init lpuart_serial_init(void) · line 1297
Quoted 8 lines
drivers/tty/serial/fsl_lpuart.c +4
-0@@ -854,6 +1291,10 @@ static int __init lpuart_serial_init(void)pr_info ("serial: Freescale lpuart driver\n" ); +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +pr_info ("serial: Freescale lpuart dma support\n" ); +#endif +
This message is not helpful in the long run, I'd rather see you drop the other one as well. Note that this function is called on *all* platforms when the driver is enabled, not just on those that actually have the uart.
Arnd
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Hi, Arnd
Thanks for your suggestion.
Quoted 21 lines
-----Original Message-----
From: linux-serial-owner at vger.kernel.org [mailto:linux-serial- owner at vger.kernel.org] On Behalf Of Arnd Bergmann
Sent: Wednesday, January 15, 2014 5:26 PM
To: Yuan Yao-B46683
Cc: gregkh at linuxfoundation.org; shawn.guo at linaro.org; linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org; linux- serial at vger.kernel.org
Subject: Re: [PATCH v3 2/2] serial:fsl_lpuart: add DMA supportQuoted 2 lines · Yuan Yao
Add dma support for lpuart. This function depend on DMA driver. You can turn on it by SERIAL_FSL_LPUART_DMA=y. And It works if dts node
has dma properties.
Quoted 2 lines
Signed-off-by Yuan Yao <[email protected]>Most of the changes you did look good, but I have to say I'm not a fan of the #ifdef you added. I don't think you actually need to have the compile-time selection, and it would be best to just drop that part.
Quoted 6 lines
If you have a good reason to keep it, please change the code to more readable "if (
IS_ENABLED(CONFIG_FSL_LPUART_DMA))" constructs. If you decide to do this, you will find that you need far fewer such conditionals because a lot of the code will automatically get dropped by the compiler.
Thank you! I even not know the IS_ENABLED macro.
At the beginning I just think this can save the size of code. But now I think it's not very necessary.
I tend to cancel it.
Quoted 9 lines
Quoted 9 lines
uart0: serial at 40027000 {
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +4
-4- compatible = "fsl,vf610-lpuart"; - reg = <0x40027000 0x1000>; - interrupts = <0 61 0x00>; - }; + compatible = "fsl,vf610-lpuart"; + reg = <0x40027000 0x1000>; + interrupts = <0 61 0x00>; + clocks = <&clks VF610_CLK_UART0>;
Quoted 9 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 27
Quoted 5 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +5
-0+ clock-names = "ipg"; + dma-names = "lpuart-tx","lpuart-rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_UART0_TX>, + <&edma0 0 VF610_EDMA_MUXID0_UART0_RX>; + };You still haven't addressed my comment about removing the
VF610_EDMA_MUXID0_UART0_TXmacros.
Very sorry for forget it. At that time the VF610_EDMA_MUXID0_UART0_TX is because of eDMA driver request. But now it also cancel the macro. So this is my fault. I will fix it next.
Quoted 32 lines
drivers/tty/serial/fsl_lpuart.c line 124
Quoted 6 lines
drivers/tty/serial/fsl_lpuart.c +5
-0+#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +#define DMA_MAXBURST 16 +#define DMA_MAXBURST_MASK (DMA_MAXBURST - 1) +#define FSL_UART_RX_DMA_BUFFER_SIZE 64 +#endif For this part there was no need for the #ifdef to start with.
Quoted 23 lines
#define
DRIVER_NAME"fsl-lpuart"
#defineDEV_NAME"ttyLP"
#defineUART_NR6drivers/tty/serial/fsl_lpuart.c +16
-0@@ -121,6 +132,26 @@ struct lpuart_port {struct clk *clk;unsigned int txfifo_size;unsigned int rxfifo_size; + +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +bool lpuart_dma_use; +struct dma_chan *dma_tx_chan; +struct dma_chan *dma_rx_chan; +struct dma_async_tx_descriptor *dma_tx_desc; +struct dma_async_tx_descriptor *dma_rx_desc; +dma_addr_t dma_tx_buf_bus; +dma_addr_t dma_rx_buf_bus; +dma_cookie_t dma_tx_cookie; +dma_cookie_t dma_rx_cookie; +unsigned char *dma_tx_buf_virt; +unsigned char *dma_rx_buf_virt; +unsigned int dma_tx_bytes; +unsigned int dma_rx_bytes; +int dma_tx_in_progress;
Quoted 9 lines
drivers/tty/serial/fsl_lpuart.c struct lpuart_port { · line 155
Quoted 5 lines
drivers/tty/serial/fsl_lpuart.c +4
-0+int dma_rx_in_progress; +unsigned int dma_rx_timeout; +struct timer_list lpuart_timer; +#endif };This part will result in a slight increase in data size even if dma support is turned off at compile time.
Yes, I will fix it.
Quoted 29 lines
Quoted 7 lines
drivers/tty/serial/fsl_lpuart.c +3
-0temp =readb (port->membase +UARTCR2 );writeb (temp |UARTCR2_TIE , port->membase +UARTCR2 ); +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +if (sport->lpuart_dma_use) { +if (!uart_circ_empty (xmit) && !sport->dma_tx_in_progress)drivers/tty/serial/fsl_lpuart.c static inline void lpuart_transmit_buffer(struct lpuart_port *sport) · line 438
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +7
-0+ lpuart_prepare_tx(sport); + }else { +if (readb (port->membase +UARTSR1 ) &UARTSR1_TDRE ) +lpuart_transmit_buffer (sport); + } +#else if (readb (port->membase +UARTSR1 ) &UARTSR1_TDRE )lpuart_transmit_buffer (sport); +#endif }So this can simply become
(quoted diff) +1
-0+ if (IS_ENABLED(CONFIG_SERIAL_FSL_LPUART_DMA) && sport-Quoted 1 line
lpuart_dma_use) {drivers/tty/serial/fsl_lpuart.c +6
-0+if (!uart_circ_empty (xmit) && !sport->dma_tx_in_progress) +lpuart_prepare_tx (sport); + }else { +if (readb (port->membase +UARTSR1 ) &UARTSR1_TDRE ) + lpuart_trans mit_buffer(sport); + }
Quoted 3 lines
and the compiler will silently drop the
lpuart_prepare_tx()function and everything it calls that isn't used elsewhere.
It's wonderful.
Quoted 36 lines
Quoted 5 lines
drivers/tty/serial/fsl_lpuart.c +4
-0+ +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +struct platform_device *pdev =to_platform_device (port->dev); +struct device_node *np = pdev->dev.of_node;drivers/tty/serial/fsl_lpuart.c static void lpuart_setup_watermark(struct lpuart_port *sport) · line 810
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +10
-0+ +if (of_get_property (np,"dmas" ,NULL )) { + sport->lpuart_dma_use = true; +lpuart_dma_tx_request (port); +lpuart_dma_rx_request (port); + temp =readb (port->membase +UARTCR5 ); +writeb (temp |UARTCR5_TDMAS , port->membase +UARTCR5 ); + }else + sport->lpuart_dma_use = false; +#endif Same here.
drivers/tty/serial/fsl_lpuart.c static int __init lpuart_serial_init(void) · line 1296
Quoted 7 lines
drivers/tty/serial/fsl_lpuart.c +3
-0@@ -854,6 +1291,10 @@ static int __init lpuart_serial_init(void)pr_info ("serial: Freescale lpuart driver\n" ); +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +pr_info ("serial: Freescale lpuart dma support\n" );#endif +This message is not helpful in the long run, I'd rather see you drop the other one as well. Note that this function is called on *all* platforms when the driver is enabled, not just on those that actually have the uart.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
In reply to Arnd BergmannHi, Arnd
Quoted 24 lines
-----Original Message-----
Quoted 23 lines
#define
DRIVER_NAME"fsl-lpuart"
#defineDEV_NAME"ttyLP"
#defineUART_NR6drivers/tty/serial/fsl_lpuart.c +16
-0@@ -121,6 +132,26 @@ struct lpuart_port {struct clk *clk;unsigned int txfifo_size;unsigned int rxfifo_size; + +#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +bool lpuart_dma_use; +struct dma_chan *dma_tx_chan; +struct dma_chan *dma_rx_chan; +struct dma_async_tx_descriptor *dma_tx_desc; +struct dma_async_tx_descriptor *dma_rx_desc; +dma_addr_t dma_tx_buf_bus; +dma_addr_t dma_rx_buf_bus; +dma_cookie_t dma_tx_cookie; +dma_cookie_t dma_rx_cookie; +unsigned char *dma_tx_buf_virt; +unsigned char *dma_rx_buf_virt; +unsigned int dma_tx_bytes; +unsigned int dma_rx_bytes; +int dma_tx_in_progress;
Quoted 9 lines
drivers/tty/serial/fsl_lpuart.c struct lpuart_port { · line 155
Quoted 5 lines
drivers/tty/serial/fsl_lpuart.c +4
-0+int dma_rx_in_progress; +unsigned int dma_rx_timeout; +struct timer_list lpuart_timer; +#endif };This part will result in a slight increase in data size even if dma support is turned off at compile time.
Yes, someone also want me define a independent struct for dma and allocate the memory when dma be use. But I think this way will add a more memory access time, like a->b->c and a->c. And the variable
about dma is just a few bytes but used frequently. So I think I'd better define the variable about dma in lpuart_port struct.
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Quoted 7 lines · Yao Yuan
Quoted 3 lines
This part will result in a slight increase in data size even if dma support is turned off at compile time.
Yes, someone also want me define a independent struct for dma and allocate the memory when dma be use. But I think this way will add a more memory access time, like
a->b->canda->c. And the variable
about dma is just a few bytes but used frequently. So I think I'd better define the variable about dma inlpuart_portstruct.
I agree. Just leave it unconditionally in here to make the code simpler.
Arnd
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
In reply to Yuan YaoQuoted 15 lines · Yuan Yao
Add dma support for lpuart. This function depend on DMA driver.
You can turn on it by SERIAL_FSL_LPUART_DMA=y. And It works if dts node has dma properties.Signed-off-by Yuan Yao <[email protected]>--- .../devicetree/bindings/serial/fsl-lpuart.txt | 21 +- drivers/tty/serial/Kconfig | 7 + drivers/tty/serial/fsl_lpuart.c | 457 ++++++++++++++++++++- 3 files changed, 473 insertions(+), 12 deletions(-)Documentation/devicetree/bindings/serial/fsl-lpuart.txt +0
-0
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 8
Quoted 5 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2
-0@@ -4,11 +4,24 @@ 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 : from common clock binding: handle to uart clock +- clock-names : from common clock binding: Shall be "ipg"
Why are these now requried if they weren't previously? That breaks old dts. I can't see any new code touching clocks. Was this an old but undocumented requirement?
Could you please reword this so clocks is defined in terms of clock-names so as to make the relationship between them clear:
- clocks: a list of phandles + clock-specifier pairs, one for each entry in clock-names
- clock-names: should contain:
* "ipg" - the uart clock
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 12
Quoted 4 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +4
-0+ +Optional properties: +- dma-names: Should contain "lpuart-tx" for transmit and "lpuart-rx" for receive channels +- dmas: Should contain dma specifiers for transmit and receive channels
Likewise could you please define dmas in terms of dma-names please. Why not just "tx" and "rx" as other bindings use?
[...]
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 22
Quoted 10 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +10
-0+#ifdef CONFIG_SERIAL_FSL_LPUART_DMA + struct platform_device *pdev = to_platform_device(port->dev); + struct device_node *np = pdev->dev.of_node; + + if (of_get_property(np, "dmas", NULL)) { + sport->lpuart_dma_use = true; + lpuart_dma_tx_request(port); + lpuart_dma_rx_request(port); + temp = readb(port->membase + UARTCR5); + writeb(temp | UARTCR5_TDMAS, port->membase + UARTCR5);
Rather than reading the raw dt to find out if you have dmas, can you not just attempt to request the dmas and if either fail give up on using them?
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 24
Quoted 2 lines
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2
-0+ } else + sport->lpuart_dma_use = false;
Nit: if you have brackets on one half of an if-else, they should be on the other half too (even if i's a single line).
Cheers,
Mark.
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Quoted 13 lines · On Wednesday 15 January 2014 11:05:37 Mark Rutland wrote:
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 8
Quoted 8 lines · Yuan Yao
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2
-0@@ -4,11 +4,24 @@ 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 : from common clock binding: handle to uart clock +- clock-names : from common clock binding: Shall be "ipg"Why are these now requried if they weren't previously? That breaks old dts. I can't see any new code touching clocks. Was this an old but undocumented requirement?
It was previously required but not documented. I asked Yuan Yao to add the text to the binding along with the new "dmas" addition.
It would have been cleaner to do this as a separate patch, but at the very least it should be mentioned in the changelog.
Arnd
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Wednesday 15 January 2014 11:05:37 Mark Rutland wrote:
Documentation/devicetree/bindings/serial/fsl-lpuart.txt Required properties: · line 8
Quoted 8 lines · Yuan Yao
Documentation/devicetree/bindings/serial/fsl-lpuart.txt +2
-0@@ -4,11 +4,24 @@ 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 : from common clock binding: handle to uart clock +- clock-names : from common clock binding: Shall be "ipg"Why are these now requried if they weren't previously? That breaks old dts. I can't see any new code touching clocks. Was this an old but undocumented requirement?
Quoted 2 lines
It was previously required but not documented. I asked Yuan Yao to add the text to the binding along with the new "dmas" addition.
Ok.
Quoted 3 lines
It would have been cleaner to do this as a separate patch, but at the very least it should be mentioned in the changelog.
Having it in the changelog would be nice.
Cheers,
Mark.
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
In reply to Mark RutlandHi, mark
Quoted 14 lines
-----Original Message-----
drivers/tty/serial/fsl_lpuart.c static void lpuart_setup_watermark(struct lpuart_port *sport) · line 807
Quoted 10 lines
drivers/tty/serial/fsl_lpuart.c +10
-0+#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +struct platform_device *pdev =to_platform_device (port->dev); +struct device_node *np = pdev->dev.of_node; + +if (of_get_property (np,"dmas" ,NULL )) { + sport->lpuart_dma_use = true; +lpuart_dma_tx_request (port); +lpuart_dma_rx_request (port); + temp =readb (port->membase +UARTCR5 ); +writeb (temp |UARTCR5_TDMAS , port->membase +UARTCR5 );Rather than reading the raw dt to find out if you have dmas, can you not just attempt to request the dmas and if either fail give up on using them?
Yes, the dma request function can also confirm it. But maybe it's better that add the judge as a dma entrance first?
I think if the dmas is be written it means dma want be support. At this time, rather than silently change to no dma model, we may throw the error when some errors happened. But dma request failed may have many other reasons. Also the judge will just run only once, it will not waste of performance.
If the dmas is not be written, we don't need to do anything about dma.
PATCH v3 2/2 serial: fsl_lpuart: add DMA support
Hi, Mark
Think twice.
Yes, you are right. "of_get_property" is not necessary here.
Thanks for your suggestion.
Quoted 29 lines
-----Original Message-----
From: linux-serial-owner at vger.kernel.org [mailto:linux-serial- owner at vger.kernel.org] On Behalf Of Yao Yuan
Sent: Thursday, January 16, 2014 2:54 PM
To: Mark Rutland
Cc: gregkh at linuxfoundation.org; shawn.guo at linaro.org; linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org; arnd at arndb.de; linux-serial at vger.kernel.org
Subject: RE: [PATCH v3 2/2] serial:fsl_lpuart: add DMA supportHi, mark
Quoted 15 lines
-----Original Message-----
drivers/tty/serial/fsl_lpuart.c static void lpuart_setup_watermark(struct lpuart_port *sport)
Quoted 11 lines
drivers/tty/serial/fsl_lpuart.c +11
-0+#ifdef CONFIG_SERIAL_FSL_LPUART_DMA +struct platform_device *pdev =to_platform_device (port->dev); +struct device_node *np = pdev->dev.of_node; + +if (of_get_property (np,"dmas" ,NULL )) { + sport->lpuart_dma_use = true; +lpuart_dma_tx_request (port); +lpuart_dma_rx_request (port); + temp =readb (port->membase +UARTCR5 ); +writeb (temp |UARTCR5_TDMAS , port->membase + +UARTCR5 );Rather than reading the raw dt to find out if you have dmas, can you not just attempt to request the dmas and if either fail give up on
using them?
Quoted 9 lines
Yes, the dma request function can also confirm it. But maybe it's better that add the judge as a dma entrance first?
I think if the dmas is be written it means dma want be support. At this time, rather than silently change to no dma model, we may throw the error when some errors happened.
But dma request failed may have many other reasons. Also the judge will just run only once, it will not waste of performance.
If the dmas is not be written, we don't need to do anything about dma. ?
& ~ & +- ? w ? m b lz ) w*jg
?j/ z ? 2 ?
Quoted 1 line
& )? a
G h j:+v w ?