diff options
author | Vitaly Bordug <vbordug@ru.mvista.com> | 2007-01-30 18:08:54 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-02-06 22:03:20 -0500 |
commit | 73844ecbaa58885c5e89af7d1b08faaffffa6833 (patch) | |
tree | df2a4f20261e2cf348347786362dff0701e54359 /arch | |
parent | c19cdcb1b8d33a20d372191eced2def7f901806b (diff) |
[POWERPC] cpm2: CPM2 interrupt controller fix
This contains important fixes for the CPM2 PIC code. Eliminated
CPM_IRQ_OFFSET, pulling the respective interrupt numbers from the interrupt
mapping. Updated devicetree files to reflect that. Changed direct
IC-related IO accesses to the IO accessors. Fixed all the sense values to
keep coherency with ipic. In the current code, CPM2 stuff will have no IRQs
and hence could be hardly usable.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/boot/dts/mpc8272ads.dts | 47 | ||||
-rw-r--r-- | arch/powerpc/boot/dts/mpc8560ads.dts | 10 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm2_pic.c | 150 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm2_pic.h | 2 |
4 files changed, 121 insertions, 88 deletions
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts index 34efdd028c4f..286638e8af6e 100644 --- a/arch/powerpc/boot/dts/mpc8272ads.dts +++ b/arch/powerpc/boot/dts/mpc8272ads.dts | |||
@@ -53,6 +53,13 @@ | |||
53 | reg = <00000000 4000000 f4500000 00000020>; | 53 | reg = <00000000 4000000 f4500000 00000020>; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | chosen { | ||
57 | name = "chosen"; | ||
58 | linux,platform = <0>; | ||
59 | interrupt-controller = <10c00>; | ||
60 | linux,phandle = <400>; | ||
61 | }; | ||
62 | |||
56 | soc8272@f0000000 { | 63 | soc8272@f0000000 { |
57 | #address-cells = <1>; | 64 | #address-cells = <1>; |
58 | #size-cells = <1>; | 65 | #size-cells = <1>; |
@@ -71,7 +78,7 @@ | |||
71 | ethernet-phy@0 { | 78 | ethernet-phy@0 { |
72 | linux,phandle = <2452000>; | 79 | linux,phandle = <2452000>; |
73 | interrupt-parent = <10c00>; | 80 | interrupt-parent = <10c00>; |
74 | interrupts = <19 1>; | 81 | interrupts = <17 4>; |
75 | reg = <0>; | 82 | reg = <0>; |
76 | bitbang = [ 12 12 13 02 02 01 ]; | 83 | bitbang = [ 12 12 13 02 02 01 ]; |
77 | device_type = "ethernet-phy"; | 84 | device_type = "ethernet-phy"; |
@@ -79,7 +86,7 @@ | |||
79 | ethernet-phy@1 { | 86 | ethernet-phy@1 { |
80 | linux,phandle = <2452001>; | 87 | linux,phandle = <2452001>; |
81 | interrupt-parent = <10c00>; | 88 | interrupt-parent = <10c00>; |
82 | interrupts = <19 1>; | 89 | interrupts = <17 4>; |
83 | bitbang = [ 12 12 13 02 02 01 ]; | 90 | bitbang = [ 12 12 13 02 02 01 ]; |
84 | reg = <3>; | 91 | reg = <3>; |
85 | device_type = "ethernet-phy"; | 92 | device_type = "ethernet-phy"; |
@@ -90,7 +97,7 @@ | |||
90 | #address-cells = <1>; | 97 | #address-cells = <1>; |
91 | #size-cells = <0>; | 98 | #size-cells = <0>; |
92 | device_type = "network"; | 99 | device_type = "network"; |
93 | device-id = <2>; | 100 | device-id = <1>; |
94 | compatible = "fs_enet"; | 101 | compatible = "fs_enet"; |
95 | model = "FCC"; | 102 | model = "FCC"; |
96 | reg = <11300 20 8400 100 11380 30>; | 103 | reg = <11300 20 8400 100 11380 30>; |
@@ -104,7 +111,7 @@ | |||
104 | 111 | ||
105 | ethernet@25000 { | 112 | ethernet@25000 { |
106 | device_type = "network"; | 113 | device_type = "network"; |
107 | device-id = <3>; | 114 | device-id = <2>; |
108 | compatible = "fs_enet"; | 115 | compatible = "fs_enet"; |
109 | model = "FCC"; | 116 | model = "FCC"; |
110 | reg = <11320 20 8500 100 113b0 30>; | 117 | reg = <11320 20 8500 100 113b0 30>; |
@@ -133,7 +140,7 @@ | |||
133 | device_type = "serial"; | 140 | device_type = "serial"; |
134 | compatible = "cpm_uart"; | 141 | compatible = "cpm_uart"; |
135 | model = "SCC"; | 142 | model = "SCC"; |
136 | device-id = <2>; | 143 | device-id = <1>; |
137 | reg = <11a00 20 8000 100>; | 144 | reg = <11a00 20 8000 100>; |
138 | current-speed = <1c200>; | 145 | current-speed = <1c200>; |
139 | interrupts = <28 2>; | 146 | interrupts = <28 2>; |
@@ -147,7 +154,7 @@ | |||
147 | device_type = "serial"; | 154 | device_type = "serial"; |
148 | compatible = "cpm_uart"; | 155 | compatible = "cpm_uart"; |
149 | model = "SCC"; | 156 | model = "SCC"; |
150 | device-id = <5>; | 157 | device-id = <4>; |
151 | reg = <11a60 20 8300 100>; | 158 | reg = <11a60 20 8300 100>; |
152 | current-speed = <1c200>; | 159 | current-speed = <1c200>; |
153 | interrupts = <2b 2>; | 160 | interrupts = <2b 2>; |
@@ -181,24 +188,24 @@ | |||
181 | interrupt-map = < | 188 | interrupt-map = < |
182 | 189 | ||
183 | /* IDSEL 0x16 */ | 190 | /* IDSEL 0x16 */ |
184 | b000 0 0 1 f8200000 40 0 | 191 | b000 0 0 1 f8200000 40 8 |
185 | b000 0 0 2 f8200000 41 0 | 192 | b000 0 0 2 f8200000 41 8 |
186 | b000 0 0 3 f8200000 42 0 | 193 | b000 0 0 3 f8200000 42 8 |
187 | b000 0 0 4 f8200000 43 0 | 194 | b000 0 0 4 f8200000 43 8 |
188 | 195 | ||
189 | /* IDSEL 0x17 */ | 196 | /* IDSEL 0x17 */ |
190 | b800 0 0 1 f8200000 43 0 | 197 | b800 0 0 1 f8200000 43 8 |
191 | b800 0 0 2 f8200000 40 0 | 198 | b800 0 0 2 f8200000 40 8 |
192 | b800 0 0 3 f8200000 41 0 | 199 | b800 0 0 3 f8200000 41 8 |
193 | b800 0 0 4 f8200000 42 0 | 200 | b800 0 0 4 f8200000 42 8 |
194 | 201 | ||
195 | /* IDSEL 0x18 */ | 202 | /* IDSEL 0x18 */ |
196 | c000 0 0 1 f8200000 42 0 | 203 | c000 0 0 1 f8200000 42 8 |
197 | c000 0 0 2 f8200000 43 0 | 204 | c000 0 0 2 f8200000 43 8 |
198 | c000 0 0 3 f8200000 40 0 | 205 | c000 0 0 3 f8200000 40 8 |
199 | c000 0 0 4 f8200000 41 0>; | 206 | c000 0 0 4 f8200000 41 8>; |
200 | interrupt-parent = <10c00>; | 207 | interrupt-parent = <10c00>; |
201 | interrupts = <14 3>; | 208 | interrupts = <14 8>; |
202 | bus-range = <0 0>; | 209 | bus-range = <0 0>; |
203 | ranges = <02000000 0 80000000 80000000 0 40000000 | 210 | ranges = <02000000 0 80000000 80000000 0 40000000 |
204 | 01000000 0 00000000 f6000000 0 02000000>; | 211 | 01000000 0 00000000 f6000000 0 02000000>; |
@@ -210,7 +217,7 @@ | |||
210 | model = "SEC2"; | 217 | model = "SEC2"; |
211 | compatible = "talitos"; | 218 | compatible = "talitos"; |
212 | reg = <30000 10000>; | 219 | reg = <30000 10000>; |
213 | interrupts = <b 0>; | 220 | interrupts = <b 2>; |
214 | interrupt-parent = <10c00>; | 221 | interrupt-parent = <10c00>; |
215 | num-channels = <4>; | 222 | num-channels = <4>; |
216 | channel-fifo-len = <18>; | 223 | channel-fifo-len = <18>; |
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts index 2b168486aeba..119bd5d3a834 100644 --- a/arch/powerpc/boot/dts/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/mpc8560ads.dts | |||
@@ -200,7 +200,7 @@ | |||
200 | a800 0 0 4 40000 31 1>; | 200 | a800 0 0 4 40000 31 1>; |
201 | 201 | ||
202 | interrupt-parent = <40000>; | 202 | interrupt-parent = <40000>; |
203 | interrupts = <42 0>; | 203 | interrupts = <8 0>; |
204 | bus-range = <0 0>; | 204 | bus-range = <0 0>; |
205 | ranges = <02000000 0 80000000 80000000 0 20000000 | 205 | ranges = <02000000 0 80000000 80000000 0 20000000 |
206 | 01000000 0 00000000 e2000000 0 01000000>; | 206 | 01000000 0 00000000 e2000000 0 01000000>; |
@@ -250,7 +250,7 @@ | |||
250 | rx-clock = <1>; | 250 | rx-clock = <1>; |
251 | tx-clock = <1>; | 251 | tx-clock = <1>; |
252 | current-speed = <1c200>; | 252 | current-speed = <1c200>; |
253 | interrupts = <64 1>; | 253 | interrupts = <28 8>; |
254 | interrupt-parent = <90c00>; | 254 | interrupt-parent = <90c00>; |
255 | }; | 255 | }; |
256 | 256 | ||
@@ -264,7 +264,7 @@ | |||
264 | rx-clock = <2>; | 264 | rx-clock = <2>; |
265 | tx-clock = <2>; | 265 | tx-clock = <2>; |
266 | current-speed = <1c200>; | 266 | current-speed = <1c200>; |
267 | interrupts = <65 1>; | 267 | interrupts = <29 8>; |
268 | interrupt-parent = <90c00>; | 268 | interrupt-parent = <90c00>; |
269 | }; | 269 | }; |
270 | 270 | ||
@@ -278,7 +278,7 @@ | |||
278 | clock-setup = <ff00ffff 250000>; | 278 | clock-setup = <ff00ffff 250000>; |
279 | rx-clock = <15>; | 279 | rx-clock = <15>; |
280 | tx-clock = <16>; | 280 | tx-clock = <16>; |
281 | interrupts = <5d 1>; | 281 | interrupts = <21 8>; |
282 | interrupt-parent = <90c00>; | 282 | interrupt-parent = <90c00>; |
283 | phy-handle = <2452002>; | 283 | phy-handle = <2452002>; |
284 | }; | 284 | }; |
@@ -293,7 +293,7 @@ | |||
293 | clock-setup = <ffff00ff 3700>; | 293 | clock-setup = <ffff00ff 3700>; |
294 | rx-clock = <17>; | 294 | rx-clock = <17>; |
295 | tx-clock = <18>; | 295 | tx-clock = <18>; |
296 | interrupts = <5e 1>; | 296 | interrupts = <22 8>; |
297 | interrupt-parent = <90c00>; | 297 | interrupt-parent = <90c00>; |
298 | phy-handle = <2452003>; | 298 | phy-handle = <2452003>; |
299 | }; | 299 | }; |
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index e2739eb93cdf..eabfe06fe05c 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
@@ -36,9 +36,20 @@ | |||
36 | #include <asm/mpc8260.h> | 36 | #include <asm/mpc8260.h> |
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | #include <asm/prom.h> | 38 | #include <asm/prom.h> |
39 | #include <asm/fs_pd.h> | ||
39 | 40 | ||
40 | #include "cpm2_pic.h" | 41 | #include "cpm2_pic.h" |
41 | 42 | ||
43 | /* External IRQS */ | ||
44 | #define CPM2_IRQ_EXT1 19 | ||
45 | #define CPM2_IRQ_EXT7 25 | ||
46 | |||
47 | /* Port C IRQS */ | ||
48 | #define CPM2_IRQ_PORTC15 48 | ||
49 | #define CPM2_IRQ_PORTC0 63 | ||
50 | |||
51 | static intctl_cpm2_t *cpm2_intctl; | ||
52 | |||
42 | static struct device_node *cpm2_pic_node; | 53 | static struct device_node *cpm2_pic_node; |
43 | static struct irq_host *cpm2_pic_host; | 54 | static struct irq_host *cpm2_pic_host; |
44 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 55 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) |
@@ -68,68 +79,55 @@ static const u_char irq_to_siubit[] = { | |||
68 | 24, 25, 26, 27, 28, 29, 30, 31, | 79 | 24, 25, 26, 27, 28, 29, 30, 31, |
69 | }; | 80 | }; |
70 | 81 | ||
71 | static void cpm2_mask_irq(unsigned int irq_nr) | 82 | static void cpm2_mask_irq(unsigned int virq) |
72 | { | 83 | { |
73 | int bit, word; | 84 | int bit, word; |
74 | volatile uint *simr; | 85 | unsigned int irq_nr = virq_to_hw(virq); |
75 | |||
76 | irq_nr -= CPM_IRQ_OFFSET; | ||
77 | 86 | ||
78 | bit = irq_to_siubit[irq_nr]; | 87 | bit = irq_to_siubit[irq_nr]; |
79 | word = irq_to_siureg[irq_nr]; | 88 | word = irq_to_siureg[irq_nr]; |
80 | 89 | ||
81 | simr = &(cpm2_intctl->ic_simrh); | ||
82 | ppc_cached_irq_mask[word] &= ~(1 << bit); | 90 | ppc_cached_irq_mask[word] &= ~(1 << bit); |
83 | simr[word] = ppc_cached_irq_mask[word]; | 91 | out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]); |
84 | } | 92 | } |
85 | 93 | ||
86 | static void cpm2_unmask_irq(unsigned int irq_nr) | 94 | static void cpm2_unmask_irq(unsigned int virq) |
87 | { | 95 | { |
88 | int bit, word; | 96 | int bit, word; |
89 | volatile uint *simr; | 97 | unsigned int irq_nr = virq_to_hw(virq); |
90 | |||
91 | irq_nr -= CPM_IRQ_OFFSET; | ||
92 | 98 | ||
93 | bit = irq_to_siubit[irq_nr]; | 99 | bit = irq_to_siubit[irq_nr]; |
94 | word = irq_to_siureg[irq_nr]; | 100 | word = irq_to_siureg[irq_nr]; |
95 | 101 | ||
96 | simr = &(cpm2_intctl->ic_simrh); | ||
97 | ppc_cached_irq_mask[word] |= 1 << bit; | 102 | ppc_cached_irq_mask[word] |= 1 << bit; |
98 | simr[word] = ppc_cached_irq_mask[word]; | 103 | out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]); |
99 | } | 104 | } |
100 | 105 | ||
101 | static void cpm2_mask_and_ack(unsigned int irq_nr) | 106 | static void cpm2_ack(unsigned int virq) |
102 | { | 107 | { |
103 | int bit, word; | 108 | int bit, word; |
104 | volatile uint *simr, *sipnr; | 109 | unsigned int irq_nr = virq_to_hw(virq); |
105 | |||
106 | irq_nr -= CPM_IRQ_OFFSET; | ||
107 | 110 | ||
108 | bit = irq_to_siubit[irq_nr]; | 111 | bit = irq_to_siubit[irq_nr]; |
109 | word = irq_to_siureg[irq_nr]; | 112 | word = irq_to_siureg[irq_nr]; |
110 | 113 | ||
111 | simr = &(cpm2_intctl->ic_simrh); | 114 | out_be32(&cpm2_intctl->ic_sipnrh + word, 1 << bit); |
112 | sipnr = &(cpm2_intctl->ic_sipnrh); | ||
113 | ppc_cached_irq_mask[word] &= ~(1 << bit); | ||
114 | simr[word] = ppc_cached_irq_mask[word]; | ||
115 | sipnr[word] = 1 << bit; | ||
116 | } | 115 | } |
117 | 116 | ||
118 | static void cpm2_end_irq(unsigned int irq_nr) | 117 | static void cpm2_end_irq(unsigned int virq) |
119 | { | 118 | { |
120 | int bit, word; | 119 | int bit, word; |
121 | volatile uint *simr; | 120 | unsigned int irq_nr = virq_to_hw(virq); |
122 | 121 | ||
123 | if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) | 122 | if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) |
124 | && irq_desc[irq_nr].action) { | 123 | && irq_desc[irq_nr].action) { |
125 | 124 | ||
126 | irq_nr -= CPM_IRQ_OFFSET; | ||
127 | bit = irq_to_siubit[irq_nr]; | 125 | bit = irq_to_siubit[irq_nr]; |
128 | word = irq_to_siureg[irq_nr]; | 126 | word = irq_to_siureg[irq_nr]; |
129 | 127 | ||
130 | simr = &(cpm2_intctl->ic_simrh); | ||
131 | ppc_cached_irq_mask[word] |= 1 << bit; | 128 | ppc_cached_irq_mask[word] |= 1 << bit; |
132 | simr[word] = ppc_cached_irq_mask[word]; | 129 | out_be32(&cpm2_intctl->ic_simrh + word, ppc_cached_irq_mask[word]); |
130 | |||
133 | /* | 131 | /* |
134 | * Work around large numbers of spurious IRQs on PowerPC 82xx | 132 | * Work around large numbers of spurious IRQs on PowerPC 82xx |
135 | * systems. | 133 | * systems. |
@@ -138,13 +136,59 @@ static void cpm2_end_irq(unsigned int irq_nr) | |||
138 | } | 136 | } |
139 | } | 137 | } |
140 | 138 | ||
139 | static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) | ||
140 | { | ||
141 | unsigned int src = virq_to_hw(virq); | ||
142 | struct irq_desc *desc = get_irq_desc(virq); | ||
143 | unsigned int vold, vnew, edibit; | ||
144 | |||
145 | if (flow_type == IRQ_TYPE_NONE) | ||
146 | flow_type = IRQ_TYPE_LEVEL_LOW; | ||
147 | |||
148 | if (flow_type & IRQ_TYPE_EDGE_RISING) { | ||
149 | printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", | ||
150 | flow_type); | ||
151 | return -EINVAL; | ||
152 | } | ||
153 | |||
154 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); | ||
155 | desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; | ||
156 | if (flow_type & IRQ_TYPE_LEVEL_LOW) { | ||
157 | desc->status |= IRQ_LEVEL; | ||
158 | desc->handle_irq = handle_level_irq; | ||
159 | } else | ||
160 | desc->handle_irq = handle_edge_irq; | ||
161 | |||
162 | /* internal IRQ senses are LEVEL_LOW | ||
163 | * EXT IRQ and Port C IRQ senses are programmable | ||
164 | */ | ||
165 | if (src >= CPM2_IRQ_EXT1 && src <= CPM2_IRQ_EXT7) | ||
166 | edibit = (14 - (src - CPM2_IRQ_EXT1)); | ||
167 | else | ||
168 | if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) | ||
169 | edibit = (31 - (src - CPM2_IRQ_PORTC15)); | ||
170 | else | ||
171 | return (flow_type & IRQ_TYPE_LEVEL_LOW) ? 0 : -EINVAL; | ||
172 | |||
173 | vold = in_be32(&cpm2_intctl->ic_siexr); | ||
174 | |||
175 | if ((flow_type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_FALLING) | ||
176 | vnew = vold | (1 << edibit); | ||
177 | else | ||
178 | vnew = vold & ~(1 << edibit); | ||
179 | |||
180 | if (vold != vnew) | ||
181 | out_be32(&cpm2_intctl->ic_siexr, vnew); | ||
182 | return 0; | ||
183 | } | ||
184 | |||
141 | static struct irq_chip cpm2_pic = { | 185 | static struct irq_chip cpm2_pic = { |
142 | .typename = " CPM2 SIU ", | 186 | .typename = " CPM2 SIU ", |
143 | .enable = cpm2_unmask_irq, | 187 | .mask = cpm2_mask_irq, |
144 | .disable = cpm2_mask_irq, | ||
145 | .unmask = cpm2_unmask_irq, | 188 | .unmask = cpm2_unmask_irq, |
146 | .mask_ack = cpm2_mask_and_ack, | 189 | .ack = cpm2_ack, |
147 | .end = cpm2_end_irq, | 190 | .eoi = cpm2_end_irq, |
191 | .set_type = cpm2_set_irq_type, | ||
148 | }; | 192 | }; |
149 | 193 | ||
150 | unsigned int cpm2_get_irq(void) | 194 | unsigned int cpm2_get_irq(void) |
@@ -154,17 +198,17 @@ unsigned int cpm2_get_irq(void) | |||
154 | 198 | ||
155 | /* For CPM2, read the SIVEC register and shift the bits down | 199 | /* For CPM2, read the SIVEC register and shift the bits down |
156 | * to get the irq number. */ | 200 | * to get the irq number. */ |
157 | bits = cpm2_intctl->ic_sivec; | 201 | bits = in_be32(&cpm2_intctl->ic_sivec); |
158 | irq = bits >> 26; | 202 | irq = bits >> 26; |
159 | 203 | ||
160 | if (irq == 0) | 204 | if (irq == 0) |
161 | return(-1); | 205 | return(-1); |
162 | return irq+CPM_IRQ_OFFSET; | 206 | return irq_linear_revmap(cpm2_pic_host, irq); |
163 | } | 207 | } |
164 | 208 | ||
165 | static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node) | 209 | static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node) |
166 | { | 210 | { |
167 | return cpm2_pic_node == NULL || cpm2_pic_node == node; | 211 | return cpm2_pic_node == node; |
168 | } | 212 | } |
169 | 213 | ||
170 | static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, | 214 | static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, |
@@ -177,39 +221,21 @@ static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, | |||
177 | return 0; | 221 | return 0; |
178 | } | 222 | } |
179 | 223 | ||
180 | static void cpm2_host_unmap(struct irq_host *h, unsigned int virq) | ||
181 | { | ||
182 | /* Make sure irq is masked in hardware */ | ||
183 | cpm2_mask_irq(virq); | ||
184 | |||
185 | /* remove chip and handler */ | ||
186 | set_irq_chip_and_handler(virq, NULL, NULL); | ||
187 | } | ||
188 | |||
189 | static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 224 | static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct, |
190 | u32 *intspec, unsigned int intsize, | 225 | u32 *intspec, unsigned int intsize, |
191 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 226 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
192 | { | 227 | { |
193 | static const unsigned char map_cpm2_senses[4] = { | ||
194 | IRQ_TYPE_LEVEL_LOW, | ||
195 | IRQ_TYPE_LEVEL_HIGH, | ||
196 | IRQ_TYPE_EDGE_FALLING, | ||
197 | IRQ_TYPE_EDGE_RISING, | ||
198 | }; | ||
199 | |||
200 | *out_hwirq = intspec[0]; | 228 | *out_hwirq = intspec[0]; |
201 | if (intsize > 1 && intspec[1] < 4) | 229 | if (intsize > 1) |
202 | *out_flags = map_cpm2_senses[intspec[1]]; | 230 | *out_flags = intspec[1]; |
203 | else | 231 | else |
204 | *out_flags = IRQ_TYPE_NONE; | 232 | *out_flags = IRQ_TYPE_NONE; |
205 | |||
206 | return 0; | 233 | return 0; |
207 | } | 234 | } |
208 | 235 | ||
209 | static struct irq_host_ops cpm2_pic_host_ops = { | 236 | static struct irq_host_ops cpm2_pic_host_ops = { |
210 | .match = cpm2_pic_host_match, | 237 | .match = cpm2_pic_host_match, |
211 | .map = cpm2_pic_host_map, | 238 | .map = cpm2_pic_host_map, |
212 | .unmap = cpm2_host_unmap, | ||
213 | .xlate = cpm2_pic_host_xlate, | 239 | .xlate = cpm2_pic_host_xlate, |
214 | }; | 240 | }; |
215 | 241 | ||
@@ -217,32 +243,34 @@ void cpm2_pic_init(struct device_node *node) | |||
217 | { | 243 | { |
218 | int i; | 244 | int i; |
219 | 245 | ||
246 | cpm2_intctl = cpm2_map(im_intctl); | ||
247 | |||
220 | /* Clear the CPM IRQ controller, in case it has any bits set | 248 | /* Clear the CPM IRQ controller, in case it has any bits set |
221 | * from the bootloader | 249 | * from the bootloader |
222 | */ | 250 | */ |
223 | 251 | ||
224 | /* Mask out everything */ | 252 | /* Mask out everything */ |
225 | 253 | ||
226 | cpm2_intctl->ic_simrh = 0x00000000; | 254 | out_be32(&cpm2_intctl->ic_simrh, 0x00000000); |
227 | cpm2_intctl->ic_simrl = 0x00000000; | 255 | out_be32(&cpm2_intctl->ic_simrl, 0x00000000); |
228 | 256 | ||
229 | wmb(); | 257 | wmb(); |
230 | 258 | ||
231 | /* Ack everything */ | 259 | /* Ack everything */ |
232 | cpm2_intctl->ic_sipnrh = 0xffffffff; | 260 | out_be32(&cpm2_intctl->ic_sipnrh, 0xffffffff); |
233 | cpm2_intctl->ic_sipnrl = 0xffffffff; | 261 | out_be32(&cpm2_intctl->ic_sipnrl, 0xffffffff); |
234 | wmb(); | 262 | wmb(); |
235 | 263 | ||
236 | /* Dummy read of the vector */ | 264 | /* Dummy read of the vector */ |
237 | i = cpm2_intctl->ic_sivec; | 265 | i = in_be32(&cpm2_intctl->ic_sivec); |
238 | rmb(); | 266 | rmb(); |
239 | 267 | ||
240 | /* Initialize the default interrupt mapping priorities, | 268 | /* Initialize the default interrupt mapping priorities, |
241 | * in case the boot rom changed something on us. | 269 | * in case the boot rom changed something on us. |
242 | */ | 270 | */ |
243 | cpm2_intctl->ic_sicr = 0; | 271 | out_be16(&cpm2_intctl->ic_sicr, 0); |
244 | cpm2_intctl->ic_scprrh = 0x05309770; | 272 | out_be32(&cpm2_intctl->ic_scprrh, 0x05309770); |
245 | cpm2_intctl->ic_scprrl = 0x05309770; | 273 | out_be32(&cpm2_intctl->ic_scprrl, 0x05309770); |
246 | 274 | ||
247 | /* create a legacy host */ | 275 | /* create a legacy host */ |
248 | cpm2_pic_node = of_node_get(node); | 276 | cpm2_pic_node = of_node_get(node); |
diff --git a/arch/powerpc/sysdev/cpm2_pic.h b/arch/powerpc/sysdev/cpm2_pic.h index 2840616529e4..30e5828a2781 100644 --- a/arch/powerpc/sysdev/cpm2_pic.h +++ b/arch/powerpc/sysdev/cpm2_pic.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _PPC_KERNEL_CPM2_H | 1 | #ifndef _PPC_KERNEL_CPM2_H |
2 | #define _PPC_KERNEL_CPM2_H | 2 | #define _PPC_KERNEL_CPM2_H |
3 | 3 | ||
4 | extern intctl_cpm2_t *cpm2_intctl; | ||
5 | |||
6 | extern unsigned int cpm2_get_irq(void); | 4 | extern unsigned int cpm2_get_irq(void); |
7 | 5 | ||
8 | extern void cpm2_pic_init(struct device_node*); | 6 | extern void cpm2_pic_init(struct device_node*); |