Skip to contentSkip to conversation

enabling EXT_WAKEUP interrupts on PXA3xx

DISCUSSION Mike Rapoport 3 participants 6 messages Nov 10, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Eric,

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

What do you prefer?

Signature · 2 lines
Sincerely yours,
Mike.
#1 lore raw
Quoted 9 lines · Mike Rapoport

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

What do you prefer?

I'm just calling

  enable_irq_wake(IRQ_WAKEUP0);

from my board support code, and it works fine - no need to change anything else.

Daniel

#2 lore raw
Quoted 9 lines · Daniel Mack
Quoted 8 lines · Mike Rapoport

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

Quoted 9 lines
Quoted 1 line

What do you prefer?

I'm just calling

?enable_irq_wake(IRQ_WAKEUP0);

from my board support code, and it works fine - no need to change anything else.

Daniel,

I think Mike is talking about "interrupt" on EXT_WAKEUP0, which involves register PECR.

My POV is the 2nd way to go, should be better and cleaner, but I'm always wondering where to add these additional two interrupts, possibly before the GPIO IRQs or after.

Quoted 2 lines

Daniel

#3 lore raw
Quoted 20 lines · Eric Miao
Quoted 9 lines · Daniel Mack
Quoted 8 lines · Mike Rapoport

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

Quoted 9 lines
Quoted 1 line

What do you prefer?

I'm just calling

?enable_irq_wake(IRQ_WAKEUP0);

from my board support code, and it works fine - no need to change anything else.

Quoted 9 lines

Daniel,

I think Mike is talking about "interrupt" on EXT_WAKEUP0, which involves register PECR.

My POV is the 2nd way to go, should be better and cleaner, but I'm always wondering where to add these additional two interrupts, possibly before the GPIO IRQs or after.

Well, my second thought on this would be after GPIO IRQs and treat them as board specific ones.

#4 lore raw
Quoted 24 lines · Eric Miao
Quoted 23 lines · Eric Miao
Quoted 9 lines · Daniel Mack
Quoted 8 lines · Mike Rapoport

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

Quoted 8 lines
Quoted 1 line

What do you prefer?

I'm just calling

enable_irq_wake(IRQ_WAKEUP0);

from my board support code, and it works fine - no need to change anything else.

Daniel,

I think Mike is talking about "interrupt" on EXT_WAKEUP0, which involves register PECR.

Quoted 8 lines
Quoted 4 lines

My POV is the 2nd way to go, should be better and cleaner, but I'm always wondering where to add these additional two interrupts, possibly before the GPIO IRQs or after.

Well, my second thought on this would be after GPIO IRQs and treat them as board specific ones.

Currently we have
#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
so probably we'll just treat them in a way similar to IRQ_GPIO[0,1]:

arch/arm/mach-pxa/irq.c +21 -0
index d694ce2..bfc57e6 100644
@@ -118,6 +118,24 @@ static void __init pxa_init_low_gpio_irq(set_wake_t fn)
 	pxa_low_gpio_chip.set_wake = fn;
 }
 
+static struct irq_chip pxa_ext_wakeup_chip = {
+	.name		= "EXT-WAKEUP",
+	.ack		= pxa_ack_ext_wakeup,
+	.mask		= pxa_mask_ext_wakeup,
+	.unmask		= pxa_unmask_ext_wakeup,
+};
+
+static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
+{
+	for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) {
+		set_irq_chip(irq, &pxa_ext_wakeup_chip);
+		set_irq_handler(irq, handle_edge_irq);
+		set_irq_flags(irq, IRQF_VALID);
+	}
+
+	pxa_ext_wakeup_chip.set_wake = fn;
+}
+
 void __init pxa_init_irq(int irq_nr, set_wake_t fn)
 {
 	int irq, i;
@@ -146,6 +164,9 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
 
 	pxa_internal_irq_chip.set_wake = fn;
 	pxa_init_low_gpio_irq(fn);
+	
+	if (cpu_is_pxa3xx())
+		pxa_init_ext_wakeup_irq(fn);
 }
 
 
Signature · 2 lines
Sincerely yours,
Mike.
#5 lore raw
Quoted 30 lines · Mike Rapoport
Quoted 29 lines · Eric Miao
Quoted 27 lines · Eric Miao
Quoted 9 lines · Daniel Mack
Quoted 8 lines · Mike Rapoport

We need to enable EXT_WAKEUP interrupts on PXA3xx and I wonder what would be the best way to do it.
I see two possibilities:
1) add 'if (irq == IRQ_WAKEUPx)' statements to pxa_{un}mask_irq functions in arch/arm/mach-pxa/irq.c
2) register additional irq_chip in arch/arm/mach-pxa/pxa3xx.c that will be responsible for handling EXT_WAKEUP (and probably other pxa3xx specific) interrupts.

Quoted 8 lines
Quoted 1 line

What do you prefer?

I'm just calling

?enable_irq_wake(IRQ_WAKEUP0);

from my board support code, and it works fine - no need to change anything else.

Daniel,

I think Mike is talking about "interrupt" on EXT_WAKEUP0, which involves register PECR.

My POV is the 2nd way to go, should be better and cleaner, but I'm always wondering where to add these additional two interrupts, possibly before the GPIO IRQs or after.

Quoted 9 lines
Quoted 3 lines

Well, my second thought on this would be after GPIO IRQs and treat them as board specific ones.

Currently we have
#define IRQ_WAKEUP0 ? ? PXA_IRQ(49) ? ? /* EXT_WAKEUP0 */ #define IRQ_WAKEUP1 ? ? PXA_IRQ(50) ? ? /* EXT_WAKEUP1 */ so probably we'll just treat them in a way similar to IRQ_GPIO[0,1]:

Ah, right that's it, almost forgot. The code below looks OK to me, and I think it would be better to put them into pxa3xx.c, as well as the registration into pxa3xx_init_irq(). Feel free to file a patch for this.

Thanks.

Quoted 45 lines
arch/arm/mach-pxa/irq.c +21 -1
index d694ce2..bfc57e6 100644
@@ -118,6 +118,24 @@ static void __init pxa_init_low_gpio_irq(set_wake_t fn)
 ? ? ? ?pxa_low_gpio_chip.set_wake = fn;
 ?}
 
+static struct irq_chip pxa_ext_wakeup_chip = {
+ ? ? ? .name ? ? ? ? ? = "EXT-WAKEUP",
+ ? ? ? .ack ? ? ? ? ? ?= pxa_ack_ext_wakeup,
+ ? ? ? .mask ? ? ? ? ? = pxa_mask_ext_wakeup,
+ ? ? ? .unmask ? ? ? ? = pxa_unmask_ext_wakeup,
+};
+
+static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
+{
+ ? ? ? for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) {
+ ? ? ? ? ? ? ? set_irq_chip(irq, &pxa_ext_wakeup_chip);
+ ? ? ? ? ? ? ? set_irq_handler(irq, handle_edge_irq);
+ ? ? ? ? ? ? ? set_irq_flags(irq, IRQF_VALID);
+ ? ? ? }
+
+ ? ? ? pxa_ext_wakeup_chip.set_wake = fn;
+}
+
 ?void __init pxa_init_irq(int irq_nr, set_wake_t fn)
 ?{
 ? ? ? ?int irq, i;
@@ -146,6 +164,9 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
 
 ? ? ? ?pxa_internal_irq_chip.set_wake = fn;
 ? ? ? ?pxa_init_low_gpio_irq(fn);
+
+ ? ? ? if (cpu_is_pxa3xx())
+ ? ? ? ? ? ? ? pxa_init_ext_wakeup_irq(fn);
 ?}
 
 
 
--

Sincerely yours,
Mike.