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

Kenny Ho kho at belairnetworks.com
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>;
};

Kenny

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com] 
Sent: Friday, February 11, 2011 4:57 PM
To: Kenny Ho
Cc: linuxppc-dev at lists.ozlabs.org
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 belairnetworks.com> 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
dts
> 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
interrupt-controller
> declaration?  I noticed the mpc8xxx_gpio driver defined its own
irq_chip
> 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
one.

> 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
can
pass to request_irq().

-Scott



More information about the Linuxppc-dev mailing list