irq-kev7a400.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* arch/arm/mach-lh7a40x/irq-kev7a400.c
  2. *
  3. * Copyright (C) 2004 Coastal Environmental Systems
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * version 2 as published by the Free Software Foundation.
  8. *
  9. */
  10. #include <linux/interrupt.h>
  11. #include <linux/init.h>
  12. #include <asm/irq.h>
  13. #include <asm/mach/irq.h>
  14. #include <asm/mach/hardware.h>
  15. #include <asm/mach/irqs.h>
  16. #include "common.h"
  17. /* KEV7a400 CPLD IRQ handling */
  18. static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
  19. static void
  20. lh7a400_ack_cpld_irq (u32 irq)
  21. {
  22. CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
  23. }
  24. static void
  25. lh7a400_mask_cpld_irq (u32 irq)
  26. {
  27. CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
  28. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  29. }
  30. static void
  31. lh7a400_unmask_cpld_irq (u32 irq)
  32. {
  33. CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
  34. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  35. }
  36. static struct
  37. irq_chip lh7a400_cpld_chip = {
  38. .name = "CPLD",
  39. .ack = lh7a400_ack_cpld_irq,
  40. .mask = lh7a400_mask_cpld_irq,
  41. .unmask = lh7a400_unmask_cpld_irq,
  42. };
  43. static void
  44. lh7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
  45. struct pt_regs *regs)
  46. {
  47. u32 mask = CPLD_LATCHED_INTS;
  48. irq = IRQ_KEV_7A400_CPLD;
  49. for (; mask; mask >>= 1, ++irq) {
  50. if (mask & 1)
  51. desc[irq].handle (irq, desc, regs);
  52. }
  53. }
  54. /* IRQ initialization */
  55. void __init
  56. lh7a400_init_board_irq (void)
  57. {
  58. int irq;
  59. for (irq = IRQ_KEV7A400_CPLD;
  60. irq < IRQ_KEV7A400_CPLD + NR_IRQ_KEV7A400_CPLD; ++irq) {
  61. set_irq_chip (irq, &lh7a400_cpld_chip);
  62. set_irq_handler (irq, do_edge_IRQ);
  63. set_irq_flags (irq, IRQF_VALID);
  64. }
  65. set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
  66. /* Clear all CPLD interrupts */
  67. CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
  68. /* *** FIXME CF enabled in ide-probe.c */
  69. GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
  70. barrier();
  71. GPIO_INTTYPE1
  72. = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
  73. GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
  74. GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
  75. GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
  76. init_FIQ();
  77. }