MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mach-p2001 / irq.c
blob21c7e3d7a592888fb9c534732d4d28c6efb2d6aa
1 /*
2 * linux/arch/arm/mach-p2001/irq.c
4 * Copyright (C) 2004-2005 Tobias Lorenz
6 * IRQ handling code
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>
35 #include <asm/io.h>
36 #include <asm/irq.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 /**************************************************************************
46 * IRQ Chip
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);
66 #if 0
67 int __inline__ p2001_irqchip_retrigger(unsigned int irq)
69 /* not implemented */
70 return 0;
72 #endif
74 #if 0
75 int __inline__ p2001_irqchip_type(unsigned int irq, unsigned int flags)
77 /* not implemented */
78 return 0;
80 #endif
82 #if 0
83 int __inline__ p2001_irqchip_wake(unsigned int irq, unsigned int on)
85 /* not implemented */
86 return 0;
88 #endif
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 **************************************************************************/
105 #if 0
106 static int irq_shutdown(struct sys_device *dev)
108 return 0;
110 #endif
112 #ifdef CONFIG_PM
113 static int irq_suspend(struct sys_device *dev, u32 state)
115 return 0;
118 static int irq_resume(struct sys_device *dev)
120 /* disable all irq sources */
121 return 0;
123 #endif
125 static struct sysdev_class irq_class = {
126 // .shutdown = irq_shutdown,
127 #ifdef CONFIG_PM
128 .suspend = irq_suspend,
129 .resume = irq_resume,
130 #endif
131 set_kset_name("irq"),
134 static struct sys_device irq_device = {
135 .id = 0,
136 .cls = &irq_class,
141 /**************************************************************************
142 * Module functions
143 **************************************************************************/
145 static int __init irq_init_sysfs(void)
147 int ret = sysdev_class_register(&irq_class);
148 if (ret == 0)
149 ret = sysdev_register(&irq_device);
150 return ret;
153 device_initcall(irq_init_sysfs);
155 void __init p2001_init_irq(void)
157 int irq;
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);