serial: at91: make usart and uart support dma transfer
Subsystems (7)
cover serial: at91: make usart and uart support dma transfer
After at91sam9g45 socs, the usart only support dma transfer. This patch serial focus on:
1) distinguish pdc and dma transfer
2) support usart dma rx and tx transfer
3) distinguish usart and uart
4) support uart dma rx and tx transfer
For those only support PDC transfer socs, we use "atmel,use-pdc-rx", "atmel,use-pdc-tx" to establish a PDC transfer. So we switch the name from "use-dma" to "use-pdc" to state more clearly.
For those only support DMA transfer socs, we use dma binding to establish a DMA transfer, detail see the last patch. We also distinguish usart and uart by read ip name, the dbgu is regard as a uart.
Because uart lack timeout function, we use software timer to trigger rx.
Elen Song (7):
serial: at91: correct definition from DMA to PDC
serial: at91: add tx dma support
serial: at91: add rx dma support
serial: at91: make DBGU support dma and pdc transfers
serial: at91: distinguish usart and uart
serial: at91: modify UART to use software timer to trigger rx
serial: at91: add dma support in usart binding descriptions
Documentation/devicetree/bindings/serial/rs485.txt | 4 +- .../devicetree/bindings/tty/serial/atmel-usart.txt | 29 +- arch/arm/boot/dts/at91rm9200.dtsi | 16 +- arch/arm/boot/dts/at91sam9260.dtsi | 24 +- arch/arm/boot/dts/at91sam9263.dtsi | 12 +- arch/arm/boot/dts/at91sam9g45.dtsi | 16 +- arch/arm/mach-at91/at91rm9200_devices.c | 20 +- arch/arm/mach-at91/at91sam9260_devices.c | 28 +- arch/arm/mach-at91/at91sam9261_devices.c | 16 +- arch/arm/mach-at91/at91sam9263_devices.c | 16 +- arch/arm/mach-at91/at91sam9g45_devices.c | 20 +- arch/arm/mach-at91/at91sam9rl_devices.c | 20 +- drivers/tty/serial/atmel_serial.c | 582 ++++++++++++++++++-- include/linux/atmel_serial.h | 2 + include/linux/platform_data/atmel.h | 2 + 15 files changed, 665 insertions(+), 142 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/7 serial: at91: correct definition from DMA to PDC
The DMA is available since at91sam9x5 socs, before that, we use PDC.
--- Documentation/devicetree/bindings/serial/rs485.txt | 4 +- .../devicetree/bindings/tty/serial/atmel-usart.txt | 12 ++-- arch/arm/boot/dts/at91rm9200.dtsi | 16 ++--- arch/arm/boot/dts/at91sam9260.dtsi | 24 +++---- arch/arm/boot/dts/at91sam9263.dtsi | 12 ++-- arch/arm/boot/dts/at91sam9g45.dtsi | 16 ++--- arch/arm/mach-at91/at91rm9200_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9260_devices.c | 28 ++++---- arch/arm/mach-at91/at91sam9261_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9263_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9g45_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9rl_devices.c | 20 +++--- drivers/tty/serial/atmel_serial.c | 74 ++++++++++---------- include/linux/platform_data/atmel.h | 4 +- 14 files changed, 141 insertions(+), 141 deletions(-)
Documentation/devicetree/bindings/serial/rs485.txt +2 -2
@@ -23,8 +23,8 @@ RS485 example for Atmel USART: compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x4000>; interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; linux,rs485-enabled-at-boot-time; rs485-rts-delay = <0 200>; // in milliseconds };
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +6 -6
@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART support
@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; + atmel,use-pdc-rx; + atmel,use-pdc-tx; };
arch/arm/boot/dts/at91rm9200.dtsi +8 -8
@@ -537,8 +537,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";
@@ -548,8 +548,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";
@@ -559,8 +559,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart2>; status = "disabled";
@@ -570,8 +570,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffcc000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart3>; status = "disabled";
arch/arm/boot/dts/at91sam9260.dtsi +12 -12
@@ -475,8 +475,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";
@@ -486,8 +486,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";
@@ -497,8 +497,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";
@@ -508,8 +508,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd0000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";
@@ -519,8 +519,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd4000 0x200>; interrupts = <24 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";
@@ -530,8 +530,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd8000 0x200>; interrupts = <25 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";
arch/arm/boot/dts/at91sam9263.dtsi +6 -6
@@ -426,8 +426,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";
@@ -437,8 +437,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";
@@ -448,8 +448,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";
arch/arm/boot/dts/at91sam9g45.dtsi +8 -8
@@ -485,8 +485,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";
@@ -496,8 +496,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";
@@ -507,8 +507,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";
@@ -518,8 +518,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff98000 0x200>; interrupts = <10 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";
arch/arm/mach-at91/at91rm9200_devices.c +10 -10
@@ -920,8 +920,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -958,8 +958,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -1007,8 +1007,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -1058,8 +1058,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
@@ -1101,8 +1101,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );
arch/arm/mach-at91/at91sam9260_devices.c +14 -14
@@ -817,8 +817,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -855,8 +855,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -906,8 +906,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -949,8 +949,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
@@ -992,8 +992,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );
@@ -1035,8 +1035,8 @@ static struct resource uart4_resources[] = { };static struct atmel_uart_data uart4_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart4_dmamask =DMA_BIT_MASK (32 );
@@ -1073,8 +1073,8 @@ static struct resource uart5_resources[] = { };static struct atmel_uart_data uart5_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart5_dmamask =DMA_BIT_MASK (32 );
arch/arm/mach-at91/at91sam9261_devices.c +8 -8
@@ -878,8 +878,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -916,8 +916,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -959,8 +959,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -1002,8 +1002,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
arch/arm/mach-at91/at91sam9263_devices.c +8 -8
@@ -1322,8 +1322,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -1360,8 +1360,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -1403,8 +1403,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -1446,8 +1446,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
arch/arm/mach-at91/at91sam9g45_devices.c +10 -10
@@ -1585,8 +1585,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 , + .use_pdc_tx =0 , + .use_pdc_rx =0 , };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -1623,8 +1623,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -1666,8 +1666,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -1709,8 +1709,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
@@ -1752,8 +1752,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );
arch/arm/mach-at91/at91sam9rl_devices.c +10 -10
@@ -954,8 +954,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );
@@ -992,8 +992,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );
@@ -1043,8 +1043,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );
@@ -1086,8 +1086,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );
@@ -1129,8 +1129,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );
drivers/tty/serial/atmel_serial.c +37 -37
231 lines not on this page · raw message
include/linux/platform_data/atmel.h +2 -2
@@ -76,8 +76,8 @@ struct atmel_nand_data {/* Serial */ struct atmel_uart_data {int num;/* port num */ -short use_dma_tx;/* use transmit DMA? */ -short use_dma_rx;/* use receive DMA? */ +short use_pdc_tx;/* use transmit PDC? */ +short use_pdc_rx;/* use receive PDC? */ void __iomem *regs;/* virt. base address, if any */ struct serial_rs485 rs485;/* rs485 settings */ };
Signature · 1 line
1.7.9.5
PATCH 1/7 serial: at91: correct definition from DMA to PDC
Hi Elen,
One comment below:
On Tue, Jul 09, 2013 at 02:33:40PM +0800, Elen Song wrote:
[...]
Quoted 16 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-2@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART support
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 23
Quoted 9 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
Maybe put these changes into an other patch since it is not in relation with the purpose of your patch.
Moreover, I am not sure that macros should be used in the documentation. From the top of my head, there was a discussion about that and the status was to not use macros in documentation since it is Linux dependant.
Quoted 4 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };
[...]
PATCH 1/7 serial: at91: correct definition from DMA to PDC
Quoted 36 lines · Ludovic Desroches
Hi Elen,
One comment below:
On Tue, Jul 09, 2013 at 02:33:40PM +0800, Elen Song wrote:
[...]
Quoted 16 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-2@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART supportDocumentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 23
Quoted 9 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;Maybe put these changes into an other patch since it is not in relation with the purpose of your patch.
Quoted 3 lines
Moreover, I am not sure that macros should be used in the documentation. From the top of my head, there was a discussion about that and the status was to not use macros in documentation since it is Linux dependant.
Ok, I will not involve the macros in the document now. So I will move all the document changes into the last patch, right?
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };[...]
PATCH 1/7 serial: at91: correct definition from DMA to PDC
Quoted 34 lines · elen.song
Quoted 33 lines · Ludovic Desroches
Hi Elen,
One comment below:
On Tue, Jul 09, 2013 at 02:33:40PM +0800, Elen Song wrote:
[...]
Quoted 14 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-2@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART supportDocumentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 22
Quoted 8 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;Maybe put these changes into an other patch since it is not in relation with the purpose of your patch.
Quoted 6 lines
Quoted 3 lines
Moreover, I am not sure that macros should be used in the documentation. From the top of my head, there was a discussion about that and the status was to not use macros in documentation since it is Linux dependant.
Ok, I will not involve the macros in the document now. So I will move all the document changes into the last patch, right?
Documentation update is ok excepting the reg field change which should be in a fixup patch since it is not related to the introduction of use-pdc-*.
Quoted 11 lines
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };[...]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/7 serial: at91: correct definition from DMA to PDC
Quoted 35 lines · Ludovic Desroches
Quoted 34 lines · elen.song
Quoted 33 lines · Ludovic Desroches
Hi Elen,
One comment below:
On Tue, Jul 09, 2013 at 02:33:40PM +0800, Elen Song wrote:
[...]
Quoted 14 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-2@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART supportDocumentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 22
Quoted 8 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;Maybe put these changes into an other patch since it is not in relation with the purpose of your patch.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Moreover, I am not sure that macros should be used in the documentation. From the top of my head, there was a discussion about that and the status was to not use macros in documentation since it is Linux dependant.
Ok, I will not involve the macros in the document now. So I will move all the document changes into the last patch, right?
Documentation update is ok excepting the reg field change which should be in a fixup patch since it is not related to the introduction of use-pdc-*.
ok, thanks.
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };[...]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/7 serial: at91: correct definition from DMA to PDC
In reply to Ludovic DesrochesQuoted 38 lines · Ludovic Desroches
Hi Elen,
One comment below:
On Tue, Jul 09, 2013 at 02:33:40PM +0800, Elen Song wrote:
[...]
Quoted 16 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-2@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART supportDocumentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 23
Quoted 9 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;Maybe put these changes into an other patch since it is not in relation with the purpose of your patch.
Quoted 3 lines
Moreover, I am not sure that macros should be used in the documentation. From the top of my head, there was a discussion about that and the status was to not use macros in documentation since it is Linux dependant.
yes you are right
Best Regards,
J.
Quoted 7 lines
Quoted 5 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };[...]
PATCH 1/7 serial: at91: correct definition from DMA to PDC
In reply to Elen SongQuoted 25 lines · Elen Song
The DMA is available since at91sam9x5 socs, before that, we use PDC.
Signed-off-by Elen Song <[email protected]>--- Documentation/devicetree/bindings/serial/rs485.txt | 4 +- .../devicetree/bindings/tty/serial/atmel-usart.txt | 12 ++-- arch/arm/boot/dts/at91rm9200.dtsi | 16 ++--- arch/arm/boot/dts/at91sam9260.dtsi | 24 +++---- arch/arm/boot/dts/at91sam9263.dtsi | 12 ++-- arch/arm/boot/dts/at91sam9g45.dtsi | 16 ++--- arch/arm/mach-at91/at91rm9200_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9260_devices.c | 28 ++++---- arch/arm/mach-at91/at91sam9261_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9263_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9g45_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9rl_devices.c | 20 +++--- drivers/tty/serial/atmel_serial.c | 74 ++++++++++---------- include/linux/platform_data/atmel.h | 4 +- 14 files changed, 141 insertions(+), 141 deletions(-)Documentation/devicetree/bindings/serial/rs485.txt +0
-0
Documentation/devicetree/bindings/serial/rs485.txt RS485 example for Atmel USART: · line 27
Quoted 7 lines
Documentation/devicetree/bindings/serial/rs485.txt +2
-2@@ -23,8 +23,8 @@ RS485 example for Atmel USART: compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x4000>; interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx;
you break dt compatibility this is not acceptable
Best Regards,
J.
Quoted 865 lines
Documentation/devicetree/bindings/serial/rs485.txt +0
-0linux,rs485-enabled-at-boot-time; rs485-rts-delay = <0 200>; // in milliseconds };Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +6
-6@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART support@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; + atmel,use-pdc-rx; + atmel,use-pdc-tx; };arch/arm/boot/dts/at91rm9200.dtsi +8
-8@@ -537,8 +537,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";@@ -548,8 +548,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";@@ -559,8 +559,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart2>; status = "disabled";@@ -570,8 +570,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffcc000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart3>; status = "disabled";arch/arm/boot/dts/at91sam9260.dtsi +12
-12@@ -475,8 +475,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -486,8 +486,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -497,8 +497,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";@@ -508,8 +508,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd0000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";@@ -519,8 +519,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd4000 0x200>; interrupts = <24 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";@@ -530,8 +530,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd8000 0x200>; interrupts = <25 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";arch/arm/boot/dts/at91sam9263.dtsi +6
-6@@ -426,8 +426,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -437,8 +437,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -448,8 +448,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";arch/arm/boot/dts/at91sam9g45.dtsi +8
-8@@ -485,8 +485,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -496,8 +496,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -507,8 +507,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";@@ -518,8 +518,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff98000 0x200>; interrupts = <10 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";arch/arm/mach-at91/at91rm9200_devices.c +10
-10@@ -920,8 +920,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -958,8 +958,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1007,8 +1007,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1058,8 +1058,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1101,8 +1101,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9260_devices.c +14
-14@@ -817,8 +817,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -855,8 +855,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -906,8 +906,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -949,8 +949,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -992,8 +992,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );@@ -1035,8 +1035,8 @@ static struct resource uart4_resources[] = { };static struct atmel_uart_data uart4_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart4_dmamask =DMA_BIT_MASK (32 );@@ -1073,8 +1073,8 @@ static struct resource uart5_resources[] = { };static struct atmel_uart_data uart5_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart5_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9261_devices.c +8
-8@@ -878,8 +878,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -916,8 +916,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -959,8 +959,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1002,8 +1002,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9263_devices.c +8
-8@@ -1322,8 +1322,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -1360,8 +1360,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1403,8 +1403,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1446,8 +1446,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9g45_devices.c +10
-10@@ -1585,8 +1585,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 , + .use_pdc_tx =0 , + .use_pdc_rx =0 , };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -1623,8 +1623,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1666,8 +1666,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1709,8 +1709,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1752,8 +1752,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9rl_devices.c +10
-10@@ -954,8 +954,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -992,8 +992,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1043,8 +1043,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1086,8 +1086,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1129,8 +1129,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );drivers/tty/serial/atmel_serial.c +37
-37@@ -140,11 +140,11 @@ struct atmel_uart_port {u32 backup_imr;/* IMR saved during suspend */ int break_active;/* break being received */ -short use_dma_rx;/* enable PDC receiver */ +short use_pdc_rx;/* enable PDC receiver */ short pdc_rx_idx;/* current PDC RX buffer */ struct atmel_dma_buffer pdc_rx[2 ];/* PDC receier */ -short use_dma_tx;/* enable PDC transmitter */ +short use_pdc_tx;/* enable PDC transmitter */ struct atmel_dma_buffer pdc_tx;/* PDC transmitter */ struct tasklet_struct tasklet;@@ -181,26 +181,26 @@ to_atmel_uart_port(struct uart_port *uart) }#ifdef CONFIG_SERIAL_ATMEL_PDC -static bool atmel_use_dma_rx (struct uart_port *port) +static bool atmel_use_pdc_rx (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -return atmel_port->use_dma_rx; +return atmel_port->use_pdc_rx; } -static bool atmel_use_dma_tx (struct uart_port *port) +static bool atmel_use_pdc_tx (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -return atmel_port->use_dma_tx; +return atmel_port->use_pdc_tx; }#else -static bool atmel_use_dma_rx (struct uart_port *port) +static bool atmel_use_pdc_rx (struct uart_port *port) {return false; } -static bool atmel_use_dma_tx (struct uart_port *port) +static bool atmel_use_pdc_tx (struct uart_port *port) {return false; }@@ -233,7 +233,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf) mode |=ATMEL_US_USMODE_RS485 ; }else {dev_dbg (port->dev,"Setting UART to RS232\n" ); -if (atmel_use_dma_tx (port)) +if (atmel_use_pdc_tx (port)) atmel_port->tx_done_mask =ATMEL_US_ENDTX |ATMEL_US_TXBUFE ;else @@ -345,7 +345,7 @@ static void atmel_stop_tx(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {/* disable PDC transmit */ UART_PUT_PTCR (port,ATMEL_PDC_TXTDIS ); }@@ -364,7 +364,7 @@ static void atmel_start_tx(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {if (UART_GET_PTSR (port) &ATMEL_PDC_TXTEN )/* The transmitter is already running. Yes, we really need this.*/ @@ -390,7 +390,7 @@ static void atmel_start_rx(struct uart_port *port)UART_PUT_CR (port,ATMEL_US_RXEN ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* enable PDC controller */ UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT | port->read_status_mask);@@ -407,7 +407,7 @@ static void atmel_stop_rx(struct uart_port *port) {UART_PUT_CR (port,ATMEL_US_RXDIS ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* disable PDC receive */ UART_PUT_PTCR (port,ATMEL_PDC_RXTDIS ); UART_PUT_IDR(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |@@ -572,7 +572,7 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* * PDC receive. Just schedule the tasklet and let it * figure out the details. @@ -661,7 +661,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)/* * Called from tasklet with ENDTX and TXBUFE interrupts disabled. */ -static void atmel_tx_dma (struct uart_port *port) +static void atmel_tx_pdc (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port);struct circ_buf *xmit = &port->state->xmit;@@ -778,7 +778,7 @@ static void atmel_rx_from_ring(struct uart_port *port)spin_lock (&port->lock); } -static void atmel_rx_from_dma (struct uart_port *port) +static void atmel_rx_from_pdc (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port);struct tty_port *tport = &port->state->port;@@ -868,8 +868,8 @@ static void atmel_tasklet_func(unsigned long data)/* The interrupt handler does not take the lock */ spin_lock (&port->lock); -if (atmel_use_dma_tx (port)) -atmel_tx_dma (port); +if (atmel_use_pdc_tx (port)) +atmel_tx_pdc (port);else atmel_tx_chars (port);@@ -893,8 +893,8 @@ static void atmel_tasklet_func(unsigned long data) atmel_port->irq_status_prev = status; } -if (atmel_use_dma_rx (port)) -atmel_rx_from_dma (port); +if (atmel_use_pdc_rx (port)) +atmel_rx_from_pdc (port);else atmel_rx_from_ring (port);@@ -930,7 +930,7 @@ static int atmel_startup(struct uart_port *port)/* * Initialize DMA (if necessary) */ -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {int i;for (i =0 ; i <2 ; i++) {@@ -964,7 +964,7 @@ static int atmel_startup(struct uart_port *port)UART_PUT_RNPR (port, atmel_port->pdc_rx[1 ].dma_addr);UART_PUT_RNCR (port,PDC_BUFFER_SIZE ); } -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;struct circ_buf *xmit = &port->state->xmit;@@ -1000,7 +1000,7 @@ static int atmel_startup(struct uart_port *port)/* enable xmit & rcvr */ UART_PUT_CR (port,ATMEL_US_TXEN |ATMEL_US_RXEN ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* set UART timeout */ UART_PUT_RTOR (port,PDC_RX_TIMEOUT );UART_PUT_CR (port,ATMEL_US_STTTO );@@ -1031,7 +1031,7 @@ static void atmel_shutdown(struct uart_port *port)/* * Shut-down the DMA. */ -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {int i;for (i =0 ; i <2 ; i++) {@@ -1044,7 +1044,7 @@ static void atmel_shutdown(struct uart_port *port)kfree (pdc->buf); } } -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx; dma_unmap_single(port->dev,@@ -1080,7 +1080,7 @@ static void atmel_flush_buffer(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {UART_PUT_TCR (port,0 ); atmel_port->pdc_tx.ofs =0 ; }@@ -1193,7 +1193,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,if (termios->c_iflag & (BRKINT |PARMRK )) port->read_status_mask |=ATMEL_US_RXBRK ; -if (atmel_use_dma_rx (port)) +if (atmel_use_pdc_rx (port))/* need to enable error interrupts */ UART_PUT_IER (port, port->read_status_mask);@@ -1429,14 +1429,14 @@ static void atmel_of_init_port(struct atmel_uart_port *atmel_port,u32 rs485_delay[2 ];/* DMA/PDC usage specification */ -if (of_get_property (np,"atmel,use-dma-rx" ,NULL )) - atmel_port->use_dma_rx =1 ; +if (of_get_property (np,"atmel,use-pdc-rx" ,NULL )) + atmel_port->use_pdc_rx =1 ;else - atmel_port->use_dma_rx =0 ; -if (of_get_property (np,"atmel,use-dma-tx" ,NULL )) - atmel_port->use_dma_tx =1 ; + atmel_port->use_pdc_rx =0 ; +if (of_get_property (np,"atmel,use-pdc-tx" ,NULL )) + atmel_port->use_pdc_tx =1 ;else - atmel_port->use_dma_tx =0 ; + atmel_port->use_pdc_tx =0 ;/* rs485 properties */ if (of_property_read_u32_array(np, "rs485-rts-delay",@@ -1467,8 +1467,8 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,if (pdev->dev.of_node) {atmel_of_init_port (atmel_port, pdev->dev.of_node); }else { - atmel_port->use_dma_rx = pdata->use_dma_rx; - atmel_port->use_dma_tx = pdata->use_dma_tx; + atmel_port->use_pdc_rx = pdata->use_pdc_rx; + atmel_port->use_pdc_tx = pdata->use_pdc_tx; atmel_port->rs485 = pdata->rs485; }@@ -1505,7 +1505,7 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,/* Use TXEMPTY for interrupt when rs485 else TXRDY or ENDTX|TXBUFE */ if (atmel_port->rs485.flags &SER_RS485_ENABLED ) atmel_port->tx_done_mask =ATMEL_US_TXEMPTY ; -else if (atmel_use_dma_tx (port)) { +else if (atmel_use_pdc_tx (port)) { port->fifosize =PDC_BUFFER_SIZE ; atmel_port->tx_done_mask =ATMEL_US_ENDTX |ATMEL_US_TXBUFE ; }else {@@ -1794,7 +1794,7 @@ static int atmel_serial_probe(struct platform_device *pdev) goto err; } -if (!atmel_use_dma_rx (&port->uart)) { +if (!atmel_use_pdc_rx (&port->uart)) { ret = -ENOMEM ; data =kmalloc (sizeof (struct atmel_uart_char ) *ATMEL_SERIAL_RINGSIZE ,GFP_KERNEL );include/linux/platform_data/atmel.h +2
-2@@ -76,8 +76,8 @@ struct atmel_nand_data {/* Serial */ struct atmel_uart_data {int num;/* port num */ -short use_dma_tx;/* use transmit DMA? */ -short use_dma_rx;/* use receive DMA? */ +short use_pdc_tx;/* use transmit PDC? */ +short use_pdc_rx;/* use receive PDC? */ void __iomem *regs;/* virt. base address, if any */ struct serial_rs485 rs485;/* rs485 settings */ };Signature · 1 line
1.7.9.5
PATCH 1/7 serial: at91: correct definition from DMA to PDC
Quoted 21 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 20 lines · Elen Song
The DMA is available since at91sam9x5 socs, before that, we use PDC.
Signed-off-by Elen Song <[email protected]>--- Documentation/devicetree/bindings/serial/rs485.txt | 4 +- .../devicetree/bindings/tty/serial/atmel-usart.txt | 12 ++-- arch/arm/boot/dts/at91rm9200.dtsi | 16 ++--- arch/arm/boot/dts/at91sam9260.dtsi | 24 +++---- arch/arm/boot/dts/at91sam9263.dtsi | 12 ++-- arch/arm/boot/dts/at91sam9g45.dtsi | 16 ++--- arch/arm/mach-at91/at91rm9200_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9260_devices.c | 28 ++++---- arch/arm/mach-at91/at91sam9261_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9263_devices.c | 16 ++--- arch/arm/mach-at91/at91sam9g45_devices.c | 20 +++--- arch/arm/mach-at91/at91sam9rl_devices.c | 20 +++--- drivers/tty/serial/atmel_serial.c | 74 ++++++++++---------- include/linux/platform_data/atmel.h | 4 +- 14 files changed, 141 insertions(+), 141 deletions(-)
Quoted 14 lines
Documentation/devicetree/bindings/serial/rs485.txt RS485 example for Atmel USART: · line 27
Quoted 12 lines
Documentation/devicetree/bindings/serial/rs485.txt +2
-2@@ -23,8 +23,8 @@ RS485 example for Atmel USART: compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x4000>; interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx;you break dt compatibility this is not acceptable
current the use-dma-r/tx just mean you want to use the DMA for rx or tx keep it as is
to detect if you want to use PDC or DMA just check the presence of the dmas property
dmas = <&dma0 1 9>,
as example
This way you do not break the dt compatibility
Best Regards,
J.
Quoted 873 lines
Best Regards,
J.Quoted 865 lines
Documentation/devicetree/bindings/serial/rs485.txt +0
-0linux,rs485-enabled-at-boot-time; rs485-rts-delay = <0 200>; // in milliseconds };Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +6
-6@@ -8,8 +8,8 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-dma-rx: use of PDC or DMA for receiving data -- atmel,use-dma-tx: use of PDC or DMA for transmitting data +- atmel,use-pdc-rx: use of PDC for receiving data +- atmel,use-pdc-tx: use of PDC for transmitting data <chip> compatible description: - at91rm9200: legacy USART support@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; + atmel,use-pdc-rx; + atmel,use-pdc-tx; };arch/arm/boot/dts/at91rm9200.dtsi +8
-8@@ -537,8 +537,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";@@ -548,8 +548,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";@@ -559,8 +559,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffc8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart2>; status = "disabled";@@ -570,8 +570,8 @@ compatible = "atmel,at91rm9200-usart"; reg = <0xfffcc000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart3>; status = "disabled";arch/arm/boot/dts/at91sam9260.dtsi +12
-12@@ -475,8 +475,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb0000 0x200>; interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -486,8 +486,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb4000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -497,8 +497,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffb8000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";@@ -508,8 +508,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd0000 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";@@ -519,8 +519,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd4000 0x200>; interrupts = <24 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; status = "disabled";@@ -530,8 +530,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfffd8000 0x200>; interrupts = <25 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "disabled";arch/arm/boot/dts/at91sam9263.dtsi +6
-6@@ -426,8 +426,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -437,8 +437,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -448,8 +448,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";arch/arm/boot/dts/at91sam9g45.dtsi +8
-8@@ -485,8 +485,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart0>; status = "disabled";@@ -496,8 +496,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff90000 0x200>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart1>; status = "disabled";@@ -507,8 +507,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff94000 0x200>; interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart2>; status = "disabled";@@ -518,8 +518,8 @@ compatible = "atmel,at91sam9260-usart"; reg = <0xfff98000 0x200>; interrupts = <10 IRQ_TYPE_LEVEL_HIGH 5>; - atmel,use-dma-rx; - atmel,use-dma-tx; + atmel,use-pdc-rx; + atmel,use-pdc-tx; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usart3>; status = "disabled";arch/arm/mach-at91/at91rm9200_devices.c +10
-10@@ -920,8 +920,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -958,8 +958,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1007,8 +1007,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1058,8 +1058,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1101,8 +1101,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9260_devices.c +14
-14@@ -817,8 +817,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -855,8 +855,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -906,8 +906,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -949,8 +949,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -992,8 +992,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );@@ -1035,8 +1035,8 @@ static struct resource uart4_resources[] = { };static struct atmel_uart_data uart4_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart4_dmamask =DMA_BIT_MASK (32 );@@ -1073,8 +1073,8 @@ static struct resource uart5_resources[] = { };static struct atmel_uart_data uart5_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart5_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9261_devices.c +8
-8@@ -878,8 +878,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -916,8 +916,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -959,8 +959,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1002,8 +1002,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9263_devices.c +8
-8@@ -1322,8 +1322,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -1360,8 +1360,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1403,8 +1403,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1446,8 +1446,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9g45_devices.c +10
-10@@ -1585,8 +1585,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 , + .use_pdc_tx =0 , + .use_pdc_rx =0 , };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -1623,8 +1623,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1666,8 +1666,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1709,8 +1709,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1752,8 +1752,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );arch/arm/mach-at91/at91sam9rl_devices.c +10
-10@@ -954,8 +954,8 @@ static struct resource dbgu_resources[] = { };static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ + .use_pdc_tx =0 , + .use_pdc_rx =0 ,/* DBGU not capable of receive PDC */ };static u64 dbgu_dmamask =DMA_BIT_MASK (32 );@@ -992,8 +992,8 @@ static struct resource uart0_resources[] = { };static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart0_dmamask =DMA_BIT_MASK (32 );@@ -1043,8 +1043,8 @@ static struct resource uart1_resources[] = { };static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart1_dmamask =DMA_BIT_MASK (32 );@@ -1086,8 +1086,8 @@ static struct resource uart2_resources[] = { };static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart2_dmamask =DMA_BIT_MASK (32 );@@ -1129,8 +1129,8 @@ static struct resource uart3_resources[] = { };static struct atmel_uart_data uart3_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .use_pdc_tx =1 , + .use_pdc_rx =1 , };static u64 uart3_dmamask =DMA_BIT_MASK (32 );drivers/tty/serial/atmel_serial.c +37
-37@@ -140,11 +140,11 @@ struct atmel_uart_port {u32 backup_imr;/* IMR saved during suspend */ int break_active;/* break being received */ -short use_dma_rx;/* enable PDC receiver */ +short use_pdc_rx;/* enable PDC receiver */ short pdc_rx_idx;/* current PDC RX buffer */ struct atmel_dma_buffer pdc_rx[2 ];/* PDC receier */ -short use_dma_tx;/* enable PDC transmitter */ +short use_pdc_tx;/* enable PDC transmitter */ struct atmel_dma_buffer pdc_tx;/* PDC transmitter */ struct tasklet_struct tasklet;@@ -181,26 +181,26 @@ to_atmel_uart_port(struct uart_port *uart) }#ifdef CONFIG_SERIAL_ATMEL_PDC -static bool atmel_use_dma_rx (struct uart_port *port) +static bool atmel_use_pdc_rx (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -return atmel_port->use_dma_rx; +return atmel_port->use_pdc_rx; } -static bool atmel_use_dma_tx (struct uart_port *port) +static bool atmel_use_pdc_tx (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -return atmel_port->use_dma_tx; +return atmel_port->use_pdc_tx; }#else -static bool atmel_use_dma_rx (struct uart_port *port) +static bool atmel_use_pdc_rx (struct uart_port *port) {return false; } -static bool atmel_use_dma_tx (struct uart_port *port) +static bool atmel_use_pdc_tx (struct uart_port *port) {return false; }@@ -233,7 +233,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf) mode |=ATMEL_US_USMODE_RS485 ; }else {dev_dbg (port->dev,"Setting UART to RS232\n" ); -if (atmel_use_dma_tx (port)) +if (atmel_use_pdc_tx (port)) atmel_port->tx_done_mask =ATMEL_US_ENDTX |ATMEL_US_TXBUFE ;else @@ -345,7 +345,7 @@ static void atmel_stop_tx(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {/* disable PDC transmit */ UART_PUT_PTCR (port,ATMEL_PDC_TXTDIS ); }@@ -364,7 +364,7 @@ static void atmel_start_tx(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {if (UART_GET_PTSR (port) &ATMEL_PDC_TXTEN )/* The transmitter is already running. Yes, we really need this.*/ @@ -390,7 +390,7 @@ static void atmel_start_rx(struct uart_port *port)UART_PUT_CR (port,ATMEL_US_RXEN ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* enable PDC controller */ UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT | port->read_status_mask);@@ -407,7 +407,7 @@ static void atmel_stop_rx(struct uart_port *port) {UART_PUT_CR (port,ATMEL_US_RXDIS ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* disable PDC receive */ UART_PUT_PTCR (port,ATMEL_PDC_RXTDIS ); UART_PUT_IDR(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT |@@ -572,7 +572,7 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* * PDC receive. Just schedule the tasklet and let it * figure out the details. @@ -661,7 +661,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)/* * Called from tasklet with ENDTX and TXBUFE interrupts disabled. */ -static void atmel_tx_dma (struct uart_port *port) +static void atmel_tx_pdc (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port);struct circ_buf *xmit = &port->state->xmit;@@ -778,7 +778,7 @@ static void atmel_rx_from_ring(struct uart_port *port)spin_lock (&port->lock); } -static void atmel_rx_from_dma (struct uart_port *port) +static void atmel_rx_from_pdc (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port);struct tty_port *tport = &port->state->port;@@ -868,8 +868,8 @@ static void atmel_tasklet_func(unsigned long data)/* The interrupt handler does not take the lock */ spin_lock (&port->lock); -if (atmel_use_dma_tx (port)) -atmel_tx_dma (port); +if (atmel_use_pdc_tx (port)) +atmel_tx_pdc (port);else atmel_tx_chars (port);@@ -893,8 +893,8 @@ static void atmel_tasklet_func(unsigned long data) atmel_port->irq_status_prev = status; } -if (atmel_use_dma_rx (port)) -atmel_rx_from_dma (port); +if (atmel_use_pdc_rx (port)) +atmel_rx_from_pdc (port);else atmel_rx_from_ring (port);@@ -930,7 +930,7 @@ static int atmel_startup(struct uart_port *port)/* * Initialize DMA (if necessary) */ -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {int i;for (i =0 ; i <2 ; i++) {@@ -964,7 +964,7 @@ static int atmel_startup(struct uart_port *port)UART_PUT_RNPR (port, atmel_port->pdc_rx[1 ].dma_addr);UART_PUT_RNCR (port,PDC_BUFFER_SIZE ); } -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;struct circ_buf *xmit = &port->state->xmit;@@ -1000,7 +1000,7 @@ static int atmel_startup(struct uart_port *port)/* enable xmit & rcvr */ UART_PUT_CR (port,ATMEL_US_TXEN |ATMEL_US_RXEN ); -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {/* set UART timeout */ UART_PUT_RTOR (port,PDC_RX_TIMEOUT );UART_PUT_CR (port,ATMEL_US_STTTO );@@ -1031,7 +1031,7 @@ static void atmel_shutdown(struct uart_port *port)/* * Shut-down the DMA. */ -if (atmel_use_dma_rx (port)) { +if (atmel_use_pdc_rx (port)) {int i;for (i =0 ; i <2 ; i++) {@@ -1044,7 +1044,7 @@ static void atmel_shutdown(struct uart_port *port)kfree (pdc->buf); } } -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx; dma_unmap_single(port->dev,@@ -1080,7 +1080,7 @@ static void atmel_flush_buffer(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); -if (atmel_use_dma_tx (port)) { +if (atmel_use_pdc_tx (port)) {UART_PUT_TCR (port,0 ); atmel_port->pdc_tx.ofs =0 ; }@@ -1193,7 +1193,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,if (termios->c_iflag & (BRKINT |PARMRK )) port->read_status_mask |=ATMEL_US_RXBRK ; -if (atmel_use_dma_rx (port)) +if (atmel_use_pdc_rx (port))/* need to enable error interrupts */ UART_PUT_IER (port, port->read_status_mask);@@ -1429,14 +1429,14 @@ static void atmel_of_init_port(struct atmel_uart_port *atmel_port,u32 rs485_delay[2 ];/* DMA/PDC usage specification */ -if (of_get_property (np,"atmel,use-dma-rx" ,NULL )) - atmel_port->use_dma_rx =1 ; +if (of_get_property (np,"atmel,use-pdc-rx" ,NULL )) + atmel_port->use_pdc_rx =1 ;else - atmel_port->use_dma_rx =0 ; -if (of_get_property (np,"atmel,use-dma-tx" ,NULL )) - atmel_port->use_dma_tx =1 ; + atmel_port->use_pdc_rx =0 ; +if (of_get_property (np,"atmel,use-pdc-tx" ,NULL )) + atmel_port->use_pdc_tx =1 ;else - atmel_port->use_dma_tx =0 ; + atmel_port->use_pdc_tx =0 ;/* rs485 properties */ if (of_property_read_u32_array(np, "rs485-rts-delay",@@ -1467,8 +1467,8 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,if (pdev->dev.of_node) {atmel_of_init_port (atmel_port, pdev->dev.of_node); }else { - atmel_port->use_dma_rx = pdata->use_dma_rx; - atmel_port->use_dma_tx = pdata->use_dma_tx; + atmel_port->use_pdc_rx = pdata->use_pdc_rx; + atmel_port->use_pdc_tx = pdata->use_pdc_tx; atmel_port->rs485 = pdata->rs485; }@@ -1505,7 +1505,7 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port,/* Use TXEMPTY for interrupt when rs485 else TXRDY or ENDTX|TXBUFE */ if (atmel_port->rs485.flags &SER_RS485_ENABLED ) atmel_port->tx_done_mask =ATMEL_US_TXEMPTY ; -else if (atmel_use_dma_tx (port)) { +else if (atmel_use_pdc_tx (port)) { port->fifosize =PDC_BUFFER_SIZE ; atmel_port->tx_done_mask =ATMEL_US_ENDTX |ATMEL_US_TXBUFE ; }else {@@ -1794,7 +1794,7 @@ static int atmel_serial_probe(struct platform_device *pdev) goto err; } -if (!atmel_use_dma_rx (&port->uart)) { +if (!atmel_use_pdc_rx (&port->uart)) { ret = -ENOMEM ; data =kmalloc (sizeof (struct atmel_uart_char ) *ATMEL_SERIAL_RINGSIZE ,GFP_KERNEL );include/linux/platform_data/atmel.h +2
-2@@ -76,8 +76,8 @@ struct atmel_nand_data {/* Serial */ struct atmel_uart_data {int num;/* port num */ -short use_dma_tx;/* use transmit DMA? */ -short use_dma_rx;/* use receive DMA? */ +short use_pdc_tx;/* use transmit PDC? */ +short use_pdc_rx;/* use receive PDC? */ void __iomem *regs;/* virt. base address, if any */ struct serial_rs485 rs485;/* rs485 settings */ };Signature · 1 line
1.7.9.5_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/7 serial: at91: correct definition from DMA to PDC
In reply to Elen SongOne little comment.
On 09/07/2013 08:33, Elen Song :
[..]
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 23
Quoted 10 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-4@@ -19,9 +19,9 @@ Example: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; - reg = <0xfff8c000 0x4000>; - interrupts = <7>; - atmel,use-dma-rx; - atmel,use-dma-tx; + reg = <0xfff8c000 0x200>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
This is not related to this patch topic: please remove.
Quoted 3 lines
Documentation/devicetree/bindings/serial/rs485.txt +2
-0+ atmel,use-pdc-rx; + atmel,use-pdc-tx; };
[..]
Signature · 1 line
Nicolas Ferre
PATCH 2/7 serial: at91: add tx dma support
In reply to Elen SongRequest a slave dma channel for tx dma use. Tx dma will setup a single transfer, when transfer complete, it will call atmel_dma_tx_complete to do finish stuff.
--- drivers/tty/serial/atmel_serial.c | 200 +++++++++++++++++++++++++++++++++++ include/linux/platform_data/atmel.h | 1 + 2 files changed, 201 insertions(+)
drivers/tty/serial/atmel_serial.c +200 -0
@@ -144,9 +144,15 @@ struct atmel_uart_port {short pdc_rx_idx;/* current PDC RX buffer */ struct atmel_dma_buffer pdc_rx[2 ];/* PDC receier */ +short use_dma_tx;/* enable DMA transmitter */ short use_pdc_tx;/* enable PDC transmitter */ struct atmel_dma_buffer pdc_tx;/* PDC transmitter */ +spinlock_t lock_tx;/* port lock */ +struct dma_chan *chan_tx; +struct dma_async_tx_descriptor *desc_tx; +dma_cookie_t cookie_tx; +struct scatterlist sg_tx;struct tasklet_struct tasklet;unsigned int irq_status;unsigned int irq_status_prev;
@@ -206,6 +212,13 @@ static bool atmel_use_pdc_tx(struct uart_port *port) }#endif +static bool atmel_use_dma_tx (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +return atmel_port->use_dma_tx; +} +/* Enable or disable the rs485 support */ void atmel_config_rs485 (struct uart_port *port,struct serial_rs485 *rs485conf) {
@@ -564,6 +577,186 @@ static void atmel_tx_chars(struct uart_port *port)UART_PUT_IER (port, atmel_port->tx_done_mask); } +static void atmel_dma_tx_complete (void *arg) +{ +struct atmel_uart_port *atmel_port = arg; +struct uart_port *port = &atmel_port->uart; +struct circ_buf *xmit = &port->state->xmit; +struct dma_chan *chan = atmel_port->chan_tx; +unsigned long flags; + +spin_lock_irqsave (&port->lock, flags); + +if (chan) +dmaengine_terminate_all (chan); + xmit->tail +=sg_dma_len (&atmel_port->sg_tx); + xmit->tail &=UART_XMIT_SIZE -1 ; + + port->icount.tx +=sg_dma_len (&atmel_port->sg_tx); + +spin_lock_irq (&atmel_port->lock_tx); +async_tx_ack (atmel_port->desc_tx); + atmel_port->cookie_tx = -EINVAL ; + atmel_port->desc_tx =NULL ; +spin_unlock_irq (&atmel_port->lock_tx); + +if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS ) +uart_write_wakeup (port); + +/* Do we really need this? */ +if (!uart_circ_empty (xmit)) +tasklet_schedule (&atmel_port->tasklet); + +spin_unlock_irqrestore (&port->lock, flags); +} + +static void atmel_tx_dma_release (struct atmel_uart_port *atmel_port) +{ +struct dma_chan *chan = atmel_port->chan_tx; +struct uart_port *port = &(atmel_port->uart); + +if (chan) { +dmaengine_terminate_all (chan); +dma_release_channel (chan); +dma_unmap_sg (port->dev, &atmel_port->sg_tx,1 , +DMA_MEM_TO_DEV ); + } + + atmel_port->desc_tx =NULL ; + atmel_port->chan_tx =NULL ; + atmel_port->cookie_tx = -EINVAL ; +} + +/* +* Called from tasklet with TXRDY interrupt is disabled. +*/ +static void atmel_tx_dma (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +struct circ_buf *xmit = &port->state->xmit; +struct dma_chan *chan = atmel_port->chan_tx; +struct dma_async_tx_descriptor *desc; +struct scatterlist *sg = &atmel_port->sg_tx; + +/* Make sure we have an idle channel */ +if (atmel_port->desc_tx !=NULL ) +return ; + +if (!uart_circ_empty (xmit) && !uart_tx_stopped (port)) { +/* +* DMA is idle now. +* Port xmit buffer is already mapped, +* and it is one page... Just adjust +* offsets and lengths. Since it is a circular buffer, +* we have to transmit till the end, and then the rest. +* Take the port lock to get a +* consistent xmit buffer state. +*/ + sg->offset = xmit->tail & (UART_XMIT_SIZE -1 ); +sg_dma_address (sg) = (sg_dma_address (sg) & + ~(UART_XMIT_SIZE -1 )) + + sg->offset; +sg_dma_len (sg) =CIRC_CNT_TO_END (xmit->head, + xmit->tail, +UART_XMIT_SIZE ); +BUG_ON (!sg_dma_len (sg)); + + desc =dmaengine_prep_slave_sg (chan, + sg, +1 , +DMA_MEM_TO_DEV , +DMA_PREP_INTERRUPT | +DMA_CTRL_ACK ); +if (!desc) { +dev_err (port->dev,"Failed to send via dma!\n" ); +return ; + } + +dma_sync_sg_for_device (port->dev, sg,1 ,DMA_MEM_TO_DEV ); + + atmel_port->desc_tx = desc; + desc->callback = atmel_dma_tx_complete; + desc->callback_param = atmel_port; + atmel_port->cookie_tx =dmaengine_submit (desc); + + }else { +if (atmel_port->rs485.flags &SER_RS485_ENABLED ) { +/* DMA done, stop TX, start RX for RS485 */ +atmel_start_rx (port); + } + } + +if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS ) +uart_write_wakeup (port); +} + +static void atmel_tx_request_dma (struct atmel_uart_port *atmel_port) +{ +struct uart_port *port; +dma_cap_mask_t mask; +struct dma_slave_config config; +int ret, nent; + +if (atmel_port ==NULL ) +return ; + + port = &(atmel_port->uart); + +dma_cap_zero (mask); +dma_cap_set (DMA_SLAVE , mask); + + atmel_port->chan_tx =dma_request_slave_channel (port->dev,"tx" ); +if (atmel_port->chan_tx ==NULL ) + goto chan_err; +dev_info (port->dev,"using %s for tx DMA transfers\n" , +dma_chan_name (atmel_port->chan_tx)); + atmel_port->use_dma_tx =1 ; + +spin_lock_init (&atmel_port->lock_tx); +sg_init_table (&atmel_port->sg_tx,1 ); +/* UART circular tx buffer is an aligned page. */ +BUG_ON ((int )port->state->xmit.buf & ~PAGE_MASK ); +sg_set_page (&atmel_port->sg_tx, +virt_to_page (port->state->xmit.buf), +UART_XMIT_SIZE , + (int )port->state->xmit.buf & ~PAGE_MASK ); + nent =dma_map_sg (port->dev, + &atmel_port->sg_tx, +1 , +DMA_MEM_TO_DEV ); + +if (!nent) +dev_dbg (port->dev,"need to release resource of dma\n" ); +else +dev_dbg (port->dev,"%s: mapped %d@%p to %x\n" , __func__, +sg_dma_len (&atmel_port->sg_tx), + port->state->xmit.buf, +sg_dma_address (&atmel_port->sg_tx)); + +/* Configure the slave DMA */ +memset (&config,0 ,sizeof (config)); + config.direction =DMA_MEM_TO_DEV ; + config.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; + config.dst_addr = port->mapbase +ATMEL_US_THR ; + + ret =dmaengine_device_control (atmel_port->chan_tx, +DMA_SLAVE_CONFIG , + (unsigned long )&config); +if (ret) { +dev_err (port->dev,"DMA tx slave configuration failed\n" ); + goto chan_err; + } + +return ; + +chan_err: +dev_err (port->dev,"TX channel not available, switch to pio\n" ); + atmel_port->use_dma_tx =0 ; +if (atmel_port->chan_tx) +atmel_tx_dma_release (atmel_port); +return ; +} +/* * receive interrupt handler. */
@@ -870,6 +1063,8 @@ static void atmel_tasklet_func(unsigned long data)if (atmel_use_pdc_tx (port))atmel_tx_pdc (port); +else if (atmel_use_dma_tx (port)) +atmel_tx_dma (port);else atmel_tx_chars (port);
@@ -977,6 +1172,8 @@ static int atmel_startup(struct uart_port *port) pdc->ofs =0 ; } +atmel_tx_request_dma (atmel_port); +/* * If there is a specific "open" function (to register * control line interrupts)
@@ -1053,6 +1250,8 @@ static void atmel_shutdown(struct uart_port *port) DMA_TO_DEVICE); } +if (atmel_use_dma_tx (port)) +atmel_tx_dma_release (atmel_port);/* * Disable all interrupts, port and break condition. */
@@ -1469,6 +1668,7 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port, }else { atmel_port->use_pdc_rx = pdata->use_pdc_rx; atmel_port->use_pdc_tx = pdata->use_pdc_tx; + atmel_port->use_dma_tx =0 ; atmel_port->rs485 = pdata->rs485; }
include/linux/platform_data/atmel.h +1 -0
@@ -78,6 +78,7 @@ struct atmel_uart_data {int num;/* port num */ short use_pdc_tx;/* use transmit PDC? */ short use_pdc_rx;/* use receive PDC? */ +short use_dma_tx;/* use transmit DMA? */ void __iomem *regs;/* virt. base address, if any */ struct serial_rs485 rs485;/* rs485 settings */ };
Signature · 1 line
1.7.9.5
PATCH 2/7 serial: at91: add tx dma support
On Tue, Jul 09, 2013 at 02:33:41PM +0800, Elen Song wrote:
[...]
drivers/tty/serial/atmel_serial.c static int atmel_startup(struct uart_port *port) · line 1179
Quoted 9 lines
drivers/tty/serial/atmel_serial.c +2
-0@@ -977,6 +1172,8 @@ static int atmel_startup(struct uart_port *port) pdc->ofs =0 ; } +atmel_tx_request_dma (atmel_port); +/* * If there is a specific "open" function (to register * control line interrupts)
Here we can have both use_pdc_tx and use_dma_tx set to true. To avoid this, we can do:
if (atmel_use_pdc_tx(port)) {
} else {
atmel_tx_request_dma(atmel_port);
}or force use_pdc_tx to 0 in atmel_tx_request_dma function when we set use_dma_tx to 1.
I prefer the second one since using dma has a higher priority than using pdc contrary to the first one.
Regards
Ludovic
PATCH 2/7 serial: at91: add tx dma support
Quoted 22 lines · Ludovic Desroches
On Tue, Jul 09, 2013 at 02:33:41PM +0800, Elen Song wrote:
[...]
drivers/tty/serial/atmel_serial.c static int atmel_startup(struct uart_port *port) · line 1179
Quoted 9 lines
drivers/tty/serial/atmel_serial.c +2
-0@@ -977,6 +1172,8 @@ static int atmel_startup(struct uart_port *port) pdc->ofs =0 ; } +atmel_tx_request_dma (atmel_port); +/* * If there is a specific "open" function (to register * control line interrupts) Here we can have both
use_pdc_txanduse_dma_txset to true. To avoid this, we can do:if (
atmel_use_pdc_tx(port)) {} else { atmel_tx_request_dma(atmel_port); }
Quoted 6 lines
or force
use_pdc_txto 0 inatmel_tx_request_dmafunction when we setuse_dma_txto 1.I prefer the second one since using dma has a higher priority than using pdc contrary to the first one.
Well ,yes, I have a better idea:
In atmel_startup:
Move "atmel_tx_request_dma" forward, just before "if (atmel_use_pdc_rx(port))",
meanwhile, force use_pdc_tx to 0 when request a dma channel.
In this case, we will not go into "if (atmel_use_pdc_rx(port))" when dma and pdc both enable and
dma have higher priority.
Quoted 3 lines
Regards
Ludovic
PATCH 3/7 serial: at91: add rx dma support
In reply to Elen SongRequest a cyclic dma channel for rx dma use. Use cyclic transfer is to prevent receive data overrun.
atmel_allocate_desc will allocate a cycle dma cookie after request channel, after that, enable uart timeout interrupt in startup stage, when data successful received, the timeout callback will check the residual bytes and insert receiving datas into the framework during the transfer interval.
When current descriptor finished, the dma callback will also check the residual bytes and filp the receiving data.
--- drivers/tty/serial/atmel_serial.c | 236 +++++++++++++++++++++++++++++++++++ include/linux/platform_data/atmel.h | 1 + 2 files changed, 237 insertions(+)
drivers/tty/serial/atmel_serial.c +236 -0
@@ -140,6 +140,7 @@ struct atmel_uart_port {u32 backup_imr;/* IMR saved during suspend */ int break_active;/* break being received */ +short use_dma_rx;/* enable DMA receiver */ short use_pdc_rx;/* enable PDC receiver */ short pdc_rx_idx;/* current PDC RX buffer */ struct atmel_dma_buffer pdc_rx[2 ];/* PDC receier */
@@ -149,10 +150,15 @@ struct atmel_uart_port {struct atmel_dma_buffer pdc_tx;/* PDC transmitter */ spinlock_t lock_tx;/* port lock */ +spinlock_t lock_rx;/* port lock */ struct dma_chan *chan_tx; +struct dma_chan *chan_rx;struct dma_async_tx_descriptor *desc_tx; +struct dma_async_tx_descriptor *desc_rx;dma_cookie_t cookie_tx; +dma_cookie_t cookie_rx;struct scatterlist sg_tx; +struct scatterlist sg_rx;struct tasklet_struct tasklet;unsigned int irq_status;unsigned int irq_status_prev;
@@ -219,6 +225,13 @@ static bool atmel_use_dma_tx(struct uart_port *port)return atmel_port->use_dma_tx; } +static bool atmel_use_dma_rx (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +return atmel_port->use_dma_rx; +} +/* Enable or disable the rs485 support */ void atmel_config_rs485 (struct uart_port *port,struct serial_rs485 *rs485conf) {
@@ -757,6 +770,204 @@ chan_err:return ; } +static void atmel_rx_dma_flip_buffer (struct uart_port *port, +char *buf,size_t count) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +struct tty_port *tport = &port->state->port; + +dma_sync_sg_for_cpu (port->dev, + &atmel_port->sg_rx, +1 , +DMA_DEV_TO_MEM ); + +tty_insert_flip_string (tport, buf, count); + +dma_sync_sg_for_device (port->dev, + &atmel_port->sg_rx, +1 , +DMA_DEV_TO_MEM ); +/* +* Drop the lock here since it might end up calling +* uart_start(), which takes the lock. +*/ +spin_unlock (&port->lock); +tty_flip_buffer_push (tport); +spin_lock (&port->lock); +} + +static void atmel_dma_rx_complete (void *arg) +{ +struct uart_port *port = arg; +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +tasklet_schedule (&atmel_port->tasklet); +} + +static void atmel_rx_dma_release (struct atmel_uart_port *atmel_port) +{ +struct dma_chan *chan = atmel_port->chan_rx; +struct uart_port *port = &(atmel_port->uart); + +if (chan) { +dmaengine_terminate_all (chan); +dma_release_channel (chan); +dma_unmap_sg (port->dev, &atmel_port->sg_rx,1 , +DMA_DEV_TO_MEM ); + } + + atmel_port->desc_rx =NULL ; + atmel_port->chan_rx =NULL ; + atmel_port->cookie_rx = -EINVAL ; +} + +static void atmel_rx_from_dma (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +struct circ_buf *ring = &atmel_port->rx_ring; +struct dma_chan *chan = atmel_port->chan_rx; +struct dma_tx_state state; +enum dma_status dmastat; +size_t pending, count; + + +/* Reset the UART timeout early so that we don't miss one */ +UART_PUT_CR (port,ATMEL_US_STTTO ); + dmastat =dmaengine_tx_status (chan, + atmel_port->cookie_rx, + &state); +/* Restart a new tasklet if DMA status is error */ +if (dmastat ==DMA_ERROR ) { +dev_dbg (port->dev,"Get residue error, restart tasklet\n" ); +UART_PUT_IER (port,ATMEL_US_TIMEOUT ); +tasklet_schedule (&atmel_port->tasklet); +return ; + } +/* current transfer size should no larger than dma buffer */ + pending =sg_dma_len (&atmel_port->sg_rx) - state.residue; +BUG_ON (pending >sg_dma_len (&atmel_port->sg_rx)); + +/* +* This will take the chars we have so far, +* ring->head will record the transfer size, only new bytes come +* will insert into the framework. +*/ +if (pending > ring->head) { + count = pending - ring->head; + +atmel_rx_dma_flip_buffer (port, ring->buf + ring->head, count); + + ring->head += count; +if (ring->head ==sg_dma_len (&atmel_port->sg_rx)) + ring->head =0 ; + + port->icount.rx += count; + } + +UART_PUT_IER (port,ATMEL_US_TIMEOUT ); +} + +static void atmel_rx_request_dma (struct atmel_uart_port *atmel_port) +{ +struct uart_port *port; +dma_cap_mask_t mask; +struct dma_slave_config config; +struct circ_buf *ring; +int ret, nent; + +if (atmel_port ==NULL ) +return ; + + ring = &atmel_port->rx_ring; + port = &(atmel_port->uart); + +dma_cap_zero (mask); +dma_cap_set (DMA_CYCLIC , mask); + + atmel_port->chan_rx =dma_request_slave_channel (port->dev,"rx" ); +if (atmel_port->chan_rx ==NULL ) + goto chan_err; +dev_info (port->dev,"using %s for rx DMA transfers\n" , +dma_chan_name (atmel_port->chan_rx)); + atmel_port->use_dma_rx =1 ; + +spin_lock_init (&atmel_port->lock_rx); +sg_init_table (&atmel_port->sg_rx,1 ); +/* UART circular rx buffer is an aligned page. */ +BUG_ON ((int )port->state->xmit.buf & ~PAGE_MASK ); +sg_set_page (&atmel_port->sg_rx, +virt_to_page (ring->buf), +ATMEL_SERIAL_RINGSIZE , + (int )ring->buf & ~PAGE_MASK ); + nent =dma_map_sg (port->dev, + &atmel_port->sg_rx, +1 , +DMA_DEV_TO_MEM ); + +if (!nent) +dev_dbg (port->dev,"need to release resource of dma\n" ); +else +dev_dbg (port->dev,"%s: mapped %d@%p to %x\n" , __func__, +sg_dma_len (&atmel_port->sg_rx), + ring->buf, +sg_dma_address (&atmel_port->sg_rx)); + +/* Configure the slave DMA */ +memset (&config,0 ,sizeof (config)); + config.direction =DMA_DEV_TO_MEM ; + config.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; + config.src_addr = port->mapbase +ATMEL_US_RHR ; + + ret =dmaengine_device_control (atmel_port->chan_rx, +DMA_SLAVE_CONFIG , + (unsigned long )&config); +if (ret) { +dev_err (port->dev,"DMA rx slave configuration failed\n" ); + goto chan_err; + } + +return ; + +chan_err: +dev_err (port->dev,"RX channel not available, switch to pio\n" ); + atmel_port->use_dma_rx =0 ; +if (atmel_port->chan_rx) +atmel_rx_dma_release (atmel_port); +return ; +} + +static int atmel_allocate_desc (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +struct dma_async_tx_descriptor *desc; +struct dma_chan *chan = atmel_port->chan_rx; + +if (!chan) { +dev_warn (port->dev,"No channel available\n" ); + goto err_dma; + } +/* +* Prepare a cyclic dma transfer, assign 2 descriptors, +* each one is half ring buffer size +*/ + desc =dmaengine_prep_dma_cyclic (chan, +sg_dma_address (&atmel_port->sg_rx), +sg_dma_len (&atmel_port->sg_rx), +sg_dma_len (&atmel_port->sg_rx)/2 , +DMA_DEV_TO_MEM , +DMA_PREP_INTERRUPT ); + desc->callback = atmel_dma_rx_complete; + desc->callback_param = port; + atmel_port->desc_rx = desc; + atmel_port->cookie_rx =dmaengine_submit (desc); + +return 0 ; + +err_dma: +atmel_rx_dma_release (atmel_port); +return -EINVAL ; +} +/* * receive interrupt handler. */
@@ -784,6 +995,13 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending)atmel_pdc_rxerr (port, pending); } +if (atmel_use_dma_rx (port)) { +if (pending &ATMEL_US_TIMEOUT ) { +UART_PUT_IDR (port,ATMEL_US_TIMEOUT ); +tasklet_schedule (&atmel_port->tasklet); + } + } +/* Interrupt receive */ if (pending &ATMEL_US_RXRDY )atmel_rx_chars (port);
@@ -1090,6 +1308,8 @@ static void atmel_tasklet_func(unsigned long data)if (atmel_use_pdc_rx (port))atmel_rx_from_pdc (port); +else if (atmel_use_dma_rx (port)) +atmel_rx_from_dma (port);else atmel_rx_from_ring (port);
@@ -1173,6 +1393,11 @@ static int atmel_startup(struct uart_port *port) }atmel_tx_request_dma (atmel_port); +atmel_rx_request_dma (atmel_port); +if (atmel_use_dma_rx (port)) { +if (atmel_allocate_desc (port)) +return -EINVAL ; + }/* * If there is a specific "open" function (to register
@@ -1205,6 +1430,12 @@ static int atmel_startup(struct uart_port *port)UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT );/* enable PDC controller */ UART_PUT_PTCR (port,ATMEL_PDC_RXTEN ); + }else if (atmel_use_dma_rx (port)) { +/* set UART timeout */ +UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); +UART_PUT_CR (port,ATMEL_US_STTTO ); + +UART_PUT_IER (port,ATMEL_US_TIMEOUT ); }else {/* enable receive only */ UART_PUT_IER (port,ATMEL_US_RXRDY );
@@ -1252,6 +1483,10 @@ static void atmel_shutdown(struct uart_port *port)if (atmel_use_dma_tx (port))atmel_tx_dma_release (atmel_port); + +if (atmel_use_dma_rx (port)) +atmel_rx_dma_release (atmel_port); +/* * Disable all interrupts, port and break condition. */
@@ -1668,6 +1903,7 @@ static void atmel_init_port(struct atmel_uart_port *atmel_port, }else { atmel_port->use_pdc_rx = pdata->use_pdc_rx; atmel_port->use_pdc_tx = pdata->use_pdc_tx; + atmel_port->use_dma_rx =0 ; atmel_port->use_dma_tx =0 ; atmel_port->rs485 = pdata->rs485; }
include/linux/platform_data/atmel.h +1 -0
@@ -79,6 +79,7 @@ struct atmel_uart_data {short use_pdc_tx;/* use transmit PDC? */ short use_pdc_rx;/* use receive PDC? */ short use_dma_tx;/* use transmit DMA? */ +short use_dma_rx;/* use receive DMA? */ void __iomem *regs;/* virt. base address, if any */ struct serial_rs485 rs485;/* rs485 settings */ };
Signature · 1 line
1.7.9.5
PATCH 4/7 serial: at91: make DBGU support dma and pdc transfers
In reply to Elen SongBecause the DBGU lack of receive timeout register, so we use a timer to trigger data receive.
--- drivers/tty/serial/atmel_serial.c | 51 ++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-)
drivers/tty/serial/atmel_serial.c +42 -9
@@ -41,6 +41,7 @@#include <linux/uaccess.h> #include <linux/pinctrl/consumer.h> #include <linux/platform_data/atmel.h> +#include <linux/timer.h> #include <asm/io.h> #include <asm/ioctls.h>
@@ -167,6 +168,7 @@ struct atmel_uart_port {struct serial_rs485 rs485;/* rs485 settings */ unsigned int tx_done_mask; +struct timer_list uart_timer;/* dbgu timer */ };static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART ];
@@ -968,6 +970,15 @@ err_dma:return -EINVAL ; } +static void atmel_uart_timer_callback (unsigned long data) +{ +struct uart_port *port = (void *)data; +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +tasklet_schedule (&atmel_port->tasklet); +mod_timer (&atmel_port->uart_timer, jiffies +uart_poll_timeout (port)); +} +/* * receive interrupt handler. */
@@ -1424,18 +1435,34 @@ static int atmel_startup(struct uart_port *port)if (atmel_use_pdc_rx (port)) {/* set UART timeout */ -UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); -UART_PUT_CR (port,ATMEL_US_STTTO ); - -UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT ); +if (port->line ==0 ) { +setup_timer (&atmel_port->uart_timer, + atmel_uart_timer_callback, + (unsigned long )port); +mod_timer (&atmel_port->uart_timer, + jiffies +uart_poll_timeout (port)); + }else { +UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); +UART_PUT_CR (port,ATMEL_US_STTTO ); + +UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT ); + }/* enable PDC controller */ UART_PUT_PTCR (port,ATMEL_PDC_RXTEN ); }else if (atmel_use_dma_rx (port)) {/* set UART timeout */ -UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); -UART_PUT_CR (port,ATMEL_US_STTTO ); - -UART_PUT_IER (port,ATMEL_US_TIMEOUT ); +if (port->line ==0 ) { +setup_timer (&atmel_port->uart_timer, + atmel_uart_timer_callback, + (unsigned long )port); +mod_timer (&atmel_port->uart_timer, + jiffies +uart_poll_timeout (port)); + }else { +UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); +UART_PUT_CR (port,ATMEL_US_STTTO ); + +UART_PUT_IER (port,ATMEL_US_TIMEOUT ); + } }else {/* enable receive only */ UART_PUT_IER (port,ATMEL_US_RXRDY );
@@ -1471,6 +1498,9 @@ static void atmel_shutdown(struct uart_port *port) DMA_FROM_DEVICE);kfree (pdc->buf); } + +if (port->line ==0 ) +del_timer_sync (&atmel_port->uart_timer); }if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
@@ -1484,8 +1514,11 @@ static void atmel_shutdown(struct uart_port *port)if (atmel_use_dma_tx (port))atmel_tx_dma_release (atmel_port); -if (atmel_use_dma_rx (port)) +if (atmel_use_dma_rx (port)) {atmel_rx_dma_release (atmel_port); +if (port->line ==0 ) +del_timer_sync (&atmel_port->uart_timer); + }/* * Disable all interrupts, port and break condition.
Signature · 1 line
1.7.9.5
PATCH 4/7 serial: at91: make DBGU support dma and pdc transfers
Quoted 99 lines · Elen Song
Because the DBGU lack of receive timeout register, so we use a timer to trigger data receive.
Signed-off-by Elen Song <[email protected]>Signed-off-by Ludovic Desroches <[email protected]>--- drivers/tty/serial/atmel_serial.c | 51 ++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-)drivers/tty/serial/atmel_serial.c +38
-8@@ -41,6 +41,7 @@#include <linux/uaccess.h> #include <linux/pinctrl/consumer.h> #include <linux/platform_data/atmel.h> +#include <linux/timer.h> #include <asm/io.h> #include <asm/ioctls.h> @@ -167,6 +168,7 @@ struct atmel_uart_port {struct serial_rs485 rs485;/* rs485 settings */ unsigned int tx_done_mask; +struct timer_list uart_timer;/* dbgu timer */ };static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART ];@@ -968,6 +970,15 @@ err_dma:return -EINVAL ; } +static void atmel_uart_timer_callback (unsigned long data) +{ +struct uart_port *port = (void *)data; +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +tasklet_schedule (&atmel_port->tasklet); +mod_timer (&atmel_port->uart_timer, jiffies +uart_poll_timeout (port)); +} +/* * receive interrupt handler. */ @@ -1424,18 +1435,34 @@ static int atmel_startup(struct uart_port *port)if (atmel_use_pdc_rx (port)) {/* set UART timeout */ -UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); -UART_PUT_CR (port,ATMEL_US_STTTO ); - -UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT ); +if (port->line ==0 ) { +setup_timer (&atmel_port->uart_timer, + atmel_uart_timer_callback, + (unsigned long )port); +mod_timer (&atmel_port->uart_timer, + jiffies +uart_poll_timeout (port)); + }else { +UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); +UART_PUT_CR (port,ATMEL_US_STTTO ); + +UART_PUT_IER (port,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT ); + }/* enable PDC controller */ UART_PUT_PTCR (port,ATMEL_PDC_RXTEN ); }else if (atmel_use_dma_rx (port)) {/* set UART timeout */ -UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); -UART_PUT_CR (port,ATMEL_US_STTTO ); - -UART_PUT_IER (port,ATMEL_US_TIMEOUT ); +if (port->line ==0 ) { +setup_timer (&atmel_port->uart_timer, + atmel_uart_timer_callback, + (unsigned long )port); +mod_timer (&atmel_port->uart_timer, + jiffies +uart_poll_timeout (port)); + }else { +UART_PUT_RTOR (port,PDC_RX_TIMEOUT ); +UART_PUT_CR (port,ATMEL_US_STTTO ); + +UART_PUT_IER (port,ATMEL_US_TIMEOUT ); + } }else {/* enable receive only */ UART_PUT_IER (port,ATMEL_US_RXRDY );@@ -1471,6 +1498,9 @@ static void atmel_shutdown(struct uart_port *port) DMA_FROM_DEVICE);kfree (pdc->buf); } + +if (port->line ==0 ) +del_timer_sync (&atmel_port->uart_timer); }if (atmel_use_pdc_tx (port)) {struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
drivers/tty/serial/atmel_serial.c static void atmel_shutdown(struct uart_port *port) · line 1521
Quoted 9 lines
drivers/tty/serial/atmel_serial.c +4
-1@@ -1484,8 +1514,11 @@ static void atmel_shutdown(struct uart_port *port)if (atmel_use_dma_tx (port))atmel_tx_dma_release (atmel_port); -if (atmel_use_dma_rx (port)) +if (atmel_use_dma_rx (port)) {atmel_rx_dma_release (atmel_port); +if (port->line ==0 ) +del_timer_sync (&atmel_port->uart_timer); + }
use function pointer to seperate the code this will simplify the code and easier the maintainance by droping all of those if(xx) else
Best Regards,
J.
Quoted 6 lines
drivers/tty/serial/atmel_serial.c +0
-0/* * Disable all interrupts, port and break condition. Signature · 1 line
1.7.9.5
PATCH 5/7 serial: at91: distinguish usart and uart
In reply to Elen SongDistinguish usart and uart by read ip name register, dbgu regards as uart.
--- drivers/tty/serial/atmel_serial.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/atmel_serial.h | 2 ++ 2 files changed, 37 insertions(+)
drivers/tty/serial/atmel_serial.c +35 -0
@@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port);#define UART_PUT_BRGR (port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR)#define UART_PUT_RTOR (port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)#define UART_PUT_TTGR (port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) +#define UART_GET_IP_NAME (port) __raw_readl((port)->membase + ATMEL_US_NAME)/* PDC registers */ #define UART_PUT_PTCR (port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
@@ -169,6 +170,7 @@ struct atmel_uart_port {struct serial_rs485 rs485;/* rs485 settings */ unsigned int tx_done_mask;struct timer_list uart_timer;/* dbgu timer */ +bool is_usart;/* usart or uart */ };static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART ];
@@ -1328,6 +1330,34 @@ static void atmel_tasklet_func(unsigned long data) }/* +* Get ip name usart or uart +*/ +static inline unsigned int atmel_get_ip_name (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +unsigned int name =cpu_to_be32 (UART_GET_IP_NAME (port)); +char *ip_name = (char *)&name; +char *usart ="USAR" ; +char *uart ="DBGU" ; + + atmel_port->is_usart = false; + +/* USAR is regards as usart, DBGU is regards as uart */ +if (!strncmp (ip_name, usart,4 )) { +dev_dbg (port->dev,"This is usart\n" ); + atmel_port->is_usart = true; + }else if (!strncmp (ip_name, uart,4 )) { +dev_dbg (port->dev,"This is uart\n" ); + atmel_port->is_usart = false; + }else { +dev_err (port->dev,"Not supported ip name, set to uart\n" ); +return -EINVAL ; + } + +return 0 ; +} + +/* * Perform initialization and enable port for reception */ static int atmel_startup (struct uart_port *port)
@@ -1354,6 +1384,11 @@ static int atmel_startup(struct uart_port *port) }/* +* Get port name of usart or uart +*/ +atmel_get_ip_name (port); + +/* * Initialize DMA (if necessary) */ if (atmel_use_pdc_rx (port)) {
include/linux/atmel_serial.h +2 -0
@@ -124,4 +124,6 @@#define ATMEL_US_NER 0x44/* Number of Errors Register */ #define ATMEL_US_IF 0x4c/* IrDA Filter Register */ +#define ATMEL_US_NAME 0xf0/* Ip Name */ +#endif
Signature · 1 line
1.7.9.5
PATCH 5/7 serial: at91: distinguish usart and uart
Quoted 42 lines · Elen Song
Distinguish usart and uart by read ip name register, dbgu regards as uart.
Signed-off-by Elen Song <[email protected]>--- drivers/tty/serial/atmel_serial.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/atmel_serial.h | 2 ++ 2 files changed, 37 insertions(+)drivers/tty/serial/atmel_serial.c +11
-0@@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port);#define UART_PUT_BRGR (port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR)#define UART_PUT_RTOR (port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)#define UART_PUT_TTGR (port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) +#define UART_GET_IP_NAME (port) __raw_readl((port)->membase + ATMEL_US_NAME)/* PDC registers */ #define UART_PUT_PTCR (port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)@@ -169,6 +170,7 @@ struct atmel_uart_port {struct serial_rs485 rs485;/* rs485 settings */ unsigned int tx_done_mask;struct timer_list uart_timer;/* dbgu timer */ +bool is_usart;/* usart or uart */ };static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART ];@@ -1328,6 +1330,34 @@ static void atmel_tasklet_func(unsigned long data) }/* +* Get ip name usart or uart +*/ +static inline unsigned int atmel_get_ip_name (struct uart_port *port) +{ +struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); +unsigned int name =cpu_to_be32 (UART_GET_IP_NAME (port)); +char *ip_name = (char *)&name; +char *usart ="USAR" ; +char *uart ="DBGU" ;
drivers/tty/serial/atmel_serial.c static void atmel_tasklet_func(unsigned long data) · line 1351
Quoted 10 lines
drivers/tty/serial/atmel_serial.c +10
-0+ + atmel_port->is_usart = false; + +/* USAR is regards as usart, DBGU is regards as uart */ +if (!strncmp (ip_name, usart,4 )) { +dev_dbg (port->dev,"This is usart\n" ); + atmel_port->is_usart = true; + }else if (!strncmp (ip_name, uart,4 )) { +dev_dbg (port->dev,"This is uart\n" ); + atmel_port->is_usart = false;
do not use string just value
Quoted 39 lines
drivers/tty/serial/atmel_serial.c +9
-0+ }else { +dev_err (port->dev,"Not supported ip name, set to uart\n" ); +return -EINVAL ; + } + +return 0 ; +} + +/* * Perform initialization and enable port for reception */ static int
atmel_startup(struct uart_port *port)drivers/tty/serial/atmel_serial.c +5
-0@@ -1354,6 +1384,11 @@ static int atmel_startup(struct uart_port *port) }/* +* Get port name of usart or uart +*/ +atmel_get_ip_name (port); + +/* * Initialize DMA (if necessary) */ if (atmel_use_pdc_rx (port)) {include/linux/atmel_serial.h +2
-0@@ -124,4 +124,6 @@#define ATMEL_US_NER 0x44/* Number of Errors Register */ #define ATMEL_US_IF 0x4c/* IrDA Filter Register */ +#define ATMEL_US_NAME 0xf0/* Ip Name */ +#endif Signature · 1 line
1.7.9.5
PATCH 6/7 serial: at91: modify UART to use software timer to trigger rx
In reply to Elen Song--- drivers/tty/serial/atmel_serial.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/atmel_serial.c +4 -4
@@ -1470,7 +1470,7 @@ static int atmel_startup(struct uart_port *port)if (atmel_use_pdc_rx (port)) {/* set UART timeout */ -if (port->line ==0 ) { +if (!atmel_port->is_usart) {setup_timer (&atmel_port->uart_timer, atmel_uart_timer_callback, (unsigned long )port);
@@ -1486,7 +1486,7 @@ static int atmel_startup(struct uart_port *port)UART_PUT_PTCR (port,ATMEL_PDC_RXTEN ); }else if (atmel_use_dma_rx (port)) {/* set UART timeout */ -if (port->line ==0 ) { +if (!atmel_port->is_usart) {setup_timer (&atmel_port->uart_timer, atmel_uart_timer_callback, (unsigned long )port);
@@ -1534,7 +1534,7 @@ static void atmel_shutdown(struct uart_port *port)kfree (pdc->buf); } -if (port->line ==0 ) +if (!atmel_port->is_usart)del_timer_sync (&atmel_port->uart_timer); }if (atmel_use_pdc_tx (port)) {
@@ -1551,7 +1551,7 @@ static void atmel_shutdown(struct uart_port *port)if (atmel_use_dma_rx (port)) {atmel_rx_dma_release (atmel_port); -if (port->line ==0 ) +if (!atmel_port->is_usart)del_timer_sync (&atmel_port->uart_timer); }
Signature · 1 line
1.7.9.5
PATCH 7/7 serial: at91: add dma support in usart binding descriptions
In reply to Elen Song--- .../devicetree/bindings/tty/serial/atmel-usart.txt | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +18 -3
@@ -8,15 +8,21 @@ Required properties: - interrupts: Should contain interrupt Optional properties: -- atmel,use-pdc-rx: use of PDC for receiving data -- atmel,use-pdc-tx: use of PDC for transmitting data +- for those only support PDC transfer socs: + - atmel,use-pdc-rx: use of PDC for receiving data + - atmel,use-pdc-tx: use of PDC for transmitting data +- for those only support DMA transfer socs: + - dmas: DMA specifier, consisting of a phandle to DMA controller node, + memory peripheral interface and USART DMA channel ID, FIFO configuration. + Refer to dma.txt and atmel-dma.txt for details. + - dma-names: "rx" for RX channel, "tx" for TX channel. <chip> compatible description: - at91rm9200: legacy USART support - at91sam9260: generic USART implementation for SAM9 SoCs Example: - +- use PDC: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>;
@@ -25,3 +31,12 @@ Example: atmel,use-pdc-tx; }; +- use DMA: + usart0: serial at f001c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xf001c000 0x100>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; + dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>, + <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>; + dma-names = "tx", "rx"; + };
Signature · 1 line
1.7.9.5
PATCH 7/7 serial: at91: add dma support in usart binding descriptions
On Tue, Jul 09, 2013 at 02:33:46PM +0800, Elen Song wrote:
[...]
Quoted 7 lines
Example:
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +1
-1- +- use PDC: usart0: serial at fff8c000 { compatible = "atmel,at91sam9260-usart"; reg = <0xfff8c000 0x200>;
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt Example: · line 40
Quoted 10 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +7
-0@@ -25,3 +31,12 @@ Example: atmel,use-pdc-tx; }; +- use DMA: + usart0: serial at f001c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xf001c000 0x100>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; + dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>, + <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
Same comment than patch 1/7. Maybe wait for confirmation by someone else before correcting it.
Quoted 5 lines
Documentation/devicetree/bindings/tty/serial/atmel-usart.txt +2
-0+ dma-names = "tx", "rx"; + };Signature · 1 line
1.7.9.5