alphascale_asm9260-icoll.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2014 Oleksij Rempel <[email protected]>
  4. */
  5. #ifndef _ALPHASCALE_ASM9260_ICOLL_H
  6. #define _ALPHASCALE_ASM9260_ICOLL_H
  7. #define ASM9260_NUM_IRQS 64
  8. /*
  9. * this device provide 4 offsets for each register:
  10. * 0x0 - plain read write mode
  11. * 0x4 - set mode, OR logic.
  12. * 0x8 - clr mode, XOR logic.
  13. * 0xc - togle mode.
  14. */
  15. #define ASM9260_HW_ICOLL_VECTOR 0x0000
  16. /*
  17. * bits 31:2
  18. * This register presents the vector address for the interrupt currently
  19. * active on the CPU IRQ input. Writing to this register notifies the
  20. * interrupt collector that the interrupt service routine for the current
  21. * interrupt has been entered.
  22. * The exception trap should have a LDPC instruction from this address:
  23. * LDPC ASM9260_HW_ICOLL_VECTOR_ADDR; IRQ exception at 0xffff0018
  24. */
  25. /*
  26. * The Interrupt Collector Level Acknowledge Register is used by software to
  27. * indicate the completion of an interrupt on a specific level.
  28. * This register is written at the very end of an interrupt service routine. If
  29. * nesting is used then the CPU irq must be turned on before writing to this
  30. * register to avoid a race condition in the CPU interrupt hardware.
  31. */
  32. #define ASM9260_HW_ICOLL_LEVELACK 0x0010
  33. #define ASM9260_BM_LEVELn(nr) BIT(nr)
  34. #define ASM9260_HW_ICOLL_CTRL 0x0020
  35. /*
  36. * ASM9260_BM_CTRL_SFTRST and ASM9260_BM_CTRL_CLKGATE are not available on
  37. * asm9260.
  38. */
  39. #define ASM9260_BM_CTRL_SFTRST BIT(31)
  40. #define ASM9260_BM_CTRL_CLKGATE BIT(30)
  41. /* disable interrupt level nesting */
  42. #define ASM9260_BM_CTRL_NO_NESTING BIT(19)
  43. /*
  44. * Set this bit to one enable the RISC32-style read side effect associated with
  45. * the vector address register. In this mode, interrupt in-service is signaled
  46. * by the read of the ASM9260_HW_ICOLL_VECTOR register to acquire the interrupt
  47. * vector address. Set this bit to zero for normal operation, in which the ISR
  48. * signals in-service explicitly by means of a write to the
  49. * ASM9260_HW_ICOLL_VECTOR register.
  50. * 0 - Must Write to Vector register to go in-service.
  51. * 1 - Go in-service as a read side effect
  52. */
  53. #define ASM9260_BM_CTRL_ARM_RSE_MODE BIT(18)
  54. #define ASM9260_BM_CTRL_IRQ_ENABLE BIT(16)
  55. #define ASM9260_HW_ICOLL_STAT_OFFSET 0x0030
  56. /*
  57. * bits 5:0
  58. * Vector number of current interrupt. Multiply by 4 and add to vector base
  59. * address to obtain the value in ASM9260_HW_ICOLL_VECTOR.
  60. */
  61. /*
  62. * RAW0 and RAW1 provides a read-only view of the raw interrupt request lines
  63. * coming from various parts of the chip. Its purpose is to improve diagnostic
  64. * observability.
  65. */
  66. #define ASM9260_HW_ICOLL_RAW0 0x0040
  67. #define ASM9260_HW_ICOLL_RAW1 0x0050
  68. #define ASM9260_HW_ICOLL_INTERRUPT0 0x0060
  69. #define ASM9260_HW_ICOLL_INTERRUPTn(n) (0x0060 + ((n) >> 2) * 0x10)
  70. /*
  71. * WARNING: Modifying the priority of an enabled interrupt may result in
  72. * undefined behavior.
  73. */
  74. #define ASM9260_BM_INT_PRIORITY_MASK 0x3
  75. #define ASM9260_BM_INT_ENABLE BIT(2)
  76. #define ASM9260_BM_INT_SOFTIRQ BIT(3)
  77. #define ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n) (((n) & 0x3) << 3)
  78. #define ASM9260_BM_ICOLL_INTERRUPTn_ENABLE(n) (1 << (2 + \
  79. ASM9260_BM_ICOLL_INTERRUPTn_SHIFT(n)))
  80. #define ASM9260_HW_ICOLL_VBASE 0x0160
  81. /*
  82. * bits 31:2
  83. * This bitfield holds the upper 30 bits of the base address of the vector
  84. * table.
  85. */
  86. #define ASM9260_HW_ICOLL_CLEAR0 0x01d0
  87. #define ASM9260_HW_ICOLL_CLEAR1 0x01e0
  88. #define ASM9260_HW_ICOLL_CLEARn(n) (((n >> 5) * 0x10) \
  89. + SET_REG)
  90. #define ASM9260_BM_CLEAR_BIT(n) BIT(n & 0x1f)
  91. /* Scratchpad */
  92. #define ASM9260_HW_ICOLL_UNDEF_VECTOR 0x01f0
  93. #endif