ifxmips_atm_ppe_common.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #ifndef IFXMIPS_ATM_PPE_COMMON_H
  2. #define IFXMIPS_ATM_PPE_COMMON_H
  3. #if defined(CONFIG_DANUBE)
  4. #include "ifxmips_atm_ppe_danube.h"
  5. #elif defined(CONFIG_AMAZON_SE)
  6. #include "ifxmips_atm_ppe_amazon_se.h"
  7. #elif defined(CONFIG_AR9)
  8. #include "ifxmips_atm_ppe_ar9.h"
  9. #elif defined(CONFIG_VR9)
  10. #include "ifxmips_atm_ppe_vr9.h"
  11. #else
  12. #error Platform is not specified!
  13. #endif
  14. /*
  15. * Code/Data Memory (CDM) Interface Configuration Register
  16. */
  17. #define CDM_CFG PPE_REG_ADDR(0x0100)
  18. #define CDM_CFG_RAM1 GET_BITS(*CDM_CFG, 3, 2)
  19. #define CDM_CFG_RAM0 (*CDM_CFG & (1 << 1))
  20. #define CDM_CFG_RAM1_SET(value) SET_BITS(0, 3, 2, value)
  21. #define CDM_CFG_RAM0_SET(value) ((value) ? (1 << 1) : 0)
  22. /*
  23. * QSB Internal Cell Delay Variation Register
  24. */
  25. #define QSB_ICDV QSB_CONF_REG_ADDR(0x0007)
  26. #define QSB_ICDV_TAU GET_BITS(*QSB_ICDV, 5, 0)
  27. #define QSB_ICDV_TAU_SET(value) SET_BITS(0, 5, 0, value)
  28. /*
  29. * QSB Scheduler Burst Limit Register
  30. */
  31. #define QSB_SBL QSB_CONF_REG_ADDR(0x0009)
  32. #define QSB_SBL_SBL GET_BITS(*QSB_SBL, 3, 0)
  33. #define QSB_SBL_SBL_SET(value) SET_BITS(0, 3, 0, value)
  34. /*
  35. * QSB Configuration Register
  36. */
  37. #define QSB_CFG QSB_CONF_REG_ADDR(0x000A)
  38. #define QSB_CFG_TSTEPC GET_BITS(*QSB_CFG, 1, 0)
  39. #define QSB_CFG_TSTEPC_SET(value) SET_BITS(0, 1, 0, value)
  40. /*
  41. * QSB RAM Transfer Table Register
  42. */
  43. #define QSB_RTM QSB_CONF_REG_ADDR(0x000B)
  44. #define QSB_RTM_DM (*QSB_RTM)
  45. #define QSB_RTM_DM_SET(value) ((value) & 0xFFFFFFFF)
  46. /*
  47. * QSB RAM Transfer Data Register
  48. */
  49. #define QSB_RTD QSB_CONF_REG_ADDR(0x000C)
  50. #define QSB_RTD_TTV (*QSB_RTD)
  51. #define QSB_RTD_TTV_SET(value) ((value) & 0xFFFFFFFF)
  52. /*
  53. * QSB RAM Access Register
  54. */
  55. #define QSB_RAMAC QSB_CONF_REG_ADDR(0x000D)
  56. #define QSB_RAMAC_RW (*QSB_RAMAC & (1 << 31))
  57. #define QSB_RAMAC_TSEL GET_BITS(*QSB_RAMAC, 27, 24)
  58. #define QSB_RAMAC_LH (*QSB_RAMAC & (1 << 16))
  59. #define QSB_RAMAC_TESEL GET_BITS(*QSB_RAMAC, 9, 0)
  60. #define QSB_RAMAC_RW_SET(value) ((value) ? (1 << 31) : 0)
  61. #define QSB_RAMAC_TSEL_SET(value) SET_BITS(0, 27, 24, value)
  62. #define QSB_RAMAC_LH_SET(value) ((value) ? (1 << 16) : 0)
  63. #define QSB_RAMAC_TESEL_SET(value) SET_BITS(0, 9, 0, value)
  64. /*
  65. * QSB Queue Scheduling and Shaping Definitions
  66. */
  67. #define QSB_WFQ_NONUBR_MAX 0x3f00
  68. #define QSB_WFQ_UBR_BYPASS 0x3fff
  69. #define QSB_TP_TS_MAX 65472
  70. #define QSB_TAUS_MAX 64512
  71. #define QSB_GCR_MIN 18
  72. /*
  73. * QSB Constant
  74. */
  75. #define QSB_RAMAC_RW_READ 0
  76. #define QSB_RAMAC_RW_WRITE 1
  77. #define QSB_RAMAC_TSEL_QPT 0x01
  78. #define QSB_RAMAC_TSEL_SCT 0x02
  79. #define QSB_RAMAC_TSEL_SPT 0x03
  80. #define QSB_RAMAC_TSEL_VBR 0x08
  81. #define QSB_RAMAC_LH_LOW 0
  82. #define QSB_RAMAC_LH_HIGH 1
  83. #define QSB_QPT_SET_MASK 0x0
  84. #define QSB_QVPT_SET_MASK 0x0
  85. #define QSB_SET_SCT_MASK 0x0
  86. #define QSB_SET_SPT_MASK 0x0
  87. #define QSB_SET_SPT_SBVALID_MASK 0x7FFFFFFF
  88. #define QSB_SPT_SBV_VALID (1 << 31)
  89. #define QSB_SPT_PN_SET(value) (((value) & 0x01) ? (1 << 16) : 0)
  90. #define QSB_SPT_INTRATE_SET(value) SET_BITS(0, 13, 0, value)
  91. /*
  92. * QSB Queue Parameter Table Entry and Queue VBR Parameter Table Entry
  93. */
  94. #if defined(__BIG_ENDIAN)
  95. union qsb_queue_parameter_table {
  96. struct {
  97. unsigned int res1 :1;
  98. unsigned int vbr :1;
  99. unsigned int wfqf :14;
  100. unsigned int tp :16;
  101. } bit;
  102. u32 dword;
  103. };
  104. union qsb_queue_vbr_parameter_table {
  105. struct {
  106. unsigned int taus :16;
  107. unsigned int ts :16;
  108. } bit;
  109. u32 dword;
  110. };
  111. #else
  112. union qsb_queue_parameter_table {
  113. struct {
  114. unsigned int tp :16;
  115. unsigned int wfqf :14;
  116. unsigned int vbr :1;
  117. unsigned int res1 :1;
  118. } bit;
  119. u32 dword;
  120. };
  121. union qsb_queue_vbr_parameter_table {
  122. struct {
  123. unsigned int ts :16;
  124. unsigned int taus :16;
  125. } bit;
  126. u32 dword;
  127. };
  128. #endif // defined(__BIG_ENDIAN)
  129. /*
  130. * Mailbox IGU0 Registers
  131. */
  132. #define MBOX_IGU0_ISRS PPE_REG_ADDR(0x0200)
  133. #define MBOX_IGU0_ISRC PPE_REG_ADDR(0x0201)
  134. #define MBOX_IGU0_ISR PPE_REG_ADDR(0x0202)
  135. #define MBOX_IGU0_IER PPE_REG_ADDR(0x0203)
  136. #define MBOX_IGU0_ISRS_SET(n) (1 << (n))
  137. #define MBOX_IGU0_ISRC_CLEAR(n) (1 << (n))
  138. #define MBOX_IGU0_ISR_ISR(n) (*MBOX_IGU0_ISR & (1 << (n)))
  139. #define MBOX_IGU0_IER_EN(n) (*MBOX_IGU0_IER & (1 << (n)))
  140. #define MBOX_IGU0_IER_EN_SET(n) (1 << (n))
  141. /*
  142. * Mailbox IGU1 Registers
  143. */
  144. #define MBOX_IGU1_ISRS PPE_REG_ADDR(0x0204)
  145. #define MBOX_IGU1_ISRC PPE_REG_ADDR(0x0205)
  146. #define MBOX_IGU1_ISR PPE_REG_ADDR(0x0206)
  147. #define MBOX_IGU1_IER PPE_REG_ADDR(0x0207)
  148. #define MBOX_IGU1_ISRS_SET(n) (1 << (n))
  149. #define MBOX_IGU1_ISRC_CLEAR(n) (1 << (n))
  150. #define MBOX_IGU1_ISR_ISR(n) (*MBOX_IGU1_ISR & (1 << (n)))
  151. #define MBOX_IGU1_IER_EN(n) (*MBOX_IGU1_IER & (1 << (n)))
  152. #define MBOX_IGU1_IER_EN_SET(n) (1 << (n))
  153. /*
  154. * Mailbox IGU3 Registers
  155. */
  156. #define MBOX_IGU3_ISRS PPE_REG_ADDR(0x0214)
  157. #define MBOX_IGU3_ISRC PPE_REG_ADDR(0x0215)
  158. #define MBOX_IGU3_ISR PPE_REG_ADDR(0x0216)
  159. #define MBOX_IGU3_IER PPE_REG_ADDR(0x0217)
  160. #define MBOX_IGU3_ISRS_SET(n) (1 << (n))
  161. #define MBOX_IGU3_ISRC_CLEAR(n) (1 << (n))
  162. #define MBOX_IGU3_ISR_ISR(n) (*MBOX_IGU3_ISR & (1 << (n)))
  163. #define MBOX_IGU3_IER_EN(n) (*MBOX_IGU3_IER & (1 << (n)))
  164. #define MBOX_IGU3_IER_EN_SET(n) (1 << (n))
  165. /*
  166. * RTHA/TTHA Registers
  167. */
  168. #define SFSM_STATE0 PPE_REG_ADDR(0x0410)
  169. #define SFSM_STATE1 PPE_REG_ADDR(0x0411)
  170. #define SFSM_DBA0 PPE_REG_ADDR(0x0412)
  171. #define SFSM_DBA1 PPE_REG_ADDR(0x0413)
  172. #define SFSM_CBA0 PPE_REG_ADDR(0x0414)
  173. #define SFSM_CBA1 PPE_REG_ADDR(0x0415)
  174. #define SFSM_CFG0 PPE_REG_ADDR(0x0416)
  175. #define SFSM_CFG1 PPE_REG_ADDR(0x0417)
  176. #define SFSM_PGCNT0 PPE_REG_ADDR(0x041C)
  177. #define SFSM_PGCNT1 PPE_REG_ADDR(0x041D)
  178. #define FFSM_DBA0 PPE_REG_ADDR(0x0508)
  179. #define FFSM_DBA1 PPE_REG_ADDR(0x0509)
  180. #define FFSM_CFG0 PPE_REG_ADDR(0x050A)
  181. #define FFSM_CFG1 PPE_REG_ADDR(0x050B)
  182. #define FFSM_IDLE_HEAD_BC0 PPE_REG_ADDR(0x050E)
  183. #define FFSM_IDLE_HEAD_BC1 PPE_REG_ADDR(0x050F)
  184. #define FFSM_PGCNT0 PPE_REG_ADDR(0x0514)
  185. #define FFSM_PGCNT1 PPE_REG_ADDR(0x0515)
  186. #endif // IFXMIPS_ATM_PPE_COMMON_H