Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

509 lines
16 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. # _____ ___ ____ ___ ____
  3. # ____| | ____| | | |____|
  4. # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
  5. #-----------------------------------------------------------------------
  6. # Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
  7. # Licenced under Academic Free License version 2.0
  8. # Review ps2sdk README & LICENSE files for further details.
  9. */
  10. /**
  11. * @file
  12. * SMAP (PS2 Network Adapter) register definitions.
  13. * Contains register definitions for the Ethernet MAC (EMAC).
  14. * The EMAC is similar to the EMAC from the IBM PowerPC 405gp.
  15. */
  16. #ifndef __SMAPREGS_H__
  17. #define __SMAPREGS_H__
  18. #include <tamtypes.h>
  19. #include <speedregs.h>
  20. /* SMAP interrupt status bits (selected from the SPEED device). */
  21. #define SMAP_INTR_EMAC3 (1<<6)
  22. #define SMAP_INTR_RXEND (1<<5)
  23. #define SMAP_INTR_TXEND (1<<4)
  24. #define SMAP_INTR_RXDNV (1<<3) /* descriptor not valid */
  25. #define SMAP_INTR_TXDNV (1<<2) /* descriptor not valid */
  26. #define SMAP_INTR_CLR_ALL (SMAP_INTR_RXEND|SMAP_INTR_TXEND|SMAP_INTR_RXDNV)
  27. #define SMAP_INTR_ENA_ALL (SMAP_INTR_EMAC3|SMAP_INTR_CLR_ALL)
  28. #define SMAP_INTR_BITMSK (SMAP_INTR_EMAC3|SMAP_INTR_RXEND|SMAP_INTR_TXEND|SMAP_INTR_RXDNV|SMAP_INTR_TXDNV)
  29. /* SMAP Register Definitions. */
  30. #define SMAP_REGBASE (SPD_REGBASE + 0x100)
  31. #define USE_SMAP_REGS volatile u8 *smap_regbase = \
  32. (volatile u8 *)SMAP_REGBASE
  33. #define SMAP_REG8(offset) (*(volatile u8 *)(smap_regbase + (offset)))
  34. #define SMAP_REG16(offset) (*(volatile u16 *)(smap_regbase + (offset)))
  35. #define SMAP_REG32(offset) (*(volatile u32 *)(smap_regbase + (offset)))
  36. #define SMAP_R_BD_MODE 0x02
  37. #define SMAP_BD_SWAP (1<<0)
  38. #define SMAP_R_INTR_CLR 0x28
  39. /* SMAP FIFO Registers. */
  40. #define SMAP_R_TXFIFO_CTRL 0xf00
  41. #define SMAP_TXFIFO_RESET (1<<0)
  42. #define SMAP_TXFIFO_DMAEN (1<<1)
  43. #define SMAP_R_TXFIFO_WR_PTR 0xf04
  44. #define SMAP_R_TXFIFO_SIZE 0xf08
  45. #define SMAP_R_TXFIFO_FRAME_CNT 0xf0C
  46. #define SMAP_R_TXFIFO_FRAME_INC 0xf10
  47. #define SMAP_R_TXFIFO_DATA 0x1000
  48. #define SMAP_R_RXFIFO_CTRL 0xf30
  49. #define SMAP_RXFIFO_RESET (1<<0)
  50. #define SMAP_RXFIFO_DMAEN (1<<1)
  51. #define SMAP_R_RXFIFO_RD_PTR 0xf34
  52. #define SMAP_R_RXFIFO_SIZE 0xf38
  53. #define SMAP_R_RXFIFO_FRAME_CNT 0xf3C
  54. #define SMAP_R_RXFIFO_FRAME_DEC 0xf40
  55. #define SMAP_R_RXFIFO_DATA 0x1100
  56. #define SMAP_R_FIFO_ADDR 0x1200
  57. #define SMAP_FIFO_CMD_READ (1<<1)
  58. #define SMAP_FIFO_DATA_SWAP (1<<0)
  59. #define SMAP_R_FIFO_DATA 0x1208
  60. /* EMAC3 Registers. */
  61. #define SMAP_EMAC3_REGBASE 0x1f00
  62. /* Seperating out the EMAC3 registers makes it a lot easier to debug register
  63. assigns. Besides, I am a staunch supporter of preprocessor macro abuse. */
  64. #define USE_SMAP_EMAC3_REGS volatile u8 *emac3_regbase = \
  65. (volatile u8 *)(SMAP_REGBASE + SMAP_EMAC3_REGBASE)
  66. #define SMAP_EMAC3_REG(offset) (*(volatile u16 *)(emac3_regbase + (offset)))
  67. #define SMAP_EMAC3_REG32(offset) (*(volatile u32 *)(emac3_regbase + (offset)))
  68. #define SMAP_EMAC3_GET(offset) ((SMAP_EMAC3_REG((offset)) << 16) | \
  69. (SMAP_EMAC3_REG((offset)+2)))
  70. #define SMAP_EMAC3_GET32(offset) (((SMAP_EMAC3_REG32((offset)) >> 16) & 0xffff) | \
  71. ((SMAP_EMAC3_REG32((offset)) & 0xffff) << 16))
  72. #define SMAP_EMAC3_WRITE32(offset, val) \
  73. SMAP_EMAC3_REG32((offset)) = ((((val) >> 16) & 0xffff) | (((val) & 0xffff) << 16));
  74. #define SMAP_EMAC3_WRITE(offset, val) \
  75. SMAP_EMAC3_REG((offset)) = ((val) >> 16) & 0xffff; \
  76. SMAP_EMAC3_REG((offset)+2) = (val) & 0xffff;
  77. #define SMAP_EMAC3_SET(offset, val) \
  78. SMAP_EMAC3_WRITE(offset, val) \
  79. (void)SMAP_EMAC3_GET(offset)
  80. #define SMAP_EMAC3_SET32(offset, val) \
  81. SMAP_EMAC3_WRITE32(offset, val) \
  82. (void)SMAP_EMAC3_GET32(offset)
  83. #define SMAP_R_EMAC3_MODE0 0x00
  84. #define SMAP_E3_RXMAC_IDLE (1<<31)
  85. #define SMAP_E3_TXMAC_IDLE (1<<30)
  86. #define SMAP_E3_SOFT_RESET (1<<29)
  87. #define SMAP_E3_TXMAC_ENABLE (1<<28)
  88. #define SMAP_E3_RXMAC_ENABLE (1<<27)
  89. #define SMAP_E3_WAKEUP_ENABLE (1<<26)
  90. #define SMAP_R_EMAC3_MODE1 0x04
  91. #define SMAP_E3_FDX_ENABLE (1<<31)
  92. /** internal loop back */
  93. #define SMAP_E3_INLPBK_ENABLE (1<<30)
  94. #define SMAP_E3_VLAN_ENABLE (1<<29)
  95. /** integrated flow ctrl(pause frame) */
  96. #define SMAP_E3_FLOWCTRL_ENABLE (1<<28)
  97. /** allow pause frame */
  98. #define SMAP_E3_ALLOW_PF (1<<27)
  99. /** allow external management IF */
  100. #define SMAP_E3_ALLOW_EXTMNGIF (1<<25)
  101. #define SMAP_E3_IGNORE_SQE (1<<24)
  102. #define SMAP_E3_MEDIA_FREQ_BITSFT (22)
  103. #define SMAP_E3_MEDIA_10M (0<<22)
  104. #define SMAP_E3_MEDIA_100M (1<<22)
  105. #define SMAP_E3_MEDIA_1000M (2<<22)
  106. #define SMAP_E3_MEDIA_MSK (3<<22)
  107. #define SMAP_E3_RXFIFO_SIZE_BITSFT (20)
  108. #define SMAP_E3_RXFIFO_512 (0<<20)
  109. #define SMAP_E3_RXFIFO_1K (1<<20)
  110. #define SMAP_E3_RXFIFO_2K (2<<20)
  111. #define SMAP_E3_RXFIFO_4K (3<<20)
  112. #define SMAP_E3_TXFIFO_SIZE_BITSFT (18)
  113. #define SMAP_E3_TXFIFO_512 (0<<18)
  114. #define SMAP_E3_TXFIFO_1K (1<<18)
  115. #define SMAP_E3_TXFIFO_2K (2<<18)
  116. #define SMAP_E3_TXREQ0_BITSFT (15)
  117. #define SMAP_E3_TXREQ0_SINGLE (0<<15)
  118. #define SMAP_E3_TXREQ0_MULTI (1<<15)
  119. #define SMAP_E3_TXREQ0_DEPEND (2<<15)
  120. #define SMAP_E3_TXREQ1_BITSFT (13)
  121. #define SMAP_E3_TXREQ1_SINGLE (0<<13)
  122. #define SMAP_E3_TXREQ1_MULTI (1<<13)
  123. #define SMAP_E3_TXREQ1_DEPEND (2<<13)
  124. #define SMAP_E3_JUMBO_ENABLE (1<<12)
  125. #define SMAP_R_EMAC3_TxMODE0 0x08
  126. /** get new packet */
  127. #define SMAP_E3_TX_GNP_0 (1<<31)
  128. /** get new packet */
  129. #define SMAP_E3_TX_GNP_1 (1<<30)
  130. /** get new packet */
  131. #define SMAP_E3_TX_GNP_DEPEND (1<<29)
  132. #define SMAP_E3_TX_FIRST_CHANNEL (1<<28)
  133. #define SMAP_R_EMAC3_TxMODE1 0x0C
  134. /** low priority request */
  135. #define SMAP_E3_TX_LOW_REQ_MSK (0x1F)
  136. /** low priority request */
  137. #define SMAP_E3_TX_LOW_REQ_BITSFT (27)
  138. /** urgent priority request */
  139. #define SMAP_E3_TX_URG_REQ_MSK (0xFF)
  140. /** urgent priority request */
  141. #define SMAP_E3_TX_URG_REQ_BITSFT (16)
  142. #define SMAP_R_EMAC3_RxMODE 0x10
  143. #define SMAP_E3_RX_STRIP_PAD (1<<31)
  144. #define SMAP_E3_RX_STRIP_FCS (1<<30)
  145. #define SMAP_E3_RX_RX_RUNT_FRAME (1<<29)
  146. #define SMAP_E3_RX_RX_FCS_ERR (1<<28)
  147. #define SMAP_E3_RX_RX_TOO_LONG_ERR (1<<27)
  148. #define SMAP_E3_RX_RX_IN_RANGE_ERR (1<<26)
  149. /** propagate pause frame */
  150. #define SMAP_E3_RX_PROP_PF (1<<25)
  151. #define SMAP_E3_RX_PROMISC (1<<24)
  152. #define SMAP_E3_RX_PROMISC_MCAST (1<<23)
  153. #define SMAP_E3_RX_INDIVID_ADDR (1<<22)
  154. #define SMAP_E3_RX_INDIVID_HASH (1<<21)
  155. #define SMAP_E3_RX_BCAST (1<<20)
  156. #define SMAP_E3_RX_MCAST (1<<19)
  157. #define SMAP_R_EMAC3_INTR_STAT 0x14
  158. #define SMAP_R_EMAC3_INTR_ENABLE 0x18
  159. /** this bit does NOT WORK */
  160. #define SMAP_E3_INTR_OVERRUN (1<<25)
  161. #define SMAP_E3_INTR_PF (1<<24)
  162. #define SMAP_E3_INTR_BAD_FRAME (1<<23)
  163. #define SMAP_E3_INTR_RUNT_FRAME (1<<22)
  164. #define SMAP_E3_INTR_SHORT_EVENT (1<<21)
  165. #define SMAP_E3_INTR_ALIGN_ERR (1<<20)
  166. #define SMAP_E3_INTR_BAD_FCS (1<<19)
  167. #define SMAP_E3_INTR_TOO_LONG (1<<18)
  168. #define SMAP_E3_INTR_OUT_RANGE_ERR (1<<17)
  169. #define SMAP_E3_INTR_IN_RANGE_ERR (1<<16)
  170. #define SMAP_E3_INTR_DEAD_DEPEND (1<<9)
  171. #define SMAP_E3_INTR_DEAD_0 (1<<8)
  172. #define SMAP_E3_INTR_SQE_ERR_0 (1<<7)
  173. #define SMAP_E3_INTR_TX_ERR_0 (1<<6)
  174. #define SMAP_E3_INTR_DEAD_1 (1<<5)
  175. #define SMAP_E3_INTR_SQE_ERR_1 (1<<4)
  176. #define SMAP_E3_INTR_TX_ERR_1 (1<<3)
  177. #define SMAP_E3_INTR_MMAOP_SUCCESS (1<<1)
  178. #define SMAP_E3_INTR_MMAOP_FAIL (1<<0)
  179. #define SMAP_E3_INTR_ALL \
  180. (SMAP_E3_INTR_OVERRUN|SMAP_E3_INTR_PF|SMAP_E3_INTR_BAD_FRAME| \
  181. SMAP_E3_INTR_RUNT_FRAME|SMAP_E3_INTR_SHORT_EVENT| \
  182. SMAP_E3_INTR_ALIGN_ERR|SMAP_E3_INTR_BAD_FCS| \
  183. SMAP_E3_INTR_TOO_LONG|SMAP_E3_INTR_OUT_RANGE_ERR| \
  184. SMAP_E3_INTR_IN_RANGE_ERR| \
  185. SMAP_E3_INTR_DEAD_DEPEND|SMAP_E3_INTR_DEAD_0| \
  186. SMAP_E3_INTR_SQE_ERR_0|SMAP_E3_INTR_TX_ERR_0| \
  187. SMAP_E3_INTR_DEAD_1|SMAP_E3_INTR_SQE_ERR_1| \
  188. SMAP_E3_INTR_TX_ERR_1| \
  189. SMAP_E3_INTR_MMAOP_SUCCESS|SMAP_E3_INTR_MMAOP_FAIL)
  190. #define SMAP_E3_DEAD_ALL \
  191. (SMAP_E3_INTR_DEAD_DEPEND|SMAP_E3_INTR_DEAD_0| \
  192. SMAP_E3_INTR_DEAD_1)
  193. #define SMAP_R_EMAC3_ADDR_HI 0x1C
  194. #define SMAP_R_EMAC3_ADDR_LO 0x20
  195. #define SMAP_R_EMAC3_VLAN_TPID 0x24
  196. #define SMAP_E3_VLAN_ID_MSK 0xFFFF
  197. #define SMAP_R_EMAC3_VLAN_TCI 0x28
  198. #define SMAP_E3_VLAN_TCITAG_MSK 0xFFFF
  199. #define SMAP_R_EMAC3_PAUSE_TIMER 0x2C
  200. #define SMAP_E3_PTIMER_MSK 0xFFFF
  201. #define SMAP_R_EMAC3_INDIVID_HASH1 0x30
  202. #define SMAP_R_EMAC3_INDIVID_HASH2 0x34
  203. #define SMAP_R_EMAC3_INDIVID_HASH3 0x38
  204. #define SMAP_R_EMAC3_INDIVID_HASH4 0x3C
  205. #define SMAP_R_EMAC3_GROUP_HASH1 0x40
  206. #define SMAP_R_EMAC3_GROUP_HASH2 0x44
  207. #define SMAP_R_EMAC3_GROUP_HASH3 0x48
  208. #define SMAP_R_EMAC3_GROUP_HASH4 0x4C
  209. #define SMAP_E3_HASH_MSK 0xFFFF
  210. #define SMAP_R_EMAC3_LAST_SA_HI 0x50
  211. #define SMAP_R_EMAC3_LAST_SA_LO 0x54
  212. #define SMAP_R_EMAC3_INTER_FRAME_GAP 0x58
  213. #define SMAP_E3_IFGAP_MSK 0x3F
  214. #define SMAP_R_EMAC3_STA_CTRL 0x5C
  215. #define SMAP_E3_PHY_DATA_MSK (0xFFFF)
  216. #define SMAP_E3_PHY_DATA_BITSFT (16)
  217. /** operation complete */
  218. #define SMAP_E3_PHY_OP_COMP (1<<15)
  219. #define SMAP_E3_PHY_ERR_READ (1<<14)
  220. #define SMAP_E3_PHY_STA_CMD_BITSFT (12)
  221. #define SMAP_E3_PHY_READ (1<<12)
  222. #define SMAP_E3_PHY_WRITE (2<<12)
  223. #define SMAP_E3_PHY_OPBCLCK_BITSFT (10)
  224. #define SMAP_E3_PHY_50M (0<<10)
  225. #define SMAP_E3_PHY_66M (1<<10)
  226. #define SMAP_E3_PHY_83M (2<<10)
  227. #define SMAP_E3_PHY_100M (3<<10)
  228. #define SMAP_E3_PHY_ADDR_MSK (0x1F)
  229. #define SMAP_E3_PHY_ADDR_BITSFT (5)
  230. #define SMAP_E3_PHY_REG_ADDR_MSK (0x1F)
  231. #define SMAP_R_EMAC3_TX_THRESHOLD 0x60
  232. #define SMAP_E3_TX_THRESHLD_MSK (0x1F)
  233. #define SMAP_E3_TX_THRESHLD_BITSFT (27)
  234. #define SMAP_R_EMAC3_RX_WATERMARK 0x64
  235. #define SMAP_E3_RX_LO_WATER_MSK (0x1FF)
  236. #define SMAP_E3_RX_LO_WATER_BITSFT (23)
  237. #define SMAP_E3_RX_HI_WATER_MSK (0x1FF)
  238. #define SMAP_E3_RX_HI_WATER_BITSFT (7)
  239. #define SMAP_R_EMAC3_TX_OCTETS 0x68
  240. #define SMAP_R_EMAC3_RX_OCTETS 0x6C
  241. /** Buffer descriptors. */
  242. typedef struct _smap_bd {
  243. u16 ctrl_stat;
  244. /** must be zero */
  245. u16 reserved;
  246. /** number of bytes in pkt */
  247. u16 length;
  248. u16 pointer;
  249. } smap_bd_t;
  250. #define SMAP_BD_REGBASE 0x2f00
  251. #define SMAP_BD_TX_BASE (SMAP_BD_REGBASE + 0x0000)
  252. /* For backward compatibility */
  253. #define SMAP_TX_BASE SMAP_TX_BUFBASE
  254. #define SMAP_TX_BUFBASE 0x1000
  255. #define SMAP_TX_BUFSIZE 4096
  256. #define SMAP_BD_RX_BASE (SMAP_BD_REGBASE + 0x0200)
  257. #define SMAP_RX_BUFBASE 0x4000
  258. #define SMAP_RX_BUFSIZE 16384
  259. #define SMAP_BD_SIZE 512
  260. #define SMAP_BD_MAX_ENTRY 64
  261. #define USE_SMAP_TX_BD volatile smap_bd_t *tx_bd = \
  262. (volatile smap_bd_t *)(SMAP_REGBASE + SMAP_BD_TX_BASE)
  263. #define USE_SMAP_RX_BD volatile smap_bd_t *rx_bd = \
  264. (volatile smap_bd_t *)(SMAP_REGBASE + SMAP_BD_RX_BASE)
  265. /* TX Control */
  266. /** set:driver, clear:HW */
  267. #define SMAP_BD_TX_READY (1<<15)
  268. /** generate FCS */
  269. #define SMAP_BD_TX_GENFCS (1<<9)
  270. /** generate padding */
  271. #define SMAP_BD_TX_GENPAD (1<<8)
  272. /** insert source address */
  273. #define SMAP_BD_TX_INSSA (1<<7)
  274. /** replace source address */
  275. #define SMAP_BD_TX_RPLSA (1<<6)
  276. /** insert VLAN Tag */
  277. #define SMAP_BD_TX_INSVLAN (1<<5)
  278. /** replace VLAN Tag */
  279. #define SMAP_BD_TX_RPLVLAN (1<<4)
  280. /* TX Status */
  281. /** set:driver, clear:HW */
  282. #define SMAP_BD_TX_READY (1<<15)
  283. /** bad FCS */
  284. #define SMAP_BD_TX_BADFCS (1<<9)
  285. /** bad previous pkt in dependent mode */
  286. #define SMAP_BD_TX_BADPKT (1<<8)
  287. /** loss of carrior sense */
  288. #define SMAP_BD_TX_LOSSCR (1<<7)
  289. /** excessive deferal */
  290. #define SMAP_BD_TX_EDEFER (1<<6)
  291. /** excessive collision */
  292. #define SMAP_BD_TX_ECOLL (1<<5)
  293. /** late collision */
  294. #define SMAP_BD_TX_LCOLL (1<<4)
  295. /** multiple collision */
  296. #define SMAP_BD_TX_MCOLL (1<<3)
  297. /** single collision */
  298. #define SMAP_BD_TX_SCOLL (1<<2)
  299. /** underrun */
  300. #define SMAP_BD_TX_UNDERRUN (1<<1)
  301. /** SQE */
  302. #define SMAP_BD_TX_SQE (1<<0)
  303. #define SMAP_BD_TX_ERROR (SMAP_BD_TX_LOSSCR|SMAP_BD_TX_EDEFER|SMAP_BD_TX_ECOLL| \
  304. SMAP_BD_TX_LCOLL|SMAP_BD_TX_UNDERRUN)
  305. /* RX Control */
  306. /** set:driver, clear:HW */
  307. #define SMAP_BD_RX_EMPTY (1<<15)
  308. /* RX Status */
  309. /** set:driver, clear:HW */
  310. #define SMAP_BD_RX_EMPTY (1<<15)
  311. /** overrun */
  312. #define SMAP_BD_RX_OVERRUN (1<<9)
  313. /** pause frame */
  314. #define SMAP_BD_RX_PFRM (1<<8)
  315. /** bad frame */
  316. #define SMAP_BD_RX_BADFRM (1<<7)
  317. /** runt frame */
  318. #define SMAP_BD_RX_RUNTFRM (1<<6)
  319. /** short event */
  320. #define SMAP_BD_RX_SHORTEVNT (1<<5)
  321. /** alignment error */
  322. #define SMAP_BD_RX_ALIGNERR (1<<4)
  323. /** bad FCS */
  324. #define SMAP_BD_RX_BADFCS (1<<3)
  325. /** frame too long */
  326. #define SMAP_BD_RX_FRMTOOLONG (1<<2)
  327. /** out of range error */
  328. #define SMAP_BD_RX_OUTRANGE (1<<1)
  329. /** in range error */
  330. #define SMAP_BD_RX_INRANGE (1<<0)
  331. #define SMAP_BD_RX_ERROR (SMAP_BD_RX_OVERRUN|SMAP_BD_RX_RUNTFRM|SMAP_BD_RX_SHORTEVNT| \
  332. SMAP_BD_RX_ALIGNERR|SMAP_BD_RX_BADFCS|SMAP_BD_RX_FRMTOOLONG| \
  333. SMAP_BD_RX_OUTRANGE|SMAP_BD_RX_INRANGE)
  334. /* PHY registers (National Semiconductor DP83846A). */
  335. #define SMAP_NS_OUI 0x080017
  336. #define SMAP_DsPHYTER_ADDRESS 0x1
  337. #define SMAP_DsPHYTER_BMCR 0x00
  338. /* ReSeT */
  339. #define SMAP_PHY_BMCR_RST (1<<15)
  340. /* LooPBacK */
  341. #define SMAP_PHY_BMCR_LPBK (1<<14)
  342. /* speed select, 1:100M, 0:10M */
  343. #define SMAP_PHY_BMCR_100M (1<<13)
  344. /* speed select, 1:100M, 0:10M */
  345. #define SMAP_PHY_BMCR_10M (0<<13)
  346. /* Auto-Negotiation ENable */
  347. #define SMAP_PHY_BMCR_ANEN (1<<12)
  348. /* PoWer DowN */
  349. #define SMAP_PHY_BMCR_PWDN (1<<11)
  350. /* ISOLate */
  351. #define SMAP_PHY_BMCR_ISOL (1<<10)
  352. /* ReStart Auto-Negotiation */
  353. #define SMAP_PHY_BMCR_RSAN (1<<9)
  354. /* DUPlex Mode, 1:FDX, 0:HDX */
  355. #define SMAP_PHY_BMCR_DUPM (1<<8)
  356. /* COLlision Test */
  357. #define SMAP_PHY_BMCR_COLT (1<<7)
  358. #define SMAP_DsPHYTER_BMSR 0x01
  359. /** Auto-Negotiation ComPlete */
  360. #define SMAP_PHY_BMSR_ANCP (1<<5)
  361. /** LINK status */
  362. #define SMAP_PHY_BMSR_LINK (1<<2)
  363. #define SMAP_DsPHYTER_PHYIDR1 0x02
  364. #define SMAP_PHY_IDR1_VAL (((SMAP_NS_OUI<<2)>>8)&0xffff)
  365. #define SMAP_DsPHYTER_PHYIDR2 0x03
  366. #define SMAP_PHY_IDR2_VMDL 0x2 /* Vendor MoDeL number */
  367. #define SMAP_PHY_IDR2_VAL \
  368. (((SMAP_NS_OUI<<10)&0xFC00)|((SMAP_PHY_IDR2_VMDL<<4)&0x3F0))
  369. #define SMAP_PHY_IDR2_MSK 0xFFF0
  370. #define SMAP_PHY_IDR2_REV_MSK 0x000F
  371. #define SMAP_DsPHYTER_ANAR 0x04
  372. /** Remote FauLT */
  373. #define SMAP_PHY_ANAR_RFLT (1<<13)
  374. /** Pause */
  375. #define SMAP_PHY_ANAR_PAUSE (1<<10)
  376. /** 100BASE-T4 Support */
  377. #define SMAP_PHY_ANAR_T4 (1<<9)
  378. /** 100BASE-TX Full Duplex Support */
  379. #define SMAP_PHY_ANAR_TX_FD (1<<8)
  380. /** 100BASE-TX Support */
  381. #define SMAP_PHY_ANAR_TX (1<<7)
  382. /** 10BASE-T Full Duplex Support */
  383. #define SMAP_PHY_ANAR_10_FD (1<<6)
  384. /** 10BASE-T Support */
  385. #define SMAP_PHY_ANAR_10 (1<<5)
  386. #define SMAP_DsPHYTER_ANLPAR 0x05
  387. #define SMAP_DsPHYTER_ANLPARNP 0x05
  388. #define SMAP_DsPHYTER_ANER 0x06
  389. #define SMAP_DsPHYTER_ANNPTR 0x07
  390. /* Extended registers. */
  391. #define SMAP_DsPHYTER_PHYSTS 0x10
  392. /** Receive Error Latch */
  393. #define SMAP_PHY_STS_REL (1<<13)
  394. /** POlarity STatus */
  395. #define SMAP_PHY_STS_POST (1<<12)
  396. /** False Carrier Sense Latch */
  397. #define SMAP_PHY_STS_FCSL (1<<11)
  398. /** 100BT unconditional Signal Detect */
  399. #define SMAP_PHY_STS_SD (1<<10)
  400. /** 100BT DeScrambler Lock */
  401. #define SMAP_PHY_STS_DSL (1<<9)
  402. /** Page ReCeiVed */
  403. #define SMAP_PHY_STS_PRCV (1<<8)
  404. /** Remote FauLT */
  405. #define SMAP_PHY_STS_RFLT (1<<6)
  406. /** JaBber DetecT */
  407. #define SMAP_PHY_STS_JBDT (1<<5)
  408. /** Auto-Negotiation ComPlete */
  409. #define SMAP_PHY_STS_ANCP (1<<4)
  410. /** LooPBacK status */
  411. #define SMAP_PHY_STS_LPBK (1<<3)
  412. /** DUPlex Status,1:FDX,0:HDX */
  413. #define SMAP_PHY_STS_DUPS (1<<2)
  414. /** Full Duplex */
  415. #define SMAP_PHY_STS_FDX (1<<2)
  416. /** Half Duplex */
  417. #define SMAP_PHY_STS_HDX (0<<2)
  418. /** SPeeD Status */
  419. #define SMAP_PHY_STS_SPDS (1<<1)
  420. /** 10Mbps */
  421. #define SMAP_PHY_STS_10M (1<<1)
  422. /** 100Mbps */
  423. #define SMAP_PHY_STS_100M (0<<1)
  424. /** LINK status */
  425. #define SMAP_PHY_STS_LINK (1<<0)
  426. #define SMAP_DsPHYTER_FCSCR 0x14
  427. #define SMAP_DsPHYTER_RECR 0x15
  428. #define SMAP_DsPHYTER_PCSR 0x16
  429. #define SMAP_DsPHYTER_PHYCTRL 0x19
  430. #define SMAP_DsPHYTER_10BTSCR 0x1A
  431. /** 10BASE-T Loopback Disable */
  432. #define SMAP_PHY_10BTSCR_LOOPBACK_10_DIS (1<<8)
  433. /** Normal Link Pulse Disable */
  434. #define SMAP_PHY_10BTSCR_LP_DIS (1<<7)
  435. /** Force 10Mb Good Link */
  436. #define SMAP_PHY_10BTSCR_FORCE_10_LINK (1<<6)
  437. /** Force 10Mb Polarity Correction */
  438. #define SMAP_PHY_10BTSCR_FORCE_POL_COR (1<<5)
  439. /** 10Mb Polarity Status */
  440. #define SMAP_PHY_10BTSCR_POLARITY (1<<4)
  441. /** Auto Polarity Detection & Correction Disable */
  442. #define SMAP_PHY_10BTSCR_AUTOPOL_DIS (1<<3)
  443. /** RESERVED - Must be set to 1 */
  444. #define SMAP_PHY_10BTSCR_2 (1<<2)
  445. /** Heartbeat Disable */
  446. #define SMAP_PHY_10BTSCR_HEARTBEAT_DIS (1<<1)
  447. /** Jabber Disable */
  448. #define SMAP_PHY_10BTSCR_JABBER_DIS (1<<0)
  449. #define SMAP_DsPHYTER_CDCTRL 0x1B
  450. #endif /* __SMAPREGS_H__ */