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

Commit e0b0baad authored by Richard Genoud's avatar Richard Genoud Committed by Greg Kroah-Hartman
Browse files

tty/serial: at91: use mctrl_gpio helpers



On sam9x5, dedicated CTS (and RTS) pins are unusable together with the
LCDC, the EMAC, or the MMC because they share the same line.

Moreover, the USART controller doesn't handle DTR/DSR/DCD/RI signals,
so we have to control them via GPIO.

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI
signals.

Signed-off-by: default avatarRichard Genoud <richard.genoud@gmail.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84130aac
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -13,8 +13,9 @@ 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.
- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
  It will use specified PIO instead of the peripheral function pin for the USART 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.
@@ -36,6 +37,11 @@ Example:
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
		cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
		dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
		dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
		dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
		rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
	};

- use DMA:
+10 −6
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>
#include <linux/platform_device.h>
#include <linux/i2c-gpio.h>

@@ -923,7 +924,6 @@ 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);
@@ -962,7 +962,14 @@ static struct resource uart0_resources[] = {
static struct atmel_uart_data uart0_data = {
	.use_dma_tx	= 1,
	.use_dma_rx	= 1,
	.rts_gpio	= -EINVAL,
};

static struct gpiod_lookup_table uart0_gpios_table = {
	.dev_id = "atmel_usart",
	.table = {
		GPIO_LOOKUP("pioA", 21, "rts", GPIO_ACTIVE_LOW),
		{ },
	},
};

static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -993,7 +1000,7 @@ static inline void configure_usart0_pins(unsigned pins)
		 * We need to drive the pin manually. The serial driver will driver
		 * this to high when initializing.
		 */
		uart0_data.rts_gpio = AT91_PIN_PA21;
		gpiod_add_lookup_table(&uart0_gpios_table);
	}
}

@@ -1013,7 +1020,6 @@ 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);
@@ -1065,7 +1071,6 @@ 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);
@@ -1109,7 +1114,6 @@ 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);
+0 −7
Original line number Diff line number Diff line
@@ -820,7 +820,6 @@ 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);
@@ -859,7 +858,6 @@ 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);
@@ -911,7 +909,6 @@ 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);
@@ -955,7 +952,6 @@ 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);
@@ -999,7 +995,6 @@ 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);
@@ -1043,7 +1038,6 @@ 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);
@@ -1082,7 +1076,6 @@ 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);
+0 −4
Original line number Diff line number Diff line
@@ -881,7 +881,6 @@ 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);
@@ -920,7 +919,6 @@ 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);
@@ -964,7 +962,6 @@ 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);
@@ -1008,7 +1005,6 @@ 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);
+0 −4
Original line number Diff line number Diff line
@@ -1325,7 +1325,6 @@ 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);
@@ -1364,7 +1363,6 @@ 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);
@@ -1408,7 +1406,6 @@ 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);
@@ -1452,7 +1449,6 @@ 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