summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.33/afeb9260/0001-RS-485-mode-of-USART1.patch
blob: 615dcef7319ddf6bd0bdc7034d3446f8fd65beac (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
From 6bb4f6fe73eea7cbf730a83471b33f95a8a924a9 Mon Sep 17 00:00:00 2001
From: Sergey Lapin <slapin@ossfans.org>
Date: Fri, 4 Jul 2008 01:53:23 +0400
Subject: [PATCH 1/7] RS-485 mode of USART1

Signed-off-by: Sergey Lapin <slapin@ossfans.org>
---
 drivers/serial/atmel_serial.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 9d948bc..426a146 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -234,8 +234,12 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
 	mode = UART_GET_MR(port) & ~ATMEL_US_CHMODE;
 	if (mctrl & TIOCM_LOOP)
 		mode |= ATMEL_US_CHMODE_LOC_LOOP;
-	else
+	else {
+		if (port->mapbase == AT91SAM9260_BASE_US1)
+			mode |= ATMEL_US_USMODE_RS485;
+
 		mode |= ATMEL_US_CHMODE_NORMAL;
+	}
 	UART_PUT_MR(port, mode);
 }
 
@@ -1115,6 +1119,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
 	/* disable receiver and transmitter */
 	UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS);
 
+	if (port->mapbase == AT91SAM9260_BASE_US1) 
+		mode |= ATMEL_US_USMODE_RS485;
+
 	/* set the parity, stop bits and data size */
 	UART_PUT_MR(port, mode);
 
-- 
1.6.3.3