linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] irqchip: sunxi: Add irq controller driver
Date: Fri, 16 Nov 2012 11:38:05 +0100	[thread overview]
Message-ID: <20121116113805.053eb5fa@skate> (raw)
In-Reply-To: <50A6047A.8090609@free-electrons.com>


On Fri, 16 Nov 2012 10:16:42 +0100, Maxime Ripard wrote:
> >> +asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs)
> >> +{
> >> +	u32 irq, reg;
> >> +	int i;
> >> +
> >> +	for (i = 0; i < 3; i++) {
> >> +		reg = readl(sunxi_irq_base + SUNXI_IRQ_PENDING_REG(i));
> >> +		if (reg == 0)
> >> +			continue;
> >> +		irq = ilog2(reg);
> >> +		break;
> >> +	}
> >> +	irq = irq_find_mapping(sunxi_irq_domain, irq);
> >> +	handle_IRQ(irq, regs);
> > 
> > Why don't you use the interrupt-vector register to get the active
> > interrupt source? Here is my version:
> > 
> > asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs)
> > {
> > 	u32 irq;
> > 
> > 	irq = readl(int_base + SW_INT_VECTOR_REG) >> 2;
> > 	irq = irq_find_mapping(sunxi_vic_domain, irq);
> > 	handle_IRQ(irq, regs);
> > }
> > 
> > I suggest you give it a try.
> 
> It definitely looks nicer. I'll try that and update.

How does this SW_INT_VECTOR_REG behave when there are multiple
interrupts pending? Shouldn't the code be something like:

	do {
		hwirq = readl(int_base + SW_INT_VECTOR_REG) >> 2;
		irq = irq_find_mapping(sunxi_vic_domain, hwirq);
		handle_IRQ(irq, regs);
	} while(hwirq != 0);

Or maybe the != 0 is not the good condition, but the idea is to handle
all pending interrupts. That said, the original code from Maxime was
not doing that as well.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2012-11-16 10:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 22:46 [PATCH 0/6] Add basic support for Allwinner A1X SoCs Maxime Ripard
2012-11-15 22:46 ` [PATCH 1/6] clocksource: sunxi: Add Allwinner A1X Timer Driver Maxime Ripard
2012-11-16 13:13   ` Thomas Petazzoni
2012-11-16 13:14   ` Thomas Petazzoni
2012-11-15 22:46 ` [PATCH 2/6] irqchip: sunxi: Add irq controller driver Maxime Ripard
2012-11-16  7:35   ` Stefan Roese
2012-11-16  9:16     ` Maxime Ripard
2012-11-16 10:38       ` Thomas Petazzoni [this message]
2012-11-16 10:47         ` Stefan Roese
2012-11-15 22:46 ` [PATCH 3/6] ARM: sunxi: Add basic support for Allwinner A1x SoCs Maxime Ripard
2012-11-16  7:42   ` Stefan Roese
2012-11-16  9:17     ` Maxime Ripard
2012-11-15 22:46 ` [PATCH 4/6] ARM: sunxi: Add earlyprintk support Maxime Ripard
2012-11-16  7:47   ` Stefan Roese
2012-11-16  9:20     ` Maxime Ripard
2012-11-16 10:41   ` Thomas Petazzoni
2012-11-15 22:46 ` [PATCH 5/6] ARM: sunxi: Add device tree for the A13 and the Olinuxino board Maxime Ripard
2012-11-16  7:57   ` Stefan Roese
2012-11-16  9:24     ` Maxime Ripard
2012-11-15 22:46 ` [PATCH 6/6] ARM: sunxi: Add entry to MAINTAINERS Maxime Ripard
2012-11-16  7:16 ` [PATCH 0/6] Add basic support for Allwinner A1X SoCs Stefan Roese
2012-11-16  7:51 ` Arnd Bergmann
2012-11-16  9:00   ` Stefan Roese
2012-11-16  9:26   ` Maxime Ripard
2012-11-16 13:11 ` Thomas Petazzoni

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=20121116113805.053eb5fa@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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).