mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-imx@nxp.com
Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: improve lpuart32 registers clearing when shutdown
Date: Wed, 9 Nov 2022 14:19:21 +0200 (EET)	[thread overview]
Message-ID: <9e682825-3420-fbe3-eb9d-8e864430363a@linux.intel.com> (raw)
In-Reply-To: <20221109104515.17266-3-sherry.sun@nxp.com>

On Wed, 9 Nov 2022, Sherry Sun wrote:

> Need to clear the UARTSTAT and UARTMODIR registers when shutdown the
> uart port, also clear the Rx/Tx DMA enable bits and loopback
> configuration bit.

This lacks answer to "Why?" question. Think about somebody not as familiar 
with the HW as you are looking back to this very commit message like 5 
years from now and wondering why this change was made.

Preferrably make a separate change out of all these four changes if the 
answers to why question are different.

It would also help in deciding whether Fixes tag is necessary or not 
since you didn't seem to include.

-- 
 i.

> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
>  drivers/tty/serial/fsl_lpuart.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index f5a0a14fa366..43d9d6a6e94a 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -1771,11 +1771,22 @@ static void lpuart32_shutdown(struct uart_port *port)
>  
>  	spin_lock_irqsave(&port->lock, flags);
>  
> +	/* clear statue */
> +	temp = lpuart32_read(&sport->port, UARTSTAT);
> +	lpuart32_write(&sport->port, temp, UARTSTAT);
> +
> +	/* disable Rx/Tx DMA */
> +	temp = lpuart32_read(port, UARTBAUD);
> +	temp &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE);
> +	lpuart32_write(port, temp, UARTBAUD);
> +
>  	/* disable Rx/Tx and interrupts */
>  	temp = lpuart32_read(port, UARTCTRL);
>  	temp &= ~(UARTCTRL_TE | UARTCTRL_RE | UARTCTRL_ILIE |
> -			UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE);
> +			UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE |
> +			UARTCTRL_LOOPS);
>  	lpuart32_write(port, temp, UARTCTRL);
> +	lpuart32_write(port, 0, UARTMODIR);
>  
>  	spin_unlock_irqrestore(&port->lock, flags);
>  
> 

  reply	other threads:[~2022-11-09 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 10:45 [PATCH 0/2] fsl_lpuart: improve Idle Line Interrupt and registers handle in .shutdown() Sherry Sun
2022-11-09 10:45 ` [PATCH 1/2] tty: serial: fsl_lpuart: only enable Idle Line Interrupt for non-dma case Sherry Sun
2022-11-09 12:02   ` Ilpo Järvinen
2022-11-10  3:27     ` Sherry Sun
2022-11-09 10:45 ` [PATCH 2/2] tty: serial: fsl_lpuart: improve lpuart32 registers clearing when shutdown Sherry Sun
2022-11-09 12:19   ` Ilpo Järvinen [this message]
2022-11-10  3:32     ` Sherry Sun

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=9e682825-3420-fbe3-eb9d-8e864430363a@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.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 \
    --cc=sherry.sun@nxp.com \
    /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®