diff options
-rw-r--r-- | Documentation/serial/serial-rs485.txt | 3 | ||||
-rw-r--r-- | drivers/tty/serial/atmel_serial.c | 9 | ||||
-rw-r--r-- | include/linux/serial.h | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt index a4932387bbfb..c8878f821d1e 100644 --- a/Documentation/serial/serial-rs485.txt +++ b/Documentation/serial/serial-rs485.txt | |||
@@ -104,6 +104,9 @@ | |||
104 | rs485conf.flags |= SER_RS485_RTS_AFTER_SEND; | 104 | rs485conf.flags |= SER_RS485_RTS_AFTER_SEND; |
105 | rs485conf.delay_rts_after_send = ...; | 105 | rs485conf.delay_rts_after_send = ...; |
106 | 106 | ||
107 | /* Set this flag if you want to receive data even whilst sending data */ | ||
108 | rs485conf.flags |= SER_RS485_RX_DURING_TX; | ||
109 | |||
107 | if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) { | 110 | if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) { |
108 | /* Error handling. See errno. */ | 111 | /* Error handling. See errno. */ |
109 | } | 112 | } |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index af9b7814965a..c7232a916c1b 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -339,7 +339,8 @@ static void atmel_stop_tx(struct uart_port *port) | |||
339 | /* Disable interrupts */ | 339 | /* Disable interrupts */ |
340 | UART_PUT_IDR(port, atmel_port->tx_done_mask); | 340 | UART_PUT_IDR(port, atmel_port->tx_done_mask); |
341 | 341 | ||
342 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) | 342 | if ((atmel_port->rs485.flags & SER_RS485_ENABLED) && |
343 | !(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX)) | ||
343 | atmel_start_rx(port); | 344 | atmel_start_rx(port); |
344 | } | 345 | } |
345 | 346 | ||
@@ -356,7 +357,8 @@ static void atmel_start_tx(struct uart_port *port) | |||
356 | really need this.*/ | 357 | really need this.*/ |
357 | return; | 358 | return; |
358 | 359 | ||
359 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) | 360 | if ((atmel_port->rs485.flags & SER_RS485_ENABLED) && |
361 | !(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX)) | ||
360 | atmel_stop_rx(port); | 362 | atmel_stop_rx(port); |
361 | 363 | ||
362 | /* re-enable PDC transmit */ | 364 | /* re-enable PDC transmit */ |
@@ -680,7 +682,8 @@ static void atmel_tx_dma(struct uart_port *port) | |||
680 | /* Enable interrupts */ | 682 | /* Enable interrupts */ |
681 | UART_PUT_IER(port, atmel_port->tx_done_mask); | 683 | UART_PUT_IER(port, atmel_port->tx_done_mask); |
682 | } else { | 684 | } else { |
683 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) { | 685 | if ((atmel_port->rs485.flags & SER_RS485_ENABLED) && |
686 | !(atmel_port->rs485.flags & SER_RS485_RX_DURING_TX)) { | ||
684 | /* DMA done, stop TX, start RX for RS485 */ | 687 | /* DMA done, stop TX, start RX for RS485 */ |
685 | atmel_start_rx(port); | 688 | atmel_start_rx(port); |
686 | } | 689 | } |
diff --git a/include/linux/serial.h b/include/linux/serial.h index ef914061511e..97ff8e27a6cc 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -211,6 +211,7 @@ struct serial_rs485 { | |||
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 | #define SER_RS485_RTS_BEFORE_SEND (1 << 3) |
214 | #define SER_RS485_RX_DURING_TX (1 << 4) | ||
214 | __u32 delay_rts_before_send; /* Milliseconds */ | 215 | __u32 delay_rts_before_send; /* Milliseconds */ |
215 | __u32 delay_rts_after_send; /* Milliseconds */ | 216 | __u32 delay_rts_after_send; /* Milliseconds */ |
216 | __u32 padding[5]; /* Memory is cheap, new structs | 217 | __u32 padding[5]; /* Memory is cheap, new structs |