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

4 messages, 2 authors, 2011-02-11 · open the first message on its own page

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

From: Kenny Ho <hidden>
Date: 2011-02-11 19:07:33

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?  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.  Do I need to define my own irq_chip structure for my device
even if I am using one of the hard irq lines?  

 

Regards,

Kenny

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

From: Scott Wood <hidden>
Date: 2011-02-11 21:57:01

On Fri, 11 Feb 2011 14:07:26 -0500
Kenny Ho [off-list ref] 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

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

From: Kenny Ho <hidden>
Date: 2011-02-11 22:15:50

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 =3D "ba,rpcl";
	interrupts =3D <0x7 2 0x8 2>;
	interrupt-parent =3D <&mpic>;
};

Kenny

-----Original Message-----
From: Scott Wood [mailto:scottwood@freescale.com]=20
Sent: Friday, February 11, 2011 4:57 PM
To: Kenny Ho
Cc: linuxppc-dev@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 [off-list ref] wrote:
Hi,
=20
=20
=20
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?=20
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? =20
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

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

From: Scott Wood <hidden>
Date: 2011-02-11 22:19:38

On Fri, 11 Feb 2011 17:15:47 -0500
Kenny Ho [off-list ref] wrote:
Thanks Scott.

Do you know the logic of the hwirq <-> virq mapping?
It's dynamic.
When I was digging into the GPIO interrupt, the hwirq seems to be the same as the virq
The allocator tries that if it's available, but if that virq is already
taken, or is in the legacy ISA region under 16, you'll get a different
number.
(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?
No.
For some reason I am getting 41 for virq... may be I am still
doing something wrong.
It's correct.  Pass what you receive into request_irq().

-Scott
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help