ifxmips_ptm_fw_regs_vdsl.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /******************************************************************************
  2. **
  3. ** FILE NAME : ifxmips_ptm_fw_regs_vdsl.h
  4. ** PROJECT : UEIP
  5. ** MODULES : PTM
  6. **
  7. ** DATE : 7 Jul 2009
  8. ** AUTHOR : Xu Liang
  9. ** DESCRIPTION : PTM driver header file (firmware register for VDSL)
  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. ** 07 JUL 2009 Xu Liang Init Version
  22. *******************************************************************************/
  23. #ifndef IFXMIPS_PTM_FW_REGS_VDSL_H
  24. #define IFXMIPS_PTM_FW_REGS_VDSL_H
  25. #if defined(CONFIG_DANUBE)
  26. #error Danube is not VDSL PTM mode!
  27. #elif defined(CONFIG_AMAZON_SE)
  28. #error Amazon-SE is not VDSL PTM mode!
  29. #elif defined(CONFIG_AR9)
  30. #error AR9 is not VDSL PTM mode!
  31. #elif defined(CONFIG_VR9)
  32. #include "ifxmips_ptm_fw_regs_vr9.h"
  33. #else
  34. #error Platform is not specified!
  35. #endif
  36. /*
  37. * MIB Table Maintained by Firmware
  38. */
  39. struct wan_rx_mib_table {
  40. unsigned int res1[2];
  41. unsigned int wrx_dropdes_pdu;
  42. unsigned int wrx_total_bytes;
  43. unsigned int res2[4];
  44. // wrx_total_pdu is implemented with hardware counter (not used by PTM TC)
  45. // check register "TC_RX_MIB_CMD"
  46. // "HEC_INC" used to increase preemption Gamma interface (wrx_total_pdu)
  47. // "AIIDLE_INC" used to increase normal Gamma interface (wrx_total_pdu)
  48. };
  49. struct wan_tx_mib_table {
  50. //unsigned int wtx_total_pdu; // version before 0.26
  51. //unsigned int small_pkt_drop_cnt;
  52. //unsigned int total_pkt_drop_cnt;
  53. unsigned int wrx_total_pdu; // version 0.26 and onwards
  54. unsigned int wrx_total_bytes;
  55. unsigned int wtx_total_pdu;
  56. unsigned int wtx_total_bytes;
  57. unsigned int wtx_cpu_dropsmall_pdu;
  58. unsigned int wtx_cpu_dropdes_pdu;
  59. unsigned int wtx_fast_dropsmall_pdu;
  60. unsigned int wtx_fast_dropdes_pdu;
  61. };
  62. /*
  63. * Host-PPE Communication Data Structure
  64. */
  65. #if defined(__BIG_ENDIAN)
  66. struct fw_ver_id {
  67. unsigned int family :4;
  68. unsigned int fwtype :4;
  69. unsigned int interface :4;
  70. unsigned int fwmode :4;
  71. unsigned int major :8;
  72. unsigned int minor :8;
  73. };
  74. struct cfg_std_data_len {
  75. unsigned int res1 :14;
  76. unsigned int byte_off :2; // byte offset in RX DMA channel
  77. unsigned int data_len :16; // data length for standard size packet buffer
  78. };
  79. struct tx_qos_cfg {
  80. unsigned int time_tick :16; // number of PP32 cycles per basic time tick
  81. unsigned int overhd_bytes :8; // number of overhead bytes per packet in rate shaping
  82. unsigned int eth1_eg_qnum :4; // number of egress QoS queues (< 8);
  83. unsigned int eth1_burst_chk :1; // always 1, more accurate WFQ
  84. unsigned int eth1_qss :1; // 1: FW QoS, 0: HW QoS
  85. unsigned int shape_en :1; // 1: enable rate shaping, 0: disable
  86. unsigned int wfq_en :1; // 1: WFQ enabled, 0: strict priority enabled
  87. };
  88. struct psave_cfg {
  89. unsigned int res1 :15;
  90. unsigned int start_state :1; // 1: start from partial PPE reset, 0: start from full PPE reset
  91. unsigned int res2 :15;
  92. unsigned int sleep_en :1; // 1: enable sleep mode, 0: disable sleep mode
  93. };
  94. struct eg_bwctrl_cfg {
  95. unsigned int fdesc_wm :16; // if free descriptors in QoS/Swap channel is less than this watermark, large size packets are discarded
  96. unsigned int class_len :16; // if packet length is not less than this value, the packet is recognized as large packet
  97. };
  98. struct test_mode {
  99. unsigned int res1 :30;
  100. unsigned int mib_clear_mode :1; // 1: MIB counter is cleared with TPS-TC software reset, 0: MIB counter not cleared
  101. unsigned int test_mode :1; // 1: test mode, 0: normal mode
  102. };
  103. struct gpio_mode {
  104. unsigned int res1 :3;
  105. unsigned int gpio_bit_bc1 :5;
  106. unsigned int res2 :3;
  107. unsigned int gpio_bit_bc0 :5;
  108. unsigned int res3 :7;
  109. unsigned int gpio_bc1_en :1;
  110. unsigned int res4 :7;
  111. unsigned int gpio_bc0_en :1;
  112. };
  113. struct gpio_wm_cfg {
  114. unsigned int stop_wm_bc1 :8;
  115. unsigned int start_wm_bc1 :8;
  116. unsigned int stop_wm_bc0 :8;
  117. unsigned int start_wm_bc0 :8;
  118. };
  119. struct rx_bc_cfg {
  120. unsigned int res1 :14;
  121. unsigned int local_state :2; // 0: local receiver is "Looking", 1: local receiver is "Freewheel Sync False", 2: local receiver is "Synced", 3: local receiver is "Freewheel Sync Truee"
  122. unsigned int res2 :15;
  123. unsigned int remote_state :1; // 0: remote receiver is "Out-of-Sync", 1: remote receiver is "Synced"
  124. unsigned int to_false_th :16; // the number of consecutive "Miss Sync" for leaving "Freewheel Sync False" to "Looking" (default 3)
  125. unsigned int to_looking_th :16; // the number of consecutive "Miss Sync" for leaving "Freewheel Sync True" to "Freewheel Sync False" (default 7)
  126. unsigned int res_word[30];
  127. };
  128. struct rx_gamma_itf_cfg {
  129. unsigned int res1 :31;
  130. unsigned int receive_state :1; // 0: "Out-of-Fragment", 1: "In-Fragment"
  131. unsigned int res2 :16;
  132. unsigned int rx_min_len :8; // min length of packet, padding if packet length is smaller than this value
  133. unsigned int rx_pad_en :1; // 0: padding disabled, 1: padding enabled
  134. unsigned int res3 :2;
  135. unsigned int rx_eth_fcs_ver_dis :1; // 0: ETH FCS verification is enabled, 1: disabled
  136. unsigned int rx_rm_eth_fcs :1; // 0: ETH FCS field is not removed, 1: ETH FCS field is removed
  137. unsigned int rx_tc_crc_ver_dis :1; // 0: TC CRC verification enabled, 1: disabled
  138. unsigned int rx_tc_crc_size :2; // 0: 0-bit, 1: 16-bit, 2: 32-bit
  139. unsigned int rx_eth_fcs_result; // if the ETH FCS result matches this magic number, then the packet is valid packet
  140. unsigned int rx_tc_crc_result; // if the TC CRC result matches this magic number, then the packet is valid packet
  141. unsigned int rx_crc_cfg :16; // TC CRC config, please check the description of SAR context data structure in the hardware spec
  142. unsigned int res4 :16;
  143. unsigned int rx_eth_fcs_init_value; // ETH FCS initialization value
  144. unsigned int rx_tc_crc_init_value; // TC CRC initialization value
  145. unsigned int res_word1;
  146. unsigned int rx_max_len_sel :1; // 0: normal, the max length is given by MAX_LEN_NORMAL, 1: fragment, the max length is given by MAX_LEN_FRAG
  147. unsigned int res5 :2;
  148. unsigned int rx_edit_num2 :4; // number of bytes to be inserted/removed
  149. unsigned int rx_edit_pos2 :7; // first byte position to be edited
  150. unsigned int rx_edit_type2 :1; // 0: remove, 1: insert
  151. unsigned int rx_edit_en2 :1; // 0: disable insertion or removal of data, 1: enable
  152. unsigned int res6 :3;
  153. unsigned int rx_edit_num1 :4; // number of bytes to be inserted/removed
  154. unsigned int rx_edit_pos1 :7; // first byte position to be edited
  155. unsigned int rx_edit_type1 :1; // 0: remove, 1: insert
  156. unsigned int rx_edit_en1 :1; // 0: disable insertion or removal of data, 1: enable
  157. unsigned int res_word2[2];
  158. unsigned int rx_inserted_bytes_1l;
  159. unsigned int rx_inserted_bytes_1h;
  160. unsigned int rx_inserted_bytes_2l;
  161. unsigned int rx_inserted_bytes_2h;
  162. int rx_len_adj; // the packet length adjustment, it is sign integer
  163. unsigned int res_word3[16];
  164. };
  165. struct tx_bc_cfg {
  166. unsigned int fill_wm :16; // default 2
  167. unsigned int uflw_wm :16; // default 2
  168. unsigned int res_word[31];
  169. };
  170. struct tx_gamma_itf_cfg {
  171. unsigned int res_word1;
  172. unsigned int res1 :8;
  173. unsigned int tx_len_adj :4; // 4 * (not TX_ETH_FCS_GEN_DIS) + TX_TC_CRC_SIZE
  174. unsigned int tx_crc_off_adj :4; // 4 + TX_TC_CRC_SIZE
  175. unsigned int tx_min_len :8; // min length of packet, if length is less than this value, packet is padded
  176. unsigned int res2 :3;
  177. unsigned int tx_eth_fcs_gen_dis :1; // 0: ETH FCS generation enabled, 1: disabled
  178. unsigned int res3 :2;
  179. unsigned int tx_tc_crc_size :2; // 0: 0-bit, 1: 16-bit, 2: 32-bit
  180. unsigned int res4 :24;
  181. unsigned int queue_mapping :8; // TX queue attached to this Gamma interface
  182. unsigned int res_word2;
  183. unsigned int tx_crc_cfg :16; // TC CRC config, please check the description of SAR context data structure in the hardware spec
  184. unsigned int res5 :16;
  185. unsigned int tx_eth_fcs_init_value; // ETH FCS initialization value
  186. unsigned int tx_tc_crc_init_value; // TC CRC initialization value
  187. unsigned int res_word3[25];
  188. };
  189. struct wtx_qos_q_desc_cfg {
  190. unsigned int threshold :8;
  191. unsigned int length :8;
  192. unsigned int addr :16;
  193. unsigned int rd_ptr :16;
  194. unsigned int wr_ptr :16;
  195. };
  196. struct wtx_eg_q_shaping_cfg {
  197. unsigned int t :8;
  198. unsigned int w :24;
  199. unsigned int s :16;
  200. unsigned int r :16;
  201. unsigned int res1 :8;
  202. unsigned int d :24; // ppe internal variable
  203. unsigned int res2 :8;
  204. unsigned int tick_cnt :8; // ppe internal variable
  205. unsigned int b :16; // ppe internal variable
  206. };
  207. /* DMA descriptor */
  208. struct rx_descriptor {
  209. /* 0 - 3h */
  210. unsigned int own :1; // 0: Central DMA TX or MIPS, 1: PPE
  211. unsigned int c :1; // PPE tells current descriptor is complete
  212. unsigned int sop :1;
  213. unsigned int eop :1;
  214. unsigned int res1 :3;
  215. unsigned int byteoff :2;
  216. unsigned int res2 :7;
  217. unsigned int datalen :16;
  218. /* 4 - 7h */
  219. unsigned int res3 :4;
  220. unsigned int dataptr :28; // byte address
  221. };
  222. struct tx_descriptor {
  223. /* 0 - 3h */
  224. unsigned int own :1; // CPU path - 0: MIPS, 1: PPE Dispatcher, Fastpath - 0: PPE Dispatcher, 1: Central DMA, QoS Queue - 0: PPE Dispatcher, 1: PPE DMA, SWAP Channel - 0: MIPS, 1: PPE Dispatcher
  225. unsigned int c :1; // MIPS or central DMA tells PPE the current descriptor is complete
  226. unsigned int sop :1;
  227. unsigned int eop :1;
  228. unsigned int byteoff :5;
  229. unsigned int qid :4; // TX Queue ID, bit 3 is reserved
  230. unsigned int res1 :3;
  231. unsigned int datalen :16;
  232. /* 4 - 7h */
  233. unsigned int small :1; // 0: standard size, 1: less than standard size
  234. unsigned int res2 :3;
  235. unsigned int dataptr :28; // byte address
  236. };
  237. #else /* defined(__BIG_ENDIAN) */
  238. #error structures are defined in big endian
  239. #endif /* defined(__BIG_ENDIAN) */
  240. #endif // IFXMIPS_PTM_FW_REGS_VDSL_H