irq.c 1.8 KB

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