irq-lh7a400.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* arch/arm/mach-lh7a40x/irq-lh7a400.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/init.h>
  11. #include <linux/module.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/ptrace.h>
  14. #include <asm/hardware.h>
  15. #include <asm/irq.h>
  16. #include <asm/mach/irq.h>
  17. #include <asm/arch/irq.h>
  18. #include <asm/arch/irqs.h>
  19. /* CPU IRQ handling */
  20. static void lh7a400_mask_irq (u32 irq)
  21. {
  22. INTC_INTENC = (1 << irq);
  23. }
  24. static void lh7a400_unmask_irq (u32 irq)
  25. {
  26. INTC_INTENS = (1 << irq);
  27. }
  28. static void lh7a400_ack_gpio_irq (u32 irq)
  29. {
  30. GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq));
  31. INTC_INTENC = (1 << irq);
  32. }
  33. static struct irqchip lh7a400_internal_chip = {
  34. .ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */
  35. .mask = lh7a400_mask_irq,
  36. .unmask = lh7a400_unmask_irq,
  37. };
  38. static struct irqchip lh7a400_gpio_chip = {
  39. .ack = lh7a400_ack_gpio_irq,
  40. .mask = lh7a400_mask_irq,
  41. .unmask = lh7a400_unmask_irq,
  42. };
  43. /* IRQ initialization */
  44. void __init lh7a400_init_irq (void)
  45. {
  46. int irq;
  47. INTC_INTENC = 0xffffffff; /* Disable all interrupts */
  48. GPIO_GPIOFINTEN = 0x00; /* Disable all GPIOF interrupts */
  49. barrier ();
  50. for (irq = 0; irq < NR_IRQS; ++irq) {
  51. switch (irq) {
  52. case IRQ_GPIO0INTR:
  53. case IRQ_GPIO1INTR:
  54. case IRQ_GPIO2INTR:
  55. case IRQ_GPIO3INTR:
  56. case IRQ_GPIO4INTR:
  57. case IRQ_GPIO5INTR:
  58. case IRQ_GPIO6INTR:
  59. case IRQ_GPIO7INTR:
  60. set_irq_chip (irq, &lh7a400_gpio_chip);
  61. set_irq_handler (irq, do_level_IRQ); /* OK default */
  62. break;
  63. default:
  64. set_irq_chip (irq, &lh7a400_internal_chip);
  65. set_irq_handler (irq, do_level_IRQ);
  66. }
  67. set_irq_flags (irq, IRQF_VALID);
  68. }
  69. lh7a40x_init_board_irq ();
  70. /* *** FIXME: the LH7a400 does use FIQ interrupts in some cases. For
  71. the time being, these are not initialized. */
  72. /* init_FIQ(); */
  73. }