All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/1] tty: serial: imx: remove imx_disable_rx_int
@ 2017-11-06 19:46 ` Troy Kisky
  0 siblings, 0 replies; 4+ messages in thread
From: Troy Kisky @ 2017-11-06 19:46 UTC (permalink / raw)
  To: gregkh, nandor.han
  Cc: Troy Kisky, linux-serial, u.kleine-koenig, fabio.estevam,
	linux-arm-kernel, l.stach

Since imx_disable_rx_int is only called by imx_startup,
let's integrate it into that function.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
v2: new patch
v3: rebased on tty-next
---
 drivers/tty/serial/imx.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 1b04ef5925ef..9923b57fa60d 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -712,25 +712,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void imx_disable_rx_int(struct imx_port *sport)
-{
-	unsigned long temp;
-
-	/* disable the receiver ready and aging timer interrupts */
-	temp = readl(sport->port.membase + UCR1);
-	temp &= ~(UCR1_RRDYEN);
-	writel(temp, sport->port.membase + UCR1);
-
-	temp = readl(sport->port.membase + UCR2);
-	temp &= ~(UCR2_ATEN);
-	writel(temp, sport->port.membase + UCR2);
-
-	/* disable the rx errors interrupts */
-	temp = readl(sport->port.membase + UCR4);
-	temp &= ~UCR4_OREN;
-	writel(temp, sport->port.membase + UCR4);
-}
-
 static void clear_rx_errors(struct imx_port *sport);
 
 /*
@@ -1261,18 +1242,21 @@ static int imx_startup(struct uart_port *port)
 	if (sport->dma_is_inited && !sport->dma_is_enabled)
 		imx_enable_dma(sport);
 
-	temp = readl(sport->port.membase + UCR1);
-	temp |= UCR1_RRDYEN | UCR1_UARTEN;
+	temp = readl(sport->port.membase + UCR1) & ~UCR1_RRDYEN;
+	if (!sport->dma_is_enabled)
+		temp |= UCR1_RRDYEN;
+	temp |= UCR1_UARTEN;
 	if (sport->have_rtscts)
 			temp |= UCR1_RTSDEN;
 
 	writel(temp, sport->port.membase + UCR1);
 
-	temp = readl(sport->port.membase + UCR4);
-	temp |= UCR4_OREN;
+	temp = readl(sport->port.membase + UCR4) & ~UCR4_OREN;
+	if (!sport->dma_is_enabled)
+		temp |= UCR4_OREN;
 	writel(temp, sport->port.membase + UCR4);
 
-	temp = readl(sport->port.membase + UCR2);
+	temp = readl(sport->port.membase + UCR2) & ~UCR2_ATEN;
 	temp |= (UCR2_RXEN | UCR2_TXEN);
 	if (!sport->have_rtscts)
 		temp |= UCR2_IRTS;
@@ -1306,10 +1290,8 @@ static int imx_startup(struct uart_port *port)
 	 * In our iMX53 the average delay for the first reception dropped from
 	 * approximately 35000 microseconds to 1000 microseconds.
 	 */
-	if (sport->dma_is_enabled) {
-		imx_disable_rx_int(sport);
+	if (sport->dma_is_enabled)
 		start_rx_dma(sport);
-	}
 
 	spin_unlock_irqrestore(&sport->port.lock, flags);
 
-- 
2.11.0

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

* [PATCH v3 1/1] tty: serial: imx: remove imx_disable_rx_int
@ 2017-11-06 19:46 ` Troy Kisky
  0 siblings, 0 replies; 4+ messages in thread
From: Troy Kisky @ 2017-11-06 19:46 UTC (permalink / raw)
  To: linux-arm-kernel

Since imx_disable_rx_int is only called by imx_startup,
let's integrate it into that function.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
v2: new patch
v3: rebased on tty-next
---
 drivers/tty/serial/imx.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 1b04ef5925ef..9923b57fa60d 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -712,25 +712,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void imx_disable_rx_int(struct imx_port *sport)
-{
-	unsigned long temp;
-
-	/* disable the receiver ready and aging timer interrupts */
-	temp = readl(sport->port.membase + UCR1);
-	temp &= ~(UCR1_RRDYEN);
-	writel(temp, sport->port.membase + UCR1);
-
-	temp = readl(sport->port.membase + UCR2);
-	temp &= ~(UCR2_ATEN);
-	writel(temp, sport->port.membase + UCR2);
-
-	/* disable the rx errors interrupts */
-	temp = readl(sport->port.membase + UCR4);
-	temp &= ~UCR4_OREN;
-	writel(temp, sport->port.membase + UCR4);
-}
-
 static void clear_rx_errors(struct imx_port *sport);
 
 /*
@@ -1261,18 +1242,21 @@ static int imx_startup(struct uart_port *port)
 	if (sport->dma_is_inited && !sport->dma_is_enabled)
 		imx_enable_dma(sport);
 
-	temp = readl(sport->port.membase + UCR1);
-	temp |= UCR1_RRDYEN | UCR1_UARTEN;
+	temp = readl(sport->port.membase + UCR1) & ~UCR1_RRDYEN;
+	if (!sport->dma_is_enabled)
+		temp |= UCR1_RRDYEN;
+	temp |= UCR1_UARTEN;
 	if (sport->have_rtscts)
 			temp |= UCR1_RTSDEN;
 
 	writel(temp, sport->port.membase + UCR1);
 
-	temp = readl(sport->port.membase + UCR4);
-	temp |= UCR4_OREN;
+	temp = readl(sport->port.membase + UCR4) & ~UCR4_OREN;
+	if (!sport->dma_is_enabled)
+		temp |= UCR4_OREN;
 	writel(temp, sport->port.membase + UCR4);
 
-	temp = readl(sport->port.membase + UCR2);
+	temp = readl(sport->port.membase + UCR2) & ~UCR2_ATEN;
 	temp |= (UCR2_RXEN | UCR2_TXEN);
 	if (!sport->have_rtscts)
 		temp |= UCR2_IRTS;
@@ -1306,10 +1290,8 @@ static int imx_startup(struct uart_port *port)
 	 * In our iMX53 the average delay for the first reception dropped from
 	 * approximately 35000 microseconds to 1000 microseconds.
 	 */
-	if (sport->dma_is_enabled) {
-		imx_disable_rx_int(sport);
+	if (sport->dma_is_enabled)
 		start_rx_dma(sport);
-	}
 
 	spin_unlock_irqrestore(&sport->port.lock, flags);
 
-- 
2.11.0

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

* Re: [PATCH v3 1/1] tty: serial: imx: remove imx_disable_rx_int
  2017-11-06 19:46 ` Troy Kisky
@ 2017-11-07  9:50   ` Uwe Kleine-König
  -1 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2017-11-07  9:50 UTC (permalink / raw)
  To: Troy Kisky
  Cc: gregkh, linux-serial, nandor.han, fabio.estevam,
	linux-arm-kernel, l.stach

On Mon, Nov 06, 2017 at 12:46:10PM -0700, Troy Kisky wrote:
> Since imx_disable_rx_int is only called by imx_startup,
> let's integrate it into that function.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> v2: new patch
> v3: rebased on tty-next
> ---
>  drivers/tty/serial/imx.c | 36 +++++++++---------------------------
>  1 file changed, 9 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 1b04ef5925ef..9923b57fa60d 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -712,25 +712,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void imx_disable_rx_int(struct imx_port *sport)
> -{
> -	unsigned long temp;
> -
> -	/* disable the receiver ready and aging timer interrupts */
> -	temp = readl(sport->port.membase + UCR1);
> -	temp &= ~(UCR1_RRDYEN);
> -	writel(temp, sport->port.membase + UCR1);
> -
> -	temp = readl(sport->port.membase + UCR2);
> -	temp &= ~(UCR2_ATEN);

ATEN is never set in the driver, right? That's the only one I had to
check with the imx driver open in my editor, so maybe point out that one
in the commit log?

Other than that you change looks fine.

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* [PATCH v3 1/1] tty: serial: imx: remove imx_disable_rx_int
@ 2017-11-07  9:50   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2017-11-07  9:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 06, 2017 at 12:46:10PM -0700, Troy Kisky wrote:
> Since imx_disable_rx_int is only called by imx_startup,
> let's integrate it into that function.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> v2: new patch
> v3: rebased on tty-next
> ---
>  drivers/tty/serial/imx.c | 36 +++++++++---------------------------
>  1 file changed, 9 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 1b04ef5925ef..9923b57fa60d 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -712,25 +712,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static void imx_disable_rx_int(struct imx_port *sport)
> -{
> -	unsigned long temp;
> -
> -	/* disable the receiver ready and aging timer interrupts */
> -	temp = readl(sport->port.membase + UCR1);
> -	temp &= ~(UCR1_RRDYEN);
> -	writel(temp, sport->port.membase + UCR1);
> -
> -	temp = readl(sport->port.membase + UCR2);
> -	temp &= ~(UCR2_ATEN);

ATEN is never set in the driver, right? That's the only one I had to
check with the imx driver open in my editor, so maybe point out that one
in the commit log?

Other than that you change looks fine.

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2017-11-07  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 19:46 [PATCH v3 1/1] tty: serial: imx: remove imx_disable_rx_int Troy Kisky
2017-11-06 19:46 ` Troy Kisky
2017-11-07  9:50 ` Uwe Kleine-König
2017-11-07  9:50   ` Uwe Kleine-König

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.