drv_smc911x.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-04-21
  9. */
  10. /* $NetBSD: lan9118reg.h,v 1.3 2010/09/27 12:29:03 kiyohara Exp $ */
  11. /*
  12. * Copyright (c) 2008 KIYOHARA Takashi
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions
  17. * are met:
  18. * 1. Redistributions of source code must retain the above copyright
  19. * notice, this list of conditions and the following disclaimer.
  20. * 2. Redistributions in binary form must reproduce the above copyright
  21. * notice, this list of conditions and the following disclaimer in the
  22. * documentation and/or other materials provided with the distribution.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  25. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  26. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  28. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  29. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  32. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. #ifndef _LAN9118REG_H_
  37. #define _LAN9118REG_H_
  38. #define CONFIG_SMC911X_32_BIT
  39. #define LAN9118_IOSIZE 0x100
  40. #define LAN9118_ID_89218 0x218a
  41. #define LAN9118_ID_9115 0x0115
  42. #define LAN9118_ID_9116 0x0116
  43. #define LAN9118_ID_9117 0x0117
  44. #define LAN9118_ID_9118 0x0118
  45. #define LAN9218_ID_9215 0x115a
  46. #define LAN9218_ID_9216 0x116a
  47. #define LAN9218_ID_9217 0x117a
  48. #define LAN9218_ID_9218 0x118a
  49. #define LAN9210_ID_9210 0x9210
  50. #define LAN9210_ID_9211 0x9211
  51. #define LAN9220_ID_9220 0x9220
  52. #define LAN9220_ID_9221 0x9221
  53. #define IS_LAN9118(id) ((id) >= LAN9118_ID_9115 && (id) <= LAN9118_ID_9118)
  54. #define IS_LAN9218(id) ((id) >= LAN9218_ID_9215 && (id) <= LAN9218_ID_9218)
  55. #define LAN9118_IPHY_ADDR 0x01 /* Internal PHY Address */
  56. #define LAN9118_RXDFIFOP 0x00 /* RX Data FIFO Port */
  57. #define LAN9118_RXDFIFOAP 0x04 /* RX Data FIFO Alias Ports */
  58. #define LAN9118_TXDFIFOP 0x20 /* TX Data FIFO Port */
  59. #define LAN9118_TXDFIFOAP 0x24 /* TX Data FIFO Alias Ports */
  60. #define LAN9118_RXSFIFOP 0x40 /* RX Status FIFO Port */
  61. #define LAN9118_RXSFIFOPEEK 0x44 /* RX Status FIFO PEEK */
  62. #define LAN9118_TXSFIFOP 0x48 /* TX Status FIFO Port */
  63. #define LAN9118_TXSFIFOPEEK 0x4c /* TX Status FIFO PEEK */
  64. /* System Control and Status Registers */
  65. #define LAN9118_ID_REV 0x50 /* Chip ID and Revision */
  66. #define LAN9118_ID_REV_ID(x) (((x) >> 16) & 0xffff)
  67. #define LAN9118_ID_REV_REV(x) ((x) & 0xffff)
  68. #define LAN9118_IRQ_CFG 0x54 /* Main Interrupt Configuration */
  69. #define LAN9118_IRQ_CFG_INT_DEAS(t) ((t) << 24) /* Intr Deassert Interval */
  70. #define LAN9118_IRQ_CFG_INT_DEAS_CLR (1 << 14) /* Intr Deass Intrval clr */
  71. #define LAN9118_IRQ_CFG_INT_DEAS_STS (1 << 13) /* Intr Deassert Status */
  72. #define LAN9118_IRQ_CFG_IRQ_INT (1 << 12) /* Master Interrupt */
  73. #define LAN9118_IRQ_CFG_IRQ_EN (1 << 8) /* IRQ Enable */
  74. #define LAN9118_IRQ_CFG_IRQ_POL (1 << 4) /* IRQ Polarity */
  75. #define LAN9118_IRQ_CFG_IRQ_TYPE (1 << 0) /* IRQ Buffer Type */
  76. #define LAN9118_INT_STS 0x58 /* Interrupt Status */
  77. #define LAN9118_INT_EN 0x5c /* Interrupt Enable Register */
  78. #define LAN9118_INT_SW_INT (1 << 31) /* Software Interrupt */
  79. #define LAN9118_INT_TXSTOP_INT (1 << 25) /* TX Stopped */
  80. #define LAN9118_INT_RXSTOP_INT (1 << 24) /* RX Stopped */
  81. #define LAN9118_INT_RXDFH_INT (1 << 23) /* RX Drppd Frm Cnt Halfway */
  82. #define LAN9118_INT_TX_IOC (1 << 21) /* TX IOC Interrupt */
  83. #define LAN9118_INT_RXD_INT (1 << 20) /* RX DMA Interrupt */
  84. #define LAN9118_INT_GPT_INT (1 << 19) /* GP Timer */
  85. #define LAN9118_INT_PHY_INT (1 << 18) /* PHY */
  86. #define LAN9118_INT_PME_INT (1 << 17) /* Power Management Event */
  87. #define LAN9118_INT_TXSO (1 << 16) /* TX Status FIFO Overflow */
  88. #define LAN9118_INT_RWT (1 << 15) /* Rcv Watchdog Time-out */
  89. #define LAN9118_INT_RXE (1 << 14) /* Receive Error */
  90. #define LAN9118_INT_TXE (1 << 13) /* Transmitter Error */
  91. #define LAN9118_INT_TDFO (1 << 10) /* TX Data FIFO Overrun */
  92. #define LAN9118_INT_TDFA (1 << 9) /* TX Data FIFO Available */
  93. #define LAN9118_INT_TSFF (1 << 8) /* TX Status FIFO Full */
  94. #define LAN9118_INT_TSFL (1 << 7) /* TX Status FIFO Level */
  95. #define LAN9118_INT_RXDF_INT (1 << 6) /* RX Dropped Frame Intr */
  96. #define LAN9118_INT_RSFF (1 << 4) /* RX Status FIFO Full */
  97. #define LAN9118_INT_RSFL (1 << 3) /* RX Status FIFO Level */
  98. #define LAN9118_INT_GPIOX_INT(x) (1 << (x)) /* GPIO[2:0] */
  99. /* 0x60 Reserved for future use */
  100. #define LAN9118_BYTE_TEST 0x64 /* Read-only byte order testing reg */
  101. #define LAN9118_BYTE_TEST_VALUE 0x87654321
  102. #define LAN9118_FIFO_INT 0x68 /* FIFO Level Interrupt */
  103. #define LAN9118_FIFO_INT_TXDAL(x) ((x) << 24) /* TX Data Available Lvl */
  104. #define LAN9118_FIFO_INT_TXSL(x) ((x) << 16) /* TX Status Level */
  105. #define LAN9118_FIFO_INT_RXSL(x) ((x) << 0) /* RX Status Level */
  106. #define LAN9118_RX_CFG 0x6c /* Receive Configuration */
  107. #define LAN9118_RX_CFG_RXEA_4B (0 << 30) /* RX End Alignment: 4 Byte */
  108. #define LAN9118_RX_CFG_RXEA_16B (1 << 30) /* 16 Byte */
  109. #define LAN9118_RX_CFG_RXEA_32B (2 << 30) /* 32 Byte */
  110. #define LAN9118_RX_CFG_RX_DMA_CNT(x) ((x) << 16) /* RX DMA Count */
  111. #define LAN9118_RX_CFG_RX_DUMP (1 << 15) /* Force RX Discard */
  112. #define LAN9118_RX_CFG_RXDOFF(x) ((x) << 8) /* RX Data Offset */
  113. #define LAN9118_TX_CFG 0x70 /* Transmit Configuration */
  114. #define LAN9118_TX_CFG_TXS_DUMP (1 << 15) /* Force TX Status Discard */
  115. #define LAN9118_TX_CFG_TXD_DUMP (1 << 14) /* Force TX Data Discard */
  116. #define LAN9118_TX_CFG_TXSAO (1 << 2) /* TX Status Allow Overrun */
  117. #define LAN9118_TX_CFG_TX_ON (1 << 1) /* Transmitter Enable */
  118. #define LAN9118_TX_CFG_STOP_TX (1 << 0) /* Stop Transmitter */
  119. #define LAN9118_HW_CFG 0x74 /* Hardware Configuration */
  120. #define LAN9118_HW_CFG_MBO (1 << 20)/* Must Be One */
  121. #define LAN9118_HW_CFG_TX_FIF_MASK (0xf << 16) /* TX FIFO Size */
  122. #define LAN9118_HW_CFG_TX_FIF_SZ(sz) ((sz) << 16)
  123. #define LAN9118_HW_CFG_PHY_CLK_SEL_MASK (3 << 5) /* PHY Clock Select */
  124. #define LAN9118_HW_CFG_PHY_CLK_SEL_IPHY (0 << 5) /* Internal PHY */
  125. #define LAN9118_HW_CFG_PHY_CLK_SEL_EMII (1 << 5) /* External MII Port */
  126. #define LAN9118_HW_CFG_PHY_CLK_SEL_CD (2 << 5) /* Clock Disabled */
  127. #define LAN9118_HW_CFG_SMI_SEL (1 << 4) /* Serial Mgmt Interface Sel */
  128. #define LAN9118_HW_CFG_EXT_PHY_DET (1 << 3) /* External PHY Detect */
  129. #define LAN9118_HW_CFG_EXT_PHY_EN (1 << 2) /* External PHY Enable */
  130. #define LAN9118_HW_CFG_SRST_TO (1 << 1) /* Soft Reset Timeout */
  131. #define LAN9118_HW_CFG_SRST (1 << 0) /* Soft Reset */
  132. #define LAN9118_RX_DP_CTL 0x78 /* RX Datapath Control */
  133. #define LAN9118_RX_DP_CTL_RX_FFWD (1 << 31)/* RX Data FIFO Fast Forward */
  134. #define LAN9118_RX_FIFO_INF 0x7c /* Receive FIFO Information */
  135. #define LAN9118_RX_FIFO_INF_RXSUSED(x) (((x) >> 16) & 0xff) /*Sts Used Space*/
  136. #define LAN9118_RX_FIFO_INF_RXDUSED(x) ((x) & 0xffff) /*Data FIFO Used Space*/
  137. #define LAN9118_TX_FIFO_INF 0x80 /* Transmit FIFO Information */
  138. #define LAN9118_TX_FIFO_INF_TXSUSED(x) (((x) >> 16) & 0xff) /*Sts Used Space*/
  139. #define LAN9118_TX_FIFO_INF_TDFREE(x) ((x) & 0xffff) /*Data FIFO Free Space*/
  140. #define LAN9118_PMT_CTRL 0x84 /* Power Management Control */
  141. #define LAN9118_PMT_CTRL_PM_MODE_MASK (3 << 12)
  142. #define LAN9118_PMT_CTRL_PM_MODE_D0 (0 << 12)
  143. #define LAN9118_PMT_CTRL_PM_MODE_D1 (1 << 12)
  144. #define LAN9118_PMT_CTRL_PM_MODE_D2 (2 << 12)
  145. #define LAN9118_PMT_CTRL_PHY_RST (1 << 10) /* PHY Reset */
  146. #define LAN9118_PMT_CTRL_WOL_EN (1 << 9) /* Wake-On-LAN Enable */
  147. #define LAN9118_PMT_CTRL_ED_EN (1 << 8) /* Energy-Detect Enable */
  148. #define LAN9118_PMT_CTRL_PME_TYPE (1 << 6) /* PME Buffer Type */
  149. #define LAN9118_PMT_CTRL_WUPS_NWUED (0 << 4) /* WAKE-UP Status: No Event */
  150. #define LAN9118_PMT_CTRL_WUPS_ED (1 << 4) /* WAKE-UP Status: Energy */
  151. #define LAN9118_PMT_CTRL_WUPS_WUD (2 << 4) /* WAKE-UP Status: Wake-up */
  152. #define LAN9118_PMT_CTRL_PME_IND (1 << 3) /* PME indication */
  153. #define LAN9118_PMT_CTRL_PME_POL (1 << 2) /* PME Polarity */
  154. #define LAN9118_PMT_CTRL_PME_EN (1 << 1) /* PME Enable */
  155. #define LAN9118_PMT_CTRL_READY (1 << 0) /* Device Ready */
  156. #define LAN9118_GPIO_CFG 0x88 /* General Purpose IO Configuration */
  157. #define LAN9118_GPIO_CFG_LEDX_EN(x) (1 << ((x) + 28)) /* LED[3:1] enable */
  158. #define LAN9118_GPIO_CFG_GPIO_INT_POL(p) (1 << ((p) + 24)) /* Intr Polarity */
  159. #define LAN9118_GPIO_CFG_EEPR_EN (7 << 20) /* EEPROM Enable */
  160. #define LAN9118_GPIO_CFG_GPIOBUFN(n) (1 << ((n) + 16)) /* Buffer Type */
  161. #define LAN9118_GPIO_CFG_GPDIRN(n) (1 << ((n) + 8)) /* Direction */
  162. #define LAN9118_GPIO_CFG_GPODN(n) (1 << (n)) /* GPIO Data (3,4 is WO) */
  163. #define LAN9118_GPT_CFG 0x8c /* General Purpose Timer Config */
  164. #define LAN9118_GPT_CNT 0x90 /* General Purpose Timer Count */
  165. /* 0x94 Reserved for future use */
  166. #define LAN9118_WORD_SWAP 0x98 /* WORD SWAP Register */
  167. #define LAN9118_FREE_RUN 0x9c /* Free Run Counter */
  168. #define LAN9118_RX_DROP 0xa0 /* RX Drop Frame Counter */
  169. #define LAN9118_MAC_CSR_CMD 0xa4 /* MAC CSR Synchronizer Command */
  170. #define LAN9118_MAC_CSR_CMD_BUSY (1 << 31)
  171. #define LAN9118_MAC_CSR_CMD_W (0 << 30)
  172. #define LAN9118_MAC_CSR_CMD_R (1 << 30)
  173. #define LAN9118_MAC_CSR_CMD_ADDRESS(a) ((a) & 0xff)
  174. #define LAN9118_MAC_CSR_DATA 0xa8 /* MAC CSR Synchronizer Data */
  175. #define LAN9118_AFC_CFG 0xac /* Automatic Flow Control Config */
  176. #define LAN9118_AFC_CFG_AFC_HI(x) ((x) << 16)
  177. #define LAN9118_AFC_CFG_AFC_LO(x) ((x) << 8)
  178. #define LAN9118_AFC_CFG_BACK_DUR(x) ((x) << 4)
  179. #define LAN9118_AFC_CFG_FCMULT (1 << 3) /* Flow Control on Multicast */
  180. #define LAN9118_AFC_CFG_FCBRD (1 << 2) /* Flow Control on Broadcast */
  181. #define LAN9118_AFC_CFG_FCADD (1 << 1) /* Flow Control on Addr Dec */
  182. #define LAN9118_AFC_CFG_FCANY (1 << 0) /* Flow Control on Any Frame */
  183. #define LAN9118_E2P_CMD 0xb0 /* EEPROM command */
  184. #define LAN9118_E2P_CMD_EPCB (1 << 31) /* EPC Busy */
  185. #define LAN9118_E2P_CMD_EPCC_READ (0 << 28) /* EPC Command: READ */
  186. #define LAN9118_E2P_CMD_EPCC_EWDS (1 << 28) /* EWDS */
  187. #define LAN9118_E2P_CMD_EPCC_EWEN (2 << 28) /* EWEN */
  188. #define LAN9118_E2P_CMD_EPCC_WRITE (3 << 28) /* WRITE */
  189. #define LAN9118_E2P_CMD_EPCC_WRAL (4 << 28) /* WRAL */
  190. #define LAN9118_E2P_CMD_EPCC_ERASE (5 << 28) /* ERASE */
  191. #define LAN9118_E2P_CMD_EPCC_ERAL (6 << 28) /* ERAL */
  192. #define LAN9118_E2P_CMD_EPCC_RELOAD (7 << 28) /* Reload */
  193. #define LAN9118_E2P_CMD_EPCTO (1 << 9) /* EPC Time-out */
  194. #define LAN9118_E2P_CMD_MACAL (1 << 8) /* MAC Address Loaded */
  195. #define LAN9118_E2P_CMD_EPCA(a) ((a) & 0xff) /* EPC Address */
  196. #define LAN9118_E2P_DATA 0xb4 /* EEPROM Data */
  197. /* 0xb8 - 0xfc Reserved for future use */
  198. /* MAC Control and Status Registers */
  199. #define LAN9118_MAC_CR 0x1 /* MAC Control Register */
  200. #define LAN9118_MAC_CR_RXALL (1 << 31) /* Receive All Mode */
  201. #define LAN9118_MAC_CR_RCVOWN (1 << 23) /* Disable Receive Own */
  202. #define LAN9118_MAC_CR_LOOPBK (1 << 21) /* Loopback operation Mode */
  203. #define LAN9118_MAC_CR_FDPX (1 << 20) /* Full Duplex Mode */
  204. #define LAN9118_MAC_CR_MCPAS (1 << 19) /* Pass All Multicast */
  205. #define LAN9118_MAC_CR_PRMS (1 << 18) /* Promiscuous Mode */
  206. #define LAN9118_MAC_CR_INVFILT (1 << 17) /* Inverse filtering */
  207. #define LAN9118_MAC_CR_PASSBAD (1 << 16) /* Pass Bad Frames */
  208. #define LAN9118_MAC_CR_HO (1 << 15) /* Hash Only Filtering mode */
  209. #define LAN9118_MAC_CR_HPFILT (1 << 13) /* Hash/Perfect Flt Mode */
  210. #define LAN9118_MAC_CR_LCOLL (1 << 12) /* Late Collision Control */
  211. #define LAN9118_MAC_CR_BCAST (1 << 11) /* Disable Broardcast Frms */
  212. #define LAN9118_MAC_CR_DISRTY (1 << 10) /* Disable Retry */
  213. #define LAN9118_MAC_CR_PADSTR (1 << 8) /* Automatic Pad String */
  214. #define LAN9118_MAC_CR_BOLMT (1 << 7) /* BackOff Limit */
  215. #define LAN9118_MAC_CR_DFCHK (1 << 5) /* Deferral Check */
  216. #define LAN9118_MAC_CR_TXEN (1 << 3) /* Transmitter enable */
  217. #define LAN9118_MAC_CR_RXEN (1 << 2) /* Receiver enable */
  218. #define LAN9118_ADDRH 0x2 /* MAC Address High */
  219. #define LAN9118_ADDRL 0x3 /* MAC Address Low */
  220. #define LAN9118_HASHH 0x4 /* Multicast Hash Table High */
  221. #define LAN9118_HASHL 0x5 /* Multicast Hash Table Low */
  222. #define LAN9118_MII_ACC 0x6 /* MII Access */
  223. #define LAN9118_MII_ACC_PHYA(a) ((a) << 11) /* PHY Address */
  224. #define LAN9118_MII_ACC_MIIRINDA(i) ((i) << 6) /* MII Register Index */
  225. #define LAN9118_MII_ACC_MIIWNR (1 << 1) /* MII Write */
  226. #define LAN9118_MII_ACC_MIIBZY (1 << 0) /* MII Busy */
  227. #define LAN9118_MII_DATA 0x7 /* MII Data */
  228. #define LAN9118_FLOW 0x8 /* Flow Control */
  229. #define LAN9118_FLOW_FCPT(t) ((t) << 16) /* Pause Time */
  230. #define LAN9118_FLOW_FCPASS (1 << 2) /* Pass Control Frame */
  231. #define LAN9118_FLOW_FCEN (1 << 1) /* Flow Control Enable */
  232. #define LAN9118_FLOW_FCBUSY (1 << 0) /* Flow Control Busy */
  233. #define LAN9118_VLAN1 0x9 /* VLAN1 Tag */
  234. #define LAN9118_VLAN2 0xa /* VLAN2 Tag */
  235. #define LAN9118_WUFF 0xb /* Wake-up Frame Filter */
  236. #define LAN9118_WUCSR 0xc /* Wake-up Control and Status */
  237. /* PHY Registers */
  238. #define LAN9118_MCSR 0x11 /* Mode Control/Status Register */
  239. #define LAN9118_MCSR_EDPWRDOWN (1 << 13) /* Energy Detect Power Down */
  240. #define LAN9118_MCSR_ENERGYON (1 << 1)
  241. #define LAN9118_SMR 0x12 /* Special Modes Register */
  242. #define LAN9118_SMR_PHYAD (0x01)
  243. #define LAN9118_SCSI 0x1b /* Special Control/Status Indications */
  244. #define LAN9118_SCSI_VCOOFF_LP (1 << 10)
  245. #define LAN9118_SCSI_XPOL (1 << 4) /* Polarity state */
  246. #define LAN9118_ISR 0x1d /* Interrupt Source Register */
  247. #define LAN9118_IMR 0x1e /* Interrupt Mask Register */
  248. #define LAN9118_I_ENERGYON (1 << 7)
  249. #define LAN9118_I_AUTONEGOCOMPL (1 << 6)
  250. #define LAN9118_I_REMOTEFAULT (1 << 5)
  251. #define LAN9118_I_LINKDOWN (1 << 4)
  252. #define LAN9118_I_AUTONEGOLPACK (1 << 3) /* AutoNego LP Acknowledge */
  253. #define LAN9118_I_PDF (1 << 2) /* Parallel Detection Fault */
  254. #define LAN9118_I_AUTONEGOPR (1 << 1) /* AutoNego Page Received */
  255. #define LAN9118_PHYSCSR 0x1f /* PHY Special Control/Status Reg */
  256. #define LAN9118_PHYSCSR_AUTODONE (1 << 12) /* AutoNego done indication */
  257. #define LAN9118_PHYSCSR_SI_10 (1 << 2) /* Speed Indication */
  258. #define LAN9118_PHYSCSR_SI_100 (2 << 2)
  259. #define LAN9118_PHYSCSR_SI_FDX (4 << 2)
  260. /* TX Command 'A' Format */
  261. #define LAN9118_TXC_A_IC (1 << 31) /* Interrupt on Completion */
  262. #define LAN9118_TXC_A_BEA_4B (0 << 24) /* Buffer End Alignment: 4B */
  263. #define LAN9118_TXC_A_BEA_16B (1 << 24) /* 16B */
  264. #define LAN9118_TXC_A_BEA_32B (2 << 24) /* 32B */
  265. #define LAN9118_TXC_A_DSO(x) ((x) << 16) /*Data Start Offset: bytes*/
  266. #define LAN9118_TXC_A_FS (1 << 13) /* First Segment */
  267. #define LAN9118_TXC_A_LS (1 << 12) /* Last Segment */
  268. #define LAN9118_TXC_A_BS(x) ((x) << 0) /* Buffer Size */
  269. /* TX Command 'B' Format */
  270. #define LAN9118_TXC_B_PT(x) ((x) << 16) /* Packet Tag */
  271. #define LAN9118_TXC_B_ACRCD (1 << 13) /* Add CRC Disable */
  272. #define LAN9118_TXC_B_DEFP (1 << 12) /* Dis Ether Frame Padding */
  273. #define LAN9118_TXC_B_PL(x) ((x) << 0) /* Packet Length */
  274. /* TX Status Format */
  275. #define LAN9118_TXS_PKTTAG(x) (((x) >> 16) & 0xff) /* Packet Tag */
  276. #define LAN9118_TXS_ES (1 << 15) /* Error Status */
  277. #define LAN9118_TXS_LOC (1 << 11) /* Loss Of Carrier */
  278. #define LAN9118_TXS_NC (1 << 10) /* No Carrier */
  279. #define LAN9118_TXS_LCOL (1 << 9) /* Late Collision */
  280. #define LAN9118_TXS_ECOL (1 << 8) /* Excessive Collision*/
  281. #define LAN9118_TXS_COLCNT(x) (((x) >> 3) & 0xf) /* Collision Count */
  282. #define LAN9118_TXS_ED (1 << 2) /* Excessive Deferral */
  283. #define LAN9118_TXS_DEFERRED (1 << 0) /* Deferred */
  284. /* RX Status Format */
  285. #define LAN9118_RXS_FILTFAIL (1 << 30) /* Filtering Fail */
  286. #define LAN9118_RXS_PKTLEN(x) (((x) >> 16) & 0x3fff) /* Packet Len */
  287. #define LAN9118_RXS_ES (1 << 15) /* Error Status */
  288. #define LAN9118_RXS_BCF (1 << 13) /* Broadcast Frame */
  289. #define LAN9118_RXS_LENERR (1 << 12) /* Length Error */
  290. #define LAN9118_RXS_RUNTF (1 << 11) /* Runt Frame */
  291. #define LAN9118_RXS_MCF (1 << 10) /* Multicast Frame */
  292. #define LAN9118_RXS_FTL (1 << 7) /* Frame Too Long */
  293. #define LAN9118_RXS_COLS (1 << 6) /* Collision Seen */
  294. #define LAN9118_RXS_FT (1 << 5) /* Frame Type */
  295. #define LAN9118_RXS_RWTO (1 << 4) /* Rcv Watchdog time-out */
  296. #define LAN9118_RXS_MIIERR (1 << 3) /* MII Error */
  297. #define LAN9118_RXS_DBIT (1 << 2) /* Drabbling Bit */
  298. #define LAN9118_RXS_CRCERR (1 << 1) /* CRC Error */
  299. /* Basic mode control register. */
  300. #define LAN9118_BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
  301. #define LAN9118_BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
  302. #define LAN9118_BMCR_RESET 0x8000 /* Reset the DP83840 */
  303. #define LAN9118_BMSR_LSTATUS 0x0004 /* Link status */
  304. /* Generic MII registers. */
  305. #define LAN9118_MII_BMCR 0x00 /* Basic mode control register */
  306. #define LAN9118_MII_BMSR 0x01 /* Basic mode status register */
  307. #define LAN9118_MII_ADVERTISE 0x04 /* Advertisement control register */
  308. #define LAN9118_GPT_CFG_TIMER_EN 0x20000000 /* R/W */
  309. #define LAN9118_RX_STS_PKT_LEN 0x3FFF0000
  310. #define LAN9118_TX_STS_UNDERRUN 0x00000002
  311. #define LAN9118_HW_CFG_SF 0x00100000 /* R/W */
  312. #define LAN9118_INT_STS_RSFL 0x00000008 /* R/WC */
  313. #define LAN9118_INT_EN_RDFL_EN 0x00000020 /* R/W */
  314. #define LAN9118_MAC_CR_HBDIS 0x10000000
  315. #endif /* _LAN9118REG_H_ */