aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-11-07 04:25:55 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2013-12-20 05:41:30 -0500
commit354e57f3a0a26120af3bcd6c92c355ad00a057c1 (patch)
tree6935c516167f34df47ebce43c579bbc8ce53f8d4
parent6a79799d5654bb7800614e8b7a009252be7ff90e (diff)
ARM/serial: at91: switch atmel serial to use gpiolib
This passes the errata fix using a GPIO to control the RTS pin on one of the AT91 chips to use gpiolib instead of the AT91-specific interfaces. Also remove the reliance on compile-time #defines and the cpu_* check and rely on the platform passing down the proper GPIO pin through platform data. This is a prerequisite for getting rid of the local GPIO implementation in the AT91 platform and move toward multiplatform. The patch also adds device tree support for getting the RTS GPIO pin from the device tree on DT boot paths. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--Documentation/devicetree/bindings/serial/atmel-usart.txt3
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c10
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c7
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c5
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c5
-rw-r--r--drivers/tty/serial/atmel_serial.c49
-rw-r--r--include/linux/platform_data/atmel.h1
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:
10Optional properties: 10Optional 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[] = {
922static struct atmel_uart_data dbgu_data = { 922static 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
927static u64 dbgu_dmamask = DMA_BIT_MASK(32); 928static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -960,6 +961,7 @@ static struct resource uart0_resources[] = {
960static struct atmel_uart_data uart0_data = { 961static 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
965static u64 uart0_dmamask = DMA_BIT_MASK(32); 967static 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[] = {
1009static struct atmel_uart_data uart1_data = { 1012static 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
1014static u64 uart1_dmamask = DMA_BIT_MASK(32); 1018static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1060,6 +1064,7 @@ static struct resource uart2_resources[] = {
1060static struct atmel_uart_data uart2_data = { 1064static 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
1065static u64 uart2_dmamask = DMA_BIT_MASK(32); 1070static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1103,6 +1108,7 @@ static struct resource uart3_resources[] = {
1103static struct atmel_uart_data uart3_data = { 1108static 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
1108static u64 uart3_dmamask = DMA_BIT_MASK(32); 1114static 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[] = {
819static struct atmel_uart_data dbgu_data = { 819static 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
824static u64 dbgu_dmamask = DMA_BIT_MASK(32); 825static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -857,6 +858,7 @@ static struct resource uart0_resources[] = {
857static struct atmel_uart_data uart0_data = { 858static 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
862static u64 uart0_dmamask = DMA_BIT_MASK(32); 864static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -908,6 +910,7 @@ static struct resource uart1_resources[] = {
908static struct atmel_uart_data uart1_data = { 910static 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
913static u64 uart1_dmamask = DMA_BIT_MASK(32); 916static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -951,6 +954,7 @@ static struct resource uart2_resources[] = {
951static struct atmel_uart_data uart2_data = { 954static 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
956static u64 uart2_dmamask = DMA_BIT_MASK(32); 960static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -994,6 +998,7 @@ static struct resource uart3_resources[] = {
994static struct atmel_uart_data uart3_data = { 998static 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
999static u64 uart3_dmamask = DMA_BIT_MASK(32); 1004static u64 uart3_dmamask = DMA_BIT_MASK(32);
@@ -1037,6 +1042,7 @@ static struct resource uart4_resources[] = {
1037static struct atmel_uart_data uart4_data = { 1042static 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
1042static u64 uart4_dmamask = DMA_BIT_MASK(32); 1048static u64 uart4_dmamask = DMA_BIT_MASK(32);
@@ -1075,6 +1081,7 @@ static struct resource uart5_resources[] = {
1075static struct atmel_uart_data uart5_data = { 1081static 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