Request_irq fails for IRQ2

Vijay Nikam vijay.t.nikam at gmail.com
Tue Oct 4 20:25:10 EST 2011


Smitha,

Do you have the entry of this device node in your DTS file?
if yes, then is the device is getting registered properly?

If you are writing platform driver then you can use 'platform_get_irq'
it returns the irq number,
which you can pass in the 'request_irq'. If it is a simple character
driver then to determine the
virtual irq number you can use 'ioremap', in this call you can pass
the HW IRQ number e.g. 20
and then pass in the 'request_irq'.

But in both cases you have to have this device node in your device
tree and should be registered,
otherwise it should be returning error and no virtual irq will be allocated.

As per your return value it seems the device node is not getting
registered, perhaps the entry is
missing in DTS file. Try with just ioremap and see if virtual irq is
returned properly.

Kind Regards,
Vijay Nikam

On Mon, Oct 3, 2011 at 7:57 PM,  <smitha.vanga at wipro.com> wrote:
>
> Hi Scott,
>
> I try to request an IRQ (IRQ2 and IRQ3 which are ineterrupt no 20 and 21 in
> mpc8247)in my driver . The
> Call fails in setup_irq in Manage.c at /kernel/irq.
>
> Setup _irq returns -ENOSYS
>
> if (desc->irq_data.chip == &no_irq_chip)
>                  return -ENOSYS;
>
>
> I found that I need to pass the virtual interrupt number instead of hardware
> interrupt number.
> So I added below piece of code
>
> Below is the call to request irq in my driver.
>
> virq = irq_create_mapping(NULL, CPLD1_INTERRUPT);
>
>
>
>
>    if ((ret = request_irq(virq,cpld_irq_handler, 0, GPIO_CHAR_PATH,
> NULL))!=0)
>    {
>       printk(KERN_ERR "gpio_init: Could not grab IRQ line for CPLD ret =
> %d\n",ret);
>           goto err1;
>    }
>
>
> Now it fails in irq_create_mapping   with NO_IRQ error.
>
> if (controller == NULL)
>                 host = irq_default_host;
> else
>                 host = irq_find_host(controller);
> if (host == NULL) {
>                 printk(KERN_WARNING "irq: no irq host found for %s !\n",
>                        controller->full_name);
>                 return NO_IRQ;
>         }
>
>
> I just don't know what I should pass for host , also when I pass NULL for
> host . I see the default host is NULL..
> Could you please help me. My project delivery is near , I need  help soon.
>
>
> Regards,
> Smitha
>
>
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>


More information about the Linuxppc-dev mailing list