linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Romain Perier <romain.perier@collabora.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Nandor Han <nandor.han@ge.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH 4/7] serial: imx: Simplify DMA disablement
Date: Mon, 3 Jul 2017 08:58:49 +0200	[thread overview]
Message-ID: <20170703065849.u55umof2lkjmgohf@pengutronix.de> (raw)
In-Reply-To: <20170630120446.13994-5-romain.perier@collabora.com>

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/  |

  reply	other threads:[~2017-07-03  6:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 12:04 [PATCH 0/7] serial: imx: various improvements Romain Perier
2017-06-30 12:04 ` [PATCH 1/7] serial: imx: only set DMA rx-ing when DMA starts Romain Perier
2017-07-03  6:48   ` Uwe Kleine-König
2017-07-04  8:55     ` Romain Perier
2017-06-30 12:04 ` [PATCH 2/7] serial: imx: move log from error to debug type Romain Perier
2017-07-03  6:50   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 3/7] serial: imx: init dma_is_{rx|tx}ing variables Romain Perier
2017-06-30 12:13   ` Lothar Waßmann
2017-07-03  6:52     ` Uwe Kleine-König
2017-07-05 10:14       ` Romain Perier
2017-07-05 11:58         ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 4/7] serial: imx: Simplify DMA disablement Romain Perier
2017-07-03  6:58   ` Uwe Kleine-König [this message]
2017-06-30 12:04 ` [PATCH 5/7] serial: imx: umap sg buffers when DMA channel is released Romain Perier
2017-07-03  7:01   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 6/7] serial: imx: update the stop rx,tx procedures Romain Perier
2017-07-03  7:03   ` Uwe Kleine-König
2017-06-30 12:04 ` [PATCH 7/7] serial: imx: Fix imx_shutdown procedure Romain Perier
2017-07-03  7:08   ` Uwe Kleine-König

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=20170703065849.u55umof2lkjmgohf@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nandor.han@ge.com \
    --cc=romain.perier@collabora.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;
as well as URLs for NNTP newsgroup(s).