ifxmips_atm_ppe_vr9.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /******************************************************************************
  2. **
  3. ** FILE NAME : ifxmips_atm_ppe_vr9.h
  4. ** PROJECT : UEIP
  5. ** MODULES : ATM (ADSL)
  6. **
  7. ** DATE : 1 AUG 2005
  8. ** AUTHOR : Xu Liang
  9. ** DESCRIPTION : ATM Driver (PPE Registers)
  10. ** COPYRIGHT : Copyright (c) 2006
  11. ** Infineon Technologies AG
  12. ** Am Campeon 1-12, 85579 Neubiberg, Germany
  13. **
  14. ** This program is free software; you can redistribute it and/or modify
  15. ** it under the terms of the GNU General Public License as published by
  16. ** the Free Software Foundation; either version 2 of the License, or
  17. ** (at your option) any later version.
  18. **
  19. ** HISTORY
  20. ** $Date $Author $Comment
  21. ** 4 AUG 2005 Xu Liang Initiate Version
  22. ** 23 OCT 2006 Xu Liang Add GPL header.
  23. ** 9 JAN 2007 Xu Liang First version got from Anand (IC designer)
  24. *******************************************************************************/
  25. #ifndef IFXMIPS_ATM_PPE_VR9_H
  26. #define IFXMIPS_ATM_PPE_VR9_H
  27. /*
  28. * FPI Configuration Bus Register and Memory Address Mapping
  29. */
  30. #define IFX_PPE (KSEG1 | 0x1E200000)
  31. #define PP32_DEBUG_REG_ADDR(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x000000 + (i) * 0x00010000) << 2)))
  32. #define CDM_CODE_MEMORY(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x001000 + (i) * 0x00010000) << 2)))
  33. #define CDM_DATA_MEMORY(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x004000 + (i) * 0x00010000) << 2)))
  34. #define SB_RAM0_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x008000) << 2)))
  35. #define SB_RAM1_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x009000) << 2)))
  36. #define SB_RAM2_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x00A000) << 2)))
  37. #define SB_RAM3_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x00B000) << 2)))
  38. #define PPE_REG_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x00D000) << 2)))
  39. #define QSB_CONF_REG_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x00E000) << 2)))
  40. #define SB_RAM6_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x018000) << 2)))
  41. /*
  42. * DWORD-Length of Memory Blocks
  43. */
  44. #define PP32_DEBUG_REG_DWLEN 0x0030
  45. #define CDM_CODE_MEMORYn_DWLEN(n) ((n) == 0 ? 0x1000 : 0x0800)
  46. #define CDM_DATA_MEMORY_DWLEN CDM_CODE_MEMORYn_DWLEN(1)
  47. #define SB_RAM0_DWLEN 0x1000
  48. #define SB_RAM1_DWLEN 0x1000
  49. #define SB_RAM2_DWLEN 0x1000
  50. #define SB_RAM3_DWLEN 0x1000
  51. #define SB_RAM6_DWLEN 0x8000
  52. #define QSB_CONF_REG_DWLEN 0x0100
  53. /*
  54. * PP32 to FPI Address Mapping
  55. */
  56. #define SB_BUFFER(__sb_addr) ((volatile unsigned int *)((((__sb_addr) >= 0x0000) && ((__sb_addr) <= 0x1FFF)) ? PPE_REG_ADDR((__sb_addr)) : \
  57. (((__sb_addr) >= 0x2000) && ((__sb_addr) <= 0x2FFF)) ? SB_RAM0_ADDR((__sb_addr) - 0x2000) : \
  58. (((__sb_addr) >= 0x3000) && ((__sb_addr) <= 0x3FFF)) ? SB_RAM1_ADDR((__sb_addr) - 0x3000) : \
  59. (((__sb_addr) >= 0x4000) && ((__sb_addr) <= 0x4FFF)) ? SB_RAM2_ADDR((__sb_addr) - 0x4000) : \
  60. (((__sb_addr) >= 0x5000) && ((__sb_addr) <= 0x5FFF)) ? SB_RAM3_ADDR((__sb_addr) - 0x5000) : \
  61. (((__sb_addr) >= 0x7000) && ((__sb_addr) <= 0x7FFF)) ? PPE_REG_ADDR((__sb_addr) - 0x7000) : \
  62. (((__sb_addr) >= 0x8000) && ((__sb_addr) <= 0xFFFF)) ? SB_RAM6_ADDR((__sb_addr) - 0x8000) : \
  63. 0))
  64. /*
  65. * PP32 Debug Control Register
  66. */
  67. #define NUM_OF_PP32 2
  68. #define PP32_FREEZE PPE_REG_ADDR(0x0000)
  69. #define PP32_SRST PPE_REG_ADDR(0x0020)
  70. #define PP32_DBG_CTRL(n) PP32_DEBUG_REG_ADDR(n, 0x0000)
  71. #define DBG_CTRL_RESTART 0
  72. #define DBG_CTRL_STOP 1
  73. #define PP32_CTRL_CMD(n) PP32_DEBUG_REG_ADDR(n, 0x0B00)
  74. #define PP32_CTRL_CMD_RESTART (1 << 0)
  75. #define PP32_CTRL_CMD_STOP (1 << 1)
  76. #define PP32_CTRL_CMD_STEP (1 << 2)
  77. #define PP32_CTRL_CMD_BREAKOUT (1 << 3)
  78. #define PP32_CTRL_OPT(n) PP32_DEBUG_REG_ADDR(n, 0x0C00)
  79. #define PP32_CTRL_OPT_BREAKOUT_ON_STOP_ON (3 << 0)
  80. #define PP32_CTRL_OPT_BREAKOUT_ON_STOP_OFF (2 << 0)
  81. #define PP32_CTRL_OPT_BREAKOUT_ON_BREAKIN_ON (3 << 2)
  82. #define PP32_CTRL_OPT_BREAKOUT_ON_BREAKIN_OFF (2 << 2)
  83. #define PP32_CTRL_OPT_STOP_ON_BREAKIN_ON (3 << 4)
  84. #define PP32_CTRL_OPT_STOP_ON_BREAKIN_OFF (2 << 4)
  85. #define PP32_CTRL_OPT_STOP_ON_BREAKPOINT_ON (3 << 6)
  86. #define PP32_CTRL_OPT_STOP_ON_BREAKPOINT_OFF (2 << 6)
  87. #define PP32_CTRL_OPT_BREAKOUT_ON_STOP(n) (*PP32_CTRL_OPT(n) & (1 << 0))
  88. #define PP32_CTRL_OPT_BREAKOUT_ON_BREAKIN(n) (*PP32_CTRL_OPT(n) & (1 << 2))
  89. #define PP32_CTRL_OPT_STOP_ON_BREAKIN(n) (*PP32_CTRL_OPT(n) & (1 << 4))
  90. #define PP32_CTRL_OPT_STOP_ON_BREAKPOINT(n) (*PP32_CTRL_OPT(n) & (1 << 6))
  91. #define PP32_BRK_PC(n, i) PP32_DEBUG_REG_ADDR(n, 0x0900 + (i) * 2)
  92. #define PP32_BRK_PC_MASK(n, i) PP32_DEBUG_REG_ADDR(n, 0x0901 + (i) * 2)
  93. #define PP32_BRK_DATA_ADDR(n, i) PP32_DEBUG_REG_ADDR(n, 0x0904 + (i) * 2)
  94. #define PP32_BRK_DATA_ADDR_MASK(n, i) PP32_DEBUG_REG_ADDR(n, 0x0905 + (i) * 2)
  95. #define PP32_BRK_DATA_VALUE_RD(n, i) PP32_DEBUG_REG_ADDR(n, 0x0908 + (i) * 2)
  96. #define PP32_BRK_DATA_VALUE_RD_MASK(n, i) PP32_DEBUG_REG_ADDR(n, 0x0909 + (i) * 2)
  97. #define PP32_BRK_DATA_VALUE_WR(n, i) PP32_DEBUG_REG_ADDR(n, 0x090C + (i) * 2)
  98. #define PP32_BRK_DATA_VALUE_WR_MASK(n, i) PP32_DEBUG_REG_ADDR(n, 0x090D + (i) * 2)
  99. #define PP32_BRK_CONTEXT_MASK(i) (1 << (i))
  100. #define PP32_BRK_CONTEXT_MASK_EN (1 << 4)
  101. #define PP32_BRK_COMPARE_GREATER_EQUAL (1 << 5) // valid for break data value rd/wr only
  102. #define PP32_BRK_COMPARE_LOWER_EQUAL (1 << 6)
  103. #define PP32_BRK_COMPARE_EN (1 << 7)
  104. #define PP32_BRK_TRIG(n) PP32_DEBUG_REG_ADDR(n, 0x0F00)
  105. #define PP32_BRK_GRPi_PCn_ON(i, n) ((3 << ((n) * 2)) << ((i) * 16))
  106. #define PP32_BRK_GRPi_PCn_OFF(i, n) ((2 << ((n) * 2)) << ((i) * 16))
  107. #define PP32_BRK_GRPi_DATA_ADDRn_ON(i, n) ((3 << ((n) * 2 + 4)) << ((i) * 16))
  108. #define PP32_BRK_GRPi_DATA_ADDRn_OFF(i, n) ((2 << ((n) * 2 + 4)) << ((i) * 16))
  109. #define PP32_BRK_GRPi_DATA_VALUE_RDn_ON(i, n) ((3 << ((n) * 2 + 8)) << ((i) * 16))
  110. #define PP32_BRK_GRPi_DATA_VALUE_RDn_OFF(i, n)((2 << ((n) * 2 + 8)) << ((i) * 16))
  111. #define PP32_BRK_GRPi_DATA_VALUE_WRn_ON(i, n) ((3 << ((n) * 2 + 12)) << ((i) * 16))
  112. #define PP32_BRK_GRPi_DATA_VALUE_WRn_OFF(i, n)((2 << ((n) * 2 + 12)) << ((i) * 16))
  113. #define PP32_BRK_GRPi_PCn(k, i, n) (*PP32_BRK_TRIG(k) & ((1 << ((n))) << ((i) * 8)))
  114. #define PP32_BRK_GRPi_DATA_ADDRn(k, i, n) (*PP32_BRK_TRIG(k) & ((1 << ((n) + 2)) << ((i) * 8)))
  115. #define PP32_BRK_GRPi_DATA_VALUE_RDn(k, i, n) (*PP32_BRK_TRIG(k) & ((1 << ((n) + 4)) << ((i) * 8)))
  116. #define PP32_BRK_GRPi_DATA_VALUE_WRn(k, i, n) (*PP32_BRK_TRIG(k) & ((1 << ((n) + 6)) << ((i) * 8)))
  117. #define PP32_CPU_STATUS(n) PP32_DEBUG_REG_ADDR(n, 0x0D00)
  118. #define PP32_HALT_STAT(n) PP32_CPU_STATUS(n)
  119. #define PP32_DBG_CUR_PC(n) PP32_CPU_STATUS(n)
  120. #define PP32_CPU_USER_STOPPED(n) (*PP32_CPU_STATUS(n) & (1 << 0))
  121. #define PP32_CPU_USER_BREAKIN_RCV(n) (*PP32_CPU_STATUS(n) & (1 << 1))
  122. #define PP32_CPU_USER_BREAKPOINT_MET(n) (*PP32_CPU_STATUS(n) & (1 << 2))
  123. #define PP32_CPU_CUR_PC(n) (*PP32_CPU_STATUS(n) >> 16)
  124. #define PP32_BREAKPOINT_REASONS(n) PP32_DEBUG_REG_ADDR(n, 0x0A00)
  125. #define PP32_BRK_PC_MET(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << (i)))
  126. #define PP32_BRK_DATA_ADDR_MET(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) + 2)))
  127. #define PP32_BRK_DATA_VALUE_RD_MET(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) + 4)))
  128. #define PP32_BRK_DATA_VALUE_WR_MET(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) + 6)))
  129. #define PP32_BRK_DATA_VALUE_RD_LO_EQ(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) * 2 + 8)))
  130. #define PP32_BRK_DATA_VALUE_RD_GT_EQ(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) * 2 + 9)))
  131. #define PP32_BRK_DATA_VALUE_WR_LO_EQ(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) * 2 + 12)))
  132. #define PP32_BRK_DATA_VALUE_WR_GT_EQ(n, i) (*PP32_BREAKPOINT_REASONS(n) & (1 << ((i) * 2 + 13)))
  133. #define PP32_BRK_CUR_CONTEXT(n) ((*PP32_BREAKPOINT_REASONS(n) >> 16) & 0x03)
  134. #define PP32_GP_REG_BASE(n) PP32_DEBUG_REG_ADDR(n, 0x0E00)
  135. #define PP32_GP_CONTEXTi_REGn(n, i, j) PP32_DEBUG_REG_ADDR(n, 0x0E00 + (i) * 16 + (j))
  136. /*
  137. * PDMA/EMA Registers
  138. */
  139. #define PDMA_CFG PPE_REG_ADDR(0x0A00)
  140. #define PDMA_RX_CMDCNT PPE_REG_ADDR(0x0A01)
  141. #define PDMA_TX_CMDCNT PPE_REG_ADDR(0x0A02)
  142. #define PDMA_RX_FWDATACNT PPE_REG_ADDR(0x0A03)
  143. #define PDMA_TX_FWDATACNT PPE_REG_ADDR(0x0A04)
  144. #define PDMA_RX_CTX_CFG PPE_REG_ADDR(0x0A05)
  145. #define PDMA_TX_CTX_CFG PPE_REG_ADDR(0x0A06)
  146. #define PDMA_RX_MAX_LEN_REG PPE_REG_ADDR(0x0A07)
  147. #define PDMA_RX_DELAY_CFG PPE_REG_ADDR(0x0A08)
  148. #define PDMA_INT_FIFO_RD PPE_REG_ADDR(0x0A09)
  149. #define PDMA_ISR PPE_REG_ADDR(0x0A0A)
  150. #define PDMA_IER PPE_REG_ADDR(0x0A0B)
  151. #define PDMA_SUBID PPE_REG_ADDR(0x0A0C)
  152. #define PDMA_BAR0 PPE_REG_ADDR(0x0A0D)
  153. #define PDMA_BAR1 PPE_REG_ADDR(0x0A0E)
  154. #define SAR_PDMA_RX_CMDBUF_CFG PPE_REG_ADDR(0x0F00)
  155. #define SAR_PDMA_TX_CMDBUF_CFG PPE_REG_ADDR(0x0F01)
  156. #define SAR_PDMA_RX_FW_CMDBUF_CFG PPE_REG_ADDR(0x0F02)
  157. #define SAR_PDMA_TX_FW_CMDBUF_CFG PPE_REG_ADDR(0x0F03)
  158. #define SAR_PDMA_RX_CMDBUF_STATUS PPE_REG_ADDR(0x0F04)
  159. #define SAR_PDMA_TX_CMDBUF_STATUS PPE_REG_ADDR(0x0F05)
  160. #define PDMA_ALIGNMENT 4
  161. #define EMA_ALIGNMENT PDMA_ALIGNMENT
  162. /*
  163. * Mailbox IGU1 Interrupt
  164. */
  165. #define PPE_MAILBOX_IGU1_INT INT_NUM_IM2_IRL24
  166. #endif // IFXMIPS_ATM_PPE_VR9_H