smsc75xx.h 13 KB

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