cvmx-smix-defs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /***********************license start***************
  2. * Author: Cavium Networks
  3. *
  4. * Contact: support@caviumnetworks.com
  5. * This file is part of the OCTEON SDK
  6. *
  7. * Copyright (c) 2003-2012 Cavium Networks
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this file; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. * or visit http://www.gnu.org/licenses/.
  23. *
  24. * This file may also be available under a different license from Cavium.
  25. * Contact Cavium Networks for more information
  26. ***********************license end**************************************/
  27. #ifndef __CVMX_SMIX_DEFS_H__
  28. #define __CVMX_SMIX_DEFS_H__
  29. static inline uint64_t CVMX_SMIX_CLK(unsigned long offset)
  30. {
  31. switch (cvmx_get_octeon_family()) {
  32. case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
  33. case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
  34. case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
  35. case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
  36. case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
  37. return CVMX_ADD_IO_SEG(0x0001180000001818ull) + (offset) * 256;
  38. case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
  39. case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
  40. case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
  41. case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
  42. case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
  43. case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
  44. return CVMX_ADD_IO_SEG(0x0001180000001818ull) + (offset) * 256;
  45. case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
  46. return CVMX_ADD_IO_SEG(0x0001180000003818ull) + (offset) * 128;
  47. }
  48. return CVMX_ADD_IO_SEG(0x0001180000001818ull) + (offset) * 256;
  49. }
  50. static inline uint64_t CVMX_SMIX_CMD(unsigned long offset)
  51. {
  52. switch (cvmx_get_octeon_family()) {
  53. case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
  54. case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
  55. case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
  56. case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
  57. case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
  58. return CVMX_ADD_IO_SEG(0x0001180000001800ull) + (offset) * 256;
  59. case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
  60. case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
  61. case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
  62. case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
  63. case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
  64. case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
  65. return CVMX_ADD_IO_SEG(0x0001180000001800ull) + (offset) * 256;
  66. case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
  67. return CVMX_ADD_IO_SEG(0x0001180000003800ull) + (offset) * 128;
  68. }
  69. return CVMX_ADD_IO_SEG(0x0001180000001800ull) + (offset) * 256;
  70. }
  71. static inline uint64_t CVMX_SMIX_EN(unsigned long offset)
  72. {
  73. switch (cvmx_get_octeon_family()) {
  74. case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
  75. case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
  76. case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
  77. case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
  78. case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
  79. return CVMX_ADD_IO_SEG(0x0001180000001820ull) + (offset) * 256;
  80. case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
  81. case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
  82. case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
  83. case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
  84. case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
  85. case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
  86. return CVMX_ADD_IO_SEG(0x0001180000001820ull) + (offset) * 256;
  87. case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
  88. return CVMX_ADD_IO_SEG(0x0001180000003820ull) + (offset) * 128;
  89. }
  90. return CVMX_ADD_IO_SEG(0x0001180000001820ull) + (offset) * 256;
  91. }
  92. static inline uint64_t CVMX_SMIX_RD_DAT(unsigned long offset)
  93. {
  94. switch (cvmx_get_octeon_family()) {
  95. case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
  96. case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
  97. case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
  98. case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
  99. case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
  100. return CVMX_ADD_IO_SEG(0x0001180000001810ull) + (offset) * 256;
  101. case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
  102. case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
  103. case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
  104. case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
  105. case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
  106. case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
  107. return CVMX_ADD_IO_SEG(0x0001180000001810ull) + (offset) * 256;
  108. case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
  109. return CVMX_ADD_IO_SEG(0x0001180000003810ull) + (offset) * 128;
  110. }
  111. return CVMX_ADD_IO_SEG(0x0001180000001810ull) + (offset) * 256;
  112. }
  113. static inline uint64_t CVMX_SMIX_WR_DAT(unsigned long offset)
  114. {
  115. switch (cvmx_get_octeon_family()) {
  116. case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
  117. case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
  118. case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
  119. case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
  120. case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
  121. return CVMX_ADD_IO_SEG(0x0001180000001808ull) + (offset) * 256;
  122. case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
  123. case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
  124. case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
  125. case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
  126. case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
  127. case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
  128. return CVMX_ADD_IO_SEG(0x0001180000001808ull) + (offset) * 256;
  129. case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
  130. return CVMX_ADD_IO_SEG(0x0001180000003808ull) + (offset) * 128;
  131. }
  132. return CVMX_ADD_IO_SEG(0x0001180000001808ull) + (offset) * 256;
  133. }
  134. union cvmx_smix_clk {
  135. uint64_t u64;
  136. struct cvmx_smix_clk_s {
  137. #ifdef __BIG_ENDIAN_BITFIELD
  138. uint64_t reserved_25_63:39;
  139. uint64_t mode:1;
  140. uint64_t reserved_21_23:3;
  141. uint64_t sample_hi:5;
  142. uint64_t sample_mode:1;
  143. uint64_t reserved_14_14:1;
  144. uint64_t clk_idle:1;
  145. uint64_t preamble:1;
  146. uint64_t sample:4;
  147. uint64_t phase:8;
  148. #else
  149. uint64_t phase:8;
  150. uint64_t sample:4;
  151. uint64_t preamble:1;
  152. uint64_t clk_idle:1;
  153. uint64_t reserved_14_14:1;
  154. uint64_t sample_mode:1;
  155. uint64_t sample_hi:5;
  156. uint64_t reserved_21_23:3;
  157. uint64_t mode:1;
  158. uint64_t reserved_25_63:39;
  159. #endif
  160. } s;
  161. struct cvmx_smix_clk_cn30xx {
  162. #ifdef __BIG_ENDIAN_BITFIELD
  163. uint64_t reserved_21_63:43;
  164. uint64_t sample_hi:5;
  165. uint64_t sample_mode:1;
  166. uint64_t reserved_14_14:1;
  167. uint64_t clk_idle:1;
  168. uint64_t preamble:1;
  169. uint64_t sample:4;
  170. uint64_t phase:8;
  171. #else
  172. uint64_t phase:8;
  173. uint64_t sample:4;
  174. uint64_t preamble:1;
  175. uint64_t clk_idle:1;
  176. uint64_t reserved_14_14:1;
  177. uint64_t sample_mode:1;
  178. uint64_t sample_hi:5;
  179. uint64_t reserved_21_63:43;
  180. #endif
  181. } cn30xx;
  182. struct cvmx_smix_clk_cn30xx cn31xx;
  183. struct cvmx_smix_clk_cn30xx cn38xx;
  184. struct cvmx_smix_clk_cn30xx cn38xxp2;
  185. struct cvmx_smix_clk_s cn50xx;
  186. struct cvmx_smix_clk_s cn52xx;
  187. struct cvmx_smix_clk_s cn52xxp1;
  188. struct cvmx_smix_clk_s cn56xx;
  189. struct cvmx_smix_clk_s cn56xxp1;
  190. struct cvmx_smix_clk_cn30xx cn58xx;
  191. struct cvmx_smix_clk_cn30xx cn58xxp1;
  192. struct cvmx_smix_clk_s cn61xx;
  193. struct cvmx_smix_clk_s cn63xx;
  194. struct cvmx_smix_clk_s cn63xxp1;
  195. struct cvmx_smix_clk_s cn66xx;
  196. struct cvmx_smix_clk_s cn68xx;
  197. struct cvmx_smix_clk_s cn68xxp1;
  198. struct cvmx_smix_clk_s cnf71xx;
  199. };
  200. union cvmx_smix_cmd {
  201. uint64_t u64;
  202. struct cvmx_smix_cmd_s {
  203. #ifdef __BIG_ENDIAN_BITFIELD
  204. uint64_t reserved_18_63:46;
  205. uint64_t phy_op:2;
  206. uint64_t reserved_13_15:3;
  207. uint64_t phy_adr:5;
  208. uint64_t reserved_5_7:3;
  209. uint64_t reg_adr:5;
  210. #else
  211. uint64_t reg_adr:5;
  212. uint64_t reserved_5_7:3;
  213. uint64_t phy_adr:5;
  214. uint64_t reserved_13_15:3;
  215. uint64_t phy_op:2;
  216. uint64_t reserved_18_63:46;
  217. #endif
  218. } s;
  219. struct cvmx_smix_cmd_cn30xx {
  220. #ifdef __BIG_ENDIAN_BITFIELD
  221. uint64_t reserved_17_63:47;
  222. uint64_t phy_op:1;
  223. uint64_t reserved_13_15:3;
  224. uint64_t phy_adr:5;
  225. uint64_t reserved_5_7:3;
  226. uint64_t reg_adr:5;
  227. #else
  228. uint64_t reg_adr:5;
  229. uint64_t reserved_5_7:3;
  230. uint64_t phy_adr:5;
  231. uint64_t reserved_13_15:3;
  232. uint64_t phy_op:1;
  233. uint64_t reserved_17_63:47;
  234. #endif
  235. } cn30xx;
  236. struct cvmx_smix_cmd_cn30xx cn31xx;
  237. struct cvmx_smix_cmd_cn30xx cn38xx;
  238. struct cvmx_smix_cmd_cn30xx cn38xxp2;
  239. struct cvmx_smix_cmd_s cn50xx;
  240. struct cvmx_smix_cmd_s cn52xx;
  241. struct cvmx_smix_cmd_s cn52xxp1;
  242. struct cvmx_smix_cmd_s cn56xx;
  243. struct cvmx_smix_cmd_s cn56xxp1;
  244. struct cvmx_smix_cmd_cn30xx cn58xx;
  245. struct cvmx_smix_cmd_cn30xx cn58xxp1;
  246. struct cvmx_smix_cmd_s cn61xx;
  247. struct cvmx_smix_cmd_s cn63xx;
  248. struct cvmx_smix_cmd_s cn63xxp1;
  249. struct cvmx_smix_cmd_s cn66xx;
  250. struct cvmx_smix_cmd_s cn68xx;
  251. struct cvmx_smix_cmd_s cn68xxp1;
  252. struct cvmx_smix_cmd_s cnf71xx;
  253. };
  254. union cvmx_smix_en {
  255. uint64_t u64;
  256. struct cvmx_smix_en_s {
  257. #ifdef __BIG_ENDIAN_BITFIELD
  258. uint64_t reserved_1_63:63;
  259. uint64_t en:1;
  260. #else
  261. uint64_t en:1;
  262. uint64_t reserved_1_63:63;
  263. #endif
  264. } s;
  265. struct cvmx_smix_en_s cn30xx;
  266. struct cvmx_smix_en_s cn31xx;
  267. struct cvmx_smix_en_s cn38xx;
  268. struct cvmx_smix_en_s cn38xxp2;
  269. struct cvmx_smix_en_s cn50xx;
  270. struct cvmx_smix_en_s cn52xx;
  271. struct cvmx_smix_en_s cn52xxp1;
  272. struct cvmx_smix_en_s cn56xx;
  273. struct cvmx_smix_en_s cn56xxp1;
  274. struct cvmx_smix_en_s cn58xx;
  275. struct cvmx_smix_en_s cn58xxp1;
  276. struct cvmx_smix_en_s cn61xx;
  277. struct cvmx_smix_en_s cn63xx;
  278. struct cvmx_smix_en_s cn63xxp1;
  279. struct cvmx_smix_en_s cn66xx;
  280. struct cvmx_smix_en_s cn68xx;
  281. struct cvmx_smix_en_s cn68xxp1;
  282. struct cvmx_smix_en_s cnf71xx;
  283. };
  284. union cvmx_smix_rd_dat {
  285. uint64_t u64;
  286. struct cvmx_smix_rd_dat_s {
  287. #ifdef __BIG_ENDIAN_BITFIELD
  288. uint64_t reserved_18_63:46;
  289. uint64_t pending:1;
  290. uint64_t val:1;
  291. uint64_t dat:16;
  292. #else
  293. uint64_t dat:16;
  294. uint64_t val:1;
  295. uint64_t pending:1;
  296. uint64_t reserved_18_63:46;
  297. #endif
  298. } s;
  299. struct cvmx_smix_rd_dat_s cn30xx;
  300. struct cvmx_smix_rd_dat_s cn31xx;
  301. struct cvmx_smix_rd_dat_s cn38xx;
  302. struct cvmx_smix_rd_dat_s cn38xxp2;
  303. struct cvmx_smix_rd_dat_s cn50xx;
  304. struct cvmx_smix_rd_dat_s cn52xx;
  305. struct cvmx_smix_rd_dat_s cn52xxp1;
  306. struct cvmx_smix_rd_dat_s cn56xx;
  307. struct cvmx_smix_rd_dat_s cn56xxp1;
  308. struct cvmx_smix_rd_dat_s cn58xx;
  309. struct cvmx_smix_rd_dat_s cn58xxp1;
  310. struct cvmx_smix_rd_dat_s cn61xx;
  311. struct cvmx_smix_rd_dat_s cn63xx;
  312. struct cvmx_smix_rd_dat_s cn63xxp1;
  313. struct cvmx_smix_rd_dat_s cn66xx;
  314. struct cvmx_smix_rd_dat_s cn68xx;
  315. struct cvmx_smix_rd_dat_s cn68xxp1;
  316. struct cvmx_smix_rd_dat_s cnf71xx;
  317. };
  318. union cvmx_smix_wr_dat {
  319. uint64_t u64;
  320. struct cvmx_smix_wr_dat_s {
  321. #ifdef __BIG_ENDIAN_BITFIELD
  322. uint64_t reserved_18_63:46;
  323. uint64_t pending:1;
  324. uint64_t val:1;
  325. uint64_t dat:16;
  326. #else
  327. uint64_t dat:16;
  328. uint64_t val:1;
  329. uint64_t pending:1;
  330. uint64_t reserved_18_63:46;
  331. #endif
  332. } s;
  333. struct cvmx_smix_wr_dat_s cn30xx;
  334. struct cvmx_smix_wr_dat_s cn31xx;
  335. struct cvmx_smix_wr_dat_s cn38xx;
  336. struct cvmx_smix_wr_dat_s cn38xxp2;
  337. struct cvmx_smix_wr_dat_s cn50xx;
  338. struct cvmx_smix_wr_dat_s cn52xx;
  339. struct cvmx_smix_wr_dat_s cn52xxp1;
  340. struct cvmx_smix_wr_dat_s cn56xx;
  341. struct cvmx_smix_wr_dat_s cn56xxp1;
  342. struct cvmx_smix_wr_dat_s cn58xx;
  343. struct cvmx_smix_wr_dat_s cn58xxp1;
  344. struct cvmx_smix_wr_dat_s cn61xx;
  345. struct cvmx_smix_wr_dat_s cn63xx;
  346. struct cvmx_smix_wr_dat_s cn63xxp1;
  347. struct cvmx_smix_wr_dat_s cn66xx;
  348. struct cvmx_smix_wr_dat_s cn68xx;
  349. struct cvmx_smix_wr_dat_s cn68xxp1;
  350. struct cvmx_smix_wr_dat_s cnf71xx;
  351. };
  352. #endif