2 * linux/arch/arm/mach-p2001/irq.c
4 * Copyright (C) 2004-2005 Tobias Lorenz
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/types.h>
23 #include <linux/sched.h>
24 #include <linux/interrupt.h>
25 #include <linux/types.h>
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/list.h>
29 #include <linux/device.h>
30 #include <linux/slab.h>
31 #include <linux/string.h>
32 #include <linux/sysdev.h>
34 #include <asm/hardware.h>
37 #include <asm/setup.h>
38 #include <asm/mach-types.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/irq.h>
42 #include <asm/mach/map.h>
45 /**************************************************************************
47 **************************************************************************/
49 void __inline__
p2001_irqchip_mask(unsigned int irq
)
51 unsigned long mask
= 1 << (irq
);
52 P2001_INT_CTRL
->Main_NIRQ_Int_Ctrl
&= ~mask
;
55 void __inline__
p2001_irqchip_unmask(unsigned int irq
)
57 unsigned long mask
= 1 << (irq
);
58 P2001_INT_CTRL
->Main_NIRQ_Int_Ctrl
|= mask
;
61 void __inline__
p2001_irqchip_ack(unsigned int irq
)
63 p2001_irqchip_mask(irq
);
67 int __inline__
p2001_irqchip_retrigger(unsigned int irq
)
75 int __inline__
p2001_irqchip_type(unsigned int irq
, unsigned int flags
)
83 int __inline__
p2001_irqchip_wake(unsigned int irq
, unsigned int on
)
90 static struct irqchip p2001_irqchip
= {
91 .ack
= p2001_irqchip_ack
, /* Acknowledge the IRQ. */
92 .mask
= p2001_irqchip_mask
, /* Mask the IRQ in hardware. */
93 .unmask
= p2001_irqchip_unmask
, /* Unmask the IRQ in hardware. */
94 // .retrigger = p2001_irqchip_retrigger, /* Ask the hardware to re-trigger the IRQ. */
95 // .type = p2001_irqchip_type, /* Set the type of the IRQ. */
96 // .wake = p2001_irqchip_wake, /* Set wakeup-enable on the selected IRQ */
101 /**************************************************************************
102 * System IRQ Device/Class
103 **************************************************************************/
106 static int irq_shutdown(struct sys_device
*dev
)
113 static int irq_suspend(struct sys_device
*dev
, u32 state
)
118 static int irq_resume(struct sys_device
*dev
)
120 /* disable all irq sources */
125 static struct sysdev_class irq_class
= {
126 // .shutdown = irq_shutdown,
128 .suspend
= irq_suspend
,
129 .resume
= irq_resume
,
131 set_kset_name("irq"),
134 static struct sys_device irq_device
= {
141 /**************************************************************************
143 **************************************************************************/
145 static int __init
irq_init_sysfs(void)
147 int ret
= sysdev_class_register(&irq_class
);
149 ret
= sysdev_register(&irq_device
);
153 device_initcall(irq_init_sysfs
);
155 void __init
p2001_init_irq(void)
159 for (irq
= 0; irq
< NR_IRQS
; irq
++) {
160 set_irq_chip(irq
, &p2001_irqchip
);
161 set_irq_handler(irq
, do_level_IRQ
);
162 set_irq_flags(irq
, IRQF_VALID
| IRQF_PROBE
);