2010-06-22 22:18:53     setting trigger mode 4 for irq 190 failed

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-06-22 22:18:53     setting trigger mode 4 for irq 190 failed

Rob D (UNITED STATES)

Message: 90546   

 

Hi All,

 

For some reason I can't seem to register GPIO_PF7 as an interrupt in my kernel module.  Here is the code

 

#define INTERLOCK_MASTER GPIO_PF7

    irq = gpio_to_irq(INTERLOCK_MASTER);

    if(irq < 0)

    {

        printk(KERN_NOTICE "gec: gpio_to_irq() failed\n");

        return -EIO;

    }

 

    if(request_irq(irq, interlock_irq_handler, IRQF_TRIGGER_HIGH,

                   "masterinterlockirq", NULL) < 0)

    {

        printk(KERN_NOTICE "gec: request_irq() failed\n");

        return -EIO;

    }

    printk( "INTERLOCK (MASTER): Interrupt initialized (%d)!\n", irq );

 

 

When I insmod, it prints:

setting trigger mode 4 for irq 190 failed (_bfin_gpio_irq_type+0x0/0x1b8)

 

I'm using other GPIO lines for interrupts just fine ( GPIO_PH2, GPIO_PD11, etc... )

 

I'm pretty sure there are no conflicts in my kernel setup - I've got all the ATAPI and PPI stuff disabled.  I've also tried GPIO_PF6 with the same result...

 

Any thoughts?

 

Thanks!

Rob

QuoteReplyEditDelete

 

 

2010-06-22 22:29:20     Re: setting trigger mode 4 for irq 190 failed

Mike Frysinger (UNITED STATES)

Message: 90547   

 

but what exactly did request_irq() return ?  you're ignoring the actual value.

 

also, your passing of NULL to request_irq() is wrong.  it needs to be globally unique like the documentation states.

QuoteReplyEditDelete

 

 

2010-06-22 22:41:23     Re: setting trigger mode 4 for irq 190 failed

Rob D (UNITED STATES)

Message: 90548   

 

but what exactly did request_irq() return ?  you're ignoring the actual value.

 

also, your passing of NULL to request_irq() is wrong.  it needs to be globally unique like the documentation states.

 

---

 

Hi Mike,

 

new code:

    if((result = request_irq(irq, interlock_irq_handler, IRQF_TRIGGER_HIGH,

                             "masterinterlockirq", NULL)) < 0)

 

I get this:

setting trigger mode 4 for irq 189 failed (_bfin_gpio_irq_type+0x0/0x1b8)

gec: request_irq() failed (-19)

 

re: NULL, according to   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:interrupts&s[]=interrupts, the request_irq prototype is:

 

    ret = request_irq(CONFIG_YOURDRIVERS_IRQ_PFX, your_irq_handler, IRQF_TRIGGER_LOW, "Your IRQ",

                      your_pointer_passed_to_the_irq_handler);

 

so, I'm not passing it a pointer, so NULL should be fine, right?

QuoteReplyEditDelete

 

 

2010-06-22 22:55:25     Re: setting trigger mode 4 for irq 190 failed

Mike Frysinger (UNITED STATES)

Message: 90549   

 

you didnt say what Blackfin you're using.  guessing by the high numeric value and the code and "ATAPI", i'm going to say BF54x.

 

if you look up 19 in the errno db, you'll see it's ENODEV.  that means it's trivial to trace back to the code where things are being rejected.  like the HRM says, not all banks of GPIO PORTs may be used as interrupts simultaneously.  i'll have to defer to Michael as to how exactly these limitatons bubble up in the BF54x linux interrupt controller implementation.

 

as for the NULL, you skipped over the part where that arg is a globally unique cookie.  you might be able to get away with it by not using a shared interrupt, but it's still wrong as the interrupt will have no state to operate on.

QuoteReplyEditDelete

 

 

2010-06-22 22:56:32     Re: setting trigger mode 4 for irq 190 failed

Mike Frysinger (UNITED STATES)

Message: 90550   

 

also, post the output of /proc/interrupts and /proc/gpio

QuoteReplyEditDelete

 

 

2010-06-23 03:21:20     Re: setting trigger mode 4 for irq 190 failed

Michael Hennerich (GERMANY)

Message: 90556    1) You need to make sure that (PORTF LOW) PF.L is set somewhere in PIN2_ASSIGN or PIN3_ASSIGN.

Check the kernel config for BF54x. The default one should include PF.L and PF.H already.

 

You'll find a option like this:

 

config PINTx_REASSIGN

bool "Reprogram PINT Assignment"

default y

help

The interrupt assignment registers controls the pin-to-interrupt

assignment in a byte-wide manner. Each option allows you to select

a set of pins (High/Low Byte) of an specific Port being mapped

to one of the four PIN Interrupts IRQ_PINTx.

 

You shouldn't change any of these unless you know exactly what you're doing.

Please consult the Blackfin BF54x Processor Hardware Reference Manual.

 

config PINT0_ASSIGN

hex "PINT0_ASSIGN"

depends on PINTx_REASSIGN

default 0x00000101

config PINT1_ASSIGN

hex "PINT1_ASSIGN"

depends on PINTx_REASSIGN

default 0x01010000

config PINT2_ASSIGN

hex "PINT2_ASSIGN"

depends on PINTx_REASSIGN

default 0x07000101

config PINT3_ASSIGN

hex "PINT3_ASSIGN"

depends on PINTx_REASSIGN

default 0x02020303

 

2) Don't pass NULL as last argument (dev_id) of request_irq()

QuoteReplyEditDelete

 

 

2010-06-23 19:57:46     Re: setting trigger mode 4 for irq 190 failed

Rob D (UNITED STATES)

Message: 90573   

 

Mike and  Michael,

 

Thanks a lot for the help - you guys are great!  The issue was the PINTx_ASSIGN register... once that was setup correcly, request_irq worked.

 

Also, thanks for the tip on the dev_id field of request_irq, I will pass in the addr of the dev struct or something as a unique ID.

 

-Rob

Attachments

    Outcomes