linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse
@ 2022-08-02 16:38 Shenwei Wang
  2022-08-04  6:51 ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Shenwei Wang @ 2022-08-02 16:38 UTC (permalink / raw)
  To: gregkh, jirislaby
  Cc: linux-serial, linux-kernel, NXP Linux Team, Shenwei Wang, Nicolas Diaz

The setting of RS485 RTS polarity is inverse in the current driver.

When the property of 'rs485-rts-active-low' is enabled in the dts node,
the RTS signal should be LOW during sending. Otherwise, if there is no
such a property, the RTS should be HIGH during sending.

Signed-off-by: Nicolas Diaz <nicolas.diaz@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/tty/serial/fsl_lpuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index afa0f941c862f..abc3a3674bc39 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1394,9 +1394,9 @@ static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios,
 		 * Note: UART is assumed to be active high.
 		 */
 		if (rs485->flags & SER_RS485_RTS_ON_SEND)
-			modem &= ~UARTMODEM_TXRTSPOL;
-		else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
 			modem |= UARTMODEM_TXRTSPOL;
+		else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
+			modem &= ~UARTMODEM_TXRTSPOL;
 	}
 
 	writeb(modem, sport->port.membase + UARTMODEM);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse
  2022-08-02 16:38 [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse Shenwei Wang
@ 2022-08-04  6:51 ` Jiri Slaby
  2022-08-04 14:35   ` [EXT] " Shenwei Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2022-08-04  6:51 UTC (permalink / raw)
  To: Shenwei Wang, gregkh
  Cc: linux-serial, linux-kernel, NXP Linux Team, Nicolas Diaz

On 02. 08. 22, 18:38, Shenwei Wang wrote:
> The setting of RS485 RTS polarity is inverse in the current driver.
> 
> When the property of 'rs485-rts-active-low' is enabled in the dts node,
> the RTS signal should be LOW during sending. Otherwise, if there is no
> such a property, the RTS should be HIGH during sending.

What commit this fixes? I.e. I am missing a Fixes tag below.

> Signed-off-by: Nicolas Diaz <nicolas.diaz@nxp.com>
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
> ---
>   drivers/tty/serial/fsl_lpuart.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index afa0f941c862f..abc3a3674bc39 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -1394,9 +1394,9 @@ static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios,
>   		 * Note: UART is assumed to be active high.
>   		 */
>   		if (rs485->flags & SER_RS485_RTS_ON_SEND)
> -			modem &= ~UARTMODEM_TXRTSPOL;
> -		else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
>   			modem |= UARTMODEM_TXRTSPOL;
> +		else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
> +			modem &= ~UARTMODEM_TXRTSPOL;
>   	}
>   
>   	writeb(modem, sport->port.membase + UARTMODEM);

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] Re: [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse
  2022-08-04  6:51 ` Jiri Slaby
@ 2022-08-04 14:35   ` Shenwei Wang
  2022-08-05  6:23     ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Shenwei Wang @ 2022-08-04 14:35 UTC (permalink / raw)
  To: Jiri Slaby, gregkh; +Cc: linux-serial, linux-kernel, dl-linux-imx, Nicolas Diaz



> -----Original Message-----
> From: Jiri Slaby <jirislaby@kernel.org>
> Sent: Thursday, August 4, 2022 1:51 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>; gregkh@linuxfoundation.org
> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; Nicolas Diaz <nicolas.diaz@nxp.com>
> Subject: [EXT] Re: [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse
> 
> Caution: EXT Email
> 
> On 02. 08. 22, 18:38, Shenwei Wang wrote:
> > The setting of RS485 RTS polarity is inverse in the current driver.
> >
> > When the property of 'rs485-rts-active-low' is enabled in the dts
> > node, the RTS signal should be LOW during sending. Otherwise, if there
> > is no such a property, the RTS should be HIGH during sending.
> 
> What commit this fixes? I.e. I am missing a Fixes tag below.

It is a fix for the following commit:
Fixes: 03895cf41d18 ("tty: serial: fsl_lpuart: Add support for RS-485")

Should I send out a new version to update it?

Thanks,
Shenwei

> 
> > Signed-off-by: Nicolas Diaz <nicolas.diaz@nxp.com>
> > Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
> > ---
> >   drivers/tty/serial/fsl_lpuart.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > b/drivers/tty/serial/fsl_lpuart.c index afa0f941c862f..abc3a3674bc39
> > 100644
> > --- a/drivers/tty/serial/fsl_lpuart.c
> > +++ b/drivers/tty/serial/fsl_lpuart.c
> > @@ -1394,9 +1394,9 @@ static int lpuart_config_rs485(struct uart_port *port,
> struct ktermios *termios,
> >                * Note: UART is assumed to be active high.
> >                */
> >               if (rs485->flags & SER_RS485_RTS_ON_SEND)
> > -                     modem &= ~UARTMODEM_TXRTSPOL;
> > -             else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
> >                       modem |= UARTMODEM_TXRTSPOL;
> > +             else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
> > +                     modem &= ~UARTMODEM_TXRTSPOL;
> >       }
> >
> >       writeb(modem, sport->port.membase + UARTMODEM);
> 
> thanks,
> --
> js
> suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXT] Re: [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse
  2022-08-04 14:35   ` [EXT] " Shenwei Wang
@ 2022-08-05  6:23     ` Jiri Slaby
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2022-08-05  6:23 UTC (permalink / raw)
  To: Shenwei Wang, gregkh
  Cc: linux-serial, linux-kernel, dl-linux-imx, Nicolas Diaz

On 04. 08. 22, 16:35, Shenwei Wang wrote:
>> On 02. 08. 22, 18:38, Shenwei Wang wrote:
>>> The setting of RS485 RTS polarity is inverse in the current driver.
>>>
>>> When the property of 'rs485-rts-active-low' is enabled in the dts
>>> node, the RTS signal should be LOW during sending. Otherwise, if there
>>> is no such a property, the RTS should be HIGH during sending.
>>
>> What commit this fixes? I.e. I am missing a Fixes tag below.
> 
> It is a fix for the following commit:
> Fixes: 03895cf41d18 ("tty: serial: fsl_lpuart: Add support for RS-485")
> 
> Should I send out a new version to update it?

It's up to Greg, but I guess so.

-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-05  6:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 16:38 [PATCH 1/1] serial: fsl_lpuart: RS485 RTS polariy is inverse Shenwei Wang
2022-08-04  6:51 ` Jiri Slaby
2022-08-04 14:35   ` [EXT] " Shenwei Wang
2022-08-05  6:23     ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).