irq.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * arch/arm/mach-kirkwood/irq.c
  3. *
  4. * Kirkwood IRQ handling.
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/gpio.h>
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <linux/io.h>
  15. #include <mach/bridge-regs.h>
  16. #include <plat/irq.h>
  17. #include "common.h"
  18. static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
  19. {
  20. BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7);
  21. BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23);
  22. orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3);
  23. }
  24. void __init kirkwood_init_irq(void)
  25. {
  26. orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
  27. orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
  28. /*
  29. * Initialize gpiolib for GPIOs 0-49.
  30. */
  31. orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0,
  32. IRQ_KIRKWOOD_GPIO_START);
  33. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler);
  34. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler);
  35. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
  36. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
  37. orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
  38. IRQ_KIRKWOOD_GPIO_START + 32);
  39. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
  40. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
  41. irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
  42. gpio_irq_handler);
  43. }