descs.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*******************************************************************************
  2. Header File to describe the DMA descriptors.
  3. Enhanced descriptors have been in case of DWMAC1000 Cores.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
  17. *******************************************************************************/
  18. #ifndef __DESCS_H__
  19. #define __DESCS_H__
  20. /* Basic descriptor structure for normal and alternate descriptors */
  21. struct dma_desc {
  22. /* Receive descriptor */
  23. union {
  24. struct {
  25. /* RDES0 */
  26. u32 payload_csum_error:1;
  27. u32 crc_error:1;
  28. u32 dribbling:1;
  29. u32 mii_error:1;
  30. u32 receive_watchdog:1;
  31. u32 frame_type:1;
  32. u32 collision:1;
  33. u32 ipc_csum_error:1;
  34. u32 last_descriptor:1;
  35. u32 first_descriptor:1;
  36. u32 vlan_tag:1;
  37. u32 overflow_error:1;
  38. u32 length_error:1;
  39. u32 sa_filter_fail:1;
  40. u32 descriptor_error:1;
  41. u32 error_summary:1;
  42. u32 frame_length:14;
  43. u32 da_filter_fail:1;
  44. u32 own:1;
  45. /* RDES1 */
  46. u32 buffer1_size:11;
  47. u32 buffer2_size:11;
  48. u32 reserved1:2;
  49. u32 second_address_chained:1;
  50. u32 end_ring:1;
  51. u32 reserved2:5;
  52. u32 disable_ic:1;
  53. } rx;
  54. struct {
  55. /* RDES0 */
  56. u32 rx_mac_addr:1;
  57. u32 crc_error:1;
  58. u32 dribbling:1;
  59. u32 error_gmii:1;
  60. u32 receive_watchdog:1;
  61. u32 frame_type:1;
  62. u32 late_collision:1;
  63. u32 ipc_csum_error:1;
  64. u32 last_descriptor:1;
  65. u32 first_descriptor:1;
  66. u32 vlan_tag:1;
  67. u32 overflow_error:1;
  68. u32 length_error:1;
  69. u32 sa_filter_fail:1;
  70. u32 descriptor_error:1;
  71. u32 error_summary:1;
  72. u32 frame_length:14;
  73. u32 da_filter_fail:1;
  74. u32 own:1;
  75. /* RDES1 */
  76. u32 buffer1_size:13;
  77. u32 reserved1:1;
  78. u32 second_address_chained:1;
  79. u32 end_ring:1;
  80. u32 buffer2_size:13;
  81. u32 reserved2:2;
  82. u32 disable_ic:1;
  83. } erx; /* -- enhanced -- */
  84. /* Transmit descriptor */
  85. struct {
  86. /* TDES0 */
  87. u32 deferred:1;
  88. u32 underflow_error:1;
  89. u32 excessive_deferral:1;
  90. u32 collision_count:4;
  91. u32 vlan_frame:1;
  92. u32 excessive_collisions:1;
  93. u32 late_collision:1;
  94. u32 no_carrier:1;
  95. u32 loss_carrier:1;
  96. u32 payload_error:1;
  97. u32 frame_flushed:1;
  98. u32 jabber_timeout:1;
  99. u32 error_summary:1;
  100. u32 ip_header_error:1;
  101. u32 time_stamp_status:1;
  102. u32 reserved1:13;
  103. u32 own:1;
  104. /* TDES1 */
  105. u32 buffer1_size:11;
  106. u32 buffer2_size:11;
  107. u32 time_stamp_enable:1;
  108. u32 disable_padding:1;
  109. u32 second_address_chained:1;
  110. u32 end_ring:1;
  111. u32 crc_disable:1;
  112. u32 checksum_insertion:2;
  113. u32 first_segment:1;
  114. u32 last_segment:1;
  115. u32 interrupt:1;
  116. } tx;
  117. struct {
  118. /* TDES0 */
  119. u32 deferred:1;
  120. u32 underflow_error:1;
  121. u32 excessive_deferral:1;
  122. u32 collision_count:4;
  123. u32 vlan_frame:1;
  124. u32 excessive_collisions:1;
  125. u32 late_collision:1;
  126. u32 no_carrier:1;
  127. u32 loss_carrier:1;
  128. u32 payload_error:1;
  129. u32 frame_flushed:1;
  130. u32 jabber_timeout:1;
  131. u32 error_summary:1;
  132. u32 ip_header_error:1;
  133. u32 time_stamp_status:1;
  134. u32 reserved1:2;
  135. u32 second_address_chained:1;
  136. u32 end_ring:1;
  137. u32 checksum_insertion:2;
  138. u32 reserved2:1;
  139. u32 time_stamp_enable:1;
  140. u32 disable_padding:1;
  141. u32 crc_disable:1;
  142. u32 first_segment:1;
  143. u32 last_segment:1;
  144. u32 interrupt:1;
  145. u32 own:1;
  146. /* TDES1 */
  147. u32 buffer1_size:13;
  148. u32 reserved3:3;
  149. u32 buffer2_size:13;
  150. u32 reserved4:3;
  151. } etx; /* -- enhanced -- */
  152. u64 all_flags;
  153. } des01;
  154. unsigned int des2;
  155. unsigned int des3;
  156. };
  157. /* Extended descriptor structure (supported by new SYNP GMAC generations) */
  158. struct dma_extended_desc {
  159. struct dma_desc basic;
  160. union {
  161. struct {
  162. u32 ip_payload_type:3;
  163. u32 ip_hdr_err:1;
  164. u32 ip_payload_err:1;
  165. u32 ip_csum_bypassed:1;
  166. u32 ipv4_pkt_rcvd:1;
  167. u32 ipv6_pkt_rcvd:1;
  168. u32 msg_type:4;
  169. u32 ptp_frame_type:1;
  170. u32 ptp_ver:1;
  171. u32 timestamp_dropped:1;
  172. u32 reserved:1;
  173. u32 av_pkt_rcvd:1;
  174. u32 av_tagged_pkt_rcvd:1;
  175. u32 vlan_tag_priority_val:3;
  176. u32 reserved3:3;
  177. u32 l3_filter_match:1;
  178. u32 l4_filter_match:1;
  179. u32 l3_l4_filter_no_match:2;
  180. u32 reserved4:4;
  181. } erx;
  182. struct {
  183. u32 reserved;
  184. } etx;
  185. } des4;
  186. unsigned int des5; /* Reserved */
  187. unsigned int des6; /* Tx/Rx Timestamp Low */
  188. unsigned int des7; /* Tx/Rx Timestamp High */
  189. };
  190. /* Transmit checksum insertion control */
  191. enum tdes_csum_insertion {
  192. cic_disabled = 0, /* Checksum Insertion Control */
  193. cic_only_ip = 1, /* Only IP header */
  194. /* IP header but pseudoheader is not calculated */
  195. cic_no_pseudoheader = 2,
  196. cic_full = 3, /* IP header and pseudoheader */
  197. };
  198. /* Extended RDES4 definitions */
  199. #define RDES_EXT_NO_PTP 0
  200. #define RDES_EXT_SYNC 0x1
  201. #define RDES_EXT_FOLLOW_UP 0x2
  202. #define RDES_EXT_DELAY_REQ 0x3
  203. #define RDES_EXT_DELAY_RESP 0x4
  204. #define RDES_EXT_PDELAY_REQ 0x5
  205. #define RDES_EXT_PDELAY_RESP 0x6
  206. #define RDES_EXT_PDELAY_FOLLOW_UP 0x7
  207. #endif /* __DESCS_H__ */