sxgbe_reg.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. /* 10G controller driver for Samsung SoCs
  2. *
  3. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Author: Siva Reddy Kallam <siva.kallam@samsung.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __SXGBE_REGMAP_H__
  13. #define __SXGBE_REGMAP_H__
  14. /* SXGBE MAC Registers */
  15. #define SXGBE_CORE_TX_CONFIG_REG 0x0000
  16. #define SXGBE_CORE_RX_CONFIG_REG 0x0004
  17. #define SXGBE_CORE_PKT_FILTER_REG 0x0008
  18. #define SXGBE_CORE_WATCHDOG_TIMEOUT_REG 0x000C
  19. #define SXGBE_CORE_HASH_TABLE_REG0 0x0010
  20. #define SXGBE_CORE_HASH_TABLE_REG1 0x0014
  21. #define SXGBE_CORE_HASH_TABLE_REG2 0x0018
  22. #define SXGBE_CORE_HASH_TABLE_REG3 0x001C
  23. #define SXGBE_CORE_HASH_TABLE_REG4 0x0020
  24. #define SXGBE_CORE_HASH_TABLE_REG5 0x0024
  25. #define SXGBE_CORE_HASH_TABLE_REG6 0x0028
  26. #define SXGBE_CORE_HASH_TABLE_REG7 0x002C
  27. /* EEE-LPI Registers */
  28. #define SXGBE_CORE_LPI_CTRL_STATUS 0x00D0
  29. #define SXGBE_CORE_LPI_TIMER_CTRL 0x00D4
  30. /* VLAN Specific Registers */
  31. #define SXGBE_CORE_VLAN_TAG_REG 0x0050
  32. #define SXGBE_CORE_VLAN_HASHTAB_REG 0x0058
  33. #define SXGBE_CORE_VLAN_INSCTL_REG 0x0060
  34. #define SXGBE_CORE_VLAN_INNERCTL_REG 0x0064
  35. #define SXGBE_CORE_RX_ETHTYPE_MATCH_REG 0x006C
  36. /* Flow Contol Registers */
  37. #define SXGBE_CORE_TX_Q0_FLOWCTL_REG 0x0070
  38. #define SXGBE_CORE_TX_Q1_FLOWCTL_REG 0x0074
  39. #define SXGBE_CORE_TX_Q2_FLOWCTL_REG 0x0078
  40. #define SXGBE_CORE_TX_Q3_FLOWCTL_REG 0x007C
  41. #define SXGBE_CORE_TX_Q4_FLOWCTL_REG 0x0080
  42. #define SXGBE_CORE_TX_Q5_FLOWCTL_REG 0x0084
  43. #define SXGBE_CORE_TX_Q6_FLOWCTL_REG 0x0088
  44. #define SXGBE_CORE_TX_Q7_FLOWCTL_REG 0x008C
  45. #define SXGBE_CORE_RX_FLOWCTL_REG 0x0090
  46. #define SXGBE_CORE_RX_CTL0_REG 0x00A0
  47. #define SXGBE_CORE_RX_CTL1_REG 0x00A4
  48. #define SXGBE_CORE_RX_CTL2_REG 0x00A8
  49. #define SXGBE_CORE_RX_CTL3_REG 0x00AC
  50. #define SXGBE_CORE_RXQ_ENABLE_MASK 0x0003
  51. #define SXGBE_CORE_RXQ_ENABLE 0x0002
  52. #define SXGBE_CORE_RXQ_DISABLE 0x0000
  53. /* Interrupt Registers */
  54. #define SXGBE_CORE_INT_STATUS_REG 0x00B0
  55. #define SXGBE_CORE_INT_ENABLE_REG 0x00B4
  56. #define SXGBE_CORE_RXTX_ERR_STATUS_REG 0x00B8
  57. #define SXGBE_CORE_PMT_CTL_STATUS_REG 0x00C0
  58. #define SXGBE_CORE_RWK_PKT_FILTER_REG 0x00C4
  59. #define SXGBE_CORE_VERSION_REG 0x0110
  60. #define SXGBE_CORE_DEBUG_REG 0x0114
  61. #define SXGBE_CORE_HW_FEA_REG(index) (0x011C + index * 4)
  62. /* SMA(MDIO) module registers */
  63. #define SXGBE_MDIO_SCMD_ADD_REG 0x0200
  64. #define SXGBE_MDIO_SCMD_DATA_REG 0x0204
  65. #define SXGBE_MDIO_CCMD_WADD_REG 0x0208
  66. #define SXGBE_MDIO_CCMD_WDATA_REG 0x020C
  67. #define SXGBE_MDIO_CSCAN_PORT_REG 0x0210
  68. #define SXGBE_MDIO_INT_STATUS_REG 0x0214
  69. #define SXGBE_MDIO_INT_ENABLE_REG 0x0218
  70. #define SXGBE_MDIO_PORT_CONDCON_REG 0x021C
  71. #define SXGBE_MDIO_CLAUSE22_PORT_REG 0x0220
  72. /* port specific, addr = 0-3 */
  73. #define SXGBE_MDIO_DEV_BASE_REG 0x0230
  74. #define SXGBE_MDIO_PORT_DEV_REG(addr) \
  75. (SXGBE_MDIO_DEV_BASE_REG + (0x10 * addr) + 0x0)
  76. #define SXGBE_MDIO_PORT_LSTATUS_REG(addr) \
  77. (SXGBE_MDIO_DEV_BASE_REG + (0x10 * addr) + 0x4)
  78. #define SXGBE_MDIO_PORT_ALIVE_REG(addr) \
  79. (SXGBE_MDIO_DEV_BASE_REG + (0x10 * addr) + 0x8)
  80. #define SXGBE_CORE_GPIO_CTL_REG 0x0278
  81. #define SXGBE_CORE_GPIO_STATUS_REG 0x027C
  82. /* Address registers for filtering */
  83. #define SXGBE_CORE_ADD_BASE_REG 0x0300
  84. /* addr = 0-31 */
  85. #define SXGBE_CORE_ADD_HIGHOFFSET(addr) \
  86. (SXGBE_CORE_ADD_BASE_REG + (0x8 * addr) + 0x0)
  87. #define SXGBE_CORE_ADD_LOWOFFSET(addr) \
  88. (SXGBE_CORE_ADD_BASE_REG + (0x8 * addr) + 0x4)
  89. /* SXGBE MMC registers */
  90. #define SXGBE_MMC_CTL_REG 0x0800
  91. #define SXGBE_MMC_RXINT_STATUS_REG 0x0804
  92. #define SXGBE_MMC_TXINT_STATUS_REG 0x0808
  93. #define SXGBE_MMC_RXINT_ENABLE_REG 0x080C
  94. #define SXGBE_MMC_TXINT_ENABLE_REG 0x0810
  95. /* TX specific counters */
  96. #define SXGBE_MMC_TXOCTETHI_GBCNT_REG 0x0814
  97. #define SXGBE_MMC_TXOCTETLO_GBCNT_REG 0x0818
  98. #define SXGBE_MMC_TXFRAMELO_GBCNT_REG 0x081C
  99. #define SXGBE_MMC_TXFRAMEHI_GBCNT_REG 0x0820
  100. #define SXGBE_MMC_TXBROADLO_GCNT_REG 0x0824
  101. #define SXGBE_MMC_TXBROADHI_GCNT_REG 0x0828
  102. #define SXGBE_MMC_TXMULTILO_GCNT_REG 0x082C
  103. #define SXGBE_MMC_TXMULTIHI_GCNT_REG 0x0830
  104. #define SXGBE_MMC_TX64LO_GBCNT_REG 0x0834
  105. #define SXGBE_MMC_TX64HI_GBCNT_REG 0x0838
  106. #define SXGBE_MMC_TX65TO127LO_GBCNT_REG 0x083C
  107. #define SXGBE_MMC_TX65TO127HI_GBCNT_REG 0x0840
  108. #define SXGBE_MMC_TX128TO255LO_GBCNT_REG 0x0844
  109. #define SXGBE_MMC_TX128TO255HI_GBCNT_REG 0x0848
  110. #define SXGBE_MMC_TX256TO511LO_GBCNT_REG 0x084C
  111. #define SXGBE_MMC_TX256TO511HI_GBCNT_REG 0x0850
  112. #define SXGBE_MMC_TX512TO1023LO_GBCNT_REG 0x0854
  113. #define SXGBE_MMC_TX512TO1023HI_GBCNT_REG 0x0858
  114. #define SXGBE_MMC_TX1023TOMAXLO_GBCNT_REG 0x085C
  115. #define SXGBE_MMC_TX1023TOMAXHI_GBCNT_REG 0x0860
  116. #define SXGBE_MMC_TXUNICASTLO_GBCNT_REG 0x0864
  117. #define SXGBE_MMC_TXUNICASTHI_GBCNT_REG 0x0868
  118. #define SXGBE_MMC_TXMULTILO_GBCNT_REG 0x086C
  119. #define SXGBE_MMC_TXMULTIHI_GBCNT_REG 0x0870
  120. #define SXGBE_MMC_TXBROADLO_GBCNT_REG 0x0874
  121. #define SXGBE_MMC_TXBROADHI_GBCNT_REG 0x0878
  122. #define SXGBE_MMC_TXUFLWLO_GBCNT_REG 0x087C
  123. #define SXGBE_MMC_TXUFLWHI_GBCNT_REG 0x0880
  124. #define SXGBE_MMC_TXOCTETLO_GCNT_REG 0x0884
  125. #define SXGBE_MMC_TXOCTETHI_GCNT_REG 0x0888
  126. #define SXGBE_MMC_TXFRAMELO_GCNT_REG 0x088C
  127. #define SXGBE_MMC_TXFRAMEHI_GCNT_REG 0x0890
  128. #define SXGBE_MMC_TXPAUSELO_CNT_REG 0x0894
  129. #define SXGBE_MMC_TXPAUSEHI_CNT_REG 0x0898
  130. #define SXGBE_MMC_TXVLANLO_GCNT_REG 0x089C
  131. #define SXGBE_MMC_TXVLANHI_GCNT_REG 0x08A0
  132. /* RX specific counters */
  133. #define SXGBE_MMC_RXFRAMELO_GBCNT_REG 0x0900
  134. #define SXGBE_MMC_RXFRAMEHI_GBCNT_REG 0x0904
  135. #define SXGBE_MMC_RXOCTETLO_GBCNT_REG 0x0908
  136. #define SXGBE_MMC_RXOCTETHI_GBCNT_REG 0x090C
  137. #define SXGBE_MMC_RXOCTETLO_GCNT_REG 0x0910
  138. #define SXGBE_MMC_RXOCTETHI_GCNT_REG 0x0914
  139. #define SXGBE_MMC_RXBROADLO_GCNT_REG 0x0918
  140. #define SXGBE_MMC_RXBROADHI_GCNT_REG 0x091C
  141. #define SXGBE_MMC_RXMULTILO_GCNT_REG 0x0920
  142. #define SXGBE_MMC_RXMULTIHI_GCNT_REG 0x0924
  143. #define SXGBE_MMC_RXCRCERRLO_REG 0x0928
  144. #define SXGBE_MMC_RXCRCERRHI_REG 0x092C
  145. #define SXGBE_MMC_RXSHORT64BFRAME_ERR_REG 0x0930
  146. #define SXGBE_MMC_RXJABBERERR_REG 0x0934
  147. #define SXGBE_MMC_RXSHORT64BFRAME_COR_REG 0x0938
  148. #define SXGBE_MMC_RXOVERMAXFRAME_COR_REG 0x093C
  149. #define SXGBE_MMC_RX64LO_GBCNT_REG 0x0940
  150. #define SXGBE_MMC_RX64HI_GBCNT_REG 0x0944
  151. #define SXGBE_MMC_RX65TO127LO_GBCNT_REG 0x0948
  152. #define SXGBE_MMC_RX65TO127HI_GBCNT_REG 0x094C
  153. #define SXGBE_MMC_RX128TO255LO_GBCNT_REG 0x0950
  154. #define SXGBE_MMC_RX128TO255HI_GBCNT_REG 0x0954
  155. #define SXGBE_MMC_RX256TO511LO_GBCNT_REG 0x0958
  156. #define SXGBE_MMC_RX256TO511HI_GBCNT_REG 0x095C
  157. #define SXGBE_MMC_RX512TO1023LO_GBCNT_REG 0x0960
  158. #define SXGBE_MMC_RX512TO1023HI_GBCNT_REG 0x0964
  159. #define SXGBE_MMC_RX1023TOMAXLO_GBCNT_REG 0x0968
  160. #define SXGBE_MMC_RX1023TOMAXHI_GBCNT_REG 0x096C
  161. #define SXGBE_MMC_RXUNICASTLO_GCNT_REG 0x0970
  162. #define SXGBE_MMC_RXUNICASTHI_GCNT_REG 0x0974
  163. #define SXGBE_MMC_RXLENERRLO_REG 0x0978
  164. #define SXGBE_MMC_RXLENERRHI_REG 0x097C
  165. #define SXGBE_MMC_RXOUTOFRANGETYPELO_REG 0x0980
  166. #define SXGBE_MMC_RXOUTOFRANGETYPEHI_REG 0x0984
  167. #define SXGBE_MMC_RXPAUSELO_CNT_REG 0x0988
  168. #define SXGBE_MMC_RXPAUSEHI_CNT_REG 0x098C
  169. #define SXGBE_MMC_RXFIFOOVERFLOWLO_GBCNT_REG 0x0990
  170. #define SXGBE_MMC_RXFIFOOVERFLOWHI_GBCNT_REG 0x0994
  171. #define SXGBE_MMC_RXVLANLO_GBCNT_REG 0x0998
  172. #define SXGBE_MMC_RXVLANHI_GBCNT_REG 0x099C
  173. #define SXGBE_MMC_RXWATCHDOG_ERR_REG 0x09A0
  174. /* L3/L4 function registers */
  175. #define SXGBE_CORE_L34_ADDCTL_REG 0x0C00
  176. #define SXGBE_CORE_L34_DATA_REG 0x0C04
  177. /* ARP registers */
  178. #define SXGBE_CORE_ARP_ADD_REG 0x0C10
  179. /* RSS registers */
  180. #define SXGBE_CORE_RSS_CTL_REG 0x0C80
  181. #define SXGBE_CORE_RSS_ADD_REG 0x0C88
  182. #define SXGBE_CORE_RSS_DATA_REG 0x0C8C
  183. /* RSS control register bits */
  184. #define SXGBE_CORE_RSS_CTL_UDP4TE BIT(3)
  185. #define SXGBE_CORE_RSS_CTL_TCP4TE BIT(2)
  186. #define SXGBE_CORE_RSS_CTL_IP2TE BIT(1)
  187. #define SXGBE_CORE_RSS_CTL_RSSE BIT(0)
  188. /* IEEE 1588 registers */
  189. #define SXGBE_CORE_TSTAMP_CTL_REG 0x0D00
  190. #define SXGBE_CORE_SUBSEC_INC_REG 0x0D04
  191. #define SXGBE_CORE_SYSTIME_SEC_REG 0x0D0C
  192. #define SXGBE_CORE_SYSTIME_NSEC_REG 0x0D10
  193. #define SXGBE_CORE_SYSTIME_SECUP_REG 0x0D14
  194. #define SXGBE_CORE_TSTAMP_ADD_REG 0x0D18
  195. #define SXGBE_CORE_SYSTIME_HWORD_REG 0x0D1C
  196. #define SXGBE_CORE_TSTAMP_STATUS_REG 0x0D20
  197. #define SXGBE_CORE_TXTIME_STATUSNSEC_REG 0x0D30
  198. #define SXGBE_CORE_TXTIME_STATUSSEC_REG 0x0D34
  199. /* Auxiliary registers */
  200. #define SXGBE_CORE_AUX_CTL_REG 0x0D40
  201. #define SXGBE_CORE_AUX_TSTAMP_NSEC_REG 0x0D48
  202. #define SXGBE_CORE_AUX_TSTAMP_SEC_REG 0x0D4C
  203. #define SXGBE_CORE_AUX_TSTAMP_INGCOR_REG 0x0D50
  204. #define SXGBE_CORE_AUX_TSTAMP_ENGCOR_REG 0x0D54
  205. #define SXGBE_CORE_AUX_TSTAMP_INGCOR_NSEC_REG 0x0D58
  206. #define SXGBE_CORE_AUX_TSTAMP_INGCOR_SUBNSEC_REG 0x0D5C
  207. #define SXGBE_CORE_AUX_TSTAMP_ENGCOR_NSEC_REG 0x0D60
  208. #define SXGBE_CORE_AUX_TSTAMP_ENGCOR_SUBNSEC_REG 0x0D64
  209. /* PPS registers */
  210. #define SXGBE_CORE_PPS_CTL_REG 0x0D70
  211. #define SXGBE_CORE_PPS_BASE 0x0D80
  212. /* addr = 0 - 3 */
  213. #define SXGBE_CORE_PPS_TTIME_SEC_REG(addr) \
  214. (SXGBE_CORE_PPS_BASE + (0x10 * addr) + 0x0)
  215. #define SXGBE_CORE_PPS_TTIME_NSEC_REG(addr) \
  216. (SXGBE_CORE_PPS_BASE + (0x10 * addr) + 0x4)
  217. #define SXGBE_CORE_PPS_INTERVAL_REG(addr) \
  218. (SXGBE_CORE_PPS_BASE + (0x10 * addr) + 0x8)
  219. #define SXGBE_CORE_PPS_WIDTH_REG(addr) \
  220. (SXGBE_CORE_PPS_BASE + (0x10 * addr) + 0xC)
  221. #define SXGBE_CORE_PTO_CTL_REG 0x0DC0
  222. #define SXGBE_CORE_SRCPORT_ITY0_REG 0x0DC4
  223. #define SXGBE_CORE_SRCPORT_ITY1_REG 0x0DC8
  224. #define SXGBE_CORE_SRCPORT_ITY2_REG 0x0DCC
  225. #define SXGBE_CORE_LOGMSG_LEVEL_REG 0x0DD0
  226. /* SXGBE MTL Registers */
  227. #define SXGBE_MTL_BASE_REG 0x1000
  228. #define SXGBE_MTL_OP_MODE_REG (SXGBE_MTL_BASE_REG + 0x0000)
  229. #define SXGBE_MTL_DEBUG_CTL_REG (SXGBE_MTL_BASE_REG + 0x0008)
  230. #define SXGBE_MTL_DEBUG_STATUS_REG (SXGBE_MTL_BASE_REG + 0x000C)
  231. #define SXGBE_MTL_FIFO_DEBUGDATA_REG (SXGBE_MTL_BASE_REG + 0x0010)
  232. #define SXGBE_MTL_INT_STATUS_REG (SXGBE_MTL_BASE_REG + 0x0020)
  233. #define SXGBE_MTL_RXQ_DMAMAP0_REG (SXGBE_MTL_BASE_REG + 0x0030)
  234. #define SXGBE_MTL_RXQ_DMAMAP1_REG (SXGBE_MTL_BASE_REG + 0x0034)
  235. #define SXGBE_MTL_RXQ_DMAMAP2_REG (SXGBE_MTL_BASE_REG + 0x0038)
  236. #define SXGBE_MTL_TX_PRTYMAP0_REG (SXGBE_MTL_BASE_REG + 0x0040)
  237. #define SXGBE_MTL_TX_PRTYMAP1_REG (SXGBE_MTL_BASE_REG + 0x0044)
  238. /* TC/Queue registers, qnum=0-15 */
  239. #define SXGBE_MTL_TC_TXBASE_REG (SXGBE_MTL_BASE_REG + 0x0100)
  240. #define SXGBE_MTL_TXQ_OPMODE_REG(qnum) \
  241. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x00)
  242. #define SXGBE_MTL_SFMODE BIT(1)
  243. #define SXGBE_MTL_FIFO_LSHIFT 16
  244. #define SXGBE_MTL_ENABLE_QUEUE 0x00000008
  245. #define SXGBE_MTL_TXQ_UNDERFLOW_REG(qnum) \
  246. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x04)
  247. #define SXGBE_MTL_TXQ_DEBUG_REG(qnum) \
  248. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x08)
  249. #define SXGBE_MTL_TXQ_ETSCTL_REG(qnum) \
  250. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x10)
  251. #define SXGBE_MTL_TXQ_ETSSTATUS_REG(qnum) \
  252. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x14)
  253. #define SXGBE_MTL_TXQ_QUANTWEIGHT_REG(qnum) \
  254. (SXGBE_MTL_TC_TXBASE_REG + (qnum * 0x80) + 0x18)
  255. #define SXGBE_MTL_TC_RXBASE_REG 0x1140
  256. #define SXGBE_RX_MTL_SFMODE BIT(5)
  257. #define SXGBE_MTL_RXQ_OPMODE_REG(qnum) \
  258. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x00)
  259. #define SXGBE_MTL_RXQ_MISPKTOVERFLOW_REG(qnum) \
  260. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x04)
  261. #define SXGBE_MTL_RXQ_DEBUG_REG(qnum) \
  262. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x08)
  263. #define SXGBE_MTL_RXQ_CTL_REG(qnum) \
  264. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x0C)
  265. #define SXGBE_MTL_RXQ_INTENABLE_REG(qnum) \
  266. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x30)
  267. #define SXGBE_MTL_RXQ_INTSTATUS_REG(qnum) \
  268. (SXGBE_MTL_TC_RXBASE_REG + (qnum * 0x80) + 0x34)
  269. /* SXGBE DMA Registers */
  270. #define SXGBE_DMA_BASE_REG 0x3000
  271. #define SXGBE_DMA_MODE_REG (SXGBE_DMA_BASE_REG + 0x0000)
  272. #define SXGBE_DMA_SOFT_RESET BIT(0)
  273. #define SXGBE_DMA_SYSBUS_MODE_REG (SXGBE_DMA_BASE_REG + 0x0004)
  274. #define SXGBE_DMA_AXI_UNDEF_BURST BIT(0)
  275. #define SXGBE_DMA_ENHACE_ADDR_MODE BIT(11)
  276. #define SXGBE_DMA_INT_STATUS_REG (SXGBE_DMA_BASE_REG + 0x0008)
  277. #define SXGBE_DMA_AXI_ARCACHECTL_REG (SXGBE_DMA_BASE_REG + 0x0010)
  278. #define SXGBE_DMA_AXI_AWCACHECTL_REG (SXGBE_DMA_BASE_REG + 0x0018)
  279. #define SXGBE_DMA_DEBUG_STATUS0_REG (SXGBE_DMA_BASE_REG + 0x0020)
  280. #define SXGBE_DMA_DEBUG_STATUS1_REG (SXGBE_DMA_BASE_REG + 0x0024)
  281. #define SXGBE_DMA_DEBUG_STATUS2_REG (SXGBE_DMA_BASE_REG + 0x0028)
  282. #define SXGBE_DMA_DEBUG_STATUS3_REG (SXGBE_DMA_BASE_REG + 0x002C)
  283. #define SXGBE_DMA_DEBUG_STATUS4_REG (SXGBE_DMA_BASE_REG + 0x0030)
  284. #define SXGBE_DMA_DEBUG_STATUS5_REG (SXGBE_DMA_BASE_REG + 0x0034)
  285. /* Channel Registers, cha_num = 0-15 */
  286. #define SXGBE_DMA_CHA_BASE_REG \
  287. (SXGBE_DMA_BASE_REG + 0x0100)
  288. #define SXGBE_DMA_CHA_CTL_REG(cha_num) \
  289. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x00)
  290. #define SXGBE_DMA_PBL_X8MODE BIT(16)
  291. #define SXGBE_DMA_CHA_TXCTL_TSE_ENABLE BIT(12)
  292. #define SXGBE_DMA_CHA_TXCTL_REG(cha_num) \
  293. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x04)
  294. #define SXGBE_DMA_CHA_RXCTL_REG(cha_num) \
  295. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x08)
  296. #define SXGBE_DMA_CHA_TXDESC_HADD_REG(cha_num) \
  297. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x10)
  298. #define SXGBE_DMA_CHA_TXDESC_LADD_REG(cha_num) \
  299. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x14)
  300. #define SXGBE_DMA_CHA_RXDESC_HADD_REG(cha_num) \
  301. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x18)
  302. #define SXGBE_DMA_CHA_RXDESC_LADD_REG(cha_num) \
  303. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x1C)
  304. #define SXGBE_DMA_CHA_TXDESC_TAILPTR_REG(cha_num) \
  305. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x24)
  306. #define SXGBE_DMA_CHA_RXDESC_TAILPTR_REG(cha_num) \
  307. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x2C)
  308. #define SXGBE_DMA_CHA_TXDESC_RINGLEN_REG(cha_num) \
  309. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x30)
  310. #define SXGBE_DMA_CHA_RXDESC_RINGLEN_REG(cha_num) \
  311. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x34)
  312. #define SXGBE_DMA_CHA_INT_ENABLE_REG(cha_num) \
  313. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x38)
  314. #define SXGBE_DMA_CHA_INT_RXWATCHTMR_REG(cha_num) \
  315. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x3C)
  316. #define SXGBE_DMA_CHA_TXDESC_CURADDLO_REG(cha_num) \
  317. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x44)
  318. #define SXGBE_DMA_CHA_RXDESC_CURADDLO_REG(cha_num) \
  319. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x4C)
  320. #define SXGBE_DMA_CHA_CURTXBUF_ADDHI_REG(cha_num) \
  321. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x50)
  322. #define SXGBE_DMA_CHA_CURTXBUF_ADDLO_REG(cha_num) \
  323. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x54)
  324. #define SXGBE_DMA_CHA_CURRXBUF_ADDHI_REG(cha_num) \
  325. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x58)
  326. #define SXGBE_DMA_CHA_CURRXBUF_ADDLO_REG(cha_num) \
  327. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x5C)
  328. #define SXGBE_DMA_CHA_STATUS_REG(cha_num) \
  329. (SXGBE_DMA_CHA_BASE_REG + (cha_num * 0x80) + 0x60)
  330. /* TX DMA control register specific */
  331. #define SXGBE_TX_START_DMA BIT(0)
  332. /* sxgbe tx configuration register bitfields */
  333. #define SXGBE_SPEED_10G 0x0
  334. #define SXGBE_SPEED_2_5G 0x1
  335. #define SXGBE_SPEED_1G 0x2
  336. #define SXGBE_SPEED_LSHIFT 29
  337. #define SXGBE_TX_ENABLE BIT(0)
  338. #define SXGBE_TX_DISDIC_ALGO BIT(1)
  339. #define SXGBE_TX_JABBER_DISABLE BIT(16)
  340. /* sxgbe rx configuration register bitfields */
  341. #define SXGBE_RX_ENABLE BIT(0)
  342. #define SXGBE_RX_ACS_ENABLE BIT(1)
  343. #define SXGBE_RX_WATCHDOG_DISABLE BIT(7)
  344. #define SXGBE_RX_JUMBPKT_ENABLE BIT(8)
  345. #define SXGBE_RX_CSUMOFFLOAD_ENABLE BIT(9)
  346. #define SXGBE_RX_LOOPBACK_ENABLE BIT(10)
  347. #define SXGBE_RX_ARPOFFLOAD_ENABLE BIT(31)
  348. /* sxgbe vlan Tag Register bitfields */
  349. #define SXGBE_VLAN_SVLAN_ENABLE BIT(18)
  350. #define SXGBE_VLAN_DOUBLEVLAN_ENABLE BIT(26)
  351. #define SXGBE_VLAN_INNERVLAN_ENABLE BIT(27)
  352. /* XMAC VLAN Tag Inclusion Register(0x0060) bitfields
  353. * Below fields same for Inner VLAN Tag Inclusion
  354. * Register(0x0064) register
  355. */
  356. enum vlan_tag_ctl_tx {
  357. VLAN_TAG_TX_NOP,
  358. VLAN_TAG_TX_DEL,
  359. VLAN_TAG_TX_INSERT,
  360. VLAN_TAG_TX_REPLACE
  361. };
  362. #define SXGBE_VLAN_PRTY_CTL BIT(18)
  363. #define SXGBE_VLAN_CSVL_CTL BIT(19)
  364. /* SXGBE TX Q Flow Control Register bitfields */
  365. #define SXGBE_TX_FLOW_CTL_FCB BIT(0)
  366. #define SXGBE_TX_FLOW_CTL_TFB BIT(1)
  367. /* SXGBE RX Q Flow Control Register bitfields */
  368. #define SXGBE_RX_FLOW_CTL_ENABLE BIT(0)
  369. #define SXGBE_RX_UNICAST_DETECT BIT(1)
  370. #define SXGBE_RX_PRTYFLOW_CTL_ENABLE BIT(8)
  371. /* sxgbe rx Q control0 register bitfields */
  372. #define SXGBE_RX_Q_ENABLE 0x2
  373. /* SXGBE hardware features bitfield specific */
  374. /* Capability Register 0 */
  375. #define SXGBE_HW_FEAT_GMII(cap) ((cap & 0x00000002) >> 1)
  376. #define SXGBE_HW_FEAT_VLAN_HASH_FILTER(cap) ((cap & 0x00000010) >> 4)
  377. #define SXGBE_HW_FEAT_SMA(cap) ((cap & 0x00000020) >> 5)
  378. #define SXGBE_HW_FEAT_PMT_TEMOTE_WOP(cap) ((cap & 0x00000040) >> 6)
  379. #define SXGBE_HW_FEAT_PMT_MAGIC_PKT(cap) ((cap & 0x00000080) >> 7)
  380. #define SXGBE_HW_FEAT_RMON(cap) ((cap & 0x00000100) >> 8)
  381. #define SXGBE_HW_FEAT_ARP_OFFLOAD(cap) ((cap & 0x00000200) >> 9)
  382. #define SXGBE_HW_FEAT_IEEE1500_2008(cap) ((cap & 0x00001000) >> 12)
  383. #define SXGBE_HW_FEAT_EEE(cap) ((cap & 0x00002000) >> 13)
  384. #define SXGBE_HW_FEAT_TX_CSUM_OFFLOAD(cap) ((cap & 0x00004000) >> 14)
  385. #define SXGBE_HW_FEAT_RX_CSUM_OFFLOAD(cap) ((cap & 0x00010000) >> 16)
  386. #define SXGBE_HW_FEAT_MACADDR_COUNT(cap) ((cap & 0x007C0000) >> 18)
  387. #define SXGBE_HW_FEAT_TSTMAP_SRC(cap) ((cap & 0x06000000) >> 25)
  388. #define SXGBE_HW_FEAT_SRCADDR_VLAN(cap) ((cap & 0x08000000) >> 27)
  389. /* Capability Register 1 */
  390. #define SXGBE_HW_FEAT_RX_FIFO_SIZE(cap) ((cap & 0x0000001F))
  391. #define SXGBE_HW_FEAT_TX_FIFO_SIZE(cap) ((cap & 0x000007C0) >> 6)
  392. #define SXGBE_HW_FEAT_IEEE1588_HWORD(cap) ((cap & 0x00002000) >> 13)
  393. #define SXGBE_HW_FEAT_DCB(cap) ((cap & 0x00010000) >> 16)
  394. #define SXGBE_HW_FEAT_SPLIT_HDR(cap) ((cap & 0x00020000) >> 17)
  395. #define SXGBE_HW_FEAT_TSO(cap) ((cap & 0x00040000) >> 18)
  396. #define SXGBE_HW_FEAT_DEBUG_MEM_IFACE(cap) ((cap & 0x00080000) >> 19)
  397. #define SXGBE_HW_FEAT_RSS(cap) ((cap & 0x00100000) >> 20)
  398. #define SXGBE_HW_FEAT_HASH_TABLE_SIZE(cap) ((cap & 0x03000000) >> 24)
  399. #define SXGBE_HW_FEAT_L3L4_FILTER_NUM(cap) ((cap & 0x78000000) >> 27)
  400. /* Capability Register 2 */
  401. #define SXGBE_HW_FEAT_RX_MTL_QUEUES(cap) ((cap & 0x0000000F))
  402. #define SXGBE_HW_FEAT_TX_MTL_QUEUES(cap) ((cap & 0x000003C0) >> 6)
  403. #define SXGBE_HW_FEAT_RX_DMA_CHANNELS(cap) ((cap & 0x0000F000) >> 12)
  404. #define SXGBE_HW_FEAT_TX_DMA_CHANNELS(cap) ((cap & 0x003C0000) >> 18)
  405. #define SXGBE_HW_FEAT_PPS_OUTPUTS(cap) ((cap & 0x07000000) >> 24)
  406. #define SXGBE_HW_FEAT_AUX_SNAPSHOTS(cap) ((cap & 0x70000000) >> 28)
  407. /* DMAchannel interrupt enable specific */
  408. /* DMA Normal interrupt */
  409. #define SXGBE_DMA_INT_ENA_NIE BIT(16) /* Normal Summary */
  410. #define SXGBE_DMA_INT_ENA_TIE BIT(0) /* Transmit Interrupt */
  411. #define SXGBE_DMA_INT_ENA_TUE BIT(2) /* Transmit Buffer Unavailable */
  412. #define SXGBE_DMA_INT_ENA_RIE BIT(6) /* Receive Interrupt */
  413. #define SXGBE_DMA_INT_NORMAL \
  414. (SXGBE_DMA_INT_ENA_NIE | SXGBE_DMA_INT_ENA_RIE | \
  415. SXGBE_DMA_INT_ENA_TIE | SXGBE_DMA_INT_ENA_TUE)
  416. /* DMA Abnormal interrupt */
  417. #define SXGBE_DMA_INT_ENA_AIE BIT(15) /* Abnormal Summary */
  418. #define SXGBE_DMA_INT_ENA_TSE BIT(1) /* Transmit Stopped */
  419. #define SXGBE_DMA_INT_ENA_RUE BIT(7) /* Receive Buffer Unavailable */
  420. #define SXGBE_DMA_INT_ENA_RSE BIT(8) /* Receive Stopped */
  421. #define SXGBE_DMA_INT_ENA_FBE BIT(12) /* Fatal Bus Error */
  422. #define SXGBE_DMA_INT_ENA_CDEE BIT(13) /* Context Descriptor Error */
  423. #define SXGBE_DMA_INT_ABNORMAL \
  424. (SXGBE_DMA_INT_ENA_AIE | SXGBE_DMA_INT_ENA_TSE | \
  425. SXGBE_DMA_INT_ENA_RUE | SXGBE_DMA_INT_ENA_RSE | \
  426. SXGBE_DMA_INT_ENA_FBE | SXGBE_DMA_INT_ENA_CDEE)
  427. #define SXGBE_DMA_ENA_INT (SXGBE_DMA_INT_NORMAL | SXGBE_DMA_INT_ABNORMAL)
  428. /* DMA channel interrupt status specific */
  429. #define SXGBE_DMA_INT_STATUS_REB2 BIT(21)
  430. #define SXGBE_DMA_INT_STATUS_REB1 BIT(20)
  431. #define SXGBE_DMA_INT_STATUS_REB0 BIT(19)
  432. #define SXGBE_DMA_INT_STATUS_TEB2 BIT(18)
  433. #define SXGBE_DMA_INT_STATUS_TEB1 BIT(17)
  434. #define SXGBE_DMA_INT_STATUS_TEB0 BIT(16)
  435. #define SXGBE_DMA_INT_STATUS_NIS BIT(15)
  436. #define SXGBE_DMA_INT_STATUS_AIS BIT(14)
  437. #define SXGBE_DMA_INT_STATUS_CTXTERR BIT(13)
  438. #define SXGBE_DMA_INT_STATUS_FBE BIT(12)
  439. #define SXGBE_DMA_INT_STATUS_RPS BIT(8)
  440. #define SXGBE_DMA_INT_STATUS_RBU BIT(7)
  441. #define SXGBE_DMA_INT_STATUS_RI BIT(6)
  442. #define SXGBE_DMA_INT_STATUS_TBU BIT(2)
  443. #define SXGBE_DMA_INT_STATUS_TPS BIT(1)
  444. #define SXGBE_DMA_INT_STATUS_TI BIT(0)
  445. #endif /* __SXGBE_REGMAP_H__ */