irq.c 1.6 KB

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