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-s5c7375 / irq.c
bloba90d7ec316da59820920de685ac67534277166a9
1 /*
2 * linux/arch/armnommu/mach-s5c7375/irq.c
4 * Copyright (C) 2003 SAMSUNG ELECTRONICS
5 * Hyok S. Choi (hyok.choi@samsung.com)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/types.h>
22 #include <linux/sched.h>
23 #include <linux/interrupt.h>
24 #include <linux/types.h>
25 #include <linux/kernel.h>
26 #include <linux/init.h>
27 #include <linux/list.h>
28 #include <linux/device.h>
29 #include <linux/slab.h>
30 #include <linux/string.h>
31 #include <linux/sysdev.h>
33 #include <asm/hardware.h>
34 #include <asm/io.h>
35 #include <asm/irq.h>
36 #include <asm/setup.h>
37 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/irq.h>
41 #include <asm/mach/map.h>
43 void __inline__ s5c7375_mask_irq(unsigned int irq)
45 rINTMSK |= ((unsigned long) 1 << irq);
48 void __inline__ s5c7375_unmask_irq(unsigned int irq)
50 rINTMSK &= ~((unsigned long)1 << irq);
53 void __inline__ s5c7375_mask_ack_irq(unsigned int irq)
55 s5c7375_mask_irq(irq);
58 void __inline__ s5c7375_clear_pb(unsigned int irq)
60 rIRQISPC = (0x00000001<<irq); /* Clear pending bit */
61 rIRQISPC; /* WriteBack */
65 /* YOU CAN CHANGE THIS ROUTINE FOR SPEED UP */
66 __inline__ unsigned int fixup_irq (int irq )
68 s5c7375_clear_pb(irq);
69 return(irq);
72 static struct irqchip s5c7375_chip = {
73 .ack = s5c7375_clear_pb,
74 .mask = s5c7375_mask_irq,
75 .unmask = s5c7375_unmask_irq,
78 #ifdef CONFIG_PM
79 static unsigned long ic_irq_enable;
81 static int irq_suspend(struct sys_device *dev, u32 state)
83 return 0;
86 static int irq_resume(struct sys_device *dev)
88 /* disable all irq sources */
89 return 0;
91 #else
92 #define irq_suspend NULL
93 #define irq_resume NULL
94 #endif
96 static struct sysdev_class irq_class = {
97 set_kset_name("irq"),
98 .suspend = irq_suspend,
99 .resume = irq_resume,
102 static struct sys_device irq_device = {
103 .id = 0,
104 .cls = &irq_class,
107 static int __init irq_init_sysfs(void)
109 int ret = sysdev_class_register(&irq_class);
110 if (ret == 0)
111 ret = sysdev_register(&irq_device);
112 return ret;
115 device_initcall(irq_init_sysfs);
117 void __init s5c7375_init_irq(void)
119 int irq;
121 /* Disable all IRQs */
123 rINTMSK = 0xffffffff; /* all masked */
124 /****************
125 * All IRQs are IRQ, not FIQ
126 * Write only one register,
127 * 0 : IRQ mode
128 * 1 : FIQ mode
129 *******************************************/
130 rINTMOD = 0x00000000;
132 for (irq = 0; irq < NR_IRQS; irq++) {
133 set_irq_chip(irq, &s5c7375_chip);
134 set_irq_handler(irq, do_level_IRQ);
135 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
137 rINTCON = 0x0; // all interrupt is disabled
138 // rINTCON = 0xD; // vectored mode
139 DisableFIQ(); // fiq is disabled
140 #ifndef CONFIG_S5C7375VM
141 EnableIRQ(); // irq is enabled
142 #else
143 DisableIRQ();
144 #endif
145 DisableGMask(); // global mask is disabled