All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready
@ 2022-11-28  5:02 Sherry Sun
  2023-01-30  3:02 ` Sherry Sun
  0 siblings, 1 reply; 4+ messages in thread
From: Sherry Sun @ 2022-11-28  5:02 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-serial, linux-kernel, linux-imx

lpuart32_setup_watermark_enable() will configure the UART FIFO and
watermark, also enable the receiver and transmitter, this should be done
after the rx/tx dma steup ready.

Also add lpuart32_hw_disable() to make sure the receiver/transmitter and
interrupts are disabled during the dma steup.

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 8918e08bb19e..bb12b328e224 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1682,6 +1682,16 @@ static int lpuart_startup(struct uart_port *port)
 	return 0;
 }
 
+static void lpuart32_hw_disable(struct lpuart_port *sport)
+{
+	unsigned long temp;
+
+	temp = lpuart32_read(&sport->port, UARTCTRL);
+	temp &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE |
+		  UARTCTRL_TIE | UARTCTRL_TE);
+	lpuart32_write(&sport->port, temp, UARTCTRL);
+}
+
 static void lpuart32_configure(struct lpuart_port *sport)
 {
 	unsigned long temp;
@@ -1706,11 +1716,12 @@ static void lpuart32_hw_setup(struct lpuart_port *sport)
 
 	spin_lock_irqsave(&sport->port.lock, flags);
 
-	lpuart32_setup_watermark_enable(sport);
+	lpuart32_hw_disable(sport);
 
 	lpuart_rx_dma_startup(sport);
 	lpuart_tx_dma_startup(sport);
 
+	lpuart32_setup_watermark_enable(sport);
 	lpuart32_configure(sport);
 
 	spin_unlock_irqrestore(&sport->port.lock, flags);
-- 
2.17.1


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

* RE: [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready
  2022-11-28  5:02 [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready Sherry Sun
@ 2023-01-30  3:02 ` Sherry Sun
  2023-01-30  5:21   ` gregkh
  0 siblings, 1 reply; 4+ messages in thread
From: Sherry Sun @ 2023-01-30  3:02 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-serial, linux-kernel, dl-linux-imx

Gentle ping...

Best Regards
Sherry

> -----Original Message-----
> From: Sherry Sun
> Sent: 2022年11月28日 13:04
> 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: don't enable receiver/transmitter
> before rx/tx dma ready
> 
> lpuart32_setup_watermark_enable() will configure the UART FIFO and
> watermark, also enable the receiver and transmitter, this should be done
> after the rx/tx dma steup ready.
> 
> Also add lpuart32_hw_disable() to make sure the receiver/transmitter and
> interrupts are disabled during the dma steup.
> 
> 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 8918e08bb19e..bb12b328e224 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -1682,6 +1682,16 @@ static int lpuart_startup(struct uart_port *port)
>  	return 0;
>  }
> 
> +static void lpuart32_hw_disable(struct lpuart_port *sport) {
> +	unsigned long temp;
> +
> +	temp = lpuart32_read(&sport->port, UARTCTRL);
> +	temp &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE |
> +		  UARTCTRL_TIE | UARTCTRL_TE);
> +	lpuart32_write(&sport->port, temp, UARTCTRL); }
> +
>  static void lpuart32_configure(struct lpuart_port *sport)  {
>  	unsigned long temp;
> @@ -1706,11 +1716,12 @@ static void lpuart32_hw_setup(struct
> lpuart_port *sport)
> 
>  	spin_lock_irqsave(&sport->port.lock, flags);
> 
> -	lpuart32_setup_watermark_enable(sport);
> +	lpuart32_hw_disable(sport);
> 
>  	lpuart_rx_dma_startup(sport);
>  	lpuart_tx_dma_startup(sport);
> 
> +	lpuart32_setup_watermark_enable(sport);
>  	lpuart32_configure(sport);
> 
>  	spin_unlock_irqrestore(&sport->port.lock, flags);
> --
> 2.17.1


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

* Re: [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready
  2023-01-30  3:02 ` Sherry Sun
@ 2023-01-30  5:21   ` gregkh
  2023-01-30  5:36     ` Sherry Sun
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2023-01-30  5:21 UTC (permalink / raw)
  To: Sherry Sun; +Cc: jirislaby, linux-serial, linux-kernel, dl-linux-imx

On Mon, Jan 30, 2023 at 03:02:21AM +0000, Sherry Sun wrote:
> Gentle ping...

This is not in my queue anywhere, sorry, it must have fallen off.  Can
you please resend?

thanks,

greg k-h

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

* RE: [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready
  2023-01-30  5:21   ` gregkh
@ 2023-01-30  5:36     ` Sherry Sun
  0 siblings, 0 replies; 4+ messages in thread
From: Sherry Sun @ 2023-01-30  5:36 UTC (permalink / raw)
  To: gregkh; +Cc: jirislaby, linux-serial, linux-kernel, dl-linux-imx



> -----Original Message-----
> From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> Sent: 2023年1月30日 13:21
> To: Sherry Sun <sherry.sun@nxp.com>
> Cc: jirislaby@kernel.org; linux-serial@vger.kernel.org; linux-
> kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter
> before rx/tx dma ready
> 
> On Mon, Jan 30, 2023 at 03:02:21AM +0000, Sherry Sun wrote:
> > Gentle ping...
> 
> This is not in my queue anywhere, sorry, it must have fallen off.  Can you
> please resend?
> 

Sure, will resend it, thanks.

Best Regards
Sherry

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

end of thread, other threads:[~2023-01-30  5:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28  5:02 [PATCH] tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready Sherry Sun
2023-01-30  3:02 ` Sherry Sun
2023-01-30  5:21   ` gregkh
2023-01-30  5:36     ` Sherry Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.