irq-lh7a400.c 2.0 KB

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