mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Robin Gong <b38343@freescale.com>
Cc: dan.j.williams@intel.com, vinod.koul@intel.com,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] dma: imx-sdma: switch to dynamic context mode after script loaded
Date: Thu, 22 Jan 2015 08:28:39 +0100	[thread overview]
Message-ID: <20150122072839.GO12209@pengutronix.de> (raw)
In-Reply-To: <1421899177-30406-1-git-send-email-b38343@freescale.com>

On Thu, Jan 22, 2015 at 11:59:37AM +0800, Robin Gong wrote:
> Below comments got from Page4724 of Reference Manual of i.mx6q:
> http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf
> 
> --"Static context mode should be used for the first channel called
> after reset to ensure that the all context RAM for that channel is
> initialized during the context SAVE phase when the channel is
> done or yields. Subsequent calls to the same channel or
> different channels may use any of the dynamic context modes.
> This will ensure that all context locations for the bootload
> channel are initialized, and prevent undefined values in context
> RAM from being loaded during the context restore if the
> channel is re-started later"
> 
> Unfortunately, the rule was broken by commit(5b28aa319bba96987316425a1131813d87cbab35)
> .This patch just take them back.
> 
> Signed-off-by: Robin Gong <b38343@freescale.com>
> ---
>  drivers/dma/imx-sdma.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index d0df198..d84b7a8 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -330,6 +330,8 @@ struct sdma_engine {
>  	const struct sdma_driver_data	*drvdata;
>  };
>  
> +static bool channel0_first;

Nah, don't break the multi instance capability of drivers without a
reason. Don't use global static variables in driver context.

> +
>  static struct sdma_driver_data sdma_imx31 = {
>  	.chnenbl0 = SDMA_CHNENBL0_IMX31,
>  	.num_events = 32,
> @@ -531,6 +533,12 @@ static int sdma_run_channel0(struct sdma_engine *sdma)
>  		dev_err(sdma->dev, "Timeout waiting for CH0 ready\n");
>  	}
>  
> +	if (!channel0_first) {
> +		/* Set bits of CONFIG register with given context switching mode */
> +		writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
> +		channel0_first = true;
> +	}

You don't need a variable. How about:

	if (readl(sdma->regs + SDMA_H_CONFIG) == 0)
		writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

      reply	other threads:[~2015-01-22  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  3:59 Robin Gong
2015-01-22  7:28 ` Sascha Hauer [this message]

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=20150122072839.GO12209@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=b38343@freescale.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.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

all inboxes | Powered by JetHome®