wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000-2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * (C) Copyright 2002 (440 port) |
| 6 | * Scott McNutt, Artesyn Communication Producs, smcnutt@artsyncp.com |
| 7 | * |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 8 | * (C) Copyright 2003 (440GX port) |
| 9 | * Travis B. Sawyer, Sandburst Corporation, tsawyer@sandburst.com |
| 10 | * |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 11 | * See file CREDITS for list of people who contributed to this |
| 12 | * project. |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU General Public License as |
| 16 | * published by the Free Software Foundation; either version 2 of |
| 17 | * the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This program is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | * GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License |
| 25 | * along with this program; if not, write to the Free Software |
| 26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 27 | * MA 02111-1307 USA |
| 28 | */ |
| 29 | |
| 30 | #include <common.h> |
| 31 | #include <watchdog.h> |
| 32 | #include <command.h> |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 33 | #include <asm/processor.h> |
| 34 | #include <ppc4xx.h> |
| 35 | #include <ppc_asm.tmpl> |
| 36 | #include <commproc.h> |
| 37 | #include "vecnum.h" |
| 38 | |
| 39 | /****************************************************************************/ |
| 40 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 41 | /* |
| 42 | * CPM interrupt vector functions. |
| 43 | */ |
| 44 | struct irq_action { |
| 45 | interrupt_handler_t *handler; |
| 46 | void *arg; |
| 47 | int count; |
| 48 | }; |
| 49 | |
| 50 | static struct irq_action irq_vecs[32]; |
| 51 | |
| 52 | #if defined(CONFIG_440) |
| 53 | static struct irq_action irq_vecs1[32]; /* For UIC1 */ |
| 54 | |
| 55 | void uic1_interrupt( void * parms); /* UIC1 handler */ |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 56 | |
| 57 | #if defined(CONFIG_440_GX) |
| 58 | static struct irq_action irq_vecs2[32]; /* For UIC2 */ |
| 59 | |
| 60 | void uic0_interrupt( void * parms); /* UIC0 handler */ |
| 61 | void uic2_interrupt( void * parms); /* UIC2 handler */ |
| 62 | #endif /* CONFIG_440_GX */ |
| 63 | |
| 64 | #endif /* CONFIG_440 */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 65 | |
| 66 | /****************************************************************************/ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 67 | #if defined(CONFIG_440) |
| 68 | |
| 69 | /* SPRN changed in 440 */ |
| 70 | static __inline__ void set_evpr(unsigned long val) |
| 71 | { |
| 72 | asm volatile("mtspr 0x03f,%0" : : "r" (val)); |
| 73 | } |
| 74 | |
| 75 | #else /* !defined(CONFIG_440) */ |
| 76 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 77 | static __inline__ void set_pit(unsigned long val) |
| 78 | { |
| 79 | asm volatile("mtpit %0" : : "r" (val)); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | static __inline__ void set_tcr(unsigned long val) |
| 84 | { |
| 85 | asm volatile("mttcr %0" : : "r" (val)); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | static __inline__ void set_evpr(unsigned long val) |
| 90 | { |
| 91 | asm volatile("mtevpr %0" : : "r" (val)); |
| 92 | } |
| 93 | #endif /* defined(CONFIG_440 */ |
| 94 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 95 | /****************************************************************************/ |
| 96 | |
wdenk | a8c7c70 | 2003-12-06 19:49:23 +0000 | [diff] [blame] | 97 | int interrupt_init_cpu (unsigned *decrementer_count) |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 98 | { |
| 99 | DECLARE_GLOBAL_DATA_PTR; |
| 100 | |
| 101 | int vec; |
| 102 | unsigned long val; |
| 103 | |
wdenk | a8c7c70 | 2003-12-06 19:49:23 +0000 | [diff] [blame] | 104 | /* decrementer is automatically reloaded */ |
| 105 | *decrementer_count = 0; |
wdenk | d4ca31c | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 106 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 107 | /* |
| 108 | * Mark all irqs as free |
| 109 | */ |
| 110 | for (vec=0; vec<32; vec++) { |
| 111 | irq_vecs[vec].handler = NULL; |
| 112 | irq_vecs[vec].arg = NULL; |
| 113 | irq_vecs[vec].count = 0; |
| 114 | #if defined(CONFIG_440) |
| 115 | irq_vecs1[vec].handler = NULL; |
| 116 | irq_vecs1[vec].arg = NULL; |
| 117 | irq_vecs1[vec].count = 0; |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 118 | #if defined(CONFIG_440_GX) |
| 119 | irq_vecs2[vec].handler = NULL; |
| 120 | irq_vecs2[vec].arg = NULL; |
| 121 | irq_vecs2[vec].count = 0; |
| 122 | #endif /* CONFIG_440_GX */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 123 | #endif |
| 124 | } |
| 125 | |
| 126 | #ifdef CONFIG_4xx |
| 127 | /* |
| 128 | * Init PIT |
| 129 | */ |
| 130 | #if defined(CONFIG_440) |
| 131 | val = mfspr( tcr ); |
| 132 | val &= (~0x04400000); /* clear DIS & ARE */ |
| 133 | mtspr( tcr, val ); |
| 134 | mtspr( dec, 0 ); /* Prevent exception after TSR clear*/ |
| 135 | mtspr( decar, 0 ); /* clear reload */ |
| 136 | mtspr( tsr, 0x08000000 ); /* clear DEC status */ |
stroese | 68e0236 | 2005-04-07 05:32:44 +0000 | [diff] [blame] | 137 | val = gd->bd->bi_intfreq/1000; /* 1 msec */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 138 | mtspr( decar, val ); /* Set auto-reload value */ |
| 139 | mtspr( dec, val ); /* Set inital val */ |
| 140 | #else |
| 141 | set_pit(gd->bd->bi_intfreq / 1000); |
| 142 | #endif |
| 143 | #endif /* CONFIG_4xx */ |
| 144 | |
| 145 | #ifdef CONFIG_ADCIOP |
| 146 | /* |
| 147 | * Init PIT |
| 148 | */ |
| 149 | set_pit(66000); |
| 150 | #endif |
| 151 | |
| 152 | /* |
| 153 | * Enable PIT |
| 154 | */ |
| 155 | val = mfspr(tcr); |
| 156 | val |= 0x04400000; |
| 157 | mtspr(tcr, val); |
| 158 | |
| 159 | /* |
| 160 | * Set EVPR to 0 |
| 161 | */ |
| 162 | set_evpr(0x00000000); |
| 163 | |
| 164 | #if defined(CONFIG_440) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 165 | #if !defined(CONFIG_440_GX) |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 166 | /* Install the UIC1 handlers */ |
| 167 | irq_install_handler(VECNUM_UIC1NC, uic1_interrupt, 0); |
| 168 | irq_install_handler(VECNUM_UIC1C, uic1_interrupt, 0); |
| 169 | #endif |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 170 | #endif |
| 171 | |
| 172 | #if defined(CONFIG_440_GX) |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 173 | /* Take the GX out of compatibility mode |
| 174 | * Travis Sawyer, 9 Mar 2004 |
| 175 | * NOTE: 440gx user manual inconsistency here |
| 176 | * Compatibility mode and Ethernet Clock select are not |
| 177 | * correct in the manual |
| 178 | */ |
| 179 | mfsdr(sdr_mfr, val); |
| 180 | val &= ~0x10000000; |
| 181 | mtsdr(sdr_mfr,val); |
| 182 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 183 | /* Enable UIC interrupts via UIC Base Enable Register */ |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 184 | mtdcr(uicb0sr, UICB0_ALL); |
| 185 | mtdcr(uicb0er, 0x54000000); |
| 186 | /* None are critical */ |
| 187 | mtdcr(uicb0cr, 0); |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 188 | #endif |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 189 | |
| 190 | return (0); |
| 191 | } |
| 192 | |
| 193 | /****************************************************************************/ |
| 194 | |
| 195 | /* |
| 196 | * Handle external interrupts |
| 197 | */ |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 198 | #if defined(CONFIG_440_GX) |
| 199 | void external_interrupt(struct pt_regs *regs) |
| 200 | { |
| 201 | ulong uic_msr; |
| 202 | |
| 203 | /* |
| 204 | * Read masked interrupt status register to determine interrupt source |
| 205 | */ |
| 206 | /* 440 GX uses base uic register */ |
| 207 | uic_msr = mfdcr(uicb0msr); |
| 208 | |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 209 | if ( (UICB0_UIC0CI & uic_msr) || (UICB0_UIC0NCI & uic_msr) ) |
| 210 | uic0_interrupt(0); |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 211 | |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 212 | if ( (UICB0_UIC1CI & uic_msr) || (UICB0_UIC1NCI & uic_msr) ) |
| 213 | uic1_interrupt(0); |
| 214 | |
| 215 | if ( (UICB0_UIC2CI & uic_msr) || (UICB0_UIC2NCI & uic_msr) ) |
| 216 | uic2_interrupt(0); |
| 217 | |
| 218 | mtdcr(uicb0sr, uic_msr); |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 219 | |
| 220 | return; |
| 221 | |
| 222 | } /* external_interrupt CONFIG_440_GX */ |
| 223 | |
| 224 | #else |
| 225 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 226 | void external_interrupt(struct pt_regs *regs) |
| 227 | { |
| 228 | ulong uic_msr; |
| 229 | ulong msr_shift; |
| 230 | int vec; |
| 231 | |
| 232 | /* |
| 233 | * Read masked interrupt status register to determine interrupt source |
| 234 | */ |
| 235 | uic_msr = mfdcr(uicmsr); |
| 236 | msr_shift = uic_msr; |
| 237 | vec = 0; |
| 238 | |
| 239 | while (msr_shift != 0) { |
| 240 | if (msr_shift & 0x80000000) { |
| 241 | /* |
| 242 | * Increment irq counter (for debug purpose only) |
| 243 | */ |
| 244 | irq_vecs[vec].count++; |
| 245 | |
| 246 | if (irq_vecs[vec].handler != NULL) { |
| 247 | /* call isr */ |
| 248 | (*irq_vecs[vec].handler)(irq_vecs[vec].arg); |
| 249 | } else { |
| 250 | mtdcr(uicer, mfdcr(uicer) & ~(0x80000000 >> vec)); |
| 251 | printf ("Masking bogus interrupt vector 0x%x\n", vec); |
| 252 | } |
| 253 | |
| 254 | /* |
| 255 | * After servicing the interrupt, we have to remove the status indicator. |
| 256 | */ |
| 257 | mtdcr(uicsr, (0x80000000 >> vec)); |
| 258 | } |
| 259 | |
| 260 | /* |
| 261 | * Shift msr to next position and increment vector |
| 262 | */ |
| 263 | msr_shift <<= 1; |
| 264 | vec++; |
| 265 | } |
| 266 | } |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 267 | #endif |
| 268 | |
| 269 | #if defined(CONFIG_440_GX) |
| 270 | /* Handler for UIC0 interrupt */ |
| 271 | void uic0_interrupt( void * parms) |
| 272 | { |
| 273 | ulong uic_msr; |
| 274 | ulong msr_shift; |
| 275 | int vec; |
| 276 | |
| 277 | /* |
| 278 | * Read masked interrupt status register to determine interrupt source |
| 279 | */ |
| 280 | uic_msr = mfdcr(uicmsr); |
| 281 | msr_shift = uic_msr; |
| 282 | vec = 0; |
| 283 | |
| 284 | while (msr_shift != 0) { |
| 285 | if (msr_shift & 0x80000000) { |
| 286 | /* |
| 287 | * Increment irq counter (for debug purpose only) |
| 288 | */ |
| 289 | irq_vecs[vec].count++; |
| 290 | |
| 291 | if (irq_vecs[vec].handler != NULL) { |
| 292 | /* call isr */ |
| 293 | (*irq_vecs[vec].handler)(irq_vecs[vec].arg); |
| 294 | } else { |
| 295 | mtdcr(uicer, mfdcr(uicer) & ~(0x80000000 >> vec)); |
| 296 | printf ("Masking bogus interrupt vector (uic0) 0x%x\n", vec); |
| 297 | } |
| 298 | |
| 299 | /* |
| 300 | * After servicing the interrupt, we have to remove the status indicator. |
| 301 | */ |
| 302 | mtdcr(uicsr, (0x80000000 >> vec)); |
| 303 | } |
| 304 | |
| 305 | /* |
| 306 | * Shift msr to next position and increment vector |
| 307 | */ |
| 308 | msr_shift <<= 1; |
| 309 | vec++; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | #endif /* CONFIG_440_GX */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 314 | |
| 315 | #if defined(CONFIG_440) |
| 316 | /* Handler for UIC1 interrupt */ |
| 317 | void uic1_interrupt( void * parms) |
| 318 | { |
| 319 | ulong uic1_msr; |
| 320 | ulong msr_shift; |
| 321 | int vec; |
| 322 | |
| 323 | /* |
| 324 | * Read masked interrupt status register to determine interrupt source |
| 325 | */ |
| 326 | uic1_msr = mfdcr(uic1msr); |
| 327 | msr_shift = uic1_msr; |
| 328 | vec = 0; |
| 329 | |
| 330 | while (msr_shift != 0) { |
| 331 | if (msr_shift & 0x80000000) { |
| 332 | /* |
| 333 | * Increment irq counter (for debug purpose only) |
| 334 | */ |
| 335 | irq_vecs1[vec].count++; |
| 336 | |
| 337 | if (irq_vecs1[vec].handler != NULL) { |
| 338 | /* call isr */ |
| 339 | (*irq_vecs1[vec].handler)(irq_vecs1[vec].arg); |
| 340 | } else { |
| 341 | mtdcr(uic1er, mfdcr(uic1er) & ~(0x80000000 >> vec)); |
| 342 | printf ("Masking bogus interrupt vector (uic1) 0x%x\n", vec); |
| 343 | } |
| 344 | |
| 345 | /* |
| 346 | * After servicing the interrupt, we have to remove the status indicator. |
| 347 | */ |
| 348 | mtdcr(uic1sr, (0x80000000 >> vec)); |
| 349 | } |
| 350 | |
| 351 | /* |
| 352 | * Shift msr to next position and increment vector |
| 353 | */ |
| 354 | msr_shift <<= 1; |
| 355 | vec++; |
| 356 | } |
| 357 | } |
| 358 | #endif /* defined(CONFIG_440) */ |
| 359 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 360 | #if defined(CONFIG_440_GX) |
| 361 | /* Handler for UIC1 interrupt */ |
| 362 | void uic2_interrupt( void * parms) |
| 363 | { |
| 364 | ulong uic2_msr; |
| 365 | ulong msr_shift; |
| 366 | int vec; |
| 367 | |
| 368 | /* |
| 369 | * Read masked interrupt status register to determine interrupt source |
| 370 | */ |
| 371 | uic2_msr = mfdcr(uic2msr); |
| 372 | msr_shift = uic2_msr; |
| 373 | vec = 0; |
| 374 | |
| 375 | while (msr_shift != 0) { |
| 376 | if (msr_shift & 0x80000000) { |
| 377 | /* |
| 378 | * Increment irq counter (for debug purpose only) |
| 379 | */ |
| 380 | irq_vecs2[vec].count++; |
| 381 | |
| 382 | if (irq_vecs2[vec].handler != NULL) { |
| 383 | /* call isr */ |
| 384 | (*irq_vecs2[vec].handler)(irq_vecs2[vec].arg); |
| 385 | } else { |
| 386 | mtdcr(uic2er, mfdcr(uic2er) & ~(0x80000000 >> vec)); |
| 387 | printf ("Masking bogus interrupt vector (uic1) 0x%x\n", vec); |
| 388 | } |
| 389 | |
| 390 | /* |
| 391 | * After servicing the interrupt, we have to remove the status indicator. |
| 392 | */ |
| 393 | mtdcr(uic2sr, (0x80000000 >> vec)); |
| 394 | } |
| 395 | |
| 396 | /* |
| 397 | * Shift msr to next position and increment vector |
| 398 | */ |
| 399 | msr_shift <<= 1; |
| 400 | vec++; |
| 401 | } |
| 402 | } |
| 403 | #endif /* defined(CONFIG_440_GX) */ |
| 404 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 405 | /****************************************************************************/ |
| 406 | |
| 407 | /* |
| 408 | * Install and free a interrupt handler. |
| 409 | */ |
| 410 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 411 | void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg) |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 412 | { |
| 413 | struct irq_action *irqa = irq_vecs; |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 414 | int i = vec; |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 415 | |
| 416 | #if defined(CONFIG_440) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 417 | #if defined(CONFIG_440_GX) |
| 418 | if ((vec > 31) && (vec < 64)) { |
| 419 | i = vec - 32; |
| 420 | irqa = irq_vecs1; |
| 421 | } else if (vec > 63) { |
| 422 | i = vec - 64; |
| 423 | irqa = irq_vecs2; |
| 424 | } |
| 425 | #else /* CONFIG_440_GX */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 426 | if (vec > 31) { |
| 427 | i = vec - 32; |
| 428 | irqa = irq_vecs1; |
| 429 | } |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 430 | #endif /* CONFIG_440_GX */ |
| 431 | #endif /* CONFIG_440 */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 432 | |
| 433 | if (irqa[i].handler != NULL) { |
| 434 | printf ("Interrupt vector %d: handler 0x%x replacing 0x%x\n", |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 435 | vec, (uint) handler, (uint) irqa[i].handler); |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 436 | } |
| 437 | irqa[i].handler = handler; |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 438 | irqa[i].arg = arg; |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 439 | |
| 440 | #if defined(CONFIG_440) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 441 | #if defined(CONFIG_440_GX) |
| 442 | if ((vec > 31) && (vec < 64)) |
| 443 | mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i)); |
| 444 | else if (vec > 63) |
| 445 | mtdcr (uic2er, mfdcr (uic2er) | (0x80000000 >> i)); |
| 446 | else |
| 447 | #endif /* CONFIG_440_GX */ |
| 448 | if (vec > 31) |
| 449 | mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i)); |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 450 | else |
| 451 | #endif |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 452 | mtdcr (uicer, mfdcr (uicer) | (0x80000000 >> i)); |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 453 | #if 0 |
| 454 | printf ("Install interrupt for vector %d ==> %p\n", vec, handler); |
| 455 | #endif |
| 456 | } |
| 457 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 458 | void irq_free_handler (int vec) |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 459 | { |
| 460 | struct irq_action *irqa = irq_vecs; |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 461 | int i = vec; |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 462 | |
| 463 | #if defined(CONFIG_440) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 464 | #if defined(CONFIG_440_GX) |
| 465 | if ((vec > 31) && (vec < 64)) { |
| 466 | irqa = irq_vecs1; |
| 467 | i = vec - 32; |
| 468 | } else if (vec > 63) { |
| 469 | irqa = irq_vecs2; |
| 470 | i = vec - 64; |
| 471 | } |
| 472 | #endif /* CONFIG_440_GX */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 473 | if (vec > 31) { |
| 474 | irqa = irq_vecs1; |
| 475 | i = vec - 32; |
| 476 | } |
| 477 | #endif |
| 478 | |
| 479 | #if 0 |
| 480 | printf ("Free interrupt for vector %d ==> %p\n", |
| 481 | vec, irq_vecs[vec].handler); |
| 482 | #endif |
| 483 | |
| 484 | #if defined(CONFIG_440) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 485 | #if defined(CONFIG_440_GX) |
| 486 | if ((vec > 31) && (vec < 64)) |
| 487 | mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i)); |
| 488 | else if (vec > 63) |
| 489 | mtdcr (uic2er, mfdcr (uic2er) & ~(0x80000000 >> i)); |
| 490 | else |
| 491 | #endif /* CONFIG_440_GX */ |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 492 | if (vec > 31) |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 493 | mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i)); |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 494 | else |
| 495 | #endif |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 496 | mtdcr (uicer, mfdcr (uicer) & ~(0x80000000 >> i)); |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 497 | |
| 498 | irqa[i].handler = NULL; |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 499 | irqa[i].arg = NULL; |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | /****************************************************************************/ |
| 503 | |
wdenk | a8c7c70 | 2003-12-06 19:49:23 +0000 | [diff] [blame] | 504 | void timer_interrupt_cpu (struct pt_regs *regs) |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 505 | { |
wdenk | a8c7c70 | 2003-12-06 19:49:23 +0000 | [diff] [blame] | 506 | /* nothing to do here */ |
| 507 | return; |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | /****************************************************************************/ |
| 511 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 512 | #if (CONFIG_COMMANDS & CFG_CMD_IRQ) |
| 513 | |
| 514 | /******************************************************************************* |
| 515 | * |
| 516 | * irqinfo - print information about PCI devices |
| 517 | * |
| 518 | */ |
| 519 | int |
| 520 | do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 521 | { |
| 522 | int vec; |
| 523 | |
| 524 | printf ("\nInterrupt-Information:\n"); |
| 525 | #if defined(CONFIG_440) |
| 526 | printf ("\nUIC 0\n"); |
| 527 | #endif |
| 528 | printf ("Nr Routine Arg Count\n"); |
| 529 | |
| 530 | for (vec=0; vec<32; vec++) { |
| 531 | if (irq_vecs[vec].handler != NULL) { |
| 532 | printf ("%02d %08lx %08lx %d\n", |
| 533 | vec, |
| 534 | (ulong)irq_vecs[vec].handler, |
| 535 | (ulong)irq_vecs[vec].arg, |
| 536 | irq_vecs[vec].count); |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | #if defined(CONFIG_440) |
| 541 | printf ("\nUIC 1\n"); |
| 542 | printf ("Nr Routine Arg Count\n"); |
| 543 | |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 544 | for (vec=0; vec<32; vec++) { |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 545 | if (irq_vecs1[vec].handler != NULL) |
| 546 | printf ("%02d %08lx %08lx %d\n", |
| 547 | vec+31, (ulong)irq_vecs1[vec].handler, |
| 548 | (ulong)irq_vecs1[vec].arg, irq_vecs1[vec].count); |
| 549 | } |
| 550 | printf("\n"); |
| 551 | #endif |
wdenk | ba56f62 | 2004-02-06 23:19:44 +0000 | [diff] [blame] | 552 | |
| 553 | #if defined(CONFIG_440_GX) |
| 554 | printf ("\nUIC 2\n"); |
| 555 | printf ("Nr Routine Arg Count\n"); |
| 556 | |
| 557 | for (vec=0; vec<32; vec++) { |
| 558 | if (irq_vecs2[vec].handler != NULL) |
| 559 | printf ("%02d %08lx %08lx %d\n", |
| 560 | vec+63, (ulong)irq_vecs2[vec].handler, |
| 561 | (ulong)irq_vecs2[vec].arg, irq_vecs2[vec].count); |
| 562 | } |
| 563 | printf("\n"); |
| 564 | #endif |
| 565 | |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 566 | return 0; |
| 567 | } |
wdenk | f780aa2 | 2002-09-18 19:21:21 +0000 | [diff] [blame] | 568 | #endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */ |