irq.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * arch/arm/mach-dove/irq.c
  3. *
  4. * Dove 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/init.h>
  11. #include <linux/irq.h>
  12. #include <linux/io.h>
  13. #include <asm/exception.h>
  14. #include <plat/irq.h>
  15. #include <mach/bridge-regs.h>
  16. #include <plat/orion-gpio.h>
  17. #include "common.h"
  18. static int __initdata gpio0_irqs[4] = {
  19. IRQ_DOVE_GPIO_0_7,
  20. IRQ_DOVE_GPIO_8_15,
  21. IRQ_DOVE_GPIO_16_23,
  22. IRQ_DOVE_GPIO_24_31,
  23. };
  24. static int __initdata gpio1_irqs[4] = {
  25. IRQ_DOVE_HIGH_GPIO,
  26. 0,
  27. 0,
  28. 0,
  29. };
  30. static int __initdata gpio2_irqs[4] = {
  31. 0,
  32. 0,
  33. 0,
  34. 0,
  35. };
  36. static void __iomem *dove_irq_base = IRQ_VIRT_BASE;
  37. static asmlinkage void
  38. __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs)
  39. {
  40. u32 stat;
  41. stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF);
  42. stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF);
  43. if (stat) {
  44. unsigned int hwirq = 1 + __fls(stat);
  45. handle_IRQ(hwirq, regs);
  46. return;
  47. }
  48. stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF);
  49. stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF);
  50. if (stat) {
  51. unsigned int hwirq = 33 + __fls(stat);
  52. handle_IRQ(hwirq, regs);
  53. return;
  54. }
  55. }
  56. void __init dove_init_irq(void)
  57. {
  58. orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
  59. orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
  60. set_handle_irq(dove_legacy_handle_irq);
  61. /*
  62. * Initialize gpiolib for GPIOs 0-71.
  63. */
  64. orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
  65. IRQ_DOVE_GPIO_START, gpio0_irqs);
  66. orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
  67. IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
  68. orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0,
  69. IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
  70. }