irq-kev7a400.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 irq_desc *desc)
  45. {
  46. u32 mask = CPLD_LATCHED_INTS;
  47. irq = IRQ_KEV_7A400_CPLD;
  48. for (; mask; mask >>= 1, ++irq) {
  49. if (mask & 1)
  50. desc[irq].handle (irq, desc);
  51. }
  52. }
  53. /* IRQ initialization */
  54. void __init
  55. lh7a400_init_board_irq (void)
  56. {
  57. int irq;
  58. for (irq = IRQ_KEV7A400_CPLD;
  59. irq < IRQ_KEV7A400_CPLD + NR_IRQ_KEV7A400_CPLD; ++irq) {
  60. set_irq_chip (irq, &lh7a400_cpld_chip);
  61. set_irq_handler (irq, handle_edge_irq);
  62. set_irq_flags (irq, IRQF_VALID);
  63. }
  64. set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
  65. /* Clear all CPLD interrupts */
  66. CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
  67. /* *** FIXME CF enabled in ide-probe.c */
  68. GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
  69. barrier();
  70. GPIO_INTTYPE1
  71. = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
  72. GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
  73. GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
  74. GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
  75. init_FIQ();
  76. }