2 * linux/arch/arm/mach-pxa/irq.c
4 * Generic PXA IRQ handling
6 * Author: Nicolas Pitre
7 * Created: Jun 15, 2001
8 * Copyright: MontaVista Software Inc.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <linux/interrupt.h>
18 #include <linux/sysdev.h>
20 #include <asm/hardware.h>
22 #include <asm/mach/irq.h>
23 #include <asm/arch/pxa-regs.h>
29 * This is for peripheral IRQs internal to the PXA chip.
32 static void pxa_mask_low_irq(unsigned int irq
)
37 static void pxa_unmask_low_irq(unsigned int irq
)
42 static struct irq_chip pxa_internal_chip_low
= {
44 .ack
= pxa_mask_low_irq
,
45 .mask
= pxa_mask_low_irq
,
46 .unmask
= pxa_unmask_low_irq
,
49 void __init
pxa_init_irq_low(void)
53 /* disable all IRQs */
56 /* all IRQs are IRQ, not FIQ */
59 /* only unmasked interrupts kick us out of idle */
62 for (irq
= PXA_IRQ(0); irq
<= PXA_IRQ(31); irq
++) {
63 set_irq_chip(irq
, &pxa_internal_chip_low
);
64 set_irq_handler(irq
, handle_level_irq
);
65 set_irq_flags(irq
, IRQF_VALID
);
69 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
72 * This is for the second set of internal IRQs as found on the PXA27x.
75 static void pxa_mask_high_irq(unsigned int irq
)
77 ICMR2
&= ~(1 << (irq
- 32));
80 static void pxa_unmask_high_irq(unsigned int irq
)
82 ICMR2
|= (1 << (irq
- 32));
85 static struct irq_chip pxa_internal_chip_high
= {
87 .ack
= pxa_mask_high_irq
,
88 .mask
= pxa_mask_high_irq
,
89 .unmask
= pxa_unmask_high_irq
,
92 void __init
pxa_init_irq_high(void)
99 for (irq
= PXA_IRQ(32); irq
< PXA_IRQ(64); irq
++) {
100 set_irq_chip(irq
, &pxa_internal_chip_high
);
101 set_irq_handler(irq
, handle_level_irq
);
102 set_irq_flags(irq
, IRQF_VALID
);
107 void __init
pxa_init_irq_set_wake(int (*set_wake
)(unsigned int, unsigned int))
109 pxa_internal_chip_low
.set_wake
= set_wake
;
111 pxa_internal_chip_high
.set_wake
= set_wake
;
113 pxa_init_gpio_set_wake(set_wake
);
117 static unsigned long saved_icmr
[2];
119 static int pxa_irq_suspend(struct sys_device
*dev
, pm_message_t state
)
123 saved_icmr
[0] = ICMR
;
126 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
128 saved_icmr
[1] = ICMR2
;
139 static int pxa_irq_resume(struct sys_device
*dev
)
143 ICMR
= saved_icmr
[0];
147 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
149 ICMR2
= saved_icmr
[1];
160 #define pxa_irq_suspend NULL
161 #define pxa_irq_resume NULL
164 struct sysdev_class pxa_irq_sysclass
= {
166 .suspend
= pxa_irq_suspend
,
167 .resume
= pxa_irq_resume
,
170 static int __init
pxa_irq_init(void)
172 return sysdev_class_register(&pxa_irq_sysclass
);
175 core_initcall(pxa_irq_init
);