irq-lh7a400.c 2.0 KB

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