* GPIO interrupts on mpc8313e
@ 2007-08-01 11:45 Yoni Levin
2007-08-01 16:26 ` Florian A. Voegel
2007-08-01 18:36 ` Scott Wood
0 siblings, 2 replies; 8+ messages in thread
From: Yoni Levin @ 2007-08-01 11:45 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
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?
[-- Attachment #2: Type: text/html, Size: 3527 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPIO interrupts on mpc8313e
2007-08-01 11:45 GPIO interrupts on mpc8313e Yoni Levin
@ 2007-08-01 16:26 ` Florian A. Voegel
2007-08-01 18:36 ` Scott Wood
1 sibling, 0 replies; 8+ messages in thread
From: Florian A. Voegel @ 2007-08-01 16:26 UTC (permalink / raw)
To: linuxppc-embedded
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" <yoni.l@slyde-tech.com> 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?
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPIO interrupts on mpc8313e
2007-08-01 11:45 GPIO interrupts on mpc8313e Yoni Levin
2007-08-01 16:26 ` Florian A. Voegel
@ 2007-08-01 18:36 ` Scott Wood
2007-08-02 6:11 ` Domen Puncer
2007-08-02 8:37 ` Yoni Levin
1 sibling, 2 replies; 8+ messages in thread
From: Scott Wood @ 2007-08-01 18:36 UTC (permalink / raw)
To: Yoni Levin; +Cc: linuxppc-embedded
On Wed, Aug 01, 2007 at 02:45:05PM +0300, Yoni Levin wrote:
> request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
^^^^^^^^^^^^^
Did you try removing that flag (or calling enable_irq())?
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPIO interrupts on mpc8313e
2007-08-01 18:36 ` Scott Wood
@ 2007-08-02 6:11 ` Domen Puncer
2007-08-02 8:37 ` Yoni Levin
1 sibling, 0 replies; 8+ messages in thread
From: Domen Puncer @ 2007-08-02 6:11 UTC (permalink / raw)
To: Scott Wood; +Cc: Yoni Levin, linuxppc-embedded
On 01/08/07 13:36 -0500, Scott Wood wrote:
> On Wed, Aug 01, 2007 at 02:45:05PM +0300, Yoni Levin wrote:
> > request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
> ^^^^^^^^^^^^^
>
> Did you try removing that flag (or calling enable_irq())?
>From interrupt.h:
38 * IRQF_DISABLED - keep irqs disabled when calling the action handler
>> irq_create_mapping(NULL,74);
>> request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: GPIO interrupts on mpc8313e
2007-08-01 18:36 ` Scott Wood
2007-08-02 6:11 ` Domen Puncer
@ 2007-08-02 8:37 ` Yoni Levin
2007-08-02 15:18 ` Scott Wood
1 sibling, 1 reply; 8+ messages in thread
From: Yoni Levin @ 2007-08-02 8:37 UTC (permalink / raw)
To: 'Scott Wood'; +Cc: linuxppc-embedded
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
[C76C9E50] [C907423C] CreateGPIOHandler+0x28/0x7c [modexample]
[C76C9E70] [C9074728] init_module+0x2c/0x8c [modexample]
[C76C9E80] [C003B568] sys_init_module+0x1c4/0x165c
[C76C9F40] [C000F7BC] ret_from_syscall+0x0/0x38
--- Exception: c01 at 0xff311f0
LR = 0x100316a8
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:
> request_irq(74,handler,IRQF_DISABLED,"GPIO",NULL);
^^^^^^^^^^^^^
Did you try removing that flag (or calling enable_irq())?
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPIO interrupts on mpc8313e
2007-08-02 8:37 ` Yoni Levin
@ 2007-08-02 15:18 ` Scott Wood
2007-08-02 15:38 ` Yoni Levin
0 siblings, 1 reply; 8+ messages in thread
From: Scott Wood @ 2007-08-02 15:18 UTC (permalink / raw)
To: Yoni Levin; +Cc: linuxppc-embedded
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: GPIO interrupts on mpc8313e
2007-08-02 15:18 ` Scott Wood
@ 2007-08-02 15:38 ` Yoni Levin
2007-08-02 15:40 ` Scott Wood
0 siblings, 1 reply; 8+ messages in thread
From: Yoni Levin @ 2007-08-02 15:38 UTC (permalink / raw)
To: 'Scott Wood'; +Cc: linuxppc-embedded
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-02 15:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-01 11:45 GPIO interrupts on mpc8313e Yoni Levin
2007-08-01 16:26 ` Florian A. Voegel
2007-08-01 18:36 ` Scott Wood
2007-08-02 6:11 ` Domen Puncer
2007-08-02 8:37 ` Yoni Levin
2007-08-02 15:18 ` Scott Wood
2007-08-02 15:38 ` Yoni Levin
2007-08-02 15:40 ` Scott Wood
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).