diff options
| -rw-r--r-- | Documentation/devicetree/bindings/serial/atmel-usart.txt | 3 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91rm9200_devices.c | 10 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 7 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91sam9g45_devices.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 5 | ||||
| -rw-r--r-- | drivers/tty/serial/atmel_serial.c | 49 | ||||
| -rw-r--r-- | include/linux/platform_data/atmel.h | 1 |
9 files changed, 68 insertions, 20 deletions
diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt index 2191dcb9f1da..3adc61c2e4ca 100644 --- a/Documentation/devicetree/bindings/serial/atmel-usart.txt +++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt | |||
| @@ -10,6 +10,8 @@ Required properties: | |||
| 10 | Optional properties: | 10 | Optional properties: |
| 11 | - atmel,use-dma-rx: use of PDC or DMA for receiving data | 11 | - atmel,use-dma-rx: use of PDC or DMA for receiving data |
| 12 | - atmel,use-dma-tx: use of PDC or DMA for transmitting data | 12 | - atmel,use-dma-tx: use of PDC or DMA for transmitting data |
| 13 | - rts-gpios: specify a GPIO for RTS line. It will use specified PIO instead of the peripheral | ||
| 14 | function pin for the USART RTS feature. If unsure, don't specify this property. | ||
| 13 | - add dma bindings for dma transfer: | 15 | - add dma bindings for dma transfer: |
| 14 | - dmas: DMA specifier, consisting of a phandle to DMA controller node, | 16 | - dmas: DMA specifier, consisting of a phandle to DMA controller node, |
| 15 | memory peripheral interface and USART DMA channel ID, FIFO configuration. | 17 | memory peripheral interface and USART DMA channel ID, FIFO configuration. |
| @@ -28,6 +30,7 @@ Example: | |||
| 28 | interrupts = <7>; | 30 | interrupts = <7>; |
| 29 | atmel,use-dma-rx; | 31 | atmel,use-dma-rx; |
| 30 | atmel,use-dma-tx; | 32 | atmel,use-dma-tx; |
| 33 | rts-gpios = <&pioD 15 0>; | ||
| 31 | }; | 34 | }; |
| 32 | 35 | ||
| 33 | - use DMA: | 36 | - use DMA: |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 3ebc9792560c..605add05af7e 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
| @@ -922,6 +922,7 @@ static struct resource dbgu_resources[] = { | |||
| 922 | static struct atmel_uart_data dbgu_data = { | 922 | static struct atmel_uart_data dbgu_data = { |
| 923 | .use_dma_tx = 0, | 923 | .use_dma_tx = 0, |
| 924 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 924 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
| 925 | .rts_gpio = -EINVAL, | ||
| 925 | }; | 926 | }; |
| 926 | 927 | ||
| 927 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 928 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -960,6 +961,7 @@ static struct resource uart0_resources[] = { | |||
| 960 | static struct atmel_uart_data uart0_data = { | 961 | static struct atmel_uart_data uart0_data = { |
| 961 | .use_dma_tx = 1, | 962 | .use_dma_tx = 1, |
| 962 | .use_dma_rx = 1, | 963 | .use_dma_rx = 1, |
| 964 | .rts_gpio = -EINVAL, | ||
| 963 | }; | 965 | }; |
| 964 | 966 | ||
| 965 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 967 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -987,9 +989,10 @@ static inline void configure_usart0_pins(unsigned pins) | |||
| 987 | if (pins & ATMEL_UART_RTS) { | 989 | if (pins & ATMEL_UART_RTS) { |
| 988 | /* | 990 | /* |
| 989 | * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. | 991 | * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. |
| 990 | * We need to drive the pin manually. Default is off (RTS is active low). | 992 | * We need to drive the pin manually. The serial driver will driver |
| 993 | * this to high when initializing. | ||
| 991 | */ | 994 | */ |
| 992 | at91_set_gpio_output(AT91_PIN_PA21, 1); | 995 | uart0_data.rts_gpio = AT91_PIN_PA21; |
| 993 | } | 996 | } |
| 994 | } | 997 | } |
| 995 | 998 | ||
| @@ -1009,6 +1012,7 @@ static struct resource uart1_resources[] = { | |||
| 1009 | static struct atmel_uart_data uart1_data = { | 1012 | static struct atmel_uart_data uart1_data = { |
| 1010 | .use_dma_tx = 1, | 1013 | .use_dma_tx = 1, |
| 1011 | .use_dma_rx = 1, | 1014 | .use_dma_rx = 1, |
| 1015 | .rts_gpio = -EINVAL, | ||
| 1012 | }; | 1016 | }; |
| 1013 | 1017 | ||
| 1014 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 1018 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -1060,6 +1064,7 @@ static struct resource uart2_resources[] = { | |||
| 1060 | static struct atmel_uart_data uart2_data = { | 1064 | static struct atmel_uart_data uart2_data = { |
| 1061 | .use_dma_tx = 1, | 1065 | .use_dma_tx = 1, |
| 1062 | .use_dma_rx = 1, | 1066 | .use_dma_rx = 1, |
| 1067 | .rts_gpio = -EINVAL, | ||
| 1063 | }; | 1068 | }; |
| 1064 | 1069 | ||
| 1065 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 1070 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
| @@ -1103,6 +1108,7 @@ static struct resource uart3_resources[] = { | |||
| 1103 | static struct atmel_uart_data uart3_data = { | 1108 | static struct atmel_uart_data uart3_data = { |
| 1104 | .use_dma_tx = 1, | 1109 | .use_dma_tx = 1, |
| 1105 | .use_dma_rx = 1, | 1110 | .use_dma_rx = 1, |
| 1111 | .rts_gpio = -EINVAL, | ||
| 1106 | }; | 1112 | }; |
| 1107 | 1113 | ||
| 1108 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | 1114 | static u64 uart3_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index eda8d1679d40..b52527c78b12 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
| @@ -819,6 +819,7 @@ static struct resource dbgu_resources[] = { | |||
| 819 | static struct atmel_uart_data dbgu_data = { | 819 | static struct atmel_uart_data dbgu_data = { |
| 820 | .use_dma_tx = 0, | 820 | .use_dma_tx = 0, |
| 821 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 821 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
| 822 | .rts_gpio = -EINVAL, | ||
| 822 | }; | 823 | }; |
| 823 | 824 | ||
| 824 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 825 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -857,6 +858,7 @@ static struct resource uart0_resources[] = { | |||
| 857 | static struct atmel_uart_data uart0_data = { | 858 | static struct atmel_uart_data uart0_data = { |
| 858 | .use_dma_tx = 1, | 859 | .use_dma_tx = 1, |
| 859 | .use_dma_rx = 1, | 860 | .use_dma_rx = 1, |
| 861 | .rts_gpio = -EINVAL, | ||
| 860 | }; | 862 | }; |
| 861 | 863 | ||
| 862 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 864 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -908,6 +910,7 @@ static struct resource uart1_resources[] = { | |||
| 908 | static struct atmel_uart_data uart1_data = { | 910 | static struct atmel_uart_data uart1_data = { |
| 909 | .use_dma_tx = 1, | 911 | .use_dma_tx = 1, |
| 910 | .use_dma_rx = 1, | 912 | .use_dma_rx = 1, |
| 913 | .rts_gpio = -EINVAL, | ||
| 911 | }; | 914 | }; |
| 912 | 915 | ||
| 913 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 916 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -951,6 +954,7 @@ static struct resource uart2_resources[] = { | |||
| 951 | static struct atmel_uart_data uart2_data = { | 954 | static struct atmel_uart_data uart2_data = { |
| 952 | .use_dma_tx = 1, | 955 | .use_dma_tx = 1, |
| 953 | .use_dma_rx = 1, | 956 | .use_dma_rx = 1, |
| 957 | .rts_gpio = -EINVAL, | ||
| 954 | }; | 958 | }; |
| 955 | 959 | ||
| 956 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 960 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
| @@ -994,6 +998,7 @@ static struct resource uart3_resources[] = { | |||
| 994 | static struct atmel_uart_data uart3_data = { | 998 | static struct atmel_uart_data uart3_data = { |
| 995 | .use_dma_tx = 1, | 999 | .use_dma_tx = 1, |
| 996 | .use_dma_rx = 1, | 1000 | .use_dma_rx = 1, |
| 1001 | .rts_gpio = -EINVAL, | ||
| 997 | }; | 1002 | }; |
| 998 | 1003 | ||
| 999 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | 1004 | static u64 uart3_dmamask = DMA_BIT_MASK(32); |
| @@ -1037,6 +1042,7 @@ static struct resource uart4_resources[] = { | |||
| 1037 | static struct atmel_uart_data uart4_data = { | 1042 | static struct atmel_uart_data uart4_data = { |
| 1038 | .use_dma_tx = 1, | 1043 | .use_dma_tx = 1, |
| 1039 | .use_dma_rx = 1, | 1044 | .use_dma_rx = 1, |
| 1045 | .rts_gpio = -EINVAL, | ||
| 1040 | }; | 1046 | }; |
| 1041 | 1047 | ||
| 1042 | static u64 uart4_dmamask = DMA_BIT_MASK(32); | 1048 | static u64 uart4_dmamask = DMA_BIT_MASK(32); |
| @@ -1075,6 +1081,7 @@ static struct resource uart5_resources[] = { | |||
| 1075 | static struct atmel_uart_data uart5_data = { | 1081 | static struct atmel_uart_data uart5_data = { |
| 1076 | .use_dma_tx = 1, | 1082 | .use_dma_tx = 1, |
| 1077 | .use_dma_rx = 1, | 1083 | .use_dma_rx = 1, |
| 1084 | .rts_gpio = -EINVAL, | ||
| 1078 | }; | 1085 | }; |
| 1079 | 1086 | ||
| 1080 | static u64 uart5_dmamask = DMA_BIT_MASK(32); | 1087 | static u64 uart5_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index b2a34740146a..6c1a2ecc306f 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
| @@ -880,6 +880,7 @@ static struct resource dbgu_resources[] = { | |||
| 880 | static struct atmel_uart_data dbgu_data = { | 880 | static struct atmel_uart_data dbgu_data = { |
| 881 | .use_dma_tx = 0, | 881 | .use_dma_tx = 0, |
| 882 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 882 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
| 883 | .rts_gpio = -EINVAL, | ||
| 883 | }; | 884 | }; |
| 884 | 885 | ||
| 885 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 886 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -918,6 +919,7 @@ static struct resource uart0_resources[] = { | |||
| 918 | static struct atmel_uart_data uart0_data = { | 919 | static struct atmel_uart_data uart0_data = { |
| 919 | .use_dma_tx = 1, | 920 | .use_dma_tx = 1, |
| 920 | .use_dma_rx = 1, | 921 | .use_dma_rx = 1, |
| 922 | .rts_gpio = -EINVAL, | ||
| 921 | }; | 923 | }; |
| 922 | 924 | ||
| 923 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 925 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -961,6 +963,7 @@ static struct resource uart1_resources[] = { | |||
| 961 | static struct atmel_uart_data uart1_data = { | 963 | static struct atmel_uart_data uart1_data = { |
| 962 | .use_dma_tx = 1, | 964 | .use_dma_tx = 1, |
| 963 | .use_dma_rx = 1, | 965 | .use_dma_rx = 1, |
| 966 | .rts_gpio = -EINVAL, | ||
| 964 | }; | 967 | }; |
| 965 | 968 | ||
| 966 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 969 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -1004,6 +1007,7 @@ static struct resource uart2_resources[] = { | |||
| 1004 | static struct atmel_uart_data uart2_data = { | 1007 | static struct atmel_uart_data uart2_data = { |
| 1005 | .use_dma_tx = 1, | 1008 | .use_dma_tx = 1, |
| 1006 | .use_dma_rx = 1, | 1009 | .use_dma_rx = 1, |
| 1010 | .rts_gpio = -EINVAL, | ||
| 1007 | }; | 1011 | }; |
| 1008 | 1012 | ||
| 1009 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 1013 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 4aeadddbc181..97cc2a0d6f90 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
| @@ -1324,6 +1324,7 @@ static struct resource dbgu_resources[] = { | |||
| 1324 | static struct atmel_uart_data dbgu_data = { | 1324 | static struct atmel_uart_data dbgu_data = { |
| 1325 | .use_dma_tx = 0, | 1325 | .use_dma_tx = 0, |
| 1326 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 1326 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
| 1327 | .rts_gpio = -EINVAL, | ||
| 1327 | }; | 1328 | }; |
| 1328 | 1329 | ||
| 1329 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 1330 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -1362,6 +1363,7 @@ static struct resource uart0_resources[] = { | |||
| 1362 | static struct atmel_uart_data uart0_data = { | 1363 | static struct atmel_uart_data uart0_data = { |
| 1363 | .use_dma_tx = 1, | 1364 | .use_dma_tx = 1, |
| 1364 | .use_dma_rx = 1, | 1365 | .use_dma_rx = 1, |
| 1366 | .rts_gpio = -EINVAL, | ||
| 1365 | }; | 1367 | }; |
| 1366 | 1368 | ||
| 1367 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 1369 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -1405,6 +1407,7 @@ static struct resource uart1_resources[] = { | |||
| 1405 | static struct atmel_uart_data uart1_data = { | 1407 | static struct atmel_uart_data uart1_data = { |
| 1406 | .use_dma_tx = 1, | 1408 | .use_dma_tx = 1, |
| 1407 | .use_dma_rx = 1, | 1409 | .use_dma_rx = 1, |
| 1410 | .rts_gpio = -EINVAL, | ||
| 1408 | }; | 1411 | }; |
| 1409 | 1412 | ||
| 1410 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 1413 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -1448,6 +1451,7 @@ static struct resource uart2_resources[] = { | |||
| 1448 | static struct atmel_uart_data uart2_data = { | 1451 | static struct atmel_uart_data uart2_data = { |
| 1449 | .use_dma_tx = 1, | 1452 | .use_dma_tx = 1, |
| 1450 | .use_dma_rx = 1, | 1453 | .use_dma_rx = 1, |
| 1454 | .rts_gpio = -EINVAL, | ||
| 1451 | }; | 1455 | }; |
| 1452 | 1456 | ||
| 1453 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 1457 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index cb36fa872d30..c10149588e21 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
| @@ -1587,6 +1587,7 @@ static struct resource dbgu_resources[] = { | |||
| 1587 | static struct atmel_uart_data dbgu_data = { | 1587 | static struct atmel_uart_data dbgu_data = { |
| 1588 | .use_dma_tx = 0, | 1588 | .use_dma_tx = 0, |
| 1589 | .use_dma_rx = 0, | 1589 | .use_dma_rx = 0, |
| 1590 | .rts_gpio = -EINVAL, | ||
| 1590 | }; | 1591 | }; |
| 1591 | 1592 | ||
| 1592 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 1593 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -1625,6 +1626,7 @@ static struct resource uart0_resources[] = { | |||
| 1625 | static struct atmel_uart_data uart0_data = { | 1626 | static struct atmel_uart_data uart0_data = { |
| 1626 | .use_dma_tx = 1, | 1627 | .use_dma_tx = 1, |
| 1627 | .use_dma_rx = 1, | 1628 | .use_dma_rx = 1, |
| 1629 | .rts_gpio = -EINVAL, | ||
| 1628 | }; | 1630 | }; |
| 1629 | 1631 | ||
| 1630 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 1632 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -1668,6 +1670,7 @@ static struct resource uart1_resources[] = { | |||
| 1668 | static struct atmel_uart_data uart1_data = { | 1670 | static struct atmel_uart_data uart1_data = { |
| 1669 | .use_dma_tx = 1, | 1671 | .use_dma_tx = 1, |
| 1670 | .use_dma_rx = 1, | 1672 | .use_dma_rx = 1, |
| 1673 | .rts_gpio = -EINVAL, | ||
| 1671 | }; | 1674 | }; |
| 1672 | 1675 | ||
| 1673 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 1676 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -1711,6 +1714,7 @@ static struct resource uart2_resources[] = { | |||
| 1711 | static struct atmel_uart_data uart2_data = { | 1714 | static struct atmel_uart_data uart2_data = { |
| 1712 | .use_dma_tx = 1, | 1715 | .use_dma_tx = 1, |
| 1713 | .use_dma_rx = 1, | 1716 | .use_dma_rx = 1, |
| 1717 | .rts_gpio = -EINVAL, | ||
| 1714 | }; | 1718 | }; |
| 1715 | 1719 | ||
| 1716 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 1720 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
| @@ -1754,6 +1758,7 @@ static struct resource uart3_resources[] = { | |||
| 1754 | static struct atmel_uart_data uart3_data = { | 1758 | static struct atmel_uart_data uart3_data = { |
| 1755 | .use_dma_tx = 1, | 1759 | .use_dma_tx = 1, |
| 1756 | .use_dma_rx = 1, | 1760 | .use_dma_rx = 1, |
| 1761 | .rts_gpio = -EINVAL, | ||
| 1757 | }; | 1762 | }; |
| 1758 | 1763 | ||
| 1759 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | 1764 | static u64 uart3_dmamask = DMA_BIT_MASK(32); |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index a698bdab2cce..4120af972b61 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
| @@ -956,6 +956,7 @@ static struct resource dbgu_resources[] = { | |||
| 956 | static struct atmel_uart_data dbgu_data = { | 956 | static struct atmel_uart_data dbgu_data = { |
| 957 | .use_dma_tx = 0, | 957 | .use_dma_tx = 0, |
| 958 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 958 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
| 959 | .rts_gpio = -EINVAL, | ||
| 959 | }; | 960 | }; |
| 960 | 961 | ||
| 961 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 962 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
| @@ -994,6 +995,7 @@ static struct resource uart0_resources[] = { | |||
| 994 | static struct atmel_uart_data uart0_data = { | 995 | static struct atmel_uart_data uart0_data = { |
| 995 | .use_dma_tx = 1, | 996 | .use_dma_tx = 1, |
| 996 | .use_dma_rx = 1, | 997 | .use_dma_rx = 1, |
| 998 | .rts_gpio = -EINVAL, | ||
| 997 | }; | 999 | }; |
| 998 | 1000 | ||
| 999 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | 1001 | static u64 uart0_dmamask = DMA_BIT_MASK(32); |
| @@ -1045,6 +1047,7 @@ static struct resource uart1_resources[] = { | |||
| 1045 | static struct atmel_uart_data uart1_data = { | 1047 | static struct atmel_uart_data uart1_data = { |
| 1046 | .use_dma_tx = 1, | 1048 | .use_dma_tx = 1, |
| 1047 | .use_dma_rx = 1, | 1049 | .use_dma_rx = 1, |
| 1050 | .rts_gpio = -EINVAL, | ||
| 1048 | }; | 1051 | }; |
| 1049 | 1052 | ||
| 1050 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | 1053 | static u64 uart1_dmamask = DMA_BIT_MASK(32); |
| @@ -1088,6 +1091,7 @@ static struct resource uart2_resources[] = { | |||
| 1088 | static struct atmel_uart_data uart2_data = { | 1091 | static struct atmel_uart_data uart2_data = { |
| 1089 | .use_dma_tx = 1, | 1092 | .use_dma_tx = 1, |
| 1090 | .use_dma_rx = 1, | 1093 | .use_dma_rx = 1, |
| 1094 | .rts_gpio = -EINVAL, | ||
| 1091 | }; | 1095 | }; |
| 1092 | 1096 | ||
| 1093 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | 1097 | static u64 uart2_dmamask = DMA_BIT_MASK(32); |
| @@ -1131,6 +1135,7 @@ static struct resource uart3_resources[] = { | |||
| 1131 | static struct atmel_uart_data uart3_data = { | 1135 | static struct atmel_uart_data uart3_data = { |
| 1132 | .use_dma_tx = 1, | 1136 | .use_dma_tx = 1, |
| 1133 | .use_dma_rx = 1, | 1137 | .use_dma_rx = 1, |
| 1138 | .rts_gpio = -EINVAL, | ||
| 1134 | }; | 1139 | }; |
| 1135 | 1140 | ||
| 1136 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | 1141 | static u64 uart3_dmamask = DMA_BIT_MASK(32); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index c7d99af46a96..40d6c9b0d98b 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
| @@ -35,21 +35,18 @@ | |||
| 35 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
| 36 | #include <linux/of.h> | 36 | #include <linux/of.h> |
| 37 | #include <linux/of_device.h> | 37 | #include <linux/of_device.h> |
| 38 | #include <linux/of_gpio.h> | ||
| 38 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
| 39 | #include <linux/atmel_pdc.h> | 40 | #include <linux/atmel_pdc.h> |
| 40 | #include <linux/atmel_serial.h> | 41 | #include <linux/atmel_serial.h> |
| 41 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
| 42 | #include <linux/platform_data/atmel.h> | 43 | #include <linux/platform_data/atmel.h> |
| 43 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
| 45 | #include <linux/gpio.h> | ||
| 44 | 46 | ||
| 45 | #include <asm/io.h> | 47 | #include <asm/io.h> |
| 46 | #include <asm/ioctls.h> | 48 | #include <asm/ioctls.h> |
| 47 | 49 | ||
| 48 | #ifdef CONFIG_ARM | ||
| 49 | #include <mach/cpu.h> | ||
| 50 | #include <asm/gpio.h> | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #define PDC_BUFFER_SIZE 512 | 50 | #define PDC_BUFFER_SIZE 512 |
| 54 | /* Revisit: We should calculate this based on the actual port settings */ | 51 | /* Revisit: We should calculate this based on the actual port settings */ |
| 55 | #define PDC_RX_TIMEOUT (3 * 10) /* 3 bytes */ | 52 | #define PDC_RX_TIMEOUT (3 * 10) /* 3 bytes */ |
| @@ -168,6 +165,7 @@ struct atmel_uart_port { | |||
| 168 | struct circ_buf rx_ring; | 165 | struct circ_buf rx_ring; |
| 169 | 166 | ||
| 170 | struct serial_rs485 rs485; /* rs485 settings */ | 167 | struct serial_rs485 rs485; /* rs485 settings */ |
| 168 | int rts_gpio; /* optional RTS GPIO */ | ||
| 171 | unsigned int tx_done_mask; | 169 | unsigned int tx_done_mask; |
| 172 | bool is_usart; /* usart or uart */ | 170 | bool is_usart; /* usart or uart */ |
| 173 | struct timer_list uart_timer; /* uart timer */ | 171 | struct timer_list uart_timer; /* uart timer */ |
| @@ -301,20 +299,16 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) | |||
| 301 | unsigned int mode; | 299 | unsigned int mode; |
| 302 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 300 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
| 303 | 301 | ||
| 304 | #ifdef CONFIG_ARCH_AT91RM9200 | 302 | /* |
| 305 | if (cpu_is_at91rm9200()) { | 303 | * AT91RM9200 Errata #39: RTS0 is not internally connected |
| 306 | /* | 304 | * to PA21. We need to drive the pin as a GPIO. |
| 307 | * AT91RM9200 Errata #39: RTS0 is not internally connected | 305 | */ |
| 308 | * to PA21. We need to drive the pin manually. | 306 | if (gpio_is_valid(atmel_port->rts_gpio)) { |
| 309 | */ | 307 | if (mctrl & TIOCM_RTS) |
| 310 | if (port->mapbase == AT91RM9200_BASE_US0) { | 308 | gpio_set_value(atmel_port->rts_gpio, 0); |
| 311 | if (mctrl & TIOCM_RTS) | 309 | else |
| 312 | at91_set_gpio_value(AT91_PIN_PA21, 0); | 310 | gpio_set_value(atmel_port->rts_gpio, 1); |
| 313 | else | ||
| 314 | at91_set_gpio_value(AT91_PIN_PA21, 1); | ||
| 315 | } | ||
| 316 | } | 311 | } |
| 317 | #endif | ||
| 318 | 312 | ||
| 319 | if (mctrl & TIOCM_RTS) | 313 | if (mctrl & TIOCM_RTS) |
| 320 | control |= ATMEL_US_RTSEN; | 314 | control |= ATMEL_US_RTSEN; |
| @@ -2379,6 +2373,25 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
| 2379 | port = &atmel_ports[ret]; | 2373 | port = &atmel_ports[ret]; |
| 2380 | port->backup_imr = 0; | 2374 | port->backup_imr = 0; |
| 2381 | port->uart.line = ret; | 2375 | port->uart.line = ret; |
| 2376 | port->rts_gpio = -EINVAL; /* Invalid, zero could be valid */ | ||
| 2377 | if (pdata) | ||
| 2378 | port->rts_gpio = pdata->rts_gpio; | ||
| 2379 | else if (np) | ||
| 2380 | port->rts_gpio = of_get_named_gpio(np, "rts-gpios", 0); | ||
| 2381 | |||
| 2382 | if (gpio_is_valid(port->rts_gpio)) { | ||
| 2383 | ret = devm_gpio_request(&pdev->dev, port->rts_gpio, "RTS"); | ||
| 2384 | if (ret) { | ||
| 2385 | dev_err(&pdev->dev, "error requesting RTS GPIO\n"); | ||
| 2386 | goto err; | ||
| 2387 | } | ||
| 2388 | /* Default to 1 as RTS is active low */ | ||
| 2389 | ret = gpio_direction_output(port->rts_gpio, 1); | ||
| 2390 | if (ret) { | ||
| 2391 | dev_err(&pdev->dev, "error setting up RTS GPIO\n"); | ||
| 2392 | goto err; | ||
| 2393 | } | ||
| 2394 | } | ||
| 2382 | 2395 | ||
| 2383 | ret = atmel_init_port(port, pdev); | 2396 | ret = atmel_init_port(port, pdev); |
| 2384 | if (ret) | 2397 | if (ret) |
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h index cea9f70133c5..e26b0c14edea 100644 --- a/include/linux/platform_data/atmel.h +++ b/include/linux/platform_data/atmel.h | |||
| @@ -84,6 +84,7 @@ struct atmel_uart_data { | |||
| 84 | short use_dma_rx; /* use receive DMA? */ | 84 | short use_dma_rx; /* use receive DMA? */ |
| 85 | void __iomem *regs; /* virt. base address, if any */ | 85 | void __iomem *regs; /* virt. base address, if any */ |
| 86 | struct serial_rs485 rs485; /* rs485 settings */ | 86 | struct serial_rs485 rs485; /* rs485 settings */ |
| 87 | int rts_gpio; /* optional RTS GPIO */ | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | /* Touchscreen Controller */ | 90 | /* Touchscreen Controller */ |
