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-s3c44b0x / irq.c
blob3868c19cce6b5f4043a8d2af3f4a78351d632583
1 /*
2 * linux/arch/arm/mach-s3c44b0x/irq.c
3 */
5 #include <linux/types.h>
6 #include <linux/sched.h>
7 #include <linux/interrupt.h>
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/list.h>
12 #include <linux/device.h>
13 #include <linux/slab.h>
14 #include <linux/string.h>
15 #include <linux/sysdev.h>
17 #include <asm/hardware.h>
18 #include <asm/io.h>
19 #include <asm/irq.h>
20 #include <asm/setup.h>
21 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/irq.h>
25 #include <asm/mach/map.h>
27 void __inline__ s3c44b0x_mask_irq(unsigned int irq)
29 SYSREG_OR_SET(S3C44B0X_INTMSK, 1<<irq);
32 void __inline__ s3c44b0x_unmask_irq(unsigned int irq)
34 SYSREG_CLR(S3C44B0X_INTMSK, 1<<irq);
37 void __inline__ s3c44b0x_mask_ack_irq(unsigned int irq)
39 s3c44b0x_mask_irq(irq);
42 /* Clear pending bit */
43 void __inline__ s3c44b0x_clear_pb(unsigned int irq)
45 SYSREG_OR_SET(S3C44B0X_I_ISPC, 1<<irq);
49 /* YOU CAN CHANGE THIS ROUTINE FOR SPEED UP */
50 __inline__ unsigned int fixup_irq (int irq )
52 s3c44b0x_clear_pb(irq);
53 return(irq);
56 static struct irqchip s3c44b0x_chip = {
57 .ack = s3c44b0x_clear_pb,
58 .mask = s3c44b0x_mask_irq,
59 .unmask = s3c44b0x_unmask_irq,
62 #ifdef CONFIG_PM
63 static unsigned long ic_irq_enable;
65 static int irq_suspend(struct sys_device *dev, u32 state)
67 return 0;
70 static int irq_resume(struct sys_device *dev)
72 /* disable all irq sources */
73 return 0;
75 #else
76 #define irq_suspend NULL
77 #define irq_resume NULL
78 #endif
80 static struct sysdev_class irq_class = {
81 set_kset_name("irq"),
82 .suspend = irq_suspend,
83 .resume = irq_resume,
86 static struct sys_device irq_device = {
87 .id = 0,
88 .cls = &irq_class,
91 static int __init irq_init_sysfs(void)
93 int ret = sysdev_class_register(&irq_class);
94 if (ret == 0)
95 ret = sysdev_register(&irq_device);
96 return ret;
99 device_initcall(irq_init_sysfs);
102 void __init s3c44b0x_init_irq(void)
104 int irq;
106 for (irq = 0; irq < NR_IRQS; irq++) {
107 set_irq_chip(irq, &s3c44b0x_chip);
108 set_irq_handler(irq, do_level_IRQ);
109 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
112 /* Note: in Samsung s3c44b0x um
114 "1. INTMSK register can be masked only when it is sure that the corresponding interrupt does not be
115 requested. If your application should mask any interrupt mask bit(INTMSK) just when the
116 corresponding interrupt is issued, please contact our FAE (field application engineer).
118 2. If you need that all interrupt is masked, we recommend that I/F bits in CPSR are set using MRS, MSR
119 instructions. The I, F bit in CPSR can be masked even when any interrupt is issued."
122 /* at this moment, the I/F bits should has been set, so it's safe to use rINTMAK */
124 /* mask and disable all further interrupts */
125 SYSREG_SET(S3C44B0X_INTMSK, 0x07ffffff);
127 /* set all to IRQ mode, not FIQ */
129 SYSREG_SET(S3C44B0X_INTCON, 0x5); // Vectored & IRQ & !FIQ
130 SYSREG_SET(S3C44B0X_INTMOD, 0x00000000); // All IRQ mode
132 /* Clear Intrerrupt pending register */
134 SYSREG_OR_SET(S3C44B0X_I_ISPC, 0x7fffffff);
137 * enable the gloabal interrupt flag, this should be
138 * safe now, all sources are masked out and acknowledged
140 SYSREG_CLR(S3C44B0X_INTMSK, 1<<26);