irq.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * linux/arch/arm/mach-iop32x/irq.c
  3. *
  4. * Generic IOP32X IRQ handling functionality
  5. *
  6. * Author: Rory Bolt <rorybolt@pacbell.net>
  7. * Copyright (C) 2002 Rory Bolt
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * Added IOP3XX chipset and IQ80321 board masking code.
  14. *
  15. */
  16. #include <linux/init.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <asm/mach/irq.h>
  20. #include <asm/irq.h>
  21. #include <asm/hardware.h>
  22. #include <asm/mach-types.h>
  23. static u32 iop321_mask /* = 0 */;
  24. static inline void intctl_write(u32 val)
  25. {
  26. iop3xx_cp6_enable();
  27. asm volatile("mcr p6,0,%0,c0,c0,0"::"r" (val));
  28. iop3xx_cp6_disable();
  29. }
  30. static inline void intstr_write(u32 val)
  31. {
  32. iop3xx_cp6_enable();
  33. asm volatile("mcr p6,0,%0,c4,c0,0"::"r" (val));
  34. iop3xx_cp6_disable();
  35. }
  36. static void
  37. iop321_irq_mask (unsigned int irq)
  38. {
  39. iop321_mask &= ~(1 << irq);
  40. intctl_write(iop321_mask);
  41. }
  42. static void
  43. iop321_irq_unmask (unsigned int irq)
  44. {
  45. iop321_mask |= (1 << irq);
  46. intctl_write(iop321_mask);
  47. }
  48. struct irq_chip ext_chip = {
  49. .name = "IOP",
  50. .ack = iop321_irq_mask,
  51. .mask = iop321_irq_mask,
  52. .unmask = iop321_irq_unmask,
  53. };
  54. void __init iop321_init_irq(void)
  55. {
  56. unsigned int i;
  57. intctl_write(0); // disable all interrupts
  58. intstr_write(0); // treat all as IRQ
  59. if(machine_is_iq80321() ||
  60. machine_is_iq31244()) // all interrupts are inputs to chip
  61. *IOP3XX_PCIIRSR = 0x0f;
  62. for(i = 0; i < NR_IRQS; i++)
  63. {
  64. set_irq_chip(i, &ext_chip);
  65. set_irq_handler(i, do_level_IRQ);
  66. set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
  67. }
  68. }