Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

smsc75xx.h 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #ifndef _SMSC75XX_H
  2. #define _SMSC75XX_H
  3. /** @file
  4. *
  5. * SMSC LAN75xx USB Ethernet driver
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include "smscusb.h"
  10. /** Interrupt status register */
  11. #define SMSC75XX_INT_STS 0x00c
  12. #define SMSC75XX_INT_STS_RDFO_INT 0x00400000UL /**< RX FIFO overflow */
  13. #define SMSC75XX_INT_STS_PHY_INT 0x00020000UL /**< PHY interrupt */
  14. /** Hardware configuration register */
  15. #define SMSC75XX_HW_CFG 0x010
  16. #define SMSC75XX_HW_CFG_BIR 0x00000080UL /**< Bulk IN use NAK */
  17. #define SMSC75XX_HW_CFG_LRST 0x00000002UL /**< Soft lite reset */
  18. /** Interrupt endpoint control register */
  19. #define SMSC75XX_INT_EP_CTL 0x038
  20. #define SMSC75XX_INT_EP_CTL_RDFO_EN 0x00400000UL /**< RX FIFO overflow */
  21. #define SMSC75XX_INT_EP_CTL_PHY_EN 0x00020000UL /**< PHY interrupt */
  22. /** Bulk IN delay register */
  23. #define SMSC75XX_BULK_IN_DLY 0x03c
  24. #define SMSC75XX_BULK_IN_DLY_SET(ticks) ( (ticks) << 0 ) /**< Delay / 16.7ns */
  25. /** EEPROM register base */
  26. #define SMSC75XX_E2P_BASE 0x040
  27. /** Receive filtering engine control register */
  28. #define SMSC75XX_RFE_CTL 0x060
  29. #define SMSC75XX_RFE_CTL_AB 0x00000400UL /**< Accept broadcast */
  30. #define SMSC75XX_RFE_CTL_AM 0x00000200UL /**< Accept multicast */
  31. #define SMSC75XX_RFE_CTL_AU 0x00000100UL /**< Accept unicast */
  32. /** FIFO controller RX FIFO control register */
  33. #define SMSC75XX_FCT_RX_CTL 0x090
  34. #define SMSC75XX_FCT_RX_CTL_EN 0x80000000UL /**< FCT RX enable */
  35. #define SMSC75XX_FCT_RX_CTL_BAD 0x02000000UL /**< Store bad frames */
  36. /** FIFO controller TX FIFO control register */
  37. #define SMSC75XX_FCT_TX_CTL 0x094
  38. #define SMSC75XX_FCT_TX_CTL_EN 0x80000000UL /**< FCT TX enable */
  39. /** MAC receive register */
  40. #define SMSC75XX_MAC_RX 0x104
  41. #define SMSC75XX_MAC_RX_MAX_SIZE(mtu) ( (mtu) << 16 ) /**< Max frame size */
  42. #define SMSC75XX_MAC_RX_MAX_SIZE_DEFAULT \
  43. SMSC75XX_MAC_RX_MAX_SIZE ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
  44. #define SMSC75XX_MAC_RX_FCS 0x00000010UL /**< FCS stripping */
  45. #define SMSC75XX_MAC_RX_EN 0x00000001UL /**< RX enable */
  46. /** MAC transmit register */
  47. #define SMSC75XX_MAC_TX 0x108
  48. #define SMSC75XX_MAC_TX_EN 0x00000001UL /**< TX enable */
  49. /** MAC receive address register base */
  50. #define SMSC75XX_RX_ADDR_BASE 0x118
  51. /** MII register base */
  52. #define SMSC75XX_MII_BASE 0x120
  53. /** MAC address perfect filter register base */
  54. #define SMSC75XX_ADDR_FILT_BASE 0x300
  55. /** Receive packet header */
  56. struct smsc75xx_rx_header {
  57. /** RX command word */
  58. uint32_t command;
  59. /** VLAN tag */
  60. uint16_t vtag;
  61. /** Checksum */
  62. uint16_t csum;
  63. /** Two-byte padding used to align Ethernet payload */
  64. uint16_t pad;
  65. } __attribute__ (( packed ));
  66. /** Receive error detected */
  67. #define SMSC75XX_RX_RED 0x00400000UL
  68. /** Transmit packet header */
  69. struct smsc75xx_tx_header {
  70. /** TX command word */
  71. uint32_t command;
  72. /** VLAN tag */
  73. uint16_t tag;
  74. /** Maximum segment size */
  75. uint16_t mss;
  76. } __attribute__ (( packed ));
  77. /** Insert frame checksum and pad */
  78. #define SMSC75XX_TX_FCS 0x00400000UL
  79. /** Byte count statistics */
  80. struct smsc75xx_byte_statistics {
  81. /** Unicast byte count */
  82. uint32_t unicast;
  83. /** Broadcast byte count */
  84. uint32_t broadcast;
  85. /** Multicast byte count */
  86. uint32_t multicast;
  87. } __attribute__ (( packed ));
  88. /** Frame count statistics */
  89. struct smsc75xx_frame_statistics {
  90. /** Unicast frames */
  91. uint32_t unicast;
  92. /** Broadcast frames */
  93. uint32_t broadcast;
  94. /** Multicast frames */
  95. uint32_t multicast;
  96. /** Pause frames */
  97. uint32_t pause;
  98. /** Frames by length category */
  99. uint32_t len[7];
  100. } __attribute__ (( packed ));
  101. /** Receive error statistics */
  102. struct smsc75xx_rx_error_statistics {
  103. /** FCS errors */
  104. uint32_t fcs;
  105. /** Alignment errors */
  106. uint32_t alignment;
  107. /** Fragment errors */
  108. uint32_t fragment;
  109. /** Jabber errors */
  110. uint32_t jabber;
  111. /** Undersize frame errors */
  112. uint32_t undersize;
  113. /** Oversize frame errors */
  114. uint32_t oversize;
  115. /** Dropped frame errors */
  116. uint32_t dropped;
  117. } __attribute__ (( packed ));
  118. /** Receive statistics */
  119. struct smsc75xx_rx_statistics {
  120. /** Error statistics */
  121. struct smsc75xx_rx_error_statistics err;
  122. /** Byte count statistics */
  123. struct smsc75xx_byte_statistics byte;
  124. /** Frame count statistics */
  125. struct smsc75xx_frame_statistics frame;
  126. } __attribute__ (( packed ));
  127. /** Transmit error statistics */
  128. struct smsc75xx_tx_error_statistics {
  129. /** FCS errors */
  130. uint32_t fcs;
  131. /** Excess deferral errors */
  132. uint32_t deferral;
  133. /** Carrier errors */
  134. uint32_t carrier;
  135. /** Bad byte count */
  136. uint32_t count;
  137. /** Single collisions */
  138. uint32_t single;
  139. /** Multiple collisions */
  140. uint32_t multiple;
  141. /** Excession collisions */
  142. uint32_t excessive;
  143. /** Late collisions */
  144. uint32_t late;
  145. } __attribute__ (( packed ));
  146. /** Transmit statistics */
  147. struct smsc75xx_tx_statistics {
  148. /** Error statistics */
  149. struct smsc75xx_tx_error_statistics err;
  150. /** Byte count statistics */
  151. struct smsc75xx_byte_statistics byte;
  152. /** Frame count statistics */
  153. struct smsc75xx_frame_statistics frame;
  154. } __attribute__ (( packed ));
  155. /** Statistics */
  156. struct smsc75xx_statistics {
  157. /** Receive statistics */
  158. struct smsc75xx_rx_statistics rx;
  159. /** Transmit statistics */
  160. struct smsc75xx_tx_statistics tx;
  161. } __attribute__ (( packed ));
  162. /** Maximum time to wait for reset (in milliseconds) */
  163. #define SMSC75XX_RESET_MAX_WAIT_MS 100
  164. /** Bulk IN maximum fill level
  165. *
  166. * This is a policy decision.
  167. */
  168. #define SMSC75XX_IN_MAX_FILL 8
  169. /** Bulk IN buffer size */
  170. #define SMSC75XX_IN_MTU \
  171. ( sizeof ( struct smsc75xx_rx_header ) + \
  172. ETH_FRAME_LEN + 4 /* possible VLAN header */ )
  173. #endif /* _SMSC75XX_H */