mt_sys_cirq.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef __CIRQ_SYS_H__
  2. #define __CIRQ_SYS_H__
  3. #define MT_EDGE_SENSITIVE 0
  4. #define MT_LEVEL_SENSITIVE 1
  5. #if !defined(CONFIG_OF)
  6. #define SYS_CIRQ_BASE (0xF0202000)
  7. #endif
  8. /*
  9. * Define hardware register
  10. */
  11. #define CIRQ_STA_BASE (SYS_CIRQ_BASE + 0x000)
  12. #define CIRQ_ACK_BASE (SYS_CIRQ_BASE + 0x040)
  13. #define CIRQ_MASK_BASE (SYS_CIRQ_BASE + 0x080)
  14. #define CIRQ_MASK_SET_BASE (SYS_CIRQ_BASE + 0x0C0)
  15. #define CIRQ_MASK_CLR_BASE (SYS_CIRQ_BASE + 0x100)
  16. #define CIRQ_SENS_BASE (SYS_CIRQ_BASE + 0x140)
  17. #define CIRQ_SENS_SET_BASE (SYS_CIRQ_BASE + 0x180)
  18. #define CIRQ_SENS_CLR_BASE (SYS_CIRQ_BASE + 0x1C0)
  19. #define CIRQ_POL_BASE (SYS_CIRQ_BASE + 0x200)
  20. #define CIRQ_POL_SET_BASE (SYS_CIRQ_BASE + 0x240)
  21. #define CIRQ_POL_CLR_BASE (SYS_CIRQ_BASE + 0x280)
  22. #define CIRQ_CON (SYS_CIRQ_BASE + 0x300)
  23. /*
  24. * Register placement
  25. */
  26. #define CIRQ_CON_EN_BITS (0)
  27. #define CIRQ_CON_EDGE_ONLY_BITS (1)
  28. #define CIRQ_CON_FLUSH_BITS (2)
  29. #define CIRQ_CON_EVENT_BITS (31)
  30. #define CIRQ_CON_BITS_MASK (0x7)
  31. /*
  32. * Register setting
  33. */
  34. #define CIRQ_CON_EN (0x1)
  35. #define CIRQ_CON_EDGE_ONLY (0x1)
  36. #define CIRQ_CON_FLUSH (0x1)
  37. /*
  38. * Define constant
  39. */
  40. #define CIRQ_CTRL_REG_NUM ((CIRQ_IRQ_NUM + 31) / 32)
  41. #define MT_CIRQ_POL_NEG (0)
  42. #define MT_CIRQ_POL_POS (1)
  43. /*
  44. * Define macro
  45. */
  46. #define IRQ_TO_CIRQ_NUM(irq) ((irq) - (GIC_PRIVATE_SIGNALS + CIRQ_SPI_START))
  47. #define CIRQ_TO_IRQ_NUM(cirq) ((cirq) + (GIC_PRIVATE_SIGNALS + CIRQ_SPI_START))
  48. #define print_func() pr_debug("[CIRQ] in %s\n", __func__)
  49. /* #define __CHECK_IRQ_TYPE */
  50. extern void __iomem *GIC_DIST_BASE;
  51. extern void __iomem *GIC_CPU_BASE;
  52. extern void __iomem *INT_POL_CTL0;
  53. #ifndef GIC_PRIVATE_SIGNALS
  54. #define GIC_PRIVATE_SIGNALS (32)
  55. #endif
  56. /*
  57. * Define function prototypes.
  58. */
  59. void mt_cirq_enable(void);
  60. void mt_cirq_disable(void);
  61. void mt_cirq_clone_gic(void);
  62. void mt_cirq_flush(void);
  63. int mt_cirq_test(void);
  64. void mt_cirq_dump_reg(void);
  65. #endif /*!__CIRQ_H__ */