irq.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * irq.c: GT64120 Interrupt Controller
  3. *
  4. * Copyright (C) 2006, Wind River System Inc.
  5. * Author: Rongkai.Zhan, <rongkai.zhan@windriver.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <linux/hardirq.h>
  13. #include <linux/init.h>
  14. #include <linux/irq.h>
  15. #include <asm/gt64120.h>
  16. #include <asm/irq_cpu.h>
  17. #include <asm/mipsregs.h>
  18. asmlinkage void plat_irq_dispatch(void)
  19. {
  20. unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
  21. if (pending & STATUSF_IP7)
  22. do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */
  23. else if (pending & STATUSF_IP6)
  24. do_IRQ(WRPPMC_UART16550_IRQ); /* UART 16550 port */
  25. else if (pending & STATUSF_IP3)
  26. do_IRQ(WRPPMC_PCI_INTA_IRQ); /* PCI INT_A */
  27. else
  28. spurious_interrupt();
  29. }
  30. /**
  31. * Initialize GT64120 Interrupt Controller
  32. */
  33. void gt64120_init_pic(void)
  34. {
  35. /* clear CPU Interrupt Cause Registers */
  36. GT_WRITE(GT_INTRCAUSE_OFS, (0x1F << 21));
  37. GT_WRITE(GT_HINTRCAUSE_OFS, 0x00);
  38. /* Disable all interrupts from GT64120 bridge chip */
  39. GT_WRITE(GT_INTRMASK_OFS, 0x00);
  40. GT_WRITE(GT_HINTRMASK_OFS, 0x00);
  41. GT_WRITE(GT_PCI0_ICMASK_OFS, 0x00);
  42. GT_WRITE(GT_PCI0_HICMASK_OFS, 0x00);
  43. }
  44. void __init arch_init_irq(void)
  45. {
  46. /* IRQ 0 - 7 are for MIPS common irq_cpu controller */
  47. mips_cpu_irq_init();
  48. gt64120_init_pic();
  49. }