From: "G, Manjunath Kondaiah" <manjugk@ti.com>
To: Adrian Hunter <adrian.hunter@nokia.com>
Cc: Tony Lindgren <tony@atomide.com>,
Santosh Shilimkar <Santosh.shilimkar@ti.com>,
linux-omap Mailing List <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 1/2] OMAP: DMA: prevent races while setting M idle mode to nostandby
Date: Thu, 2 Dec 2010 00:41:54 +0530 [thread overview]
Message-ID: <20101201191154.GB8149@GLPP-machine> (raw)
In-Reply-To: <20101130132347.13286.40388.sendpatchset@ahunter-work.research.nokia.com>
Hi Adrian,
* Adrian Hunter <adrian.hunter@nokia.com> [2010-11-30 15:23:47 +0200]:
> From 8c0f4490d93b67326ff24f6ce1c7e925b08d96b3 Mon Sep 17 00:00:00 2001
> From: Adrian Hunter <adrian.hunter@nokia.com>
> Date: Mon, 22 Nov 2010 11:32:48 +0200
> Subject: [PATCH 1/2] OMAP: DMA: prevent races while setting M idle mode to nostandby
>
> In a couple of OMAP errata cases, sDMA M idle mode must be
> set temporarily to nostandby. If two DMA users were to do
> that at the same time, a race condition would arise.
> Prevent that by using a spin lock and counting up/down the
> number of times nostandby is set/reset.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---
> arch/arm/plat-omap/dma.c | 59 ++++++++++++++++++++++++++++++++++-----------
> 1 files changed, 44 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
> index a863f55..6158c99 100644
> --- a/arch/arm/plat-omap/dma.c
> +++ b/arch/arm/plat-omap/dma.c
> @@ -139,6 +139,9 @@ static spinlock_t dma_chan_lock;
> static struct omap_dma_lch *dma_chan;
> static void __iomem *omap_dma_base;
>
> +static u32 midlemode_saved;
> +static int midlemode_save_cnt;
> +
> static const u8 omap1_dma_irq[OMAP1_LOGICAL_DMA_CH_COUNT] = {
> INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3,
> INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7,
> @@ -1016,6 +1019,41 @@ void omap_start_dma(int lch)
> }
> EXPORT_SYMBOL(omap_start_dma);
>
> +static void midlemode_nostandby(void)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&dma_chan_lock, flags);
> + if (!midlemode_save_cnt) {
> + u32 l;
> +
> + midlemode_saved = dma_read(OCP_SYSCONFIG);
> + l = midlemode_saved;
> + l &= ~DMA_SYSCONFIG_MIDLEMODE_MASK;
> + l |= DMA_SYSCONFIG_MIDLEMODE(DMA_IDLEMODE_NO_IDLE);
> + dma_write(l, OCP_SYSCONFIG);
> + }
> + midlemode_save_cnt += 1;
> + spin_unlock_irqrestore(&dma_chan_lock, flags);
The latest DMA hwmod patch series is already taken care of this
issue through the API's:
https://patchwork.kernel.org/patch/372231/
-Manjunath
[...]
next prev parent reply other threads:[~2010-12-01 19:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 13:23 [PATCH 0/2] Minor DMA fixes Adrian Hunter
2010-11-30 13:23 ` [PATCH 1/2] OMAP: DMA: prevent races while setting M idle mode to nostandby Adrian Hunter
2010-11-30 14:24 ` Santosh Shilimkar
2010-12-01 12:21 ` Peter Ujfalusi
2010-12-01 19:11 ` G, Manjunath Kondaiah [this message]
2010-11-30 13:23 ` [PATCH 2/2] OMAP: DMA: clear interrupt status correctly Adrian Hunter
2010-11-30 14:25 ` Santosh Shilimkar
2010-12-21 20:29 ` Tony Lindgren
2011-01-05 9:58 ` Adrian Hunter
2011-01-05 17:27 ` Kevin Hilman
2011-01-19 10:24 ` [PATCH] " Adrian Hunter
2011-01-19 22:23 ` Tony Lindgren
2011-01-19 22:44 ` Tony Lindgren
2011-01-20 3:44 ` G, Manjunath Kondaiah
2011-01-20 11:10 ` Adrian Hunter
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=20101201191154.GB8149@GLPP-machine \
--to=manjugk@ti.com \
--cc=Santosh.shilimkar@ti.com \
--cc=adrian.hunter@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.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