smsc95xx.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /***************************************************************************
  2. *
  3. * Copyright (C) 2007-2008 SMSC
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. *
  19. *****************************************************************************/
  20. #ifndef _SMSC95XX_H
  21. #define _SMSC95XX_H
  22. /* Tx command words */
  23. #define TX_CMD_A_DATA_OFFSET_ (0x001F0000)
  24. #define TX_CMD_A_FIRST_SEG_ (0x00002000)
  25. #define TX_CMD_A_LAST_SEG_ (0x00001000)
  26. #define TX_CMD_A_BUF_SIZE_ (0x000007FF)
  27. #define TX_CMD_B_CSUM_ENABLE (0x00004000)
  28. #define TX_CMD_B_ADD_CRC_DISABLE_ (0x00002000)
  29. #define TX_CMD_B_DISABLE_PADDING_ (0x00001000)
  30. #define TX_CMD_B_PKT_BYTE_LENGTH_ (0x000007FF)
  31. /* Rx status word */
  32. #define RX_STS_FF_ (0x40000000) /* Filter Fail */
  33. #define RX_STS_FL_ (0x3FFF0000) /* Frame Length */
  34. #define RX_STS_ES_ (0x00008000) /* Error Summary */
  35. #define RX_STS_BF_ (0x00002000) /* Broadcast Frame */
  36. #define RX_STS_LE_ (0x00001000) /* Length Error */
  37. #define RX_STS_RF_ (0x00000800) /* Runt Frame */
  38. #define RX_STS_MF_ (0x00000400) /* Multicast Frame */
  39. #define RX_STS_TL_ (0x00000080) /* Frame too long */
  40. #define RX_STS_CS_ (0x00000040) /* Collision Seen */
  41. #define RX_STS_FT_ (0x00000020) /* Frame Type */
  42. #define RX_STS_RW_ (0x00000010) /* Receive Watchdog */
  43. #define RX_STS_ME_ (0x00000008) /* Mii Error */
  44. #define RX_STS_DB_ (0x00000004) /* Dribbling */
  45. #define RX_STS_CRC_ (0x00000002) /* CRC Error */
  46. /* SCSRs */
  47. #define ID_REV (0x00)
  48. #define ID_REV_CHIP_ID_MASK_ (0xFFFF0000)
  49. #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF)
  50. #define ID_REV_CHIP_ID_9500_ (0x9500)
  51. #define INT_STS (0x08)
  52. #define INT_STS_TX_STOP_ (0x00020000)
  53. #define INT_STS_RX_STOP_ (0x00010000)
  54. #define INT_STS_PHY_INT_ (0x00008000)
  55. #define INT_STS_TXE_ (0x00004000)
  56. #define INT_STS_TDFU_ (0x00002000)
  57. #define INT_STS_TDFO_ (0x00001000)
  58. #define INT_STS_RXDF_ (0x00000800)
  59. #define INT_STS_GPIOS_ (0x000007FF)
  60. #define RX_CFG (0x0C)
  61. #define RX_FIFO_FLUSH_ (0x00000001)
  62. #define TX_CFG (0x10)
  63. #define TX_CFG_ON_ (0x00000004)
  64. #define TX_CFG_STOP_ (0x00000002)
  65. #define TX_CFG_FIFO_FLUSH_ (0x00000001)
  66. #define HW_CFG (0x14)
  67. #define HW_CFG_BIR_ (0x00001000)
  68. #define HW_CFG_LEDB_ (0x00000800)
  69. #define HW_CFG_RXDOFF_ (0x00000600)
  70. #define HW_CFG_DRP_ (0x00000040)
  71. #define HW_CFG_MEF_ (0x00000020)
  72. #define HW_CFG_LRST_ (0x00000008)
  73. #define HW_CFG_PSEL_ (0x00000004)
  74. #define HW_CFG_BCE_ (0x00000002)
  75. #define HW_CFG_SRST_ (0x00000001)
  76. #define PM_CTRL (0x20)
  77. #define PM_CTL_DEV_RDY_ (0x00000080)
  78. #define PM_CTL_SUS_MODE_ (0x00000060)
  79. #define PM_CTL_SUS_MODE_0 (0x00000000)
  80. #define PM_CTL_SUS_MODE_1 (0x00000020)
  81. #define PM_CTL_SUS_MODE_2 (0x00000060)
  82. #define PM_CTL_PHY_RST_ (0x00000010)
  83. #define PM_CTL_WOL_EN_ (0x00000008)
  84. #define PM_CTL_ED_EN_ (0x00000004)
  85. #define PM_CTL_WUPS_ (0x00000003)
  86. #define PM_CTL_WUPS_NO_ (0x00000000)
  87. #define PM_CTL_WUPS_ED_ (0x00000001)
  88. #define PM_CTL_WUPS_WOL_ (0x00000002)
  89. #define PM_CTL_WUPS_MULTI_ (0x00000003)
  90. #define LED_GPIO_CFG (0x24)
  91. #define LED_GPIO_CFG_SPD_LED (0x01000000)
  92. #define LED_GPIO_CFG_LNK_LED (0x00100000)
  93. #define LED_GPIO_CFG_FDX_LED (0x00010000)
  94. #define GPIO_CFG (0x28)
  95. #define AFC_CFG (0x2C)
  96. /* Hi watermark = 15.5Kb (~10 mtu pkts) */
  97. /* low watermark = 3k (~2 mtu pkts) */
  98. /* backpressure duration = ~ 350us */
  99. /* Apply FC on any frame. */
  100. #define AFC_CFG_DEFAULT (0x00F830A1)
  101. #define E2P_CMD (0x30)
  102. #define E2P_CMD_BUSY_ (0x80000000)
  103. #define E2P_CMD_MASK_ (0x70000000)
  104. #define E2P_CMD_READ_ (0x00000000)
  105. #define E2P_CMD_EWDS_ (0x10000000)
  106. #define E2P_CMD_EWEN_ (0x20000000)
  107. #define E2P_CMD_WRITE_ (0x30000000)
  108. #define E2P_CMD_WRAL_ (0x40000000)
  109. #define E2P_CMD_ERASE_ (0x50000000)
  110. #define E2P_CMD_ERAL_ (0x60000000)
  111. #define E2P_CMD_RELOAD_ (0x70000000)
  112. #define E2P_CMD_TIMEOUT_ (0x00000400)
  113. #define E2P_CMD_LOADED_ (0x00000200)
  114. #define E2P_CMD_ADDR_ (0x000001FF)
  115. #define MAX_EEPROM_SIZE (512)
  116. #define E2P_DATA (0x34)
  117. #define E2P_DATA_MASK_ (0x000000FF)
  118. #define BURST_CAP (0x38)
  119. #define GPIO_WAKE (0x64)
  120. #define INT_EP_CTL (0x68)
  121. #define INT_EP_CTL_INTEP_ (0x80000000)
  122. #define INT_EP_CTL_MACRTO_ (0x00080000)
  123. #define INT_EP_CTL_TX_STOP_ (0x00020000)
  124. #define INT_EP_CTL_RX_STOP_ (0x00010000)
  125. #define INT_EP_CTL_PHY_INT_ (0x00008000)
  126. #define INT_EP_CTL_TXE_ (0x00004000)
  127. #define INT_EP_CTL_TDFU_ (0x00002000)
  128. #define INT_EP_CTL_TDFO_ (0x00001000)
  129. #define INT_EP_CTL_RXDF_ (0x00000800)
  130. #define INT_EP_CTL_GPIOS_ (0x000007FF)
  131. #define BULK_IN_DLY (0x6C)
  132. /* MAC CSRs */
  133. #define MAC_CR (0x100)
  134. #define MAC_CR_RXALL_ (0x80000000)
  135. #define MAC_CR_RCVOWN_ (0x00800000)
  136. #define MAC_CR_LOOPBK_ (0x00200000)
  137. #define MAC_CR_FDPX_ (0x00100000)
  138. #define MAC_CR_MCPAS_ (0x00080000)
  139. #define MAC_CR_PRMS_ (0x00040000)
  140. #define MAC_CR_INVFILT_ (0x00020000)
  141. #define MAC_CR_PASSBAD_ (0x00010000)
  142. #define MAC_CR_HFILT_ (0x00008000)
  143. #define MAC_CR_HPFILT_ (0x00002000)
  144. #define MAC_CR_LCOLL_ (0x00001000)
  145. #define MAC_CR_BCAST_ (0x00000800)
  146. #define MAC_CR_DISRTY_ (0x00000400)
  147. #define MAC_CR_PADSTR_ (0x00000100)
  148. #define MAC_CR_BOLMT_MASK (0x000000C0)
  149. #define MAC_CR_DFCHK_ (0x00000020)
  150. #define MAC_CR_TXEN_ (0x00000008)
  151. #define MAC_CR_RXEN_ (0x00000004)
  152. #define ADDRH (0x104)
  153. #define ADDRL (0x108)
  154. #define HASHH (0x10C)
  155. #define HASHL (0x110)
  156. #define MII_ADDR (0x114)
  157. #define MII_WRITE_ (0x02)
  158. #define MII_BUSY_ (0x01)
  159. #define MII_READ_ (0x00) /* ~of MII Write bit */
  160. #define MII_DATA (0x118)
  161. #define FLOW (0x11C)
  162. #define FLOW_FCPT_ (0xFFFF0000)
  163. #define FLOW_FCPASS_ (0x00000004)
  164. #define FLOW_FCEN_ (0x00000002)
  165. #define FLOW_FCBSY_ (0x00000001)
  166. #define VLAN1 (0x120)
  167. #define VLAN2 (0x124)
  168. #define WUFF (0x128)
  169. #define WUCSR (0x12C)
  170. #define COE_CR (0x130)
  171. #define Tx_COE_EN_ (0x00010000)
  172. #define Rx_COE_MODE_ (0x00000002)
  173. #define Rx_COE_EN_ (0x00000001)
  174. /* Vendor-specific PHY Definitions */
  175. /* Mode Control/Status Register */
  176. #define PHY_MODE_CTRL_STS (17)
  177. #define MODE_CTRL_STS_EDPWRDOWN_ ((u16)0x2000)
  178. #define MODE_CTRL_STS_ENERGYON_ ((u16)0x0002)
  179. #define SPECIAL_CTRL_STS (27)
  180. #define SPECIAL_CTRL_STS_OVRRD_AMDIX_ ((u16)0x8000)
  181. #define SPECIAL_CTRL_STS_AMDIX_ENABLE_ ((u16)0x4000)
  182. #define SPECIAL_CTRL_STS_AMDIX_STATE_ ((u16)0x2000)
  183. #define PHY_INT_SRC (29)
  184. #define PHY_INT_SRC_ENERGY_ON_ ((u16)0x0080)
  185. #define PHY_INT_SRC_ANEG_COMP_ ((u16)0x0040)
  186. #define PHY_INT_SRC_REMOTE_FAULT_ ((u16)0x0020)
  187. #define PHY_INT_SRC_LINK_DOWN_ ((u16)0x0010)
  188. #define PHY_INT_MASK (30)
  189. #define PHY_INT_MASK_ENERGY_ON_ ((u16)0x0080)
  190. #define PHY_INT_MASK_ANEG_COMP_ ((u16)0x0040)
  191. #define PHY_INT_MASK_REMOTE_FAULT_ ((u16)0x0020)
  192. #define PHY_INT_MASK_LINK_DOWN_ ((u16)0x0010)
  193. #define PHY_INT_MASK_DEFAULT_ (PHY_INT_MASK_ANEG_COMP_ | \
  194. PHY_INT_MASK_LINK_DOWN_)
  195. #define PHY_SPECIAL (31)
  196. #define PHY_SPECIAL_SPD_ ((u16)0x001C)
  197. #define PHY_SPECIAL_SPD_10HALF_ ((u16)0x0004)
  198. #define PHY_SPECIAL_SPD_10FULL_ ((u16)0x0014)
  199. #define PHY_SPECIAL_SPD_100HALF_ ((u16)0x0008)
  200. #define PHY_SPECIAL_SPD_100FULL_ ((u16)0x0018)
  201. /* USB Vendor Requests */
  202. #define USB_VENDOR_REQUEST_WRITE_REGISTER 0xA0
  203. #define USB_VENDOR_REQUEST_READ_REGISTER 0xA1
  204. #define USB_VENDOR_REQUEST_GET_STATS 0xA2
  205. /* Interrupt Endpoint status word bitfields */
  206. #define INT_ENP_TX_STOP_ ((u32)BIT(17))
  207. #define INT_ENP_RX_STOP_ ((u32)BIT(16))
  208. #define INT_ENP_PHY_INT_ ((u32)BIT(15))
  209. #define INT_ENP_TXE_ ((u32)BIT(14))
  210. #define INT_ENP_TDFU_ ((u32)BIT(13))
  211. #define INT_ENP_TDFO_ ((u32)BIT(12))
  212. #define INT_ENP_RXDF_ ((u32)BIT(11))
  213. #endif /* _SMSC95XX_H */