smsc75xx.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /***************************************************************************
  2. *
  3. * Copyright (C) 2007-2010 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 _SMSC75XX_H
  21. #define _SMSC75XX_H
  22. /* Tx command words */
  23. #define TX_CMD_A_LSO (0x08000000)
  24. #define TX_CMD_A_IPE (0x04000000)
  25. #define TX_CMD_A_TPE (0x02000000)
  26. #define TX_CMD_A_IVTG (0x01000000)
  27. #define TX_CMD_A_RVTG (0x00800000)
  28. #define TX_CMD_A_FCS (0x00400000)
  29. #define TX_CMD_A_LEN (0x000FFFFF)
  30. #define TX_CMD_B_MSS (0x3FFF0000)
  31. #define TX_CMD_B_MSS_SHIFT (16)
  32. #define TX_MSS_MIN ((u16)8)
  33. #define TX_CMD_B_VTAG (0x0000FFFF)
  34. /* Rx command words */
  35. #define RX_CMD_A_ICE (0x80000000)
  36. #define RX_CMD_A_TCE (0x40000000)
  37. #define RX_CMD_A_IPV (0x20000000)
  38. #define RX_CMD_A_PID (0x18000000)
  39. #define RX_CMD_A_PID_NIP (0x00000000)
  40. #define RX_CMD_A_PID_TCP (0x08000000)
  41. #define RX_CMD_A_PID_UDP (0x10000000)
  42. #define RX_CMD_A_PID_PP (0x18000000)
  43. #define RX_CMD_A_PFF (0x04000000)
  44. #define RX_CMD_A_BAM (0x02000000)
  45. #define RX_CMD_A_MAM (0x01000000)
  46. #define RX_CMD_A_FVTG (0x00800000)
  47. #define RX_CMD_A_RED (0x00400000)
  48. #define RX_CMD_A_RWT (0x00200000)
  49. #define RX_CMD_A_RUNT (0x00100000)
  50. #define RX_CMD_A_LONG (0x00080000)
  51. #define RX_CMD_A_RXE (0x00040000)
  52. #define RX_CMD_A_DRB (0x00020000)
  53. #define RX_CMD_A_FCS (0x00010000)
  54. #define RX_CMD_A_UAM (0x00008000)
  55. #define RX_CMD_A_LCSM (0x00004000)
  56. #define RX_CMD_A_LEN (0x00003FFF)
  57. #define RX_CMD_B_CSUM (0xFFFF0000)
  58. #define RX_CMD_B_CSUM_SHIFT (16)
  59. #define RX_CMD_B_VTAG (0x0000FFFF)
  60. /* SCSRs */
  61. #define ID_REV (0x0000)
  62. #define FPGA_REV (0x0004)
  63. #define BOND_CTL (0x0008)
  64. #define INT_STS (0x000C)
  65. #define INT_STS_RDFO_INT (0x00400000)
  66. #define INT_STS_TXE_INT (0x00200000)
  67. #define INT_STS_MACRTO_INT (0x00100000)
  68. #define INT_STS_TX_DIS_INT (0x00080000)
  69. #define INT_STS_RX_DIS_INT (0x00040000)
  70. #define INT_STS_PHY_INT_ (0x00020000)
  71. #define INT_STS_MAC_ERR_INT (0x00008000)
  72. #define INT_STS_TDFU (0x00004000)
  73. #define INT_STS_TDFO (0x00002000)
  74. #define INT_STS_GPIOS (0x00000FFF)
  75. #define INT_STS_CLEAR_ALL (0xFFFFFFFF)
  76. #define HW_CFG (0x0010)
  77. #define HW_CFG_SMDET_STS (0x00008000)
  78. #define HW_CFG_SMDET_EN (0x00004000)
  79. #define HW_CFG_EEM (0x00002000)
  80. #define HW_CFG_RST_PROTECT (0x00001000)
  81. #define HW_CFG_PORT_SWAP (0x00000800)
  82. #define HW_CFG_PHY_BOOST (0x00000600)
  83. #define HW_CFG_PHY_BOOST_NORMAL (0x00000000)
  84. #define HW_CFG_PHY_BOOST_4 (0x00002000)
  85. #define HW_CFG_PHY_BOOST_8 (0x00004000)
  86. #define HW_CFG_PHY_BOOST_12 (0x00006000)
  87. #define HW_CFG_LEDB (0x00000100)
  88. #define HW_CFG_BIR (0x00000080)
  89. #define HW_CFG_SBP (0x00000040)
  90. #define HW_CFG_IME (0x00000020)
  91. #define HW_CFG_MEF (0x00000010)
  92. #define HW_CFG_ETC (0x00000008)
  93. #define HW_CFG_BCE (0x00000004)
  94. #define HW_CFG_LRST (0x00000002)
  95. #define HW_CFG_SRST (0x00000001)
  96. #define PMT_CTL (0x0014)
  97. #define PMT_CTL_PHY_PWRUP (0x00000400)
  98. #define PMT_CTL_RES_CLR_WKP_EN (0x00000100)
  99. #define PMT_CTL_DEV_RDY (0x00000080)
  100. #define PMT_CTL_SUS_MODE (0x00000060)
  101. #define PMT_CTL_SUS_MODE_0 (0x00000000)
  102. #define PMT_CTL_SUS_MODE_1 (0x00000020)
  103. #define PMT_CTL_SUS_MODE_2 (0x00000040)
  104. #define PMT_CTL_SUS_MODE_3 (0x00000060)
  105. #define PMT_CTL_PHY_RST (0x00000010)
  106. #define PMT_CTL_WOL_EN (0x00000008)
  107. #define PMT_CTL_ED_EN (0x00000004)
  108. #define PMT_CTL_WUPS (0x00000003)
  109. #define PMT_CTL_WUPS_NO (0x00000000)
  110. #define PMT_CTL_WUPS_ED (0x00000001)
  111. #define PMT_CTL_WUPS_WOL (0x00000002)
  112. #define PMT_CTL_WUPS_MULTI (0x00000003)
  113. #define LED_GPIO_CFG (0x0018)
  114. #define LED_GPIO_CFG_LED2_FUN_SEL (0x80000000)
  115. #define LED_GPIO_CFG_LED10_FUN_SEL (0x40000000)
  116. #define LED_GPIO_CFG_LEDGPIO_EN (0x0000F000)
  117. #define LED_GPIO_CFG_LEDGPIO_EN_0 (0x00001000)
  118. #define LED_GPIO_CFG_LEDGPIO_EN_1 (0x00002000)
  119. #define LED_GPIO_CFG_LEDGPIO_EN_2 (0x00004000)
  120. #define LED_GPIO_CFG_LEDGPIO_EN_3 (0x00008000)
  121. #define LED_GPIO_CFG_GPBUF (0x00000F00)
  122. #define LED_GPIO_CFG_GPBUF_0 (0x00000100)
  123. #define LED_GPIO_CFG_GPBUF_1 (0x00000200)
  124. #define LED_GPIO_CFG_GPBUF_2 (0x00000400)
  125. #define LED_GPIO_CFG_GPBUF_3 (0x00000800)
  126. #define LED_GPIO_CFG_GPDIR (0x000000F0)
  127. #define LED_GPIO_CFG_GPDIR_0 (0x00000010)
  128. #define LED_GPIO_CFG_GPDIR_1 (0x00000020)
  129. #define LED_GPIO_CFG_GPDIR_2 (0x00000040)
  130. #define LED_GPIO_CFG_GPDIR_3 (0x00000080)
  131. #define LED_GPIO_CFG_GPDATA (0x0000000F)
  132. #define LED_GPIO_CFG_GPDATA_0 (0x00000001)
  133. #define LED_GPIO_CFG_GPDATA_1 (0x00000002)
  134. #define LED_GPIO_CFG_GPDATA_2 (0x00000004)
  135. #define LED_GPIO_CFG_GPDATA_3 (0x00000008)
  136. #define GPIO_CFG (0x001C)
  137. #define GPIO_CFG_SHIFT (24)
  138. #define GPIO_CFG_GPEN (0xFF000000)
  139. #define GPIO_CFG_GPBUF (0x00FF0000)
  140. #define GPIO_CFG_GPDIR (0x0000FF00)
  141. #define GPIO_CFG_GPDATA (0x000000FF)
  142. #define GPIO_WAKE (0x0020)
  143. #define GPIO_WAKE_PHY_LINKUP_EN (0x80000000)
  144. #define GPIO_WAKE_POL (0x0FFF0000)
  145. #define GPIO_WAKE_POL_SHIFT (16)
  146. #define GPIO_WAKE_WK (0x00000FFF)
  147. #define DP_SEL (0x0024)
  148. #define DP_SEL_DPRDY (0x80000000)
  149. #define DP_SEL_RSEL (0x0000000F)
  150. #define DP_SEL_URX (0x00000000)
  151. #define DP_SEL_VHF (0x00000001)
  152. #define DP_SEL_VHF_HASH_LEN (16)
  153. #define DP_SEL_VHF_VLAN_LEN (128)
  154. #define DP_SEL_LSO_HEAD (0x00000002)
  155. #define DP_SEL_FCT_RX (0x00000003)
  156. #define DP_SEL_FCT_TX (0x00000004)
  157. #define DP_SEL_DESCRIPTOR (0x00000005)
  158. #define DP_SEL_WOL (0x00000006)
  159. #define DP_CMD (0x0028)
  160. #define DP_CMD_WRITE (0x01)
  161. #define DP_CMD_READ (0x00)
  162. #define DP_ADDR (0x002C)
  163. #define DP_DATA (0x0030)
  164. #define BURST_CAP (0x0034)
  165. #define BURST_CAP_MASK (0x0000000F)
  166. #define INT_EP_CTL (0x0038)
  167. #define INT_EP_CTL_INTEP_ON (0x80000000)
  168. #define INT_EP_CTL_RDFO_EN (0x00400000)
  169. #define INT_EP_CTL_TXE_EN (0x00200000)
  170. #define INT_EP_CTL_MACROTO_EN (0x00100000)
  171. #define INT_EP_CTL_TX_DIS_EN (0x00080000)
  172. #define INT_EP_CTL_RX_DIS_EN (0x00040000)
  173. #define INT_EP_CTL_PHY_EN_ (0x00020000)
  174. #define INT_EP_CTL_MAC_ERR_EN (0x00008000)
  175. #define INT_EP_CTL_TDFU_EN (0x00004000)
  176. #define INT_EP_CTL_TDFO_EN (0x00002000)
  177. #define INT_EP_CTL_RX_FIFO_EN (0x00001000)
  178. #define INT_EP_CTL_GPIOX_EN (0x00000FFF)
  179. #define BULK_IN_DLY (0x003C)
  180. #define BULK_IN_DLY_MASK (0xFFFF)
  181. #define E2P_CMD (0x0040)
  182. #define E2P_CMD_BUSY (0x80000000)
  183. #define E2P_CMD_MASK (0x70000000)
  184. #define E2P_CMD_READ (0x00000000)
  185. #define E2P_CMD_EWDS (0x10000000)
  186. #define E2P_CMD_EWEN (0x20000000)
  187. #define E2P_CMD_WRITE (0x30000000)
  188. #define E2P_CMD_WRAL (0x40000000)
  189. #define E2P_CMD_ERASE (0x50000000)
  190. #define E2P_CMD_ERAL (0x60000000)
  191. #define E2P_CMD_RELOAD (0x70000000)
  192. #define E2P_CMD_TIMEOUT (0x00000400)
  193. #define E2P_CMD_LOADED (0x00000200)
  194. #define E2P_CMD_ADDR (0x000001FF)
  195. #define MAX_EEPROM_SIZE (512)
  196. #define E2P_DATA (0x0044)
  197. #define E2P_DATA_MASK_ (0x000000FF)
  198. #define RFE_CTL (0x0060)
  199. #define RFE_CTL_TCPUDP_CKM (0x00001000)
  200. #define RFE_CTL_IP_CKM (0x00000800)
  201. #define RFE_CTL_AB (0x00000400)
  202. #define RFE_CTL_AM (0x00000200)
  203. #define RFE_CTL_AU (0x00000100)
  204. #define RFE_CTL_VS (0x00000080)
  205. #define RFE_CTL_UF (0x00000040)
  206. #define RFE_CTL_VF (0x00000020)
  207. #define RFE_CTL_SPF (0x00000010)
  208. #define RFE_CTL_MHF (0x00000008)
  209. #define RFE_CTL_DHF (0x00000004)
  210. #define RFE_CTL_DPF (0x00000002)
  211. #define RFE_CTL_RST_RF (0x00000001)
  212. #define VLAN_TYPE (0x0064)
  213. #define VLAN_TYPE_MASK (0x0000FFFF)
  214. #define FCT_RX_CTL (0x0090)
  215. #define FCT_RX_CTL_EN (0x80000000)
  216. #define FCT_RX_CTL_RST (0x40000000)
  217. #define FCT_RX_CTL_SBF (0x02000000)
  218. #define FCT_RX_CTL_OVERFLOW (0x01000000)
  219. #define FCT_RX_CTL_FRM_DROP (0x00800000)
  220. #define FCT_RX_CTL_RX_NOT_EMPTY (0x00400000)
  221. #define FCT_RX_CTL_RX_EMPTY (0x00200000)
  222. #define FCT_RX_CTL_RX_DISABLED (0x00100000)
  223. #define FCT_RX_CTL_RXUSED (0x0000FFFF)
  224. #define FCT_TX_CTL (0x0094)
  225. #define FCT_TX_CTL_EN (0x80000000)
  226. #define FCT_TX_CTL_RST (0x40000000)
  227. #define FCT_TX_CTL_TX_NOT_EMPTY (0x00400000)
  228. #define FCT_TX_CTL_TX_EMPTY (0x00200000)
  229. #define FCT_TX_CTL_TX_DISABLED (0x00100000)
  230. #define FCT_TX_CTL_TXUSED (0x0000FFFF)
  231. #define FCT_RX_FIFO_END (0x0098)
  232. #define FCT_RX_FIFO_END_MASK (0x0000007F)
  233. #define FCT_TX_FIFO_END (0x009C)
  234. #define FCT_TX_FIFO_END_MASK (0x0000003F)
  235. #define FCT_FLOW (0x00A0)
  236. #define FCT_FLOW_THRESHOLD_OFF (0x00007F00)
  237. #define FCT_FLOW_THRESHOLD_OFF_SHIFT (8)
  238. #define FCT_FLOW_THRESHOLD_ON (0x0000007F)
  239. /* MAC CSRs */
  240. #define MAC_CR (0x100)
  241. #define MAC_CR_ADP (0x00002000)
  242. #define MAC_CR_ADD (0x00001000)
  243. #define MAC_CR_ASD (0x00000800)
  244. #define MAC_CR_INT_LOOP (0x00000400)
  245. #define MAC_CR_BOLMT (0x000000C0)
  246. #define MAC_CR_FDPX (0x00000008)
  247. #define MAC_CR_CFG (0x00000006)
  248. #define MAC_CR_CFG_10 (0x00000000)
  249. #define MAC_CR_CFG_100 (0x00000002)
  250. #define MAC_CR_CFG_1000 (0x00000004)
  251. #define MAC_CR_RST (0x00000001)
  252. #define MAC_RX (0x104)
  253. #define MAC_RX_MAX_SIZE (0x3FFF0000)
  254. #define MAC_RX_MAX_SIZE_SHIFT (16)
  255. #define MAC_RX_FCS_STRIP (0x00000010)
  256. #define MAC_RX_FSE (0x00000004)
  257. #define MAC_RX_RXD (0x00000002)
  258. #define MAC_RX_RXEN (0x00000001)
  259. #define MAC_TX (0x108)
  260. #define MAC_TX_BFCS (0x00000004)
  261. #define MAC_TX_TXD (0x00000002)
  262. #define MAC_TX_TXEN (0x00000001)
  263. #define FLOW (0x10C)
  264. #define FLOW_FORCE_FC (0x80000000)
  265. #define FLOW_TX_FCEN (0x40000000)
  266. #define FLOW_RX_FCEN (0x20000000)
  267. #define FLOW_FPF (0x10000000)
  268. #define FLOW_PAUSE_TIME (0x0000FFFF)
  269. #define RAND_SEED (0x110)
  270. #define RAND_SEED_MASK (0x0000FFFF)
  271. #define ERR_STS (0x114)
  272. #define ERR_STS_FCS_ERR (0x00000100)
  273. #define ERR_STS_LFRM_ERR (0x00000080)
  274. #define ERR_STS_RUNT_ERR (0x00000040)
  275. #define ERR_STS_COLLISION_ERR (0x00000010)
  276. #define ERR_STS_ALIGN_ERR (0x00000008)
  277. #define ERR_STS_URUN_ERR (0x00000004)
  278. #define RX_ADDRH (0x118)
  279. #define RX_ADDRH_MASK (0x0000FFFF)
  280. #define RX_ADDRL (0x11C)
  281. #define MII_ACCESS (0x120)
  282. #define MII_ACCESS_PHY_ADDR (0x0000F800)
  283. #define MII_ACCESS_PHY_ADDR_SHIFT (11)
  284. #define MII_ACCESS_REG_ADDR (0x000007C0)
  285. #define MII_ACCESS_REG_ADDR_SHIFT (6)
  286. #define MII_ACCESS_READ (0x00000000)
  287. #define MII_ACCESS_WRITE (0x00000002)
  288. #define MII_ACCESS_BUSY (0x00000001)
  289. #define MII_DATA (0x124)
  290. #define MII_DATA_MASK (0x0000FFFF)
  291. #define WUCSR (0x140)
  292. #define WUCSR_PFDA_FR (0x00000080)
  293. #define WUCSR_WUFR (0x00000040)
  294. #define WUCSR_MPR (0x00000020)
  295. #define WUCSR_BCAST_FR (0x00000010)
  296. #define WUCSR_PFDA_EN (0x00000008)
  297. #define WUCSR_WUEN (0x00000004)
  298. #define WUCSR_MPEN (0x00000002)
  299. #define WUCSR_BCST_EN (0x00000001)
  300. #define WUF_CFGX (0x144)
  301. #define WUF_CFGX_EN (0x80000000)
  302. #define WUF_CFGX_ATYPE (0x03000000)
  303. #define WUF_CFGX_ATYPE_UNICAST (0x00000000)
  304. #define WUF_CFGX_ATYPE_MULTICAST (0x02000000)
  305. #define WUF_CFGX_ATYPE_ALL (0x03000000)
  306. #define WUF_CFGX_PATTERN_OFFSET (0x007F0000)
  307. #define WUF_CFGX_PATTERN_OFFSET_SHIFT (16)
  308. #define WUF_CFGX_CRC16 (0x0000FFFF)
  309. #define WUF_NUM (8)
  310. #define WUF_MASKX (0x170)
  311. #define WUF_MASKX_AVALID (0x80000000)
  312. #define WUF_MASKX_ATYPE (0x40000000)
  313. #define ADDR_FILTX (0x300)
  314. #define ADDR_FILTX_FB_VALID (0x80000000)
  315. #define ADDR_FILTX_FB_TYPE (0x40000000)
  316. #define ADDR_FILTX_FB_ADDRHI (0x0000FFFF)
  317. #define ADDR_FILTX_SB_ADDRLO (0xFFFFFFFF)
  318. #define WUCSR2 (0x500)
  319. #define WUCSR2_NS_RCD (0x00000040)
  320. #define WUCSR2_ARP_RCD (0x00000020)
  321. #define WUCSR2_TCPSYN_RCD (0x00000010)
  322. #define WUCSR2_NS_OFFLOAD (0x00000004)
  323. #define WUCSR2_ARP_OFFLOAD (0x00000002)
  324. #define WUCSR2_TCPSYN_OFFLOAD (0x00000001)
  325. #define WOL_FIFO_STS (0x504)
  326. #define IPV6_ADDRX (0x510)
  327. #define IPV4_ADDRX (0x590)
  328. /* Vendor-specific PHY Definitions */
  329. /* Mode Control/Status Register */
  330. #define PHY_MODE_CTRL_STS (17)
  331. #define MODE_CTRL_STS_EDPWRDOWN ((u16)0x2000)
  332. #define MODE_CTRL_STS_ENERGYON ((u16)0x0002)
  333. #define PHY_INT_SRC (29)
  334. #define PHY_INT_SRC_ENERGY_ON ((u16)0x0080)
  335. #define PHY_INT_SRC_ANEG_COMP ((u16)0x0040)
  336. #define PHY_INT_SRC_REMOTE_FAULT ((u16)0x0020)
  337. #define PHY_INT_SRC_LINK_DOWN ((u16)0x0010)
  338. #define PHY_INT_MASK (30)
  339. #define PHY_INT_MASK_ENERGY_ON ((u16)0x0080)
  340. #define PHY_INT_MASK_ANEG_COMP ((u16)0x0040)
  341. #define PHY_INT_MASK_REMOTE_FAULT ((u16)0x0020)
  342. #define PHY_INT_MASK_LINK_DOWN ((u16)0x0010)
  343. #define PHY_INT_MASK_DEFAULT (PHY_INT_MASK_ANEG_COMP | \
  344. PHY_INT_MASK_LINK_DOWN)
  345. #define PHY_SPECIAL (31)
  346. #define PHY_SPECIAL_SPD ((u16)0x001C)
  347. #define PHY_SPECIAL_SPD_10HALF ((u16)0x0004)
  348. #define PHY_SPECIAL_SPD_10FULL ((u16)0x0014)
  349. #define PHY_SPECIAL_SPD_100HALF ((u16)0x0008)
  350. #define PHY_SPECIAL_SPD_100FULL ((u16)0x0018)
  351. /* USB Vendor Requests */
  352. #define USB_VENDOR_REQUEST_WRITE_REGISTER 0xA0
  353. #define USB_VENDOR_REQUEST_READ_REGISTER 0xA1
  354. #define USB_VENDOR_REQUEST_GET_STATS 0xA2
  355. /* Interrupt Endpoint status word bitfields */
  356. #define INT_ENP_RDFO_INT ((u32)BIT(22))
  357. #define INT_ENP_TXE_INT ((u32)BIT(21))
  358. #define INT_ENP_TX_DIS_INT ((u32)BIT(19))
  359. #define INT_ENP_RX_DIS_INT ((u32)BIT(18))
  360. #define INT_ENP_PHY_INT ((u32)BIT(17))
  361. #define INT_ENP_MAC_ERR_INT ((u32)BIT(15))
  362. #define INT_ENP_RX_FIFO_DATA_INT ((u32)BIT(12))
  363. #endif /* _SMSC75XX_H */