summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-mtcdt-atmel-multidrop.patch
blob: d04b13c96e606653564e2657dfc1c770b58e2f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 This patch was derived from the Vizzini driver and this patch:

 https://www.spinics.net/lists/linux-serial/msg25999.html

 Since all prior versions of MTCDT used the Vizzini driver,
 the mapping of 5 bit serial to multidrop (9 bit serial) was
 used.

 The purpose of this patch is to reserve the Atmel 5 bit mode
 for 9 bit usage on MTCDT MTAC-MFSER.
===========================================================================================
diff --git orig/drivers/tty/serial/atmel_serial.c new/drivers/tty/serial/atmel_serial.c
index 1297853..cd7987b 100644
--- orig/drivers/tty/serial/atmel_serial.c
+++ new/drivers/tty/serial/atmel_serial.c
@@ -2073,7 +2073,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 	unsigned long flags;
-	unsigned int old_mode, mode, imr, quot, baud, div, cd, fp = 0;
+	unsigned int old_mode, mode, mdrop, imr, quot, baud, div, cd, fp = 0;
 
 	/* save the current mode register */
 	mode = old_mode = atmel_uart_readl(port, ATMEL_US_MR);
@@ -2084,10 +2084,13 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
 
+	mdrop = 0;
 	/* byte size */
 	switch (termios->c_cflag & CSIZE) {
 	case CS5:
-		mode |= ATMEL_US_CHRL_5;
+		mode |= ATMEL_US_PAR_MULTI_DROP;
+		mdrop = ATMEL_US_SENDA;
+		printk(KERN_INFO "termios: Setting Atmel Multi-Drop serial");
 		break;
 	case CS6:
 		mode |= ATMEL_US_CHRL_6;
@@ -2246,7 +2249,8 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	atmel_uart_writel(port, ATMEL_US_BRGR, quot);
 	atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
-	atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN);
+	atmel_uart_writel(port, ATMEL_US_CR,
+				mdrop | ATMEL_US_TXEN | ATMEL_US_RXEN);
 	atmel_port->tx_stopped = false;
 
 	/* restore interrupts */