GPIO interrupts on mpc8313e

8 messages, 4 authors, 2007-08-02 · open the first message on its own page

GPIO interrupts on mpc8313e

From: Yoni Levin <hidden>
Date: 2007-08-01 11:45:18

 

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?

 

 

Re: GPIO interrupts on mpc8313e

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?

 

 

Re: GPIO interrupts on mpc8313e

From: Scott Wood <hidden>
Date: 2007-08-01 18:36:26

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

Re: GPIO interrupts on mpc8313e

From: Domen Puncer <hidden>
Date: 2007-08-02 06:11:51

On 01/08/07 13:36 -0500, Scott Wood wrote:
On Wed, Aug 01, 2007 at 02:45:05PM +0300, Yoni Levin wrote:
quoted
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

quoted
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

RE: GPIO interrupts on mpc8313e

From: Yoni Levin <hidden>
Date: 2007-08-02 08:37:31

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

Re: GPIO interrupts on mpc8313e

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

RE: GPIO interrupts on mpc8313e

From: Yoni Levin <hidden>
Date: 2007-08-02 15:39:10

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

Re: GPIO interrupts on mpc8313e

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help