linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Hooking an IRQ on a modified mpc8349emitx board
@ 2008-09-03 22:55 Oscar Takeshita
  2008-09-04 14:44 ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Oscar Takeshita @ 2008-09-03 22:55 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

I've been trying to hook an IRQ on a modified mpc8349emitx board without 
success.

The IRQ is hooked physically to IRQ1/GPIO2[13] on the mpc8349e. No other 
devices are
tied to this pin.

I'm using uboot 1.2.0 and kernel 2.6.22.19.

Do I need to have a dts entry for this interrupt in order to make
request_irq() succeed?

How can I find the IRQ number? I tried probe_irq_on/off unfortunately it 
did not work.
Would it be MPC83xx_IRQ_EXT1 in arch/powerpc/include/asm/mpc83xx.h ?

I'm new doing kernel work. Any hints appreciated.

Oscar

 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hooking an IRQ on a modified mpc8349emitx board
  2008-09-03 22:55 Hooking an IRQ on a modified mpc8349emitx board Oscar Takeshita
@ 2008-09-04 14:44 ` Scott Wood
  2008-09-04 15:21   ` Gary Thomas
  2008-09-04 18:44   ` Oscar Takeshita
  0 siblings, 2 replies; 4+ messages in thread
From: Scott Wood @ 2008-09-04 14:44 UTC (permalink / raw)
  To: Oscar Takeshita; +Cc: linuxppc-dev

On Wed, Sep 03, 2008 at 03:55:41PM -0700, Oscar Takeshita wrote:
> I've been trying to hook an IRQ on a modified mpc8349emitx board without 
> success.
> 
> The IRQ is hooked physically to IRQ1/GPIO2[13] on the mpc8349e. No other 
> devices are
> tied to this pin.
> 
> I'm using uboot 1.2.0 and kernel 2.6.22.19.
> 
> Do I need to have a dts entry for this interrupt in order to make
> request_irq() succeed?
> 
> How can I find the IRQ number? I tried probe_irq_on/off unfortunately it 
> did not work.
> Would it be MPC83xx_IRQ_EXT1 in arch/powerpc/include/asm/mpc83xx.h ?
> 
> I'm new doing kernel work. Any hints appreciated.

You need to describe the IRQ in a device tree node and use
irq_of_parse_and_map().  request_irq() takes virtual IRQ numbers.

Maybe we should put together an arch/powerpc FAQ...

-Scott

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hooking an IRQ on a modified mpc8349emitx board
  2008-09-04 14:44 ` Scott Wood
@ 2008-09-04 15:21   ` Gary Thomas
  2008-09-04 18:44   ` Oscar Takeshita
  1 sibling, 0 replies; 4+ messages in thread
From: Gary Thomas @ 2008-09-04 15:21 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Scott Wood wrote:
> On Wed, Sep 03, 2008 at 03:55:41PM -0700, Oscar Takeshita wrote:
>> I've been trying to hook an IRQ on a modified mpc8349emitx board without 
>> success.
>>
>> The IRQ is hooked physically to IRQ1/GPIO2[13] on the mpc8349e. No other 
>> devices are
>> tied to this pin.
>>
>> I'm using uboot 1.2.0 and kernel 2.6.22.19.
>>
>> Do I need to have a dts entry for this interrupt in order to make
>> request_irq() succeed?
>>
>> How can I find the IRQ number? I tried probe_irq_on/off unfortunately it 
>> did not work.
>> Would it be MPC83xx_IRQ_EXT1 in arch/powerpc/include/asm/mpc83xx.h ?
>>
>> I'm new doing kernel work. Any hints appreciated.
> 
> You need to describe the IRQ in a device tree node and use
> irq_of_parse_and_map().  request_irq() takes virtual IRQ numbers.
> 
> Maybe we should put together an arch/powerpc FAQ...

That would be wonderful :-)  This could help many [of us] over these
initial speed-bumps.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hooking an IRQ on a modified mpc8349emitx board
  2008-09-04 14:44 ` Scott Wood
  2008-09-04 15:21   ` Gary Thomas
@ 2008-09-04 18:44   ` Oscar Takeshita
  1 sibling, 0 replies; 4+ messages in thread
From: Oscar Takeshita @ 2008-09-04 18:44 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Thanks Scott,

It is hooked and alive! Your couple of lines guided me through. Here's 
the outline of what I did after looking
at other powerpc drivers and the ePAPR document from Power.org:

1. Assumed that MPC83xx_IRQ_EXT1 (0x11 without offset) corresponds to IRQ1.
2. Created a node in my dts that looks like:

mydevice@40000 {
     device_type = "network";
     interrupts = <11 8>;
     interrupt-parent = < &ipic >;
}

3. On my kernel device driver I have the following outline:

struct device_node *np;
int irq;
if ((np = of_find_node_by_name(NULL, "mydevice")) == NULL) {
        printk(KERN_ERR "Can't find my device node\n");
        irq = -1;
}
else
        irq = irq_of_parse_and_map(np,0);


4. Ready to use request_irq() on irq!

Thanks,

Oscar

Scott Wood wrote:
> On Wed, Sep 03, 2008 at 03:55:41PM -0700, Oscar Takeshita wrote:
>   
>> I've been trying to hook an IRQ on a modified mpc8349emitx board without 
>> success.
>>
>> The IRQ is hooked physically to IRQ1/GPIO2[13] on the mpc8349e. No other 
>> devices are
>> tied to this pin.
>>
>> I'm using uboot 1.2.0 and kernel 2.6.22.19.
>>
>> Do I need to have a dts entry for this interrupt in order to make
>> request_irq() succeed?
>>
>> How can I find the IRQ number? I tried probe_irq_on/off unfortunately it 
>> did not work.
>> Would it be MPC83xx_IRQ_EXT1 in arch/powerpc/include/asm/mpc83xx.h ?
>>
>> I'm new doing kernel work. Any hints appreciated.
>>     
>
> You need to describe the IRQ in a device tree node and use
> irq_of_parse_and_map().  request_irq() takes virtual IRQ numbers.
>
> Maybe we should put together an arch/powerpc FAQ...
>
> -Scott
>
>
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-04 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 22:55 Hooking an IRQ on a modified mpc8349emitx board Oscar Takeshita
2008-09-04 14:44 ` Scott Wood
2008-09-04 15:21   ` Gary Thomas
2008-09-04 18:44   ` Oscar Takeshita

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).