devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Andy Shevchenko
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Emilio Lopez <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH 4/5] DMA: sun6i: Add driver for the Allwinner A31 DMA controller
Date: Fri, 28 Feb 2014 15:27:53 +0100	[thread overview]
Message-ID: <20140228142753.GQ607@lukather> (raw)
In-Reply-To: <1393594391.28803.79.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2726 bytes --]

On Fri, Feb 28, 2014 at 03:33:11PM +0200, Andy Shevchenko wrote:
> On Fri, 2014-02-28 at 11:36 +0100, Maxime Ripard wrote:
> > Hi Andy,
> > 
> > On Tue, Feb 25, 2014 at 01:28:15PM +0200, Andy Shevchenko wrote:
> > > > +static irqreturn_t sun6i_dma_interrupt(int irq, void *dev_id)
> > > > +{
> > > > +	struct sun6i_dma_dev *sdev = (struct sun6i_dma_dev *)dev_id;
> > > > +	struct sun6i_vchan *vchan;
> > > > +	struct sun6i_pchan *pchan;
> > > > +	int i, j, ret = 0;
> > > > +	u32 status;
> > > > +
> > > > +	for (i = 0; i < 2; i++) {
> > > > +		status = readl(sdev->base + DMA_IRQ_STAT(i));
> > > > +		if (!status) {
> > > > +			ret |= IRQ_NONE;
> > > 
> > > Maybe move this to definition block.
> > > 
> > > > +			continue;
> > > > +		}
> > > > +
> > > > +		dev_dbg(sdev->slave.dev, "DMA irq status %s: 0x%x\n",
> > > > +			i ? "high" : "low", status);
> > > > +
> > > > +		writel(status, sdev->base + DMA_IRQ_STAT(i));
> > > > +
> > > > +		for (j = 0; (j < 8) && status; j++) {
> > > > +			if (status & DMA_IRQ_QUEUE) {
> > > > +				pchan = sdev->pchans + j;
> > > > +				vchan = pchan->vchan;
> > > > +
> > > > +				if (vchan) {
> > > > +					unsigned long flags;
> > > > +
> > > > +					spin_lock_irqsave(&vchan->vc.lock,
> > > > +							  flags);
> > > > +					vchan_cookie_complete(&pchan->desc->vd);
> > > > +					pchan->done = pchan->desc;
> > > > +					spin_unlock_irqrestore(&vchan->vc.lock,
> > > > +							       flags);
> > > > +				}
> > > > +			}
> > > > +
> > > > +			status = status >> 4;
> > > > +		}
> > > > +
> > > > +		ret |= IRQ_HANDLED;
> > > 
> > > In case one is handled, another is not, what you have to do?
> > 
> > The interrupt status is split across two registers. In the case where
> > one of the two register reports an interrupt, we still have to handle
> > our interrupt, we actually did, so we have to return IRQ_HANDLED.
> 
> You removed the code below this assignment, but if I remember correctly
> you check for exact value there.
> 
> In case of one is not handled and the other is handled you will have ret
> = IRQ_HANDLED | IRQ_NONE. Thus, your following code will not be
> executed. Is it by design?

The code that got removed was

if (ret == IRQ_HANDLED)
   tasklet_schedule()

return ret;

The only thing that wouldn't have been executed if we had no
interrupts to report was the tasklet_schedule.

This has lightly changed though in the v2, thanks to your comments.

I don't have the | anymore, and call tasklet_schedule directly in the
loop.

I'll send the v2 in a short while.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-02-28 14:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 16:22 [PATCH 0/5] Add support for the Allwinner A31 DMA Controller Maxime Ripard
     [not found] ` <1393258967-4843-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-24 16:22   ` [PATCH 1/5] clk: sun6i: Protect CPU clock Maxime Ripard
     [not found]     ` <1393258967-4843-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-24 16:30       ` Russell King - ARM Linux
     [not found]         ` <20140224163034.GN21483-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-02-24 23:38           ` Emilio López
     [not found]             ` <530BD804.5090806-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>
2014-02-25  0:01               ` Russell King - ARM Linux
     [not found]                 ` <20140225000154.GR21483-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-02-25  0:30                   ` Emilio López
2014-02-24 16:22   ` [PATCH 2/5] clk: sun6i: Reparent AHB clock on PLL6 Maxime Ripard
2014-02-24 16:22   ` [PATCH 3/5] clk: sun6i: Protect SDRAM gating bit Maxime Ripard
2014-02-24 16:22   ` [PATCH 4/5] DMA: sun6i: Add driver for the Allwinner A31 DMA controller Maxime Ripard
     [not found]     ` <1393258967-4843-5-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-25 11:28       ` Andy Shevchenko
     [not found]         ` <1393327695.28803.25.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-02-28 10:36           ` Maxime Ripard
2014-02-28 13:33             ` Andy Shevchenko
     [not found]               ` <1393594391.28803.79.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-02-28 14:27                 ` Maxime Ripard [this message]
2014-02-24 16:22   ` [PATCH 5/5] ARM: sun6i: dt: Add A31 DMA controller to DTSI Maxime Ripard

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=20140228142753.GQ607@lukather \
    --to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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).