Question on setting up external interrupt for P1020 (MPC8xxx) with device tree

Kenny Ho kho at
Sat Feb 12 09:15:47 EST 2011

Thanks Scott.

Do you know the logic of the hwirq <-> virq mapping?  When I was digging
into the GPIO interrupt, the hwirq seems to be the same as the virq
(both are 47 which is 16 (external interrupt) + 31 (internal interrupt).
If I want to use external interrupt 7 and 8, should the virq also be 7
and 8?  For some reason I am getting 41 for virq... may be I am still
doing something wrong.

This is the node definition I created:
rpcl {
	compatible = "ba,rpcl";
	interrupts = <0x7 2 0x8 2>;
	interrupt-parent = <&mpic>;


-----Original Message-----
From: Scott Wood [mailto:scottwood at] 
Sent: Friday, February 11, 2011 4:57 PM
To: Kenny Ho
Cc: linuxppc-dev at
Subject: Re: Question on setting up external interrupt for P1020
(MPC8xxx) with device tree

On Fri, 11 Feb 2011 14:07:26 -0500
Kenny Ho <kho at> wrote:

> Hi,
> I am trying to write a device driver that uses an external interrupt
> (one of the 16 irq lines) for the Freescale P1020 processor and I hope
> some of you can help.  Am I suppose to setup a separate node in the
> and look for that node in my driver to setup the interrupt? 

Ideally, yes.  It's good to describe your device with a node even if it
doesn't have interrupts.

> Or does the > dts interrupt declaration belong to the
> declaration?  I noticed the mpc8xxx_gpio driver defined its own
> but I thought that may be because each gpio pin can trigger an
> interrupt.

Right, it's because gpio is an interrupt controller, not just a user of

> Do I need to define my own irq_chip structure for my device
> even if I am using one of the hard irq lines?  

No.  If the device's node describes the interrupt correctly, you can use
irq_of_parse_and_map() on the device node to get a virtual irq that you
pass to request_irq().


More information about the Linuxppc-dev mailing list