aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/atmel_serial.c11
-rw-r--r--include/linux/serial.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index a182def7007d..3892666b5fbd 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -217,7 +217,8 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
217 if (rs485conf->flags & SER_RS485_ENABLED) { 217 if (rs485conf->flags & SER_RS485_ENABLED) {
218 dev_dbg(port->dev, "Setting UART to RS485\n"); 218 dev_dbg(port->dev, "Setting UART to RS485\n");
219 atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; 219 atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
220 UART_PUT_TTGR(port, rs485conf->delay_rts_before_send); 220 if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND)
221 UART_PUT_TTGR(port, rs485conf->delay_rts_after_send);
221 mode |= ATMEL_US_USMODE_RS485; 222 mode |= ATMEL_US_USMODE_RS485;
222 } else { 223 } else {
223 dev_dbg(port->dev, "Setting UART to RS232\n"); 224 dev_dbg(port->dev, "Setting UART to RS232\n");
@@ -292,7 +293,9 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
292 293
293 if (atmel_port->rs485.flags & SER_RS485_ENABLED) { 294 if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
294 dev_dbg(port->dev, "Setting UART to RS485\n"); 295 dev_dbg(port->dev, "Setting UART to RS485\n");
295 UART_PUT_TTGR(port, atmel_port->rs485.delay_rts_before_send); 296 if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
297 UART_PUT_TTGR(port,
298 atmel_port->rs485.delay_rts_after_send);
296 mode |= ATMEL_US_USMODE_RS485; 299 mode |= ATMEL_US_USMODE_RS485;
297 } else { 300 } else {
298 dev_dbg(port->dev, "Setting UART to RS232\n"); 301 dev_dbg(port->dev, "Setting UART to RS232\n");
@@ -1211,7 +1214,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
1211 1214
1212 if (atmel_port->rs485.flags & SER_RS485_ENABLED) { 1215 if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
1213 dev_dbg(port->dev, "Setting UART to RS485\n"); 1216 dev_dbg(port->dev, "Setting UART to RS485\n");
1214 UART_PUT_TTGR(port, atmel_port->rs485.delay_rts_before_send); 1217 if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
1218 UART_PUT_TTGR(port,
1219 atmel_port->rs485.delay_rts_after_send);
1215 mode |= ATMEL_US_USMODE_RS485; 1220 mode |= ATMEL_US_USMODE_RS485;
1216 } else { 1221 } else {
1217 dev_dbg(port->dev, "Setting UART to RS232\n"); 1222 dev_dbg(port->dev, "Setting UART to RS232\n");
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c3b45add494d..ef914061511e 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -210,8 +210,10 @@ struct serial_rs485 {
210#define SER_RS485_ENABLED (1 << 0) 210#define SER_RS485_ENABLED (1 << 0)
211#define SER_RS485_RTS_ON_SEND (1 << 1) 211#define SER_RS485_RTS_ON_SEND (1 << 1)
212#define SER_RS485_RTS_AFTER_SEND (1 << 2) 212#define SER_RS485_RTS_AFTER_SEND (1 << 2)
213#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
213 __u32 delay_rts_before_send; /* Milliseconds */ 214 __u32 delay_rts_before_send; /* Milliseconds */
214 __u32 padding[6]; /* Memory is cheap, new structs 215 __u32 delay_rts_after_send; /* Milliseconds */
216 __u32 padding[5]; /* Memory is cheap, new structs
215 are a royal PITA .. */ 217 are a royal PITA .. */
216}; 218};
217 219