mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sherry Sun <sherry.sun@nxp.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jirislaby@kernel.org" <jirislaby@kernel.org>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH] tty: serial: fsl_lpuart: make sure to turn off break before enabling CTS
Date: Fri, 19 May 2023 09:17:59 +0000	[thread overview]
Message-ID: <AS8PR04MB8404282ABF1BADCB551D66BC927C9@AS8PR04MB8404.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20230516101138.24179-1-sherry.sun@nxp.com>

Sorry, please ignore this patch, will send another patch to fix the lpuart break issue.

Best Regards
Sherry
> -----Original Message-----
> From: Sherry Sun
> Sent: 2023年5月16日 18:16
> To: gregkh@linuxfoundation.org; jirislaby@kernel.org
> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [PATCH] tty: serial: fsl_lpuart: make sure to turn off break before
> enabling CTS
> 
> Due to one LPUART IP bug which treat the CTS as higher priority than the
> break signal, that cause the break signal sending through UARTCTRL_SBK may
> impacted by the CTS input if the HW flow control is enabled.
> 
> So commit c4c81db5cf8b ("tty: serial: fsl_lpuart: disable the CTS when send
> break signal") try to workaround this IP issue, it disables CTS before asserting
> SBK to avoid any interference from CTS, and re-enable it when break off.
> 
> Here we enable CTS before turning off the break, there is still a risk of the
> break signal been impacted by CTS input. The correct sequence is to disable
> CTS before asserting SBK, and re-enable CTS after break off, which ensures
> the break signal won't be impacted by CTS, so fix it.
> 
> Fixes: c4c81db5cf8b ("tty: serial: fsl_lpuart: disable the CTS when send break
> signal")
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
>  drivers/tty/serial/fsl_lpuart.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index 0e56fa64b4ce..d9e46f7b80e5 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -1550,20 +1550,19 @@ static void lpuart32_break_ctl(struct uart_port
> *port, int break_state)
>  	modem = lpuart32_read(port, UARTMODIR);
> 
>  	if (break_state != 0) {
> -		temp |= UARTCTRL_SBK;
>  		/*
>  		 * LPUART CTS has higher priority than SBK, need to disable
> CTS before
>  		 * asserting SBK to avoid any interference if flow control is
> enabled.
>  		 */
>  		if (cflag & CRTSCTS && modem & UARTMODIR_TXCTSE)
>  			lpuart32_write(port, modem &
> ~UARTMODIR_TXCTSE, UARTMODIR);
> +		lpuart32_write(port, temp | UARTCTRL_SBK, UARTCTRL);
>  	} else {
> -		/* Re-enable the CTS when break off. */
> +		lpuart32_write(port, temp, UARTCTRL);
> +		/* Re-enable the CTS after break off. */
>  		if (cflag & CRTSCTS && !(modem & UARTMODIR_TXCTSE))
>  			lpuart32_write(port, modem | UARTMODIR_TXCTSE,
> UARTMODIR);
>  	}
> -
> -	lpuart32_write(port, temp, UARTCTRL);
>  }
> 
>  static void lpuart_setup_watermark(struct lpuart_port *sport)
> --
> 2.17.1


      reply	other threads:[~2023-05-19  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 10:11 Sherry Sun
2023-05-19  9:17 ` Sherry Sun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR04MB8404282ABF1BADCB551D66BC927C9@AS8PR04MB8404.eurprd04.prod.outlook.com \
    --to=sherry.sun@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®