I want to receive interrupt from 1 GPIO port (for example 14)
I changed the GPIMR to 0xffffffff (so I need to get interrupts from all GPIO
ports)
And then request the irq by :
irq_create_mapping(NULL,74);
request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
the return value is 0 (OK)
but I cant receive any interrupt.
do I need to do something else?
From: Florian A. Voegel <hidden> Date: 2007-08-01 15:24:05
Is the interrupt configured properly for whatever it is you connect to it? (level vs edge triggered, rising vs falling)
Best regards,
Florian
On Wed, 1 Aug 2007 14:45:05 +0300
"Yoni Levin" [off-list ref] wrote:
I want to receive interrupt from 1 GPIO port (for example 14)
I changed the GPIMR to 0xffffffff (so I need to get interrupts from all GPIO
ports)
And then request the irq by :
irq_create_mapping(NULL,74);
request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
the return value is 0 (OK)
but I cant receive any interrupt.
do I need to do something else?
Request irq should use virq that irq_create_mapping returns.
Maybe there's another "enable global GPIO interrupts" register, that
needs to be set too?
Domen
Yes, I removed the flag (0) and nothing change in both cases the request_irq
return 0 which is good.
Then I added enable_irq and I recived :
Unbalanced enable for IRQ 74
------------[ cut here ]------------
Badness at c0043578 [verbose debug info unavailable]
Call Trace:
[C76C9D00] [C0008648] show_stack+0x48/0x194 (unreliable)
[C76C9D30] [C0139364] report_bug+0x84/0xac
[C76C9D40] [C000E398] program_check_exception+0xe0/0x538
[C76C9D80] [C000FE04] ret_from_except_full+0x0/0x4c
--- Exception: 700 at enable_irq+0x80/0xb0
LR = enable_irq+0x80/0xb0
By the way this is my code :
static irqreturn_t GPIOinterrupt_handler(int i,void *n,struct pt_regs *
myRegs)
{
printk("GPIO recived and handled !!!!!!!!!!!!!!!!!!!...\n");
return IRQ_HANDLED;
}
void CreateGPIOHandler()
{
unsigned int myirq=irq_create_mapping(NULL,74);
enable_irq(74);
printk("myirq is : %d \n",myirq);
int ret;
ret=- request_irq(74, GPIOinterrupt_handler,0, "GPIO", NULL);
printk("ret is : %d \n",ret);
}
-----Original Message-----
From: Scott Wood [mailto:scottwood@freescale.com]
Sent: Wednesday, August 01, 2007 9:36 PM
To: Yoni Levin
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: GPIO interrupts on mpc8313e
On Wed, Aug 01, 2007 at 02:45:05PM +0300, Yoni Levin wrote:
From: Scott Wood <hidden> Date: 2007-08-02 15:19:17
Yoni Levin wrote:
Yes, I removed the flag (0) and nothing change in both cases the request_irq
return 0 which is good.
Then I added enable_irq and I recived :
Unbalanced enable for IRQ 74
Yeah, sorry, I misremembered what IRQF_DISABLED does. As Domen pointed
out, you need to pass myirq, not 74, to request_irq().
void CreateGPIOHandler()
{
unsigned int myirq=irq_create_mapping(NULL,74);
enable_irq(74);
printk("myirq is : %d \n",myirq);
int ret;
ret=- request_irq(74, GPIOinterrupt_handler,0, "GPIO", NULL);
printk("ret is : %d \n",ret);
}
Even if IRQF_DISABLED did do what I thought it did (I was thinking of
IRQ_NOAUTOEN, which is apparently an ARM-only thing), you should never
call enable_irq() before request_irq(), or without previously disabling
it (either explicitly or via IRQ_NOAUTOEN).
-Scott
myirq=74
-----Original Message-----
From: Scott Wood [mailto:scottwood@freescale.com]
Sent: Thursday, August 02, 2007 6:19 PM
To: Yoni Levin
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: GPIO interrupts on mpc8313e
Yoni Levin wrote:
Yes, I removed the flag (0) and nothing change in both cases the
request_irq
return 0 which is good.
Then I added enable_irq and I recived :
Unbalanced enable for IRQ 74
Yeah, sorry, I misremembered what IRQF_DISABLED does. As Domen pointed
out, you need to pass myirq, not 74, to request_irq().
void CreateGPIOHandler()
{
unsigned int myirq=irq_create_mapping(NULL,74);
enable_irq(74);
printk("myirq is : %d \n",myirq);
int ret;
ret=- request_irq(74, GPIOinterrupt_handler,0, "GPIO", NULL);
printk("ret is : %d \n",ret);
}
Even if IRQF_DISABLED did do what I thought it did (I was thinking of
IRQ_NOAUTOEN, which is apparently an ARM-only thing), you should never
call enable_irq() before request_irq(), or without previously disabling
it (either explicitly or via IRQ_NOAUTOEN).
-Scott
From: Scott Wood <hidden> Date: 2007-08-02 15:41:08
Yoni Levin wrote:
myirq=74
OK, that's obviously not the problem then, but you still shouldn't rely
on them being equal.
Try dumping the PIC registers to see which interrupts (if any) are
actually pending.
-Scott