linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: bwarren@qstreams.com
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: 83xx: requesting external interrupts
Date: Fri, 11 May 2007 15:15:02 -0500	[thread overview]
Message-ID: <C873B42C-ABE7-4265-9EF5-15EBA9525324@kernel.crashing.org> (raw)
In-Reply-To: <1178892748.9018.13.camel@saruman.qstreams.net>


On May 11, 2007, at 9:12 AM, Ben Warren wrote:

> Alex,
>
> On Fri, 2007-05-11 at 10:29 +0100, Alex Zeffertt wrote:
>> Hi,
>>
>> Thanks for your reply Ben, but I think my problem is slightly  
>> different.  It is not
>> that the sense (high/low/rising/falling) of the interrupt is  
>> wrong, but that the
>> kernel will not allow me to register the handler.
>>
>> I've changed my code to:
>>
>>      struct device_node *np = of_find_node_by_type(NULL, "ipic");
>>      struct irq_host *host = irq_find_host(np);
>>      int rc;
>>
>>      unsigned int virq = irq_find_mapping(host, 5);
>>      set_irq_type(virq, IRQ_TYPE_EDGE_FALLING);
>>      rc = request_irq(virq, mpc832xemds_phy_interrupt,  
>> IRQF_SHARED, "pm5384", dev);
>>
>> but the last line still returns a non-zero error code.
>>
>> Is there a new way of requesting to install a handler for external  
>> interrupts?  I
>> can't find any powerpc examples in the kernel tree....
>>
> Sorry, I missed a bit of the implementation.  You need to register the
> IRQs before attempting to attach an ISR. Here's some sample code that
> works for me.  You'll probably need different IRQs, based on what your
> board does:
>
> /* All external IRQs + Generic timer IRQs must be initialized by  
> BSP */
> const int bsp_irqs[] = {48, 17, 18, 19, 20, 21, 22, 23, 90, 78, 84,  
> 72};
>
> Add this to your BSP IRQ init code (void __init xxx_init_IRQs())
>
>
> 	for (i=0;i<sizeof(bsp_irqs)/sizeof(bsp_irqs[0]);i++)
> 		virq = irq_create_mapping(NULL, bsp_irqs[i]);

I assume you're code doesn't look exactly like this.  You'll need to  
use the virq in the request_irq()... its most likely just random luck  
if things are working and you aren't using the virq returned from  
irq_create_mapping()

(Well its more than random luck, its because most 83xx systems only  
have one PIC and this hw_irq # == virq)

- k

  reply	other threads:[~2007-05-11 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10 16:45 83xx: requesting external interrupts Alex Zeffertt
2007-05-10 17:07 ` Ben Warren
     [not found]   ` <46443784.3060600@cambridgebroadband.com>
2007-05-11 14:12     ` Ben Warren
2007-05-11 20:15       ` Kumar Gala [this message]
2007-05-11 20:29         ` Ben Warren
2007-05-11 20:37           ` Kumar Gala
2007-06-29 11:34       ` Joakim Tjernlund
2007-06-29 16:43         ` Ben Warren
2007-06-29 23:54         ` Andy Fleming
2007-06-30 14:02           ` Joakim Tjernlund

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=C873B42C-ABE7-4265-9EF5-15EBA9525324@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=bwarren@qstreams.com \
    --cc=linuxppc-embedded@ozlabs.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).