irq-kev7a400.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /* KEV7a400 CPLD IRQ handling */
  17. static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
  18. static void
  19. lh7a400_ack_cpld_irq (u32 irq)
  20. {
  21. CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
  22. }
  23. static void
  24. lh7a400_mask_cpld_irq (u32 irq)
  25. {
  26. CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
  27. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  28. }
  29. static void
  30. lh7a400_unmask_cpld_irq (u32 irq)
  31. {
  32. CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
  33. CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
  34. }
  35. static struct
  36. irqchip lh7a400_cpld_chip = {
  37. .ack = lh7a400_ack_cpld_irq,
  38. .mask = lh7a400_mask_cpld_irq,
  39. .unmask = lh7a400_unmask_cpld_irq,
  40. };
  41. static void
  42. lh7a400_cpld_handler (unsigned int irq, struct irqdesc *desc,
  43. struct pt_regs *regs)
  44. {
  45. u32 mask = CPLD_LATCHED_INTS;
  46. irq = IRQ_KEV_7A400_CPLD;
  47. for (; mask; mask >>= 1, ++irq) {
  48. if (mask & 1)
  49. desc[irq].handle (irq, desc, regs);
  50. }
  51. }
  52. /* IRQ initialization */
  53. void __init
  54. lh7a400_init_board_irq (void)
  55. {
  56. int irq;
  57. for (irq = IRQ_KEV7A400_CPLD;
  58. irq < IRQ_KEV7A400_CPLD + NR_IRQ_KEV7A400_CPLD; ++irq) {
  59. set_irq_chip (irq, &lh7a400_cpld_chip);
  60. set_irq_handler (irq, do_edge_IRQ);
  61. set_irq_flags (irq, IRQF_VALID);
  62. }
  63. set_irq_chained_handler (IRQ_CPLD, kev7a400_cpld_handler);
  64. /* Clear all CPLD interrupts */
  65. CPLD_CL_INT = 0xff; /* CPLD_INTR_MMC_CD | CPLD_INTR_ETH_INT; */
  66. /* *** FIXME CF enabled in ide-probe.c */
  67. GPIO_GPIOINTEN = 0; /* Disable all GPIO interrupts */
  68. barrier();
  69. GPIO_INTTYPE1
  70. = (GPIO_INTR_PCC1_CD | GPIO_INTR_PCC1_CD); /* Edge trig. */
  71. GPIO_INTTYPE2 = 0; /* Falling edge & low-level */
  72. GPIO_GPIOFEOI = 0xff; /* Clear all GPIO interrupts */
  73. GPIO_GPIOINTEN = 0xff; /* Enable all GPIO interrupts */
  74. init_FIQ();
  75. }