diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2013-11-07 04:25:55 -0500 |
|---|---|---|
| committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-12-20 05:41:30 -0500 |
| commit | 354e57f3a0a26120af3bcd6c92c355ad00a057c1 (patch) | |
| tree | 6935c516167f34df47ebce43c579bbc8ce53f8d4 | |
| parent | 6a79799d5654bb7800614e8b7a009252be7ff90e (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.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 | |||
