[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vcv9Uicn=auPLaSymYDHgWrd6-KnFN=GkHL-5MZQicYFg@mail.gmail.com>
Date: Mon, 3 Jun 2013 13:07:44 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Xiang Wang <wangxfdu@...il.com>
Cc: Dan Williams <djbw@...com>, Vinod Koul <vinod.koul@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
cxie4@...vell.com, Xiang Wang <wangx@...vell.com>
Subject: Re: [PATCH 2/2] dma: mmp_pdma: clear DRCMR when free a phy channel
On Mon, Jun 3, 2013 at 11:02 AM, Xiang Wang <wangxfdu@...il.com> wrote:
> From: Xiang Wang <wangx@...vell.com>
>
> In mmp pdma, phy channels are allocated/freed dynamically.
> The mapping from DMA request to DMA channel number in DRCMR
> should be cleared when a phy channel is freed. Otherwise
> conflicts will happen when:
> 1. A is using channel 2 and free it after finished, but A
> still maps to channel 2 in DRCMR of A.
> 2. Now another one B gets channel 2. So B maps to channel 2
> too in DRCMR of B.
> In the datasheet, it is described that "Do not map two active
> requests to the same channel since it produces unpredictable
> results" and we can observe that during test.
> --- a/drivers/dma/mmp_pdma.c
> +++ b/drivers/dma/mmp_pdma.c
> @@ -252,9 +252,15 @@ static void free_phy(struct mmp_pdma_chan *pchan)
> {
> struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
> unsigned long flags;
> + u32 reg;
May be empty line here (and maybe even in previous patch)?
> if (!pchan->phy)
> return;
>
> + /* clear the channel mapping in DRCMR */
> + reg = pchan->phy->vchan->drcmr;
> + reg = (((reg) < 64) ? 0x0100 : 0x1100) + (((reg) & 0x3f) << 2);
Too many braces.
It is not a macro, you don't need to embrace reg.
> + writel(0, pchan->phy->base + reg);
> +
> spin_lock_irqsave(&pdev->phy_lock, flags);
> pchan->phy->vchan = NULL;
> pchan->phy = NULL;
--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists