irq.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * 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. #include <linux/init.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/list.h>
  16. #include <asm/mach/irq.h>
  17. #include <asm/irq.h>
  18. #include <mach/hardware.h>
  19. #include <asm/mach-types.h>
  20. static u32 iop32x_mask;
  21. static void intctl_write(u32 val)
  22. {
  23. asm volatile("mcr p6, 0, %0, c0, c0, 0" : : "r" (val));
  24. }
  25. static void intstr_write(u32 val)
  26. {
  27. asm volatile("mcr p6, 0, %0, c4, c0, 0" : : "r" (val));
  28. }
  29. static void
  30. iop32x_irq_mask(struct irq_data *d)
  31. {
  32. iop32x_mask &= ~(1 << d->irq);
  33. intctl_write(iop32x_mask);
  34. }
  35. static void
  36. iop32x_irq_unmask(struct irq_data *d)
  37. {
  38. iop32x_mask |= 1 << d->irq;
  39. intctl_write(iop32x_mask);
  40. }
  41. struct irq_chip ext_chip = {
  42. .name = "IOP32x",
  43. .irq_ack = iop32x_irq_mask,
  44. .irq_mask = iop32x_irq_mask,
  45. .irq_unmask = iop32x_irq_unmask,
  46. };
  47. void __init iop32x_init_irq(void)
  48. {
  49. int i;
  50. iop_init_cp6_handler();
  51. intctl_write(0);
  52. intstr_write(0);
  53. if (machine_is_glantank() ||
  54. machine_is_iq80321() ||
  55. machine_is_iq31244() ||
  56. machine_is_n2100() ||
  57. machine_is_em7210())
  58. *IOP3XX_PCIIRSR = 0x0f;
  59. for (i = 0; i < NR_IRQS; i++) {
  60. irq_set_chip_and_handler(i, &ext_chip, handle_level_irq);
  61. set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
  62. }
  63. }