diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/boards/renesas/hs7751rvoip/irq.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sh/boards/renesas/hs7751rvoip/irq.c')
-rw-r--r-- | arch/sh/boards/renesas/hs7751rvoip/irq.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/arch/sh/boards/renesas/hs7751rvoip/irq.c b/arch/sh/boards/renesas/hs7751rvoip/irq.c new file mode 100644 index 000000000000..a7921f67a35f --- /dev/null +++ b/arch/sh/boards/renesas/hs7751rvoip/irq.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/hs7751rvoip/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * | ||
6 | * Renesas Technology Sales HS7751RVoIP Support. | ||
7 | * | ||
8 | * Modified for HS7751RVoIP by | ||
9 | * Atom Create Engineering Co., Ltd. 2002. | ||
10 | * Lineo uSolutions, Inc. 2003. | ||
11 | */ | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/irq.h> | ||
18 | #include <asm/hs7751rvoip/hs7751rvoip.h> | ||
19 | |||
20 | static int mask_pos[] = {8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7}; | ||
21 | |||
22 | static void enable_hs7751rvoip_irq(unsigned int irq); | ||
23 | static void disable_hs7751rvoip_irq(unsigned int irq); | ||
24 | |||
25 | /* shutdown is same as "disable" */ | ||
26 | #define shutdown_hs7751rvoip_irq disable_hs7751rvoip_irq | ||
27 | |||
28 | static void ack_hs7751rvoip_irq(unsigned int irq); | ||
29 | static void end_hs7751rvoip_irq(unsigned int irq); | ||
30 | |||
31 | static unsigned int startup_hs7751rvoip_irq(unsigned int irq) | ||
32 | { | ||
33 | enable_hs7751rvoip_irq(irq); | ||
34 | return 0; /* never anything pending */ | ||
35 | } | ||
36 | |||
37 | static void disable_hs7751rvoip_irq(unsigned int irq) | ||
38 | { | ||
39 | unsigned long flags; | ||
40 | unsigned short val; | ||
41 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | ||
42 | |||
43 | /* Set the priority in IPR to 0 */ | ||
44 | local_irq_save(flags); | ||
45 | val = ctrl_inw(IRLCNTR3); | ||
46 | val &= mask; | ||
47 | ctrl_outw(val, IRLCNTR3); | ||
48 | local_irq_restore(flags); | ||
49 | } | ||
50 | |||
51 | static void enable_hs7751rvoip_irq(unsigned int irq) | ||
52 | { | ||
53 | unsigned long flags; | ||
54 | unsigned short val; | ||
55 | unsigned short value = (0x0001 << mask_pos[irq]); | ||
56 | |||
57 | /* Set priority in IPR back to original value */ | ||
58 | local_irq_save(flags); | ||
59 | val = ctrl_inw(IRLCNTR3); | ||
60 | val |= value; | ||
61 | ctrl_outw(val, IRLCNTR3); | ||
62 | local_irq_restore(flags); | ||
63 | } | ||
64 | |||
65 | static void ack_hs7751rvoip_irq(unsigned int irq) | ||
66 | { | ||
67 | disable_hs7751rvoip_irq(irq); | ||
68 | } | ||
69 | |||
70 | static void end_hs7751rvoip_irq(unsigned int irq) | ||
71 | { | ||
72 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
73 | enable_hs7751rvoip_irq(irq); | ||
74 | } | ||
75 | |||
76 | static struct hw_interrupt_type hs7751rvoip_irq_type = { | ||
77 | "HS7751RVoIP IRQ", | ||
78 | startup_hs7751rvoip_irq, | ||
79 | shutdown_hs7751rvoip_irq, | ||
80 | enable_hs7751rvoip_irq, | ||
81 | disable_hs7751rvoip_irq, | ||
82 | ack_hs7751rvoip_irq, | ||
83 | end_hs7751rvoip_irq, | ||
84 | }; | ||
85 | |||
86 | static void make_hs7751rvoip_irq(unsigned int irq) | ||
87 | { | ||
88 | disable_irq_nosync(irq); | ||
89 | irq_desc[irq].handler = &hs7751rvoip_irq_type; | ||
90 | disable_hs7751rvoip_irq(irq); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Initialize IRQ setting | ||
95 | */ | ||
96 | void __init init_hs7751rvoip_IRQ(void) | ||
97 | { | ||
98 | int i; | ||
99 | |||
100 | /* IRL0=ON HOOK1 | ||
101 | * IRL1=OFF HOOK1 | ||
102 | * IRL2=ON HOOK2 | ||
103 | * IRL3=OFF HOOK2 | ||
104 | * IRL4=Ringing Detection | ||
105 | * IRL5=CODEC | ||
106 | * IRL6=Ethernet | ||
107 | * IRL7=Ethernet Hub | ||
108 | * IRL8=USB Communication | ||
109 | * IRL9=USB Connection | ||
110 | * IRL10=USB DMA | ||
111 | * IRL11=CF Card | ||
112 | * IRL12=PCMCIA | ||
113 | * IRL13=PCI Slot | ||
114 | */ | ||
115 | ctrl_outw(0x9876, IRLCNTR1); | ||
116 | ctrl_outw(0xdcba, IRLCNTR2); | ||
117 | ctrl_outw(0x0050, IRLCNTR4); | ||
118 | ctrl_outw(0x4321, IRLCNTR5); | ||
119 | |||
120 | for (i=0; i<14; i++) | ||
121 | make_hs7751rvoip_irq(i); | ||
122 | } | ||