Linux-2.6.12-rc2
[linux-2.6/next.git] / arch / h8300 / platform / h8300h / ints_h8300h.c
blob86a155479167c904ba6950c75262d2ea209c31d0
1 /*
2 * linux/arch/h8300/platform/h8300h/ints_h8300h.c
3 * Interrupt handling CPU variants
5 * Yoshinori Sato <ysato@users.sourceforge.jp>
7 */
9 #include <linux/config.h>
10 #include <linux/init.h>
11 #include <linux/errno.h>
13 #include <asm/ptrace.h>
14 #include <asm/traps.h>
15 #include <asm/irq.h>
16 #include <asm/io.h>
17 #include <asm/gpio.h>
18 #include <asm/regs306x.h>
20 /* saved vector list */
21 const int __initdata h8300_saved_vectors[]={
22 #if defined(CONFIG_GDB_DEBUG)
23 TRAP3_VEC,
24 #endif
28 /* trap entry table */
29 const unsigned long __initdata h8300_trap_table[NR_TRAPS]={
30 0,0,0,0,0,0,0,0,
31 (unsigned long)system_call, /* TRAPA #0 */
32 0,0,
33 (unsigned long)trace_break, /* TRAPA #3 */
36 int h8300_enable_irq_pin(unsigned int irq)
38 int bitmask;
39 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
40 return 0;
42 /* initialize IRQ pin */
43 bitmask = 1 << (irq - EXT_IRQ0);
44 switch(irq) {
45 case EXT_IRQ0:
46 case EXT_IRQ1:
47 case EXT_IRQ2:
48 case EXT_IRQ3:
49 if (H8300_GPIO_RESERVE(H8300_GPIO_P8, bitmask) == 0)
50 return -EBUSY;
51 H8300_GPIO_DDR(H8300_GPIO_P8, bitmask, H8300_GPIO_INPUT);
52 break;
53 case EXT_IRQ4:
54 case EXT_IRQ5:
55 if (H8300_GPIO_RESERVE(H8300_GPIO_P9, bitmask) == 0)
56 return -EBUSY;
57 H8300_GPIO_DDR(H8300_GPIO_P9, bitmask, H8300_GPIO_INPUT);
58 break;
61 return 0;
64 void h8300_disable_irq_pin(unsigned int irq)
66 int bitmask;
67 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
68 return;
70 /* disable interrupt & release IRQ pin */
71 bitmask = 1 << (irq - EXT_IRQ0);
72 switch(irq) {
73 case EXT_IRQ0:
74 case EXT_IRQ1:
75 case EXT_IRQ2:
76 case EXT_IRQ3:
77 *(volatile unsigned char *)IER &= ~bitmask;
78 H8300_GPIO_FREE(H8300_GPIO_P8, bitmask);
79 break ;
80 case EXT_IRQ4:
81 case EXT_IRQ5:
82 *(volatile unsigned char *)IER &= ~bitmask;
83 H8300_GPIO_FREE(H8300_GPIO_P9, bitmask);
84 break;