Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 354e57f3 authored by Linus Walleij's avatar Linus Walleij Committed by Uwe Kleine-König
Browse files

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: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 6a79799d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ Required properties:
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
- rts-gpios: specify a GPIO for RTS line. It will use specified PIO instead of the peripheral
  function pin for the USART RTS feature. If unsure, don't specify this property.
- add dma bindings for dma transfer:
	- dmas: DMA specifier, consisting of a phandle to DMA controller node,
		memory peripheral interface and USART DMA channel ID, FIFO configuration.
@@ -28,6 +30,7 @@ Example:
		interrupts = <7>;
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		rts-gpios = <&pioD 15 0>;
	};

- use DMA:
+8 −2
Original line number Diff line number Diff line
@@ -922,6 +922,7 @@ 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 */
	.rts_gpio	= -EINVAL,
};

static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -960,6 +961,7 @@ static struct resource uart0_resources[] = {
static struct atmel_uart_data uart0_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -987,9 +989,10 @@ static inline void configure_usart0_pins(unsigned pins)
	if (pins & ATMEL_UART_RTS) {
		/*
		 * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21.
		 *  We need to drive the pin manually.  Default is off (RTS is active low).
		 * We need to drive the pin manually. The serial driver will driver
		 * this to high when initializing.
		 */
		at91_set_gpio_output(AT91_PIN_PA21, 1);
		uart0_data.rts_gpio = AT91_PIN_PA21;
	}
}

@@ -1009,6 +1012,7 @@ static struct resource uart1_resources[] = {
static struct atmel_uart_data uart1_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1060,6 +1064,7 @@ static struct resource uart2_resources[] = {
static struct atmel_uart_data uart2_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1103,6 +1108,7 @@ static struct resource uart3_resources[] = {
static struct atmel_uart_data uart3_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart3_dmamask = DMA_BIT_MASK(32);
+7 −0
Original line number Diff line number Diff line
@@ -819,6 +819,7 @@ 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 */
	.rts_gpio	= -EINVAL,
};

static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -857,6 +858,7 @@ static struct resource uart0_resources[] = {
static struct atmel_uart_data uart0_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -908,6 +910,7 @@ static struct resource uart1_resources[] = {
static struct atmel_uart_data uart1_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -951,6 +954,7 @@ static struct resource uart2_resources[] = {
static struct atmel_uart_data uart2_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -994,6 +998,7 @@ static struct resource uart3_resources[] = {
static struct atmel_uart_data uart3_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart3_dmamask = DMA_BIT_MASK(32);
@@ -1037,6 +1042,7 @@ static struct resource uart4_resources[] = {
static struct atmel_uart_data uart4_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart4_dmamask = DMA_BIT_MASK(32);
@@ -1075,6 +1081,7 @@ static struct resource uart5_resources[] = {
static struct atmel_uart_data uart5_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart5_dmamask = DMA_BIT_MASK(32);
+4 −0
Original line number Diff line number Diff line
@@ -880,6 +880,7 @@ 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 */
	.rts_gpio	= -EINVAL,
};

static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -918,6 +919,7 @@ static struct resource uart0_resources[] = {
static struct atmel_uart_data uart0_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -961,6 +963,7 @@ static struct resource uart1_resources[] = {
static struct atmel_uart_data uart1_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1004,6 +1007,7 @@ static struct resource uart2_resources[] = {
static struct atmel_uart_data uart2_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart2_dmamask = DMA_BIT_MASK(32);
+4 −0
Original line number Diff line number Diff line
@@ -1324,6 +1324,7 @@ 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 */
	.rts_gpio	= -EINVAL,
};

static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1362,6 +1363,7 @@ static struct resource uart0_resources[] = {
static struct atmel_uart_data uart0_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1405,6 +1407,7 @@ static struct resource uart1_resources[] = {
static struct atmel_uart_data uart1_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1448,6 +1451,7 @@ static struct resource uart2_resources[] = {
static struct atmel_uart_data uart2_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static u64 uart2_dmamask = DMA_BIT_MASK(32);
Loading