Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1678739 > unrolled thread
| Started by | Romain Perier <romain.perier@collabora.com> |
|---|---|
| First post | 2017-06-30 14:10 +0200 |
| Last post | 2017-07-03 09:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/7] serial: imx: Simplify DMA disablement Romain Perier <romain.perier@collabora.com> - 2017-06-30 14:10 +0200
Re: [PATCH 4/7] serial: imx: Simplify DMA disablement Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-07-03 09:10 +0200
| From | Romain Perier <romain.perier@collabora.com> |
|---|---|
| Date | 2017-06-30 14:10 +0200 |
| Subject | [PATCH 4/7] serial: imx: Simplify DMA disablement |
| Message-ID | <tY2Ui-5iT-15@gated-at.bofh.it> |
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.
Also move away CTSC and CTS as this is not related to DMA.
Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
drivers/tty/serial/imx.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 81fb413..e8cf7cf 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1208,6 +1208,24 @@ static int imx_uart_dma_init(struct imx_port *sport)
return ret;
}
+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);
+}
+
static void imx_enable_dma(struct imx_port *sport)
{
unsigned long temp;
@@ -1233,17 +1251,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);
-
- /* clear UCR2 */
- temp = readl(sport->port.membase + UCR2);
- temp &= ~(UCR2_CTSC | UCR2_CTS | UCR2_ATEN);
- writel(temp, sport->port.membase + UCR2);
+ imx_stop_rx_dma(sport);
+ imx_stop_tx_dma(sport);
imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
|---|---|
| Date | 2017-07-03 09:10 +0200 |
| Message-ID | <tZ3ED-6bp-21@gated-at.bofh.it> |
| In reply to | #1678739 |
On Fri, Jun 30, 2017 at 02:04:43PM +0200, Romain Perier wrote:
> 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.
I'd point out there that this prepares the next commit because in the
current state I'd prefer just improved comments.
> Also move away CTSC and CTS as this is not related to DMA.
Hmm, maybe this is related to the rs485 breakage we're seeing and
deserves a separate commit?
This also has the advantage that the refactoring change is semantically
a no-op.
> Signed-off-by: Nandor Han <nandor.han@ge.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
> drivers/tty/serial/imx.c | 31 ++++++++++++++++++++-----------
> 1 file changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 81fb413..e8cf7cf 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1208,6 +1208,24 @@ static int imx_uart_dma_init(struct imx_port *sport)
> return ret;
> }
>
> +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);
> +}
> +
> static void imx_enable_dma(struct imx_port *sport)
> {
> unsigned long temp;
> @@ -1233,17 +1251,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);
> -
> - /* clear UCR2 */
> - temp = readl(sport->port.membase + UCR2);
> - temp &= ~(UCR2_CTSC | UCR2_CTS | UCR2_ATEN);
You also dropped clearing ATEN without mentioning that in the commit
log. Is this done on purpose?
> - writel(temp, sport->port.membase + UCR2);
> + imx_stop_rx_dma(sport);
> + imx_stop_tx_dma(sport);
>
> imx_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web