Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736828

[PATCH v3 3/6] serial: imx: Simplify DMA disablement

From Martyn Welch <martyn.welch@collabora.co.uk>
Newsgroups linux.kernel
Subject [PATCH v3 3/6] serial: imx: Simplify DMA disablement
Date 2017-09-21 18:20 +0200
Message-ID <uscmK-3iX-33@gated-at.bofh.it> (permalink)
References <uscmJ-3iX-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Nandor Han <nandor.han@ge.com>

This commits simplify the function imx_disable_dma() by moving
the code for disabling RX and TX DMAs to dedicated functions.
This is a preparation for the next commit.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---
 drivers/tty/serial/imx.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 7835279..2fb3210 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -350,6 +350,24 @@ static void imx_port_rts_auto(struct imx_port *sport, unsigned long *ucr2)
 	*ucr2 |= UCR2_CTSC;
 }
 
+static void imx_stop_tx_dma(struct imx_port *sport)
+{
+	unsigned long temp;
+
+	temp = readl(sport->port.membase + UCR1);
+	temp &= ~UCR1_TDMAEN;
+	writel(temp, sport->port.membase + UCR1);
+}
+
+static void imx_stop_rx_dma(struct imx_port *sport)
+{
+	unsigned long temp;
+
+	temp = readl(sport->port.membase + UCR1);
+	temp &= ~(UCR1_RDMAEN | UCR1_ATDMAEN);
+	writel(temp, sport->port.membase + UCR1);
+}
+
 /*
  * interrupts disabled on entry
  */
@@ -1217,13 +1235,8 @@ static void imx_enable_dma(struct imx_port *sport)
 
 static void imx_disable_dma(struct imx_port *sport)
 {
-	unsigned long temp;
-
-	/* clear UCR1 */
-	temp = readl(sport->port.membase + UCR1);
-	temp &= ~(UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN);
-	writel(temp, sport->port.membase + UCR1);
-
+	imx_stop_rx_dma(sport);
+	imx_stop_tx_dma(sport);
 	imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
 
 	sport->dma_is_enabled = 0;
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/6] serial: imx: various improvements Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
  [PATCH v3 3/6] serial: imx: Simplify DMA disablement Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
  [PATCH v3 6/6] serial: imx: Fix imx_shutdown procedure Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
  [PATCH v3 4/6] serial: imx: unmap sg buffers when DMA channel is released Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:20 +0200
    Re: [PATCH v3 4/6] serial: imx: unmap sg buffers when DMA channel is  released Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-09-21 20:30 +0200
  [PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from imx_disable_dma Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 18:30 +0200
    Re: [PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from  imx_disable_dma Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-09-21 20:30 +0200
      Re: [PATCH v3 1/6] serial: imx: remove CTSC and CTS handling from  imx_disable_dma Martyn Welch <martyn.welch@collabora.co.uk> - 2017-09-21 21:20 +0200

csiph-web