lkml.org 
[lkml]   [2018]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/4] serial: 8250: Make em485_rts_after_send() set mctrl according to rts state.
From
Date
On Wed, 2018-06-06 at 11:49 +0200, Giulio Benetti wrote:
> When rs485 enabled and RTS_AFTER_SEND set on startup, need to preserve
> mctrl status, because later functions will call set_mctrl passing
> port->mctrl=0 overriding rts status, resulting in rts pin in
> transmission when idle.
>
> Make mctrl reflect rts pin state.
>

This might make sense, I leave it to Matwey to Ack / NAK / etc.
But it also feels that patch 2/4 should be part of this change.

> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
> ---
> drivers/tty/serial/8250/8250_port.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c
> b/drivers/tty/serial/8250/8250_port.c
> index 95833cbc4338..c8c10b5ec6d6 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -562,10 +562,13 @@ static inline void
> serial8250_em485_rts_after_send(struct uart_8250_port *p)
> {
> unsigned char mcr = serial8250_in_MCR(p);
>
> - if (p->port.rs485.flags & SER_RS485_RTS_AFTER_SEND)
> + if (p->port.rs485.flags & SER_RS485_RTS_AFTER_SEND) {
> mcr |= UART_MCR_RTS;
> - else
> + p->port.mctrl |= TIOCM_RTS;
> + } else {
> mcr &= ~UART_MCR_RTS;
> + p->port.mctrl &= ~TIOCM_RTS;
> + }
> serial8250_out_MCR(p, mcr);
> }
>

--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

\
 
 \ /
  Last update: 2018-06-06 14:03    [W:0.055 / U:0.096 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site