xmac_ii.h 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579
  1. /******************************************************************************
  2. *
  3. * Name: xmac_ii.h
  4. * Project: Gigabit Ethernet Adapters, Common Modules
  5. * Version: $Revision: 1.52 $
  6. * Date: $Date: 2003/10/02 16:35:50 $
  7. * Purpose: Defines and Macros for Gigabit Ethernet Controller
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. * (C)Copyright 1998-2002 SysKonnect.
  13. * (C)Copyright 2002-2003 Marvell.
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * The information in this file is provided "AS IS" without warranty.
  21. *
  22. ******************************************************************************/
  23. #ifndef __INC_XMAC_H
  24. #define __INC_XMAC_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif /* __cplusplus */
  28. /* defines ********************************************************************/
  29. /*
  30. * XMAC II registers
  31. *
  32. * The XMAC registers are 16 or 32 bits wide.
  33. * The XMACs host processor interface is set to 16 bit mode,
  34. * therefore ALL registers will be addressed with 16 bit accesses.
  35. *
  36. * The following macros are provided to access the XMAC registers
  37. * XM_IN16(), XM_OUT16, XM_IN32(), XM_OUT32(), XM_INADR(), XM_OUTADR(),
  38. * XM_INHASH(), and XM_OUTHASH().
  39. * The macros are defined in SkGeHw.h.
  40. *
  41. * Note: NA reg = Network Address e.g DA, SA etc.
  42. *
  43. */
  44. #define XM_MMU_CMD 0x0000 /* 16 bit r/w MMU Command Register */
  45. /* 0x0004: reserved */
  46. #define XM_POFF 0x0008 /* 32 bit r/w Packet Offset Register */
  47. #define XM_BURST 0x000c /* 32 bit r/w Burst Register for half duplex*/
  48. #define XM_1L_VLAN_TAG 0x0010 /* 16 bit r/w One Level VLAN Tag ID */
  49. #define XM_2L_VLAN_TAG 0x0014 /* 16 bit r/w Two Level VLAN Tag ID */
  50. /* 0x0018 - 0x001e: reserved */
  51. #define XM_TX_CMD 0x0020 /* 16 bit r/w Transmit Command Register */
  52. #define XM_TX_RT_LIM 0x0024 /* 16 bit r/w Transmit Retry Limit Register */
  53. #define XM_TX_STIME 0x0028 /* 16 bit r/w Transmit Slottime Register */
  54. #define XM_TX_IPG 0x002c /* 16 bit r/w Transmit Inter Packet Gap */
  55. #define XM_RX_CMD 0x0030 /* 16 bit r/w Receive Command Register */
  56. #define XM_PHY_ADDR 0x0034 /* 16 bit r/w PHY Address Register */
  57. #define XM_PHY_DATA 0x0038 /* 16 bit r/w PHY Data Register */
  58. /* 0x003c: reserved */
  59. #define XM_GP_PORT 0x0040 /* 32 bit r/w General Purpose Port Register */
  60. #define XM_IMSK 0x0044 /* 16 bit r/w Interrupt Mask Register */
  61. #define XM_ISRC 0x0048 /* 16 bit r/o Interrupt Status Register */
  62. #define XM_HW_CFG 0x004c /* 16 bit r/w Hardware Config Register */
  63. /* 0x0050 - 0x005e: reserved */
  64. #define XM_TX_LO_WM 0x0060 /* 16 bit r/w Tx FIFO Low Water Mark */
  65. #define XM_TX_HI_WM 0x0062 /* 16 bit r/w Tx FIFO High Water Mark */
  66. #define XM_TX_THR 0x0064 /* 16 bit r/w Tx Request Threshold */
  67. #define XM_HT_THR 0x0066 /* 16 bit r/w Host Request Threshold */
  68. #define XM_PAUSE_DA 0x0068 /* NA reg r/w Pause Destination Address */
  69. /* 0x006e: reserved */
  70. #define XM_CTL_PARA 0x0070 /* 32 bit r/w Control Parameter Register */
  71. #define XM_MAC_OPCODE 0x0074 /* 16 bit r/w Opcode for MAC control frames */
  72. #define XM_MAC_PTIME 0x0076 /* 16 bit r/w Pause time for MAC ctrl frames*/
  73. #define XM_TX_STAT 0x0078 /* 32 bit r/o Tx Status LIFO Register */
  74. /* 0x0080 - 0x00fc: 16 NA reg r/w Exact Match Address Registers */
  75. /* use the XM_EXM() macro to address */
  76. #define XM_EXM_START 0x0080 /* r/w Start Address of the EXM Regs */
  77. /*
  78. * XM_EXM(Reg)
  79. *
  80. * returns the XMAC address offset of specified Exact Match Addr Reg
  81. *
  82. * para: Reg EXM register to addr (0 .. 15)
  83. *
  84. * usage: XM_INADDR(IoC, MAC_1, XM_EXM(i), &val[i]);
  85. */
  86. #define XM_EXM(Reg) (XM_EXM_START + ((Reg) << 3))
  87. #define XM_SRC_CHK 0x0100 /* NA reg r/w Source Check Address Register */
  88. #define XM_SA 0x0108 /* NA reg r/w Station Address Register */
  89. #define XM_HSM 0x0110 /* 64 bit r/w Hash Match Address Registers */
  90. #define XM_RX_LO_WM 0x0118 /* 16 bit r/w Receive Low Water Mark */
  91. #define XM_RX_HI_WM 0x011a /* 16 bit r/w Receive High Water Mark */
  92. #define XM_RX_THR 0x011c /* 32 bit r/w Receive Request Threshold */
  93. #define XM_DEV_ID 0x0120 /* 32 bit r/o Device ID Register */
  94. #define XM_MODE 0x0124 /* 32 bit r/w Mode Register */
  95. #define XM_LSA 0x0128 /* NA reg r/o Last Source Register */
  96. /* 0x012e: reserved */
  97. #define XM_TS_READ 0x0130 /* 32 bit r/o Time Stamp Read Register */
  98. #define XM_TS_LOAD 0x0134 /* 32 bit r/o Time Stamp Load Value */
  99. /* 0x0138 - 0x01fe: reserved */
  100. #define XM_STAT_CMD 0x0200 /* 16 bit r/w Statistics Command Register */
  101. #define XM_RX_CNT_EV 0x0204 /* 32 bit r/o Rx Counter Event Register */
  102. #define XM_TX_CNT_EV 0x0208 /* 32 bit r/o Tx Counter Event Register */
  103. #define XM_RX_EV_MSK 0x020c /* 32 bit r/w Rx Counter Event Mask */
  104. #define XM_TX_EV_MSK 0x0210 /* 32 bit r/w Tx Counter Event Mask */
  105. /* 0x0204 - 0x027e: reserved */
  106. #define XM_TXF_OK 0x0280 /* 32 bit r/o Frames Transmitted OK Conuter */
  107. #define XM_TXO_OK_HI 0x0284 /* 32 bit r/o Octets Transmitted OK High Cnt*/
  108. #define XM_TXO_OK_LO 0x0288 /* 32 bit r/o Octets Transmitted OK Low Cnt */
  109. #define XM_TXF_BC_OK 0x028c /* 32 bit r/o Broadcast Frames Xmitted OK */
  110. #define XM_TXF_MC_OK 0x0290 /* 32 bit r/o Multicast Frames Xmitted OK */
  111. #define XM_TXF_UC_OK 0x0294 /* 32 bit r/o Unicast Frames Xmitted OK */
  112. #define XM_TXF_LONG 0x0298 /* 32 bit r/o Tx Long Frame Counter */
  113. #define XM_TXE_BURST 0x029c /* 32 bit r/o Tx Burst Event Counter */
  114. #define XM_TXF_MPAUSE 0x02a0 /* 32 bit r/o Tx Pause MAC Ctrl Frame Cnt */
  115. #define XM_TXF_MCTRL 0x02a4 /* 32 bit r/o Tx MAC Ctrl Frame Counter */
  116. #define XM_TXF_SNG_COL 0x02a8 /* 32 bit r/o Tx Single Collision Counter */
  117. #define XM_TXF_MUL_COL 0x02ac /* 32 bit r/o Tx Multiple Collision Counter */
  118. #define XM_TXF_ABO_COL 0x02b0 /* 32 bit r/o Tx aborted due to Exces. Col. */
  119. #define XM_TXF_LAT_COL 0x02b4 /* 32 bit r/o Tx Late Collision Counter */
  120. #define XM_TXF_DEF 0x02b8 /* 32 bit r/o Tx Deferred Frame Counter */
  121. #define XM_TXF_EX_DEF 0x02bc /* 32 bit r/o Tx Excessive Deferall Counter */
  122. #define XM_TXE_FIFO_UR 0x02c0 /* 32 bit r/o Tx FIFO Underrun Event Cnt */
  123. #define XM_TXE_CS_ERR 0x02c4 /* 32 bit r/o Tx Carrier Sense Error Cnt */
  124. #define XM_TXP_UTIL 0x02c8 /* 32 bit r/o Tx Utilization in % */
  125. /* 0x02cc - 0x02ce: reserved */
  126. #define XM_TXF_64B 0x02d0 /* 32 bit r/o 64 Byte Tx Frame Counter */
  127. #define XM_TXF_127B 0x02d4 /* 32 bit r/o 65-127 Byte Tx Frame Counter */
  128. #define XM_TXF_255B 0x02d8 /* 32 bit r/o 128-255 Byte Tx Frame Counter */
  129. #define XM_TXF_511B 0x02dc /* 32 bit r/o 256-511 Byte Tx Frame Counter */
  130. #define XM_TXF_1023B 0x02e0 /* 32 bit r/o 512-1023 Byte Tx Frame Counter*/
  131. #define XM_TXF_MAX_SZ 0x02e4 /* 32 bit r/o 1024-MaxSize Byte Tx Frame Cnt*/
  132. /* 0x02e8 - 0x02fe: reserved */
  133. #define XM_RXF_OK 0x0300 /* 32 bit r/o Frames Received OK */
  134. #define XM_RXO_OK_HI 0x0304 /* 32 bit r/o Octets Received OK High Cnt */
  135. #define XM_RXO_OK_LO 0x0308 /* 32 bit r/o Octets Received OK Low Counter*/
  136. #define XM_RXF_BC_OK 0x030c /* 32 bit r/o Broadcast Frames Received OK */
  137. #define XM_RXF_MC_OK 0x0310 /* 32 bit r/o Multicast Frames Received OK */
  138. #define XM_RXF_UC_OK 0x0314 /* 32 bit r/o Unicast Frames Received OK */
  139. #define XM_RXF_MPAUSE 0x0318 /* 32 bit r/o Rx Pause MAC Ctrl Frame Cnt */
  140. #define XM_RXF_MCTRL 0x031c /* 32 bit r/o Rx MAC Ctrl Frame Counter */
  141. #define XM_RXF_INV_MP 0x0320 /* 32 bit r/o Rx invalid Pause Frame Cnt */
  142. #define XM_RXF_INV_MOC 0x0324 /* 32 bit r/o Rx Frames with inv. MAC Opcode*/
  143. #define XM_RXE_BURST 0x0328 /* 32 bit r/o Rx Burst Event Counter */
  144. #define XM_RXE_FMISS 0x032c /* 32 bit r/o Rx Missed Frames Event Cnt */
  145. #define XM_RXF_FRA_ERR 0x0330 /* 32 bit r/o Rx Framing Error Counter */
  146. #define XM_RXE_FIFO_OV 0x0334 /* 32 bit r/o Rx FIFO overflow Event Cnt */
  147. #define XM_RXF_JAB_PKT 0x0338 /* 32 bit r/o Rx Jabber Packet Frame Cnt */
  148. #define XM_RXE_CAR_ERR 0x033c /* 32 bit r/o Rx Carrier Event Error Cnt */
  149. #define XM_RXF_LEN_ERR 0x0340 /* 32 bit r/o Rx in Range Length Error */
  150. #define XM_RXE_SYM_ERR 0x0344 /* 32 bit r/o Rx Symbol Error Counter */
  151. #define XM_RXE_SHT_ERR 0x0348 /* 32 bit r/o Rx Short Event Error Cnt */
  152. #define XM_RXE_RUNT 0x034c /* 32 bit r/o Rx Runt Event Counter */
  153. #define XM_RXF_LNG_ERR 0x0350 /* 32 bit r/o Rx Frame too Long Error Cnt */
  154. #define XM_RXF_FCS_ERR 0x0354 /* 32 bit r/o Rx Frame Check Seq. Error Cnt */
  155. /* 0x0358 - 0x035a: reserved */
  156. #define XM_RXF_CEX_ERR 0x035c /* 32 bit r/o Rx Carrier Ext Error Frame Cnt*/
  157. #define XM_RXP_UTIL 0x0360 /* 32 bit r/o Rx Utilization in % */
  158. /* 0x0364 - 0x0366: reserved */
  159. #define XM_RXF_64B 0x0368 /* 32 bit r/o 64 Byte Rx Frame Counter */
  160. #define XM_RXF_127B 0x036c /* 32 bit r/o 65-127 Byte Rx Frame Counter */
  161. #define XM_RXF_255B 0x0370 /* 32 bit r/o 128-255 Byte Rx Frame Counter */
  162. #define XM_RXF_511B 0x0374 /* 32 bit r/o 256-511 Byte Rx Frame Counter */
  163. #define XM_RXF_1023B 0x0378 /* 32 bit r/o 512-1023 Byte Rx Frame Counter*/
  164. #define XM_RXF_MAX_SZ 0x037c /* 32 bit r/o 1024-MaxSize Byte Rx Frame Cnt*/
  165. /* 0x02e8 - 0x02fe: reserved */
  166. /*----------------------------------------------------------------------------*/
  167. /*
  168. * XMAC Bit Definitions
  169. *
  170. * If the bit access behaviour differs from the register access behaviour
  171. * (r/w, r/o) this is documented after the bit number.
  172. * The following bit access behaviours are used:
  173. * (sc) self clearing
  174. * (ro) read only
  175. */
  176. /* XM_MMU_CMD 16 bit r/w MMU Command Register */
  177. /* Bit 15..13: reserved */
  178. #define XM_MMU_PHY_RDY (1<<12) /* Bit 12: PHY Read Ready */
  179. #define XM_MMU_PHY_BUSY (1<<11) /* Bit 11: PHY Busy */
  180. #define XM_MMU_IGN_PF (1<<10) /* Bit 10: Ignore Pause Frame */
  181. #define XM_MMU_MAC_LB (1<<9) /* Bit 9: Enable MAC Loopback */
  182. /* Bit 8: reserved */
  183. #define XM_MMU_FRC_COL (1<<7) /* Bit 7: Force Collision */
  184. #define XM_MMU_SIM_COL (1<<6) /* Bit 6: Simulate Collision */
  185. #define XM_MMU_NO_PRE (1<<5) /* Bit 5: No MDIO Preamble */
  186. #define XM_MMU_GMII_FD (1<<4) /* Bit 4: GMII uses Full Duplex */
  187. #define XM_MMU_RAT_CTRL (1<<3) /* Bit 3: Enable Rate Control */
  188. #define XM_MMU_GMII_LOOP (1<<2) /* Bit 2: PHY is in Loopback Mode */
  189. #define XM_MMU_ENA_RX (1<<1) /* Bit 1: Enable Receiver */
  190. #define XM_MMU_ENA_TX (1<<0) /* Bit 0: Enable Transmitter */
  191. /* XM_TX_CMD 16 bit r/w Transmit Command Register */
  192. /* Bit 15..7: reserved */
  193. #define XM_TX_BK2BK (1<<6) /* Bit 6: Ignor Carrier Sense (Tx Bk2Bk)*/
  194. #define XM_TX_ENC_BYP (1<<5) /* Bit 5: Set Encoder in Bypass Mode */
  195. #define XM_TX_SAM_LINE (1<<4) /* Bit 4: (sc) Start utilization calculation */
  196. #define XM_TX_NO_GIG_MD (1<<3) /* Bit 3: Disable Carrier Extension */
  197. #define XM_TX_NO_PRE (1<<2) /* Bit 2: Disable Preamble Generation */
  198. #define XM_TX_NO_CRC (1<<1) /* Bit 1: Disable CRC Generation */
  199. #define XM_TX_AUTO_PAD (1<<0) /* Bit 0: Enable Automatic Padding */
  200. /* XM_TX_RT_LIM 16 bit r/w Transmit Retry Limit Register */
  201. /* Bit 15..5: reserved */
  202. #define XM_RT_LIM_MSK 0x1f /* Bit 4..0: Tx Retry Limit */
  203. /* XM_TX_STIME 16 bit r/w Transmit Slottime Register */
  204. /* Bit 15..7: reserved */
  205. #define XM_STIME_MSK 0x7f /* Bit 6..0: Tx Slottime bits */
  206. /* XM_TX_IPG 16 bit r/w Transmit Inter Packet Gap */
  207. /* Bit 15..8: reserved */
  208. #define XM_IPG_MSK 0xff /* Bit 7..0: IPG value bits */
  209. /* XM_RX_CMD 16 bit r/w Receive Command Register */
  210. /* Bit 15..9: reserved */
  211. #define XM_RX_LENERR_OK (1<<8) /* Bit 8 don't set Rx Err bit for */
  212. /* inrange error packets */
  213. #define XM_RX_BIG_PK_OK (1<<7) /* Bit 7 don't set Rx Err bit for */
  214. /* jumbo packets */
  215. #define XM_RX_IPG_CAP (1<<6) /* Bit 6 repl. type field with IPG */
  216. #define XM_RX_TP_MD (1<<5) /* Bit 5: Enable transparent Mode */
  217. #define XM_RX_STRIP_FCS (1<<4) /* Bit 4: Enable FCS Stripping */
  218. #define XM_RX_SELF_RX (1<<3) /* Bit 3: Enable Rx of own packets */
  219. #define XM_RX_SAM_LINE (1<<2) /* Bit 2: (sc) Start utilization calculation */
  220. #define XM_RX_STRIP_PAD (1<<1) /* Bit 1: Strip pad bytes of Rx frames */
  221. #define XM_RX_DIS_CEXT (1<<0) /* Bit 0: Disable carrier ext. check */
  222. /* XM_PHY_ADDR 16 bit r/w PHY Address Register */
  223. /* Bit 15..5: reserved */
  224. #define XM_PHY_ADDR_SZ 0x1f /* Bit 4..0: PHY Address bits */
  225. /* XM_GP_PORT 32 bit r/w General Purpose Port Register */
  226. /* Bit 31..7: reserved */
  227. #define XM_GP_ANIP (1L<<6) /* Bit 6: (ro) Auto-Neg. in progress */
  228. #define XM_GP_FRC_INT (1L<<5) /* Bit 5: (sc) Force Interrupt */
  229. /* Bit 4: reserved */
  230. #define XM_GP_RES_MAC (1L<<3) /* Bit 3: (sc) Reset MAC and FIFOs */
  231. #define XM_GP_RES_STAT (1L<<2) /* Bit 2: (sc) Reset the statistics module */
  232. /* Bit 1: reserved */
  233. #define XM_GP_INP_ASS (1L<<0) /* Bit 0: (ro) GP Input Pin asserted */
  234. /* XM_IMSK 16 bit r/w Interrupt Mask Register */
  235. /* XM_ISRC 16 bit r/o Interrupt Status Register */
  236. /* Bit 15: reserved */
  237. #define XM_IS_LNK_AE (1<<14) /* Bit 14: Link Asynchronous Event */
  238. #define XM_IS_TX_ABORT (1<<13) /* Bit 13: Transmit Abort, late Col. etc */
  239. #define XM_IS_FRC_INT (1<<12) /* Bit 12: Force INT bit set in GP */
  240. #define XM_IS_INP_ASS (1<<11) /* Bit 11: Input Asserted, GP bit 0 set */
  241. #define XM_IS_LIPA_RC (1<<10) /* Bit 10: Link Partner requests config */
  242. #define XM_IS_RX_PAGE (1<<9) /* Bit 9: Page Received */
  243. #define XM_IS_TX_PAGE (1<<8) /* Bit 8: Next Page Loaded for Transmit */
  244. #define XM_IS_AND (1<<7) /* Bit 7: Auto-Negotiation Done */
  245. #define XM_IS_TSC_OV (1<<6) /* Bit 6: Time Stamp Counter Overflow */
  246. #define XM_IS_RXC_OV (1<<5) /* Bit 5: Rx Counter Event Overflow */
  247. #define XM_IS_TXC_OV (1<<4) /* Bit 4: Tx Counter Event Overflow */
  248. #define XM_IS_RXF_OV (1<<3) /* Bit 3: Receive FIFO Overflow */
  249. #define XM_IS_TXF_UR (1<<2) /* Bit 2: Transmit FIFO Underrun */
  250. #define XM_IS_TX_COMP (1<<1) /* Bit 1: Frame Tx Complete */
  251. #define XM_IS_RX_COMP (1<<0) /* Bit 0: Frame Rx Complete */
  252. #define XM_DEF_MSK (~(XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE |\
  253. XM_IS_AND | XM_IS_RXC_OV | XM_IS_TXC_OV | XM_IS_TXF_UR))
  254. /* XM_HW_CFG 16 bit r/w Hardware Config Register */
  255. /* Bit 15.. 4: reserved */
  256. #define XM_HW_GEN_EOP (1<<3) /* Bit 3: generate End of Packet pulse */
  257. #define XM_HW_COM4SIG (1<<2) /* Bit 2: use Comma Detect for Sig. Det.*/
  258. /* Bit 1: reserved */
  259. #define XM_HW_GMII_MD (1<<0) /* Bit 0: GMII Interface selected */
  260. /* XM_TX_LO_WM 16 bit r/w Tx FIFO Low Water Mark */
  261. /* XM_TX_HI_WM 16 bit r/w Tx FIFO High Water Mark */
  262. /* Bit 15..10 reserved */
  263. #define XM_TX_WM_MSK 0x01ff /* Bit 9.. 0 Tx FIFO Watermark bits */
  264. /* XM_TX_THR 16 bit r/w Tx Request Threshold */
  265. /* XM_HT_THR 16 bit r/w Host Request Threshold */
  266. /* XM_RX_THR 16 bit r/w Rx Request Threshold */
  267. /* Bit 15..11 reserved */
  268. #define XM_THR_MSK 0x03ff /* Bit 10.. 0 Rx/Tx Request Threshold bits */
  269. /* XM_TX_STAT 32 bit r/o Tx Status LIFO Register */
  270. #define XM_ST_VALID (1UL<<31) /* Bit 31: Status Valid */
  271. #define XM_ST_BYTE_CNT (0x3fffL<<17) /* Bit 30..17: Tx frame Length */
  272. #define XM_ST_RETRY_CNT (0x1fL<<12) /* Bit 16..12: Retry Count */
  273. #define XM_ST_EX_COL (1L<<11) /* Bit 11: Excessive Collisions */
  274. #define XM_ST_EX_DEF (1L<<10) /* Bit 10: Excessive Deferral */
  275. #define XM_ST_BURST (1L<<9) /* Bit 9: p. xmitted in burst md*/
  276. #define XM_ST_DEFER (1L<<8) /* Bit 8: packet was defered */
  277. #define XM_ST_BC (1L<<7) /* Bit 7: Broadcast packet */
  278. #define XM_ST_MC (1L<<6) /* Bit 6: Multicast packet */
  279. #define XM_ST_UC (1L<<5) /* Bit 5: Unicast packet */
  280. #define XM_ST_TX_UR (1L<<4) /* Bit 4: FIFO Underrun occured */
  281. #define XM_ST_CS_ERR (1L<<3) /* Bit 3: Carrier Sense Error */
  282. #define XM_ST_LAT_COL (1L<<2) /* Bit 2: Late Collision Error */
  283. #define XM_ST_MUL_COL (1L<<1) /* Bit 1: Multiple Collisions */
  284. #define XM_ST_SGN_COL (1L<<0) /* Bit 0: Single Collision */
  285. /* XM_RX_LO_WM 16 bit r/w Receive Low Water Mark */
  286. /* XM_RX_HI_WM 16 bit r/w Receive High Water Mark */
  287. /* Bit 15..11: reserved */
  288. #define XM_RX_WM_MSK 0x03ff /* Bit 11.. 0: Rx FIFO Watermark bits */
  289. /* XM_DEV_ID 32 bit r/o Device ID Register */
  290. #define XM_DEV_OUI (0x00ffffffUL<<8) /* Bit 31..8: Device OUI */
  291. #define XM_DEV_REV (0x07L << 5) /* Bit 7..5: Chip Rev Num */
  292. /* XM_MODE 32 bit r/w Mode Register */
  293. /* Bit 31..27: reserved */
  294. #define XM_MD_ENA_REJ (1L<<26) /* Bit 26: Enable Frame Reject */
  295. #define XM_MD_SPOE_E (1L<<25) /* Bit 25: Send Pause on Edge */
  296. /* extern generated */
  297. #define XM_MD_TX_REP (1L<<24) /* Bit 24: Transmit Repeater Mode */
  298. #define XM_MD_SPOFF_I (1L<<23) /* Bit 23: Send Pause on FIFO full */
  299. /* intern generated */
  300. #define XM_MD_LE_STW (1L<<22) /* Bit 22: Rx Stat Word in Little Endian */
  301. #define XM_MD_TX_CONT (1L<<21) /* Bit 21: Send Continuous */
  302. #define XM_MD_TX_PAUSE (1L<<20) /* Bit 20: (sc) Send Pause Frame */
  303. #define XM_MD_ATS (1L<<19) /* Bit 19: Append Time Stamp */
  304. #define XM_MD_SPOL_I (1L<<18) /* Bit 18: Send Pause on Low */
  305. /* intern generated */
  306. #define XM_MD_SPOH_I (1L<<17) /* Bit 17: Send Pause on High */
  307. /* intern generated */
  308. #define XM_MD_CAP (1L<<16) /* Bit 16: Check Address Pair */
  309. #define XM_MD_ENA_HASH (1L<<15) /* Bit 15: Enable Hashing */
  310. #define XM_MD_CSA (1L<<14) /* Bit 14: Check Station Address */
  311. #define XM_MD_CAA (1L<<13) /* Bit 13: Check Address Array */
  312. #define XM_MD_RX_MCTRL (1L<<12) /* Bit 12: Rx MAC Control Frame */
  313. #define XM_MD_RX_RUNT (1L<<11) /* Bit 11: Rx Runt Frames */
  314. #define XM_MD_RX_IRLE (1L<<10) /* Bit 10: Rx in Range Len Err Frame */
  315. #define XM_MD_RX_LONG (1L<<9) /* Bit 9: Rx Long Frame */
  316. #define XM_MD_RX_CRCE (1L<<8) /* Bit 8: Rx CRC Error Frame */
  317. #define XM_MD_RX_ERR (1L<<7) /* Bit 7: Rx Error Frame */
  318. #define XM_MD_DIS_UC (1L<<6) /* Bit 6: Disable Rx Unicast */
  319. #define XM_MD_DIS_MC (1L<<5) /* Bit 5: Disable Rx Multicast */
  320. #define XM_MD_DIS_BC (1L<<4) /* Bit 4: Disable Rx Broadcast */
  321. #define XM_MD_ENA_PROM (1L<<3) /* Bit 3: Enable Promiscuous */
  322. #define XM_MD_ENA_BE (1L<<2) /* Bit 2: Enable Big Endian */
  323. #define XM_MD_FTF (1L<<1) /* Bit 1: (sc) Flush Tx FIFO */
  324. #define XM_MD_FRF (1L<<0) /* Bit 0: (sc) Flush Rx FIFO */
  325. #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I)
  326. #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\
  327. XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA | XM_MD_CAA)
  328. /* XM_STAT_CMD 16 bit r/w Statistics Command Register */
  329. /* Bit 16..6: reserved */
  330. #define XM_SC_SNP_RXC (1<<5) /* Bit 5: (sc) Snap Rx Counters */
  331. #define XM_SC_SNP_TXC (1<<4) /* Bit 4: (sc) Snap Tx Counters */
  332. #define XM_SC_CP_RXC (1<<3) /* Bit 3: Copy Rx Counters Continuously */
  333. #define XM_SC_CP_TXC (1<<2) /* Bit 2: Copy Tx Counters Continuously */
  334. #define XM_SC_CLR_RXC (1<<1) /* Bit 1: (sc) Clear Rx Counters */
  335. #define XM_SC_CLR_TXC (1<<0) /* Bit 0: (sc) Clear Tx Counters */
  336. /* XM_RX_CNT_EV 32 bit r/o Rx Counter Event Register */
  337. /* XM_RX_EV_MSK 32 bit r/w Rx Counter Event Mask */
  338. #define XMR_MAX_SZ_OV (1UL<<31) /* Bit 31: 1024-MaxSize Rx Cnt Ov*/
  339. #define XMR_1023B_OV (1L<<30) /* Bit 30: 512-1023Byte Rx Cnt Ov*/
  340. #define XMR_511B_OV (1L<<29) /* Bit 29: 256-511 Byte Rx Cnt Ov*/
  341. #define XMR_255B_OV (1L<<28) /* Bit 28: 128-255 Byte Rx Cnt Ov*/
  342. #define XMR_127B_OV (1L<<27) /* Bit 27: 65-127 Byte Rx Cnt Ov */
  343. #define XMR_64B_OV (1L<<26) /* Bit 26: 64 Byte Rx Cnt Ov */
  344. #define XMR_UTIL_OV (1L<<25) /* Bit 25: Rx Util Cnt Overflow */
  345. #define XMR_UTIL_UR (1L<<24) /* Bit 24: Rx Util Cnt Underrun */
  346. #define XMR_CEX_ERR_OV (1L<<23) /* Bit 23: CEXT Err Cnt Ov */
  347. /* Bit 22: reserved */
  348. #define XMR_FCS_ERR_OV (1L<<21) /* Bit 21: Rx FCS Error Cnt Ov */
  349. #define XMR_LNG_ERR_OV (1L<<20) /* Bit 20: Rx too Long Err Cnt Ov*/
  350. #define XMR_RUNT_OV (1L<<19) /* Bit 19: Runt Event Cnt Ov */
  351. #define XMR_SHT_ERR_OV (1L<<18) /* Bit 18: Rx Short Ev Err Cnt Ov*/
  352. #define XMR_SYM_ERR_OV (1L<<17) /* Bit 17: Rx Sym Err Cnt Ov */
  353. /* Bit 16: reserved */
  354. #define XMR_CAR_ERR_OV (1L<<15) /* Bit 15: Rx Carr Ev Err Cnt Ov */
  355. #define XMR_JAB_PKT_OV (1L<<14) /* Bit 14: Rx Jabb Packet Cnt Ov */
  356. #define XMR_FIFO_OV (1L<<13) /* Bit 13: Rx FIFO Ov Ev Cnt Ov */
  357. #define XMR_FRA_ERR_OV (1L<<12) /* Bit 12: Rx Framing Err Cnt Ov */
  358. #define XMR_FMISS_OV (1L<<11) /* Bit 11: Rx Missed Ev Cnt Ov */
  359. #define XMR_BURST (1L<<10) /* Bit 10: Rx Burst Event Cnt Ov */
  360. #define XMR_INV_MOC (1L<<9) /* Bit 9: Rx with inv. MAC OC Ov*/
  361. #define XMR_INV_MP (1L<<8) /* Bit 8: Rx inv Pause Frame Ov */
  362. #define XMR_MCTRL_OV (1L<<7) /* Bit 7: Rx MAC Ctrl-F Cnt Ov */
  363. #define XMR_MPAUSE_OV (1L<<6) /* Bit 6: Rx Pause MAC Ctrl-F Ov*/
  364. #define XMR_UC_OK_OV (1L<<5) /* Bit 5: Rx Unicast Frame CntOv*/
  365. #define XMR_MC_OK_OV (1L<<4) /* Bit 4: Rx Multicast Cnt Ov */
  366. #define XMR_BC_OK_OV (1L<<3) /* Bit 3: Rx Broadcast Cnt Ov */
  367. #define XMR_OK_LO_OV (1L<<2) /* Bit 2: Octets Rx OK Low CntOv*/
  368. #define XMR_OK_HI_OV (1L<<1) /* Bit 1: Octets Rx OK Hi Cnt Ov*/
  369. #define XMR_OK_OV (1L<<0) /* Bit 0: Frames Received Ok Ov */
  370. #define XMR_DEF_MSK (XMR_OK_LO_OV | XMR_OK_HI_OV)
  371. /* XM_TX_CNT_EV 32 bit r/o Tx Counter Event Register */
  372. /* XM_TX_EV_MSK 32 bit r/w Tx Counter Event Mask */
  373. /* Bit 31..26: reserved */
  374. #define XMT_MAX_SZ_OV (1L<<25) /* Bit 25: 1024-MaxSize Tx Cnt Ov*/
  375. #define XMT_1023B_OV (1L<<24) /* Bit 24: 512-1023Byte Tx Cnt Ov*/
  376. #define XMT_511B_OV (1L<<23) /* Bit 23: 256-511 Byte Tx Cnt Ov*/
  377. #define XMT_255B_OV (1L<<22) /* Bit 22: 128-255 Byte Tx Cnt Ov*/
  378. #define XMT_127B_OV (1L<<21) /* Bit 21: 65-127 Byte Tx Cnt Ov */
  379. #define XMT_64B_OV (1L<<20) /* Bit 20: 64 Byte Tx Cnt Ov */
  380. #define XMT_UTIL_OV (1L<<19) /* Bit 19: Tx Util Cnt Overflow */
  381. #define XMT_UTIL_UR (1L<<18) /* Bit 18: Tx Util Cnt Underrun */
  382. #define XMT_CS_ERR_OV (1L<<17) /* Bit 17: Tx Carr Sen Err Cnt Ov*/
  383. #define XMT_FIFO_UR_OV (1L<<16) /* Bit 16: Tx FIFO Ur Ev Cnt Ov */
  384. #define XMT_EX_DEF_OV (1L<<15) /* Bit 15: Tx Ex Deferall Cnt Ov */
  385. #define XMT_DEF (1L<<14) /* Bit 14: Tx Deferred Cnt Ov */
  386. #define XMT_LAT_COL_OV (1L<<13) /* Bit 13: Tx Late Col Cnt Ov */
  387. #define XMT_ABO_COL_OV (1L<<12) /* Bit 12: Tx abo dueto Ex Col Ov*/
  388. #define XMT_MUL_COL_OV (1L<<11) /* Bit 11: Tx Mult Col Cnt Ov */
  389. #define XMT_SNG_COL (1L<<10) /* Bit 10: Tx Single Col Cnt Ov */
  390. #define XMT_MCTRL_OV (1L<<9) /* Bit 9: Tx MAC Ctrl Counter Ov*/
  391. #define XMT_MPAUSE (1L<<8) /* Bit 8: Tx Pause MAC Ctrl-F Ov*/
  392. #define XMT_BURST (1L<<7) /* Bit 7: Tx Burst Event Cnt Ov */
  393. #define XMT_LONG (1L<<6) /* Bit 6: Tx Long Frame Cnt Ov */
  394. #define XMT_UC_OK_OV (1L<<5) /* Bit 5: Tx Unicast Cnt Ov */
  395. #define XMT_MC_OK_OV (1L<<4) /* Bit 4: Tx Multicast Cnt Ov */
  396. #define XMT_BC_OK_OV (1L<<3) /* Bit 3: Tx Broadcast Cnt Ov */
  397. #define XMT_OK_LO_OV (1L<<2) /* Bit 2: Octets Tx OK Low CntOv*/
  398. #define XMT_OK_HI_OV (1L<<1) /* Bit 1: Octets Tx OK Hi Cnt Ov*/
  399. #define XMT_OK_OV (1L<<0) /* Bit 0: Frames Tx Ok Ov */
  400. #define XMT_DEF_MSK (XMT_OK_LO_OV | XMT_OK_HI_OV)
  401. /*
  402. * Receive Frame Status Encoding
  403. */
  404. #define XMR_FS_LEN (0x3fffUL<<18) /* Bit 31..18: Rx Frame Length */
  405. #define XMR_FS_2L_VLAN (1L<<17) /* Bit 17: tagged wh 2Lev VLAN ID*/
  406. #define XMR_FS_1L_VLAN (1L<<16) /* Bit 16: tagged wh 1Lev VLAN ID*/
  407. #define XMR_FS_BC (1L<<15) /* Bit 15: Broadcast Frame */
  408. #define XMR_FS_MC (1L<<14) /* Bit 14: Multicast Frame */
  409. #define XMR_FS_UC (1L<<13) /* Bit 13: Unicast Frame */
  410. /* Bit 12: reserved */
  411. #define XMR_FS_BURST (1L<<11) /* Bit 11: Burst Mode */
  412. #define XMR_FS_CEX_ERR (1L<<10) /* Bit 10: Carrier Ext. Error */
  413. #define XMR_FS_802_3 (1L<<9) /* Bit 9: 802.3 Frame */
  414. #define XMR_FS_COL_ERR (1L<<8) /* Bit 8: Collision Error */
  415. #define XMR_FS_CAR_ERR (1L<<7) /* Bit 7: Carrier Event Error */
  416. #define XMR_FS_LEN_ERR (1L<<6) /* Bit 6: In-Range Length Error */
  417. #define XMR_FS_FRA_ERR (1L<<5) /* Bit 5: Framing Error */
  418. #define XMR_FS_RUNT (1L<<4) /* Bit 4: Runt Frame */
  419. #define XMR_FS_LNG_ERR (1L<<3) /* Bit 3: Giant (Jumbo) Frame */
  420. #define XMR_FS_FCS_ERR (1L<<2) /* Bit 2: Frame Check Sequ Err */
  421. #define XMR_FS_ERR (1L<<1) /* Bit 1: Frame Error */
  422. #define XMR_FS_MCTRL (1L<<0) /* Bit 0: MAC Control Packet */
  423. /*
  424. * XMR_FS_ERR will be set if
  425. * XMR_FS_FCS_ERR, XMR_FS_LNG_ERR, XMR_FS_RUNT,
  426. * XMR_FS_FRA_ERR, XMR_FS_LEN_ERR, or XMR_FS_CEX_ERR
  427. * is set. XMR_FS_LNG_ERR and XMR_FS_LEN_ERR will issue
  428. * XMR_FS_ERR unless the corresponding bit in the Receive Command
  429. * Register is set.
  430. */
  431. #define XMR_FS_ANY_ERR XMR_FS_ERR
  432. /*----------------------------------------------------------------------------*/
  433. /*
  434. * XMAC-PHY Registers, indirect addressed over the XMAC
  435. */
  436. #define PHY_XMAC_CTRL 0x00 /* 16 bit r/w PHY Control Register */
  437. #define PHY_XMAC_STAT 0x01 /* 16 bit r/w PHY Status Register */
  438. #define PHY_XMAC_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
  439. #define PHY_XMAC_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
  440. #define PHY_XMAC_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
  441. #define PHY_XMAC_AUNE_LP 0x05 /* 16 bit r/o Link Partner Abi Reg */
  442. #define PHY_XMAC_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
  443. #define PHY_XMAC_NEPG 0x07 /* 16 bit r/w Next Page Register */
  444. #define PHY_XMAC_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
  445. /* 0x09 - 0x0e: reserved */
  446. #define PHY_XMAC_EXT_STAT 0x0f /* 16 bit r/o Ext Status Register */
  447. #define PHY_XMAC_RES_ABI 0x10 /* 16 bit r/o PHY Resolved Ability */
  448. /*----------------------------------------------------------------------------*/
  449. /*
  450. * Broadcom-PHY Registers, indirect addressed over XMAC
  451. */
  452. #define PHY_BCOM_CTRL 0x00 /* 16 bit r/w PHY Control Register */
  453. #define PHY_BCOM_STAT 0x01 /* 16 bit r/o PHY Status Register */
  454. #define PHY_BCOM_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
  455. #define PHY_BCOM_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
  456. #define PHY_BCOM_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
  457. #define PHY_BCOM_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
  458. #define PHY_BCOM_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
  459. #define PHY_BCOM_NEPG 0x07 /* 16 bit r/w Next Page Register */
  460. #define PHY_BCOM_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
  461. /* Broadcom-specific registers */
  462. #define PHY_BCOM_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
  463. #define PHY_BCOM_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
  464. /* 0x0b - 0x0e: reserved */
  465. #define PHY_BCOM_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
  466. #define PHY_BCOM_P_EXT_CTRL 0x10 /* 16 bit r/w PHY Extended Ctrl Reg */
  467. #define PHY_BCOM_P_EXT_STAT 0x11 /* 16 bit r/o PHY Extended Stat Reg */
  468. #define PHY_BCOM_RE_CTR 0x12 /* 16 bit r/w Receive Error Counter */
  469. #define PHY_BCOM_FC_CTR 0x13 /* 16 bit r/w False Carrier Sense Cnt */
  470. #define PHY_BCOM_RNO_CTR 0x14 /* 16 bit r/w Receiver NOT_OK Cnt */
  471. /* 0x15 - 0x17: reserved */
  472. #define PHY_BCOM_AUX_CTRL 0x18 /* 16 bit r/w Auxiliary Control Reg */
  473. #define PHY_BCOM_AUX_STAT 0x19 /* 16 bit r/o Auxiliary Stat Summary */
  474. #define PHY_BCOM_INT_STAT 0x1a /* 16 bit r/o Interrupt Status Reg */
  475. #define PHY_BCOM_INT_MASK 0x1b /* 16 bit r/w Interrupt Mask Reg */
  476. /* 0x1c: reserved */
  477. /* 0x1d - 0x1f: test registers */
  478. /*----------------------------------------------------------------------------*/
  479. /*
  480. * Marvel-PHY Registers, indirect addressed over GMAC
  481. */
  482. #define PHY_MARV_CTRL 0x00 /* 16 bit r/w PHY Control Register */
  483. #define PHY_MARV_STAT 0x01 /* 16 bit r/o PHY Status Register */
  484. #define PHY_MARV_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
  485. #define PHY_MARV_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
  486. #define PHY_MARV_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
  487. #define PHY_MARV_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
  488. #define PHY_MARV_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
  489. #define PHY_MARV_NEPG 0x07 /* 16 bit r/w Next Page Register */
  490. #define PHY_MARV_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
  491. /* Marvel-specific registers */
  492. #define PHY_MARV_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Ctrl Reg */
  493. #define PHY_MARV_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
  494. /* 0x0b - 0x0e: reserved */
  495. #define PHY_MARV_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
  496. #define PHY_MARV_PHY_CTRL 0x10 /* 16 bit r/w PHY Specific Ctrl Reg */
  497. #define PHY_MARV_PHY_STAT 0x11 /* 16 bit r/o PHY Specific Stat Reg */
  498. #define PHY_MARV_INT_MASK 0x12 /* 16 bit r/w Interrupt Mask Reg */
  499. #define PHY_MARV_INT_STAT 0x13 /* 16 bit r/o Interrupt Status Reg */
  500. #define PHY_MARV_EXT_CTRL 0x14 /* 16 bit r/w Ext. PHY Specific Ctrl */
  501. #define PHY_MARV_RXE_CNT 0x15 /* 16 bit r/w Receive Error Counter */
  502. #define PHY_MARV_EXT_ADR 0x16 /* 16 bit r/w Ext. Ad. for Cable Diag. */
  503. /* 0x17: reserved */
  504. #define PHY_MARV_LED_CTRL 0x18 /* 16 bit r/w LED Control Reg */
  505. #define PHY_MARV_LED_OVER 0x19 /* 16 bit r/w Manual LED Override Reg */
  506. #define PHY_MARV_EXT_CTRL_2 0x1a /* 16 bit r/w Ext. PHY Specific Ctrl 2 */
  507. #define PHY_MARV_EXT_P_STAT 0x1b /* 16 bit r/w Ext. PHY Spec. Stat Reg */
  508. #define PHY_MARV_CABLE_DIAG 0x1c /* 16 bit r/o Cable Diagnostic Reg */
  509. /* 0x1d - 0x1f: reserved */
  510. /*----------------------------------------------------------------------------*/
  511. /*
  512. * Level One-PHY Registers, indirect addressed over XMAC
  513. */
  514. #define PHY_LONE_CTRL 0x00 /* 16 bit r/w PHY Control Register */
  515. #define PHY_LONE_STAT 0x01 /* 16 bit r/o PHY Status Register */
  516. #define PHY_LONE_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
  517. #define PHY_LONE_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
  518. #define PHY_LONE_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
  519. #define PHY_LONE_AUNE_LP 0x05 /* 16 bit r/o Link Part Ability Reg */
  520. #define PHY_LONE_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
  521. #define PHY_LONE_NEPG 0x07 /* 16 bit r/w Next Page Register */
  522. #define PHY_LONE_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner */
  523. /* Level One-specific registers */
  524. #define PHY_LONE_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg*/
  525. #define PHY_LONE_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
  526. /* 0x0b -0x0e: reserved */
  527. #define PHY_LONE_EXT_STAT 0x0f /* 16 bit r/o Extended Status Reg */
  528. #define PHY_LONE_PORT_CFG 0x10 /* 16 bit r/w Port Configuration Reg*/
  529. #define PHY_LONE_Q_STAT 0x11 /* 16 bit r/o Quick Status Reg */
  530. #define PHY_LONE_INT_ENAB 0x12 /* 16 bit r/w Interrupt Enable Reg */
  531. #define PHY_LONE_INT_STAT 0x13 /* 16 bit r/o Interrupt Status Reg */
  532. #define PHY_LONE_LED_CFG 0x14 /* 16 bit r/w LED Configuration Reg */
  533. #define PHY_LONE_PORT_CTRL 0x15 /* 16 bit r/w Port Control Reg */
  534. #define PHY_LONE_CIM 0x16 /* 16 bit r/o CIM Reg */
  535. /* 0x17 -0x1c: reserved */
  536. /*----------------------------------------------------------------------------*/
  537. /*
  538. * National-PHY Registers, indirect addressed over XMAC
  539. */
  540. #define PHY_NAT_CTRL 0x00 /* 16 bit r/w PHY Control Register */
  541. #define PHY_NAT_STAT 0x01 /* 16 bit r/w PHY Status Register */
  542. #define PHY_NAT_ID0 0x02 /* 16 bit r/o PHY ID0 Register */
  543. #define PHY_NAT_ID1 0x03 /* 16 bit r/o PHY ID1 Register */
  544. #define PHY_NAT_AUNE_ADV 0x04 /* 16 bit r/w Auto-Neg. Advertisement */
  545. #define PHY_NAT_AUNE_LP 0x05 /* 16 bit r/o Link Partner Ability Reg */
  546. #define PHY_NAT_AUNE_EXP 0x06 /* 16 bit r/o Auto-Neg. Expansion Reg */
  547. #define PHY_NAT_NEPG 0x07 /* 16 bit r/w Next Page Register */
  548. #define PHY_NAT_NEPG_LP 0x08 /* 16 bit r/o Next Page Link Partner Reg */
  549. /* National-specific registers */
  550. #define PHY_NAT_1000T_CTRL 0x09 /* 16 bit r/w 1000Base-T Control Reg */
  551. #define PHY_NAT_1000T_STAT 0x0a /* 16 bit r/o 1000Base-T Status Reg */
  552. /* 0x0b -0x0e: reserved */
  553. #define PHY_NAT_EXT_STAT 0x0f /* 16 bit r/o Extended Status Register */
  554. #define PHY_NAT_EXT_CTRL1 0x10 /* 16 bit r/o Extended Control Reg1 */
  555. #define PHY_NAT_Q_STAT1 0x11 /* 16 bit r/o Quick Status Reg1 */
  556. #define PHY_NAT_10B_OP 0x12 /* 16 bit r/o 10Base-T Operations Reg */
  557. #define PHY_NAT_EXT_CTRL2 0x13 /* 16 bit r/o Extended Control Reg1 */
  558. #define PHY_NAT_Q_STAT2 0x14 /* 16 bit r/o Quick Status Reg2 */
  559. /* 0x15 -0x18: reserved */
  560. #define PHY_NAT_PHY_ADDR 0x19 /* 16 bit r/o PHY Address Register */
  561. /*----------------------------------------------------------------------------*/
  562. /*
  563. * PHY bit definitions
  564. * Bits defined as PHY_X_..., PHY_B_..., PHY_L_... or PHY_N_... are
  565. * XMAC/Broadcom/LevelOne/National/Marvell-specific.
  566. * All other are general.
  567. */
  568. /***** PHY_XMAC_CTRL 16 bit r/w PHY Control Register *****/
  569. /***** PHY_BCOM_CTRL 16 bit r/w PHY Control Register *****/
  570. /***** PHY_MARV_CTRL 16 bit r/w PHY Status Register *****/
  571. /***** PHY_LONE_CTRL 16 bit r/w PHY Control Register *****/
  572. #define PHY_CT_RESET (1<<15) /* Bit 15: (sc) clear all PHY related regs */
  573. #define PHY_CT_LOOP (1<<14) /* Bit 14: enable Loopback over PHY */
  574. #define PHY_CT_SPS_LSB (1<<13) /* Bit 13: (BC,L1) Speed select, lower bit */
  575. #define PHY_CT_ANE (1<<12) /* Bit 12: Auto-Negotiation Enabled */
  576. #define PHY_CT_PDOWN (1<<11) /* Bit 11: (BC,L1) Power Down Mode */
  577. #define PHY_CT_ISOL (1<<10) /* Bit 10: (BC,L1) Isolate Mode */
  578. #define PHY_CT_RE_CFG (1<<9) /* Bit 9: (sc) Restart Auto-Negotiation */
  579. #define PHY_CT_DUP_MD (1<<8) /* Bit 8: Duplex Mode */
  580. #define PHY_CT_COL_TST (1<<7) /* Bit 7: (BC,L1) Collision Test enabled */
  581. #define PHY_CT_SPS_MSB (1<<6) /* Bit 6: (BC,L1) Speed select, upper bit */
  582. /* Bit 5..0: reserved */
  583. #define PHY_CT_SP1000 PHY_CT_SPS_MSB /* enable speed of 1000 Mbps */
  584. #define PHY_CT_SP100 PHY_CT_SPS_LSB /* enable speed of 100 Mbps */
  585. #define PHY_CT_SP10 (0) /* enable speed of 10 Mbps */
  586. /***** PHY_XMAC_STAT 16 bit r/w PHY Status Register *****/
  587. /***** PHY_BCOM_STAT 16 bit r/w PHY Status Register *****/
  588. /***** PHY_MARV_STAT 16 bit r/w PHY Status Register *****/
  589. /***** PHY_LONE_STAT 16 bit r/w PHY Status Register *****/
  590. /* Bit 15..9: reserved */
  591. /* (BC/L1) 100/10 Mbps cap bits ignored*/
  592. #define PHY_ST_EXT_ST (1<<8) /* Bit 8: Extended Status Present */
  593. /* Bit 7: reserved */
  594. #define PHY_ST_PRE_SUP (1<<6) /* Bit 6: (BC/L1) preamble suppression */
  595. #define PHY_ST_AN_OVER (1<<5) /* Bit 5: Auto-Negotiation Over */
  596. #define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occured */
  597. #define PHY_ST_AN_CAP (1<<3) /* Bit 3: Auto-Negotiation Capability */
  598. #define PHY_ST_LSYNC (1<<2) /* Bit 2: Link Synchronized */
  599. #define PHY_ST_JAB_DET (1<<1) /* Bit 1: (BC/L1) Jabber Detected */
  600. #define PHY_ST_EXT_REG (1<<0) /* Bit 0: Extended Register available */
  601. /***** PHY_XMAC_ID1 16 bit r/o PHY ID1 Register */
  602. /***** PHY_BCOM_ID1 16 bit r/o PHY ID1 Register */
  603. /***** PHY_MARV_ID1 16 bit r/o PHY ID1 Register */
  604. /***** PHY_LONE_ID1 16 bit r/o PHY ID1 Register */
  605. #define PHY_I1_OUI_MSK (0x3f<<10) /* Bit 15..10: Organization Unique ID */
  606. #define PHY_I1_MOD_NUM (0x3f<<4) /* Bit 9.. 4: Model Number */
  607. #define PHY_I1_REV_MSK 0x0f /* Bit 3.. 0: Revision Number */
  608. /* different Broadcom PHY Ids */
  609. #define PHY_BCOM_ID1_A1 0x6041
  610. #define PHY_BCOM_ID1_B2 0x6043
  611. #define PHY_BCOM_ID1_C0 0x6044
  612. #define PHY_BCOM_ID1_C5 0x6047
  613. /***** PHY_XMAC_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  614. /***** PHY_XMAC_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
  615. #define PHY_AN_NXT_PG (1<<15) /* Bit 15: Request Next Page */
  616. #define PHY_X_AN_ACK (1<<14) /* Bit 14: (ro) Acknowledge Received */
  617. #define PHY_X_AN_RFB (3<<12) /* Bit 13..12: Remote Fault Bits */
  618. /* Bit 11.. 9: reserved */
  619. #define PHY_X_AN_PAUSE (3<<7) /* Bit 8.. 7: Pause Bits */
  620. #define PHY_X_AN_HD (1<<6) /* Bit 6: Half Duplex */
  621. #define PHY_X_AN_FD (1<<5) /* Bit 5: Full Duplex */
  622. /* Bit 4.. 0: reserved */
  623. /***** PHY_BCOM_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  624. /***** PHY_BCOM_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
  625. /* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */
  626. /* Bit 14: reserved */
  627. #define PHY_B_AN_RF (1<<13) /* Bit 13: Remote Fault */
  628. /* Bit 12: reserved */
  629. #define PHY_B_AN_ASP (1<<11) /* Bit 11: Asymmetric Pause */
  630. #define PHY_B_AN_PC (1<<10) /* Bit 10: Pause Capable */
  631. /* Bit 9..5: 100/10 BT cap bits ingnored */
  632. #define PHY_B_AN_SEL 0x1f /* Bit 4..0: Selector Field, 00001=Ethernet*/
  633. /***** PHY_LONE_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  634. /***** PHY_LONE_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
  635. /* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */
  636. /* Bit 14: reserved */
  637. #define PHY_L_AN_RF (1<<13) /* Bit 13: Remote Fault */
  638. /* Bit 12: reserved */
  639. #define PHY_L_AN_ASP (1<<11) /* Bit 11: Asymmetric Pause */
  640. #define PHY_L_AN_PC (1<<10) /* Bit 10: Pause Capable */
  641. /* Bit 9..5: 100/10 BT cap bits ingnored */
  642. #define PHY_L_AN_SEL 0x1f /* Bit 4..0: Selector Field, 00001=Ethernet*/
  643. /***** PHY_NAT_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  644. /***** PHY_NAT_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
  645. /* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */
  646. /* Bit 14: reserved */
  647. #define PHY_N_AN_RF (1<<13) /* Bit 13: Remote Fault */
  648. /* Bit 12: reserved */
  649. #define PHY_N_AN_100F (1<<11) /* Bit 11: 100Base-T2 FD Support */
  650. #define PHY_N_AN_100H (1<<10) /* Bit 10: 100Base-T2 HD Support */
  651. /* Bit 9..5: 100/10 BT cap bits ingnored */
  652. #define PHY_N_AN_SEL 0x1f /* Bit 4..0: Selector Field, 00001=Ethernet*/
  653. /* field type definition for PHY_x_AN_SEL */
  654. #define PHY_SEL_TYPE 0x01 /* 00001 = Ethernet */
  655. /***** PHY_XMAC_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
  656. /* Bit 15..4: reserved */
  657. #define PHY_ANE_LP_NP (1<<3) /* Bit 3: Link Partner can Next Page */
  658. #define PHY_ANE_LOC_NP (1<<2) /* Bit 2: Local PHY can Next Page */
  659. #define PHY_ANE_RX_PG (1<<1) /* Bit 1: Page Received */
  660. /* Bit 0: reserved */
  661. /***** PHY_BCOM_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
  662. /***** PHY_LONE_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
  663. /***** PHY_MARV_AUNE_EXP 16 bit r/o Auto-Negotiation Expansion Reg *****/
  664. /* Bit 15..5: reserved */
  665. #define PHY_ANE_PAR_DF (1<<4) /* Bit 4: Parallel Detection Fault */
  666. /* PHY_ANE_LP_NP (see XMAC) Bit 3: Link Partner can Next Page */
  667. /* PHY_ANE_LOC_NP (see XMAC) Bit 2: Local PHY can Next Page */
  668. /* PHY_ANE_RX_PG (see XMAC) Bit 1: Page Received */
  669. #define PHY_ANE_LP_CAP (1<<0) /* Bit 0: Link Partner Auto-Neg. Cap. */
  670. /***** PHY_XMAC_NEPG 16 bit r/w Next Page Register *****/
  671. /***** PHY_BCOM_NEPG 16 bit r/w Next Page Register *****/
  672. /***** PHY_LONE_NEPG 16 bit r/w Next Page Register *****/
  673. /***** PHY_XMAC_NEPG_LP 16 bit r/o Next Page Link Partner *****/
  674. /***** PHY_BCOM_NEPG_LP 16 bit r/o Next Page Link Partner *****/
  675. /***** PHY_LONE_NEPG_LP 16 bit r/o Next Page Link Partner *****/
  676. #define PHY_NP_MORE (1<<15) /* Bit 15: More, Next Pages to follow */
  677. #define PHY_NP_ACK1 (1<<14) /* Bit 14: (ro) Ack1, for receiving a message */
  678. #define PHY_NP_MSG_VAL (1<<13) /* Bit 13: Message Page valid */
  679. #define PHY_NP_ACK2 (1<<12) /* Bit 12: Ack2, comply with msg content */
  680. #define PHY_NP_TOG (1<<11) /* Bit 11: Toggle Bit, ensure sync */
  681. #define PHY_NP_MSG 0x07ff /* Bit 10..0: Message from/to Link Partner */
  682. /*
  683. * XMAC-Specific
  684. */
  685. /***** PHY_XMAC_EXT_STAT 16 bit r/w Extended Status Register *****/
  686. #define PHY_X_EX_FD (1<<15) /* Bit 15: Device Supports Full Duplex */
  687. #define PHY_X_EX_HD (1<<14) /* Bit 14: Device Supports Half Duplex */
  688. /* Bit 13..0: reserved */
  689. /***** PHY_XMAC_RES_ABI 16 bit r/o PHY Resolved Ability *****/
  690. /* Bit 15..9: reserved */
  691. #define PHY_X_RS_PAUSE (3<<7) /* Bit 8..7: selected Pause Mode */
  692. #define PHY_X_RS_HD (1<<6) /* Bit 6: Half Duplex Mode selected */
  693. #define PHY_X_RS_FD (1<<5) /* Bit 5: Full Duplex Mode selected */
  694. #define PHY_X_RS_ABLMIS (1<<4) /* Bit 4: duplex or pause cap mismatch */
  695. #define PHY_X_RS_PAUMIS (1<<3) /* Bit 3: pause capability mismatch */
  696. /* Bit 2..0: reserved */
  697. /*
  698. * Remote Fault Bits (PHY_X_AN_RFB) encoding
  699. */
  700. #define X_RFB_OK (0<<12) /* Bit 13..12 No errors, Link OK */
  701. #define X_RFB_LF (1<<12) /* Bit 13..12 Link Failure */
  702. #define X_RFB_OFF (2<<12) /* Bit 13..12 Offline */
  703. #define X_RFB_AN_ERR (3<<12) /* Bit 13..12 Auto-Negotiation Error */
  704. /*
  705. * Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding
  706. */
  707. #define PHY_X_P_NO_PAUSE (0<<7) /* Bit 8..7: no Pause Mode */
  708. #define PHY_X_P_SYM_MD (1<<7) /* Bit 8..7: symmetric Pause Mode */
  709. #define PHY_X_P_ASYM_MD (2<<7) /* Bit 8..7: asymmetric Pause Mode */
  710. #define PHY_X_P_BOTH_MD (3<<7) /* Bit 8..7: both Pause Mode */
  711. /*
  712. * Broadcom-Specific
  713. */
  714. /***** PHY_BCOM_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  715. #define PHY_B_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */
  716. #define PHY_B_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */
  717. #define PHY_B_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */
  718. #define PHY_B_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */
  719. #define PHY_B_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */
  720. #define PHY_B_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */
  721. /* Bit 7..0: reserved */
  722. /***** PHY_BCOM_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  723. /***** PHY_MARV_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  724. #define PHY_B_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */
  725. #define PHY_B_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */
  726. #define PHY_B_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */
  727. #define PHY_B_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status */
  728. #define PHY_B_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */
  729. #define PHY_B_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */
  730. /* Bit 9..8: reserved */
  731. #define PHY_B_1000S_IEC 0xff /* Bit 7..0: Idle Error Count */
  732. /***** PHY_BCOM_EXT_STAT 16 bit r/o Extended Status Register *****/
  733. #define PHY_B_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */
  734. #define PHY_B_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */
  735. #define PHY_B_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */
  736. #define PHY_B_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */
  737. /* Bit 11..0: reserved */
  738. /***** PHY_BCOM_P_EXT_CTRL 16 bit r/w PHY Extended Control Reg *****/
  739. #define PHY_B_PEC_MAC_PHY (1<<15) /* Bit 15: 10BIT/GMI-Interface */
  740. #define PHY_B_PEC_DIS_CROSS (1<<14) /* Bit 14: Disable MDI Crossover */
  741. #define PHY_B_PEC_TX_DIS (1<<13) /* Bit 13: Tx output Disabled */
  742. #define PHY_B_PEC_INT_DIS (1<<12) /* Bit 12: Interrupts Disabled */
  743. #define PHY_B_PEC_F_INT (1<<11) /* Bit 11: Force Interrupt */
  744. #define PHY_B_PEC_BY_45 (1<<10) /* Bit 10: Bypass 4B5B-Decoder */
  745. #define PHY_B_PEC_BY_SCR (1<<9) /* Bit 9: Bypass Scrambler */
  746. #define PHY_B_PEC_BY_MLT3 (1<<8) /* Bit 8: Bypass MLT3 Encoder */
  747. #define PHY_B_PEC_BY_RXA (1<<7) /* Bit 7: Bypass Rx Alignm. */
  748. #define PHY_B_PEC_RES_SCR (1<<6) /* Bit 6: Reset Scrambler */
  749. #define PHY_B_PEC_EN_LTR (1<<5) /* Bit 5: Ena LED Traffic Mode */
  750. #define PHY_B_PEC_LED_ON (1<<4) /* Bit 4: Force LED's on */
  751. #define PHY_B_PEC_LED_OFF (1<<3) /* Bit 3: Force LED's off */
  752. #define PHY_B_PEC_EX_IPG (1<<2) /* Bit 2: Extend Tx IPG Mode */
  753. #define PHY_B_PEC_3_LED (1<<1) /* Bit 1: Three Link LED mode */
  754. #define PHY_B_PEC_HIGH_LA (1<<0) /* Bit 0: GMII FIFO Elasticy */
  755. /***** PHY_BCOM_P_EXT_STAT 16 bit r/o PHY Extended Status Reg *****/
  756. /* Bit 15..14: reserved */
  757. #define PHY_B_PES_CROSS_STAT (1<<13) /* Bit 13: MDI Crossover Status */
  758. #define PHY_B_PES_INT_STAT (1<<12) /* Bit 12: Interrupt Status */
  759. #define PHY_B_PES_RRS (1<<11) /* Bit 11: Remote Receiver Stat. */
  760. #define PHY_B_PES_LRS (1<<10) /* Bit 10: Local Receiver Stat. */
  761. #define PHY_B_PES_LOCKED (1<<9) /* Bit 9: Locked */
  762. #define PHY_B_PES_LS (1<<8) /* Bit 8: Link Status */
  763. #define PHY_B_PES_RF (1<<7) /* Bit 7: Remote Fault */
  764. #define PHY_B_PES_CE_ER (1<<6) /* Bit 6: Carrier Ext Error */
  765. #define PHY_B_PES_BAD_SSD (1<<5) /* Bit 5: Bad SSD */
  766. #define PHY_B_PES_BAD_ESD (1<<4) /* Bit 4: Bad ESD */
  767. #define PHY_B_PES_RX_ER (1<<3) /* Bit 3: Receive Error */
  768. #define PHY_B_PES_TX_ER (1<<2) /* Bit 2: Transmit Error */
  769. #define PHY_B_PES_LOCK_ER (1<<1) /* Bit 1: Lock Error */
  770. #define PHY_B_PES_MLT3_ER (1<<0) /* Bit 0: MLT3 code Error */
  771. /***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/
  772. /* Bit 15..8: reserved */
  773. #define PHY_B_FC_CTR 0xff /* Bit 7..0: False Carrier Counter */
  774. /***** PHY_BCOM_RNO_CTR 16 bit r/w Receive NOT_OK Counter *****/
  775. #define PHY_B_RC_LOC_MSK 0xff00 /* Bit 15..8: Local Rx NOT_OK cnt */
  776. #define PHY_B_RC_REM_MSK 0x00ff /* Bit 7..0: Remote Rx NOT_OK cnt */
  777. /***** PHY_BCOM_AUX_CTRL 16 bit r/w Auxiliary Control Reg *****/
  778. #define PHY_B_AC_L_SQE (1<<15) /* Bit 15: Low Squelch */
  779. #define PHY_B_AC_LONG_PACK (1<<14) /* Bit 14: Rx Long Packets */
  780. #define PHY_B_AC_ER_CTRL (3<<12) /* Bit 13..12: Edgerate Control */
  781. /* Bit 11: reserved */
  782. #define PHY_B_AC_TX_TST (1<<10) /* Bit 10: Tx test bit, always 1 */
  783. /* Bit 9.. 8: reserved */
  784. #define PHY_B_AC_DIS_PRF (1<<7) /* Bit 7: dis part resp filter */
  785. /* Bit 6: reserved */
  786. #define PHY_B_AC_DIS_PM (1<<5) /* Bit 5: dis power management */
  787. /* Bit 4: reserved */
  788. #define PHY_B_AC_DIAG (1<<3) /* Bit 3: Diagnostic Mode */
  789. /* Bit 2.. 0: reserved */
  790. /***** PHY_BCOM_AUX_STAT 16 bit r/o Auxiliary Status Reg *****/
  791. #define PHY_B_AS_AN_C (1<<15) /* Bit 15: AutoNeg complete */
  792. #define PHY_B_AS_AN_CA (1<<14) /* Bit 14: AN Complete Ack */
  793. #define PHY_B_AS_ANACK_D (1<<13) /* Bit 13: AN Ack Detect */
  794. #define PHY_B_AS_ANAB_D (1<<12) /* Bit 12: AN Ability Detect */
  795. #define PHY_B_AS_NPW (1<<11) /* Bit 11: AN Next Page Wait */
  796. #define PHY_B_AS_AN_RES_MSK (7<<8) /* Bit 10..8: AN HDC */
  797. #define PHY_B_AS_PDF (1<<7) /* Bit 7: Parallel Detect. Fault */
  798. #define PHY_B_AS_RF (1<<6) /* Bit 6: Remote Fault */
  799. #define PHY_B_AS_ANP_R (1<<5) /* Bit 5: AN Page Received */
  800. #define PHY_B_AS_LP_ANAB (1<<4) /* Bit 4: LP AN Ability */
  801. #define PHY_B_AS_LP_NPAB (1<<3) /* Bit 3: LP Next Page Ability */
  802. #define PHY_B_AS_LS (1<<2) /* Bit 2: Link Status */
  803. #define PHY_B_AS_PRR (1<<1) /* Bit 1: Pause Resolution-Rx */
  804. #define PHY_B_AS_PRT (1<<0) /* Bit 0: Pause Resolution-Tx */
  805. #define PHY_B_AS_PAUSE_MSK (PHY_B_AS_PRR | PHY_B_AS_PRT)
  806. /***** PHY_BCOM_INT_STAT 16 bit r/o Interrupt Status Reg *****/
  807. /***** PHY_BCOM_INT_MASK 16 bit r/w Interrupt Mask Reg *****/
  808. /* Bit 15: reserved */
  809. #define PHY_B_IS_PSE (1<<14) /* Bit 14: Pair Swap Error */
  810. #define PHY_B_IS_MDXI_SC (1<<13) /* Bit 13: MDIX Status Change */
  811. #define PHY_B_IS_HCT (1<<12) /* Bit 12: counter above 32k */
  812. #define PHY_B_IS_LCT (1<<11) /* Bit 11: counter above 128 */
  813. #define PHY_B_IS_AN_PR (1<<10) /* Bit 10: Page Received */
  814. #define PHY_B_IS_NO_HDCL (1<<9) /* Bit 9: No HCD Link */
  815. #define PHY_B_IS_NO_HDC (1<<8) /* Bit 8: No HCD */
  816. #define PHY_B_IS_NEG_USHDC (1<<7) /* Bit 7: Negotiated Unsup. HCD */
  817. #define PHY_B_IS_SCR_S_ER (1<<6) /* Bit 6: Scrambler Sync Error */
  818. #define PHY_B_IS_RRS_CHANGE (1<<5) /* Bit 5: Remote Rx Stat Change */
  819. #define PHY_B_IS_LRS_CHANGE (1<<4) /* Bit 4: Local Rx Stat Change */
  820. #define PHY_B_IS_DUP_CHANGE (1<<3) /* Bit 3: Duplex Mode Change */
  821. #define PHY_B_IS_LSP_CHANGE (1<<2) /* Bit 2: Link Speed Change */
  822. #define PHY_B_IS_LST_CHANGE (1<<1) /* Bit 1: Link Status Changed */
  823. #define PHY_B_IS_CRC_ER (1<<0) /* Bit 0: CRC Error */
  824. #define PHY_B_DEF_MSK (~(PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE))
  825. /* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */
  826. #define PHY_B_P_NO_PAUSE (0<<10) /* Bit 11..10: no Pause Mode */
  827. #define PHY_B_P_SYM_MD (1<<10) /* Bit 11..10: symmetric Pause Mode */
  828. #define PHY_B_P_ASYM_MD (2<<10) /* Bit 11..10: asymmetric Pause Mode */
  829. #define PHY_B_P_BOTH_MD (3<<10) /* Bit 11..10: both Pause Mode */
  830. /*
  831. * Resolved Duplex mode and Capabilities (Aux Status Summary Reg)
  832. */
  833. #define PHY_B_RES_1000FD (7<<8) /* Bit 10..8: 1000Base-T Full Dup. */
  834. #define PHY_B_RES_1000HD (6<<8) /* Bit 10..8: 1000Base-T Half Dup. */
  835. /* others: 100/10: invalid for us */
  836. /*
  837. * Level One-Specific
  838. */
  839. /***** PHY_LONE_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  840. #define PHY_L_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */
  841. #define PHY_L_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */
  842. #define PHY_L_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */
  843. #define PHY_L_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */
  844. #define PHY_L_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */
  845. #define PHY_L_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */
  846. /* Bit 7..0: reserved */
  847. /***** PHY_LONE_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  848. #define PHY_L_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */
  849. #define PHY_L_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */
  850. #define PHY_L_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */
  851. #define PHY_L_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status */
  852. #define PHY_L_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */
  853. #define PHY_L_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */
  854. /* Bit 9..8: reserved */
  855. #define PHY_B_1000S_IEC 0xff /* Bit 7..0: Idle Error Count */
  856. /***** PHY_LONE_EXT_STAT 16 bit r/o Extended Status Register *****/
  857. #define PHY_L_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */
  858. #define PHY_L_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */
  859. #define PHY_L_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */
  860. #define PHY_L_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */
  861. /* Bit 11..0: reserved */
  862. /***** PHY_LONE_PORT_CFG 16 bit r/w Port Configuration Reg *****/
  863. #define PHY_L_PC_REP_MODE (1<<15) /* Bit 15: Repeater Mode */
  864. /* Bit 14: reserved */
  865. #define PHY_L_PC_TX_DIS (1<<13) /* Bit 13: Tx output Disabled */
  866. #define PHY_L_PC_BY_SCR (1<<12) /* Bit 12: Bypass Scrambler */
  867. #define PHY_L_PC_BY_45 (1<<11) /* Bit 11: Bypass 4B5B-Decoder */
  868. #define PHY_L_PC_JAB_DIS (1<<10) /* Bit 10: Jabber Disabled */
  869. #define PHY_L_PC_SQE (1<<9) /* Bit 9: Enable Heartbeat */
  870. #define PHY_L_PC_TP_LOOP (1<<8) /* Bit 8: TP Loopback */
  871. #define PHY_L_PC_SSS (1<<7) /* Bit 7: Smart Speed Selection */
  872. #define PHY_L_PC_FIFO_SIZE (1<<6) /* Bit 6: FIFO Size */
  873. #define PHY_L_PC_PRE_EN (1<<5) /* Bit 5: Preamble Enable */
  874. #define PHY_L_PC_CIM (1<<4) /* Bit 4: Carrier Integrity Mon */
  875. #define PHY_L_PC_10_SER (1<<3) /* Bit 3: Use Serial Output */
  876. #define PHY_L_PC_ANISOL (1<<2) /* Bit 2: Unisolate Port */
  877. #define PHY_L_PC_TEN_BIT (1<<1) /* Bit 1: 10bit iface mode on */
  878. #define PHY_L_PC_ALTCLOCK (1<<0) /* Bit 0: (ro) ALTCLOCK Mode on */
  879. /***** PHY_LONE_Q_STAT 16 bit r/o Quick Status Reg *****/
  880. #define PHY_L_QS_D_RATE (3<<14) /* Bit 15..14: Data Rate */
  881. #define PHY_L_QS_TX_STAT (1<<13) /* Bit 13: Transmitting */
  882. #define PHY_L_QS_RX_STAT (1<<12) /* Bit 12: Receiving */
  883. #define PHY_L_QS_COL_STAT (1<<11) /* Bit 11: Collision */
  884. #define PHY_L_QS_L_STAT (1<<10) /* Bit 10: Link is up */
  885. #define PHY_L_QS_DUP_MOD (1<<9) /* Bit 9: Full/Half Duplex */
  886. #define PHY_L_QS_AN (1<<8) /* Bit 8: AutoNeg is On */
  887. #define PHY_L_QS_AN_C (1<<7) /* Bit 7: AN is Complete */
  888. #define PHY_L_QS_LLE (7<<4) /* Bit 6: Line Length Estim. */
  889. #define PHY_L_QS_PAUSE (1<<3) /* Bit 3: LP advertised Pause */
  890. #define PHY_L_QS_AS_PAUSE (1<<2) /* Bit 2: LP adv. asym. Pause */
  891. #define PHY_L_QS_ISOLATE (1<<1) /* Bit 1: CIM Isolated */
  892. #define PHY_L_QS_EVENT (1<<0) /* Bit 0: Event has occurred */
  893. /***** PHY_LONE_INT_ENAB 16 bit r/w Interrupt Enable Reg *****/
  894. /***** PHY_LONE_INT_STAT 16 bit r/o Interrupt Status Reg *****/
  895. /* Bit 15..14: reserved */
  896. #define PHY_L_IS_AN_F (1<<13) /* Bit 13: Auto-Negotiation fault */
  897. /* Bit 12: not described */
  898. #define PHY_L_IS_CROSS (1<<11) /* Bit 11: Crossover used */
  899. #define PHY_L_IS_POL (1<<10) /* Bit 10: Polarity correct. used */
  900. #define PHY_L_IS_SS (1<<9) /* Bit 9: Smart Speed Downgrade */
  901. #define PHY_L_IS_CFULL (1<<8) /* Bit 8: Counter Full */
  902. #define PHY_L_IS_AN_C (1<<7) /* Bit 7: AutoNeg Complete */
  903. #define PHY_L_IS_SPEED (1<<6) /* Bit 6: Speed Changed */
  904. #define PHY_L_IS_DUP (1<<5) /* Bit 5: Duplex Changed */
  905. #define PHY_L_IS_LS (1<<4) /* Bit 4: Link Status Changed */
  906. #define PHY_L_IS_ISOL (1<<3) /* Bit 3: Isolate Occured */
  907. #define PHY_L_IS_MDINT (1<<2) /* Bit 2: (ro) STAT: MII Int Pending */
  908. #define PHY_L_IS_INTEN (1<<1) /* Bit 1: ENAB: Enable IRQs */
  909. #define PHY_L_IS_FORCE (1<<0) /* Bit 0: ENAB: Force Interrupt */
  910. /* int. mask */
  911. #define PHY_L_DEF_MSK (PHY_L_IS_LS | PHY_L_IS_ISOL | PHY_L_IS_INTEN)
  912. /***** PHY_LONE_LED_CFG 16 bit r/w LED Configuration Reg *****/
  913. #define PHY_L_LC_LEDC (3<<14) /* Bit 15..14: Col/Blink/On/Off */
  914. #define PHY_L_LC_LEDR (3<<12) /* Bit 13..12: Rx/Blink/On/Off */
  915. #define PHY_L_LC_LEDT (3<<10) /* Bit 11..10: Tx/Blink/On/Off */
  916. #define PHY_L_LC_LEDG (3<<8) /* Bit 9..8: Giga/Blink/On/Off */
  917. #define PHY_L_LC_LEDS (3<<6) /* Bit 7..6: 10-100/Blink/On/Off */
  918. #define PHY_L_LC_LEDL (3<<4) /* Bit 5..4: Link/Blink/On/Off */
  919. #define PHY_L_LC_LEDF (3<<2) /* Bit 3..2: Duplex/Blink/On/Off */
  920. #define PHY_L_LC_PSTRECH (1<<1) /* Bit 1: Strech LED Pulses */
  921. #define PHY_L_LC_FREQ (1<<0) /* Bit 0: 30/100 ms */
  922. /***** PHY_LONE_PORT_CTRL 16 bit r/w Port Control Reg *****/
  923. #define PHY_L_PC_TX_TCLK (1<<15) /* Bit 15: Enable TX_TCLK */
  924. /* Bit 14: reserved */
  925. #define PHY_L_PC_ALT_NP (1<<13) /* Bit 14: Alternate Next Page */
  926. #define PHY_L_PC_GMII_ALT (1<<12) /* Bit 13: Alternate GMII driver */
  927. /* Bit 11: reserved */
  928. #define PHY_L_PC_TEN_CRS (1<<10) /* Bit 10: Extend CRS*/
  929. /* Bit 9..0: not described */
  930. /***** PHY_LONE_CIM 16 bit r/o CIM Reg *****/
  931. #define PHY_L_CIM_ISOL (255<<8)/* Bit 15..8: Isolate Count */
  932. #define PHY_L_CIM_FALSE_CAR (255<<0)/* Bit 7..0: False Carrier Count */
  933. /*
  934. * Pause Bits (PHY_L_AN_ASP and PHY_L_AN_PC) encoding
  935. */
  936. #define PHY_L_P_NO_PAUSE (0<<10) /* Bit 11..10: no Pause Mode */
  937. #define PHY_L_P_SYM_MD (1<<10) /* Bit 11..10: symmetric Pause Mode */
  938. #define PHY_L_P_ASYM_MD (2<<10) /* Bit 11..10: asymmetric Pause Mode */
  939. #define PHY_L_P_BOTH_MD (3<<10) /* Bit 11..10: both Pause Mode */
  940. /*
  941. * National-Specific
  942. */
  943. /***** PHY_NAT_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  944. #define PHY_N_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */
  945. #define PHY_N_1000C_MSE (1<<12) /* Bit 12: Master/Slave Enable */
  946. #define PHY_N_1000C_MSC (1<<11) /* Bit 11: M/S Configuration */
  947. #define PHY_N_1000C_RD (1<<10) /* Bit 10: Repeater/DTE */
  948. #define PHY_N_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */
  949. #define PHY_N_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */
  950. #define PHY_N_1000C_APC (1<<7) /* Bit 7: Asymmetric Pause Cap. */
  951. /* Bit 6..0: reserved */
  952. /***** PHY_NAT_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  953. #define PHY_N_1000S_MSF (1<<15) /* Bit 15: Master/Slave Fault */
  954. #define PHY_N_1000S_MSR (1<<14) /* Bit 14: Master/Slave Result */
  955. #define PHY_N_1000S_LRS (1<<13) /* Bit 13: Local Receiver Status */
  956. #define PHY_N_1000S_RRS (1<<12) /* Bit 12: Remote Receiver Status*/
  957. #define PHY_N_1000S_LP_FD (1<<11) /* Bit 11: Link Partner can FD */
  958. #define PHY_N_1000S_LP_HD (1<<10) /* Bit 10: Link Partner can HD */
  959. #define PHY_N_1000C_LP_APC (1<<9) /* Bit 9: LP Asym. Pause Cap. */
  960. /* Bit 8: reserved */
  961. #define PHY_N_1000S_IEC 0xff /* Bit 7..0: Idle Error Count */
  962. /***** PHY_NAT_EXT_STAT 16 bit r/o Extended Status Register *****/
  963. #define PHY_N_ES_X_FD_CAP (1<<15) /* Bit 15: 1000Base-X FD capable */
  964. #define PHY_N_ES_X_HD_CAP (1<<14) /* Bit 14: 1000Base-X HD capable */
  965. #define PHY_N_ES_T_FD_CAP (1<<13) /* Bit 13: 1000Base-T FD capable */
  966. #define PHY_N_ES_T_HD_CAP (1<<12) /* Bit 12: 1000Base-T HD capable */
  967. /* Bit 11..0: reserved */
  968. /* todo: those are still missing */
  969. /***** PHY_NAT_EXT_CTRL1 16 bit r/o Extended Control Reg1 *****/
  970. /***** PHY_NAT_Q_STAT1 16 bit r/o Quick Status Reg1 *****/
  971. /***** PHY_NAT_10B_OP 16 bit r/o 10Base-T Operations Reg *****/
  972. /***** PHY_NAT_EXT_CTRL2 16 bit r/o Extended Control Reg1 *****/
  973. /***** PHY_NAT_Q_STAT2 16 bit r/o Quick Status Reg2 *****/
  974. /***** PHY_NAT_PHY_ADDR 16 bit r/o PHY Address Register *****/
  975. /*
  976. * Marvell-Specific
  977. */
  978. /***** PHY_MARV_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  979. /***** PHY_MARV_AUNE_LP 16 bit r/w Link Part Ability Reg *****/
  980. #define PHY_M_AN_NXT_PG BIT_15 /* Request Next Page */
  981. #define PHY_M_AN_ACK BIT_14 /* (ro) Acknowledge Received */
  982. #define PHY_M_AN_RF BIT_13 /* Remote Fault */
  983. /* Bit 12: reserved */
  984. #define PHY_M_AN_ASP BIT_11 /* Asymmetric Pause */
  985. #define PHY_M_AN_PC BIT_10 /* MAC Pause implemented */
  986. #define PHY_M_AN_100_FD BIT_8 /* Advertise 100Base-TX Full Duplex */
  987. #define PHY_M_AN_100_HD BIT_7 /* Advertise 100Base-TX Half Duplex */
  988. #define PHY_M_AN_10_FD BIT_6 /* Advertise 10Base-TX Full Duplex */
  989. #define PHY_M_AN_10_HD BIT_5 /* Advertise 10Base-TX Half Duplex */
  990. /* special defines for FIBER (88E1011S only) */
  991. #define PHY_M_AN_ASP_X BIT_8 /* Asymmetric Pause */
  992. #define PHY_M_AN_PC_X BIT_7 /* MAC Pause implemented */
  993. #define PHY_M_AN_1000X_AHD BIT_6 /* Advertise 10000Base-X Half Duplex */
  994. #define PHY_M_AN_1000X_AFD BIT_5 /* Advertise 10000Base-X Full Duplex */
  995. /* Pause Bits (PHY_M_AN_ASP_X and PHY_M_AN_PC_X) encoding */
  996. #define PHY_M_P_NO_PAUSE_X (0<<7) /* Bit 8.. 7: no Pause Mode */
  997. #define PHY_M_P_SYM_MD_X (1<<7) /* Bit 8.. 7: symmetric Pause Mode */
  998. #define PHY_M_P_ASYM_MD_X (2<<7) /* Bit 8.. 7: asymmetric Pause Mode */
  999. #define PHY_M_P_BOTH_MD_X (3<<7) /* Bit 8.. 7: both Pause Mode */
  1000. /***** PHY_MARV_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  1001. #define PHY_M_1000C_TEST (7<<13) /* Bit 15..13: Test Modes */
  1002. #define PHY_M_1000C_MSE (1<<12) /* Bit 12: Manual Master/Slave Enable */
  1003. #define PHY_M_1000C_MSC (1<<11) /* Bit 11: M/S Configuration (1=Master) */
  1004. #define PHY_M_1000C_MPD (1<<10) /* Bit 10: Multi-Port Device */
  1005. #define PHY_M_1000C_AFD (1<<9) /* Bit 9: Advertise Full Duplex */
  1006. #define PHY_M_1000C_AHD (1<<8) /* Bit 8: Advertise Half Duplex */
  1007. /* Bit 7..0: reserved */
  1008. /***** PHY_MARV_PHY_CTRL 16 bit r/w PHY Specific Ctrl Reg *****/
  1009. #define PHY_M_PC_TX_FFD_MSK (3<<14) /* Bit 15..14: Tx FIFO Depth Mask */
  1010. #define PHY_M_PC_RX_FFD_MSK (3<<12) /* Bit 13..12: Rx FIFO Depth Mask */
  1011. #define PHY_M_PC_ASS_CRS_TX (1<<11) /* Bit 11: Assert CRS on Transmit */
  1012. #define PHY_M_PC_FL_GOOD (1<<10) /* Bit 10: Force Link Good */
  1013. #define PHY_M_PC_EN_DET_MSK (3<<8) /* Bit 9.. 8: Energy Detect Mask */
  1014. #define PHY_M_PC_ENA_EXT_D (1<<7) /* Bit 7: Enable Ext. Distance (10BT) */
  1015. #define PHY_M_PC_MDIX_MSK (3<<5) /* Bit 6.. 5: MDI/MDIX Config. Mask */
  1016. #define PHY_M_PC_DIS_125CLK (1<<4) /* Bit 4: Disable 125 CLK */
  1017. #define PHY_M_PC_MAC_POW_UP (1<<3) /* Bit 3: MAC Power up */
  1018. #define PHY_M_PC_SQE_T_ENA (1<<2) /* Bit 2: SQE Test Enabled */
  1019. #define PHY_M_PC_POL_R_DIS (1<<1) /* Bit 1: Polarity Reversal Disabled */
  1020. #define PHY_M_PC_DIS_JABBER (1<<0) /* Bit 0: Disable Jabber */
  1021. #define PHY_M_PC_EN_DET SHIFT8(2) /* Energy Detect (Mode 1) */
  1022. #define PHY_M_PC_EN_DET_PLUS SHIFT8(3) /* Energy Detect Plus (Mode 2) */
  1023. #define PHY_M_PC_MDI_XMODE(x) SHIFT5(x)
  1024. #define PHY_M_PC_MAN_MDI 0 /* 00 = Manual MDI configuration */
  1025. #define PHY_M_PC_MAN_MDIX 1 /* 01 = Manual MDIX configuration */
  1026. #define PHY_M_PC_ENA_AUTO 3 /* 11 = Enable Automatic Crossover */
  1027. /***** PHY_MARV_PHY_STAT 16 bit r/o PHY Specific Status Reg *****/
  1028. #define PHY_M_PS_SPEED_MSK (3<<14) /* Bit 15..14: Speed Mask */
  1029. #define PHY_M_PS_SPEED_1000 (1<<15) /* 10 = 1000 Mbps */
  1030. #define PHY_M_PS_SPEED_100 (1<<14) /* 01 = 100 Mbps */
  1031. #define PHY_M_PS_SPEED_10 0 /* 00 = 10 Mbps */
  1032. #define PHY_M_PS_FULL_DUP (1<<13) /* Bit 13: Full Duplex */
  1033. #define PHY_M_PS_PAGE_REC (1<<12) /* Bit 12: Page Received */
  1034. #define PHY_M_PS_SPDUP_RES (1<<11) /* Bit 11: Speed & Duplex Resolved */
  1035. #define PHY_M_PS_LINK_UP (1<<10) /* Bit 10: Link Up */
  1036. #define PHY_M_PS_CABLE_MSK (3<<7) /* Bit 9.. 7: Cable Length Mask */
  1037. #define PHY_M_PS_MDI_X_STAT (1<<6) /* Bit 6: MDI Crossover Stat (1=MDIX) */
  1038. #define PHY_M_PS_DOWNS_STAT (1<<5) /* Bit 5: Downshift Status (1=downsh.) */
  1039. #define PHY_M_PS_ENDET_STAT (1<<4) /* Bit 4: Energy Detect Status (1=act) */
  1040. #define PHY_M_PS_TX_P_EN (1<<3) /* Bit 3: Tx Pause Enabled */
  1041. #define PHY_M_PS_RX_P_EN (1<<2) /* Bit 2: Rx Pause Enabled */
  1042. #define PHY_M_PS_POL_REV (1<<1) /* Bit 1: Polarity Reversed */
  1043. #define PHY_M_PC_JABBER (1<<0) /* Bit 0: Jabber */
  1044. #define PHY_M_PS_PAUSE_MSK (PHY_M_PS_TX_P_EN | PHY_M_PS_RX_P_EN)
  1045. /***** PHY_MARV_INT_MASK 16 bit r/w Interrupt Mask Reg *****/
  1046. /***** PHY_MARV_INT_STAT 16 bit r/o Interrupt Status Reg *****/
  1047. #define PHY_M_IS_AN_ERROR (1<<15) /* Bit 15: Auto-Negotiation Error */
  1048. #define PHY_M_IS_LSP_CHANGE (1<<14) /* Bit 14: Link Speed Changed */
  1049. #define PHY_M_IS_DUP_CHANGE (1<<13) /* Bit 13: Duplex Mode Changed */
  1050. #define PHY_M_IS_AN_PR (1<<12) /* Bit 12: Page Received */
  1051. #define PHY_M_IS_AN_COMPL (1<<11) /* Bit 11: Auto-Negotiation Completed */
  1052. #define PHY_M_IS_LST_CHANGE (1<<10) /* Bit 10: Link Status Changed */
  1053. #define PHY_M_IS_SYMB_ERROR (1<<9) /* Bit 9: Symbol Error */
  1054. #define PHY_M_IS_FALSE_CARR (1<<8) /* Bit 8: False Carrier */
  1055. #define PHY_M_IS_FIFO_ERROR (1<<7) /* Bit 7: FIFO Overflow/Underrun Error */
  1056. #define PHY_M_IS_MDI_CHANGE (1<<6) /* Bit 6: MDI Crossover Changed */
  1057. #define PHY_M_IS_DOWNSH_DET (1<<5) /* Bit 5: Downshift Detected */
  1058. #define PHY_M_IS_END_CHANGE (1<<4) /* Bit 4: Energy Detect Changed */
  1059. /* Bit 3..2: reserved */
  1060. #define PHY_M_IS_POL_CHANGE (1<<1) /* Bit 1: Polarity Changed */
  1061. #define PHY_M_IS_JABBER (1<<0) /* Bit 0: Jabber */
  1062. #define PHY_M_DEF_MSK (PHY_M_IS_AN_ERROR | PHY_M_IS_AN_PR | \
  1063. PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR)
  1064. /***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/
  1065. #define PHY_M_EC_M_DSC_MSK (3<<10) /* Bit 11..10: Master downshift counter */
  1066. #define PHY_M_EC_S_DSC_MSK (3<<8) /* Bit 9.. 8: Slave downshift counter */
  1067. #define PHY_M_EC_MAC_S_MSK (7<<4) /* Bit 6.. 4: Def. MAC interface speed */
  1068. #define PHY_M_EC_FIB_AN_ENA (1<<3) /* Bit 3: Fiber Auto-Neg. Enable */
  1069. #define PHY_M_EC_M_DSC(x) SHIFT10(x) /* 00=1x; 01=2x; 10=3x; 11=4x */
  1070. #define PHY_M_EC_S_DSC(x) SHIFT8(x) /* 00=dis; 01=1x; 10=2x; 11=3x */
  1071. #define PHY_M_EC_MAC_S(x) SHIFT4(x) /* 01X=0; 110=2.5; 111=25 (MHz) */
  1072. #define MAC_TX_CLK_0_MHZ 2
  1073. #define MAC_TX_CLK_2_5_MHZ 6
  1074. #define MAC_TX_CLK_25_MHZ 7
  1075. /***** PHY_MARV_LED_CTRL 16 bit r/w LED Control Reg *****/
  1076. #define PHY_M_LEDC_DIS_LED (1<<15) /* Bit 15: Disable LED */
  1077. #define PHY_M_LEDC_PULS_MSK (7<<12) /* Bit 14..12: Pulse Stretch Mask */
  1078. #define PHY_M_LEDC_F_INT (1<<11) /* Bit 11: Force Interrupt */
  1079. #define PHY_M_LEDC_BL_R_MSK (7<<8) /* Bit 10.. 8: Blink Rate Mask */
  1080. /* Bit 7.. 5: reserved */
  1081. #define PHY_M_LEDC_LINK_MSK (3<<3) /* Bit 4.. 3: Link Control Mask */
  1082. #define PHY_M_LEDC_DP_CTRL (1<<2) /* Bit 2: Duplex Control */
  1083. #define PHY_M_LEDC_RX_CTRL (1<<1) /* Bit 1: Rx activity / Link */
  1084. #define PHY_M_LEDC_TX_CTRL (1<<0) /* Bit 0: Tx activity / Link */
  1085. #define PHY_M_LED_PULS_DUR(x) SHIFT12(x) /* Pulse Stretch Duration */
  1086. #define PULS_NO_STR 0 /* no pulse stretching */
  1087. #define PULS_21MS 1 /* 21 ms to 42 ms */
  1088. #define PULS_42MS 2 /* 42 ms to 84 ms */
  1089. #define PULS_84MS 3 /* 84 ms to 170 ms */
  1090. #define PULS_170MS 4 /* 170 ms to 340 ms */
  1091. #define PULS_340MS 5 /* 340 ms to 670 ms */
  1092. #define PULS_670MS 6 /* 670 ms to 1.3 s */
  1093. #define PULS_1300MS 7 /* 1.3 s to 2.7 s */
  1094. #define PHY_M_LED_BLINK_RT(x) SHIFT8(x) /* Blink Rate */
  1095. #define BLINK_42MS 0 /* 42 ms */
  1096. #define BLINK_84MS 1 /* 84 ms */
  1097. #define BLINK_170MS 2 /* 170 ms */
  1098. #define BLINK_340MS 3 /* 340 ms */
  1099. #define BLINK_670MS 4 /* 670 ms */
  1100. /* values 5 - 7: reserved */
  1101. /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/
  1102. #define PHY_M_LED_MO_DUP(x) SHIFT10(x) /* Bit 11..10: Duplex */
  1103. #define PHY_M_LED_MO_10(x) SHIFT8(x) /* Bit 9.. 8: Link 10 */
  1104. #define PHY_M_LED_MO_100(x) SHIFT6(x) /* Bit 7.. 6: Link 100 */
  1105. #define PHY_M_LED_MO_1000(x) SHIFT4(x) /* Bit 5.. 4: Link 1000 */
  1106. #define PHY_M_LED_MO_RX(x) SHIFT2(x) /* Bit 3.. 2: Rx */
  1107. #define PHY_M_LED_MO_TX(x) SHIFT0(x) /* Bit 1.. 0: Tx */
  1108. #define MO_LED_NORM 0
  1109. #define MO_LED_BLINK 1
  1110. #define MO_LED_OFF 2
  1111. #define MO_LED_ON 3
  1112. /***** PHY_MARV_EXT_CTRL_2 16 bit r/w Ext. PHY Specific Ctrl 2 *****/
  1113. /* Bit 15.. 7: reserved */
  1114. #define PHY_M_EC2_FI_IMPED (1<<6) /* Bit 6: Fiber Input Impedance */
  1115. #define PHY_M_EC2_FO_IMPED (1<<5) /* Bit 5: Fiber Output Impedance */
  1116. #define PHY_M_EC2_FO_M_CLK (1<<4) /* Bit 4: Fiber Mode Clock Enable */
  1117. #define PHY_M_EC2_FO_BOOST (1<<3) /* Bit 3: Fiber Output Boost */
  1118. #define PHY_M_EC2_FO_AM_MSK 7 /* Bit 2.. 0: Fiber Output Amplitude */
  1119. /***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/
  1120. #define PHY_M_FC_AUTO_SEL (1<<15) /* Bit 15: Fiber/Copper Auto Sel. dis. */
  1121. #define PHY_M_FC_AN_REG_ACC (1<<14) /* Bit 14: Fiber/Copper Autoneg. reg acc */
  1122. #define PHY_M_FC_RESULUTION (1<<13) /* Bit 13: Fiber/Copper Resulution */
  1123. #define PHY_M_SER_IF_AN_BP (1<<12) /* Bit 12: Ser IF autoneg. bypass enable */
  1124. #define PHY_M_SER_IF_BP_ST (1<<11) /* Bit 11: Ser IF autoneg. bypass status */
  1125. #define PHY_M_IRQ_POLARITY (1<<10) /* Bit 10: IRQ polarity */
  1126. /* Bit 9..4: reserved */
  1127. #define PHY_M_UNDOC1 (1<< 7) /* undocumented bit !! */
  1128. #define PHY_M_MODE_MASK (0xf<<0)/* Bit 3..0: copy of HWCFG MODE[3:0] */
  1129. /***** PHY_MARV_CABLE_DIAG 16 bit r/o Cable Diagnostic Reg *****/
  1130. #define PHY_M_CABD_ENA_TEST (1<<15) /* Bit 15: Enable Test */
  1131. #define PHY_M_CABD_STAT_MSK (3<<13) /* Bit 14..13: Status */
  1132. /* Bit 12.. 8: reserved */
  1133. #define PHY_M_CABD_DIST_MSK 0xff /* Bit 7.. 0: Distance */
  1134. /* values for Cable Diagnostic Status (11=fail; 00=OK; 10=open; 01=short) */
  1135. #define CABD_STAT_NORMAL 0
  1136. #define CABD_STAT_SHORT 1
  1137. #define CABD_STAT_OPEN 2
  1138. #define CABD_STAT_FAIL 3
  1139. /*
  1140. * GMAC registers
  1141. *
  1142. * The GMAC registers are 16 or 32 bits wide.
  1143. * The GMACs host processor interface is 16 bits wide,
  1144. * therefore ALL registers will be addressed with 16 bit accesses.
  1145. *
  1146. * The following macros are provided to access the GMAC registers
  1147. * GM_IN16(), GM_OUT16, GM_IN32(), GM_OUT32(), GM_INADR(), GM_OUTADR(),
  1148. * GM_INHASH(), and GM_OUTHASH().
  1149. * The macros are defined in SkGeHw.h.
  1150. *
  1151. * Note: NA reg = Network Address e.g DA, SA etc.
  1152. *
  1153. */
  1154. /* Port Registers */
  1155. #define GM_GP_STAT 0x0000 /* 16 bit r/o General Purpose Status */
  1156. #define GM_GP_CTRL 0x0004 /* 16 bit r/w General Purpose Control */
  1157. #define GM_TX_CTRL 0x0008 /* 16 bit r/w Transmit Control Reg. */
  1158. #define GM_RX_CTRL 0x000c /* 16 bit r/w Receive Control Reg. */
  1159. #define GM_TX_FLOW_CTRL 0x0010 /* 16 bit r/w Transmit Flow-Control */
  1160. #define GM_TX_PARAM 0x0014 /* 16 bit r/w Transmit Parameter Reg. */
  1161. #define GM_SERIAL_MODE 0x0018 /* 16 bit r/w Serial Mode Register */
  1162. /* Source Address Registers */
  1163. #define GM_SRC_ADDR_1L 0x001c /* 16 bit r/w Source Address 1 (low) */
  1164. #define GM_SRC_ADDR_1M 0x0020 /* 16 bit r/w Source Address 1 (middle) */
  1165. #define GM_SRC_ADDR_1H 0x0024 /* 16 bit r/w Source Address 1 (high) */
  1166. #define GM_SRC_ADDR_2L 0x0028 /* 16 bit r/w Source Address 2 (low) */
  1167. #define GM_SRC_ADDR_2M 0x002c /* 16 bit r/w Source Address 2 (middle) */
  1168. #define GM_SRC_ADDR_2H 0x0030 /* 16 bit r/w Source Address 2 (high) */
  1169. /* Multicast Address Hash Registers */
  1170. #define GM_MC_ADDR_H1 0x0034 /* 16 bit r/w Multicast Address Hash 1 */
  1171. #define GM_MC_ADDR_H2 0x0038 /* 16 bit r/w Multicast Address Hash 2 */
  1172. #define GM_MC_ADDR_H3 0x003c /* 16 bit r/w Multicast Address Hash 3 */
  1173. #define GM_MC_ADDR_H4 0x0040 /* 16 bit r/w Multicast Address Hash 4 */
  1174. /* Interrupt Source Registers */
  1175. #define GM_TX_IRQ_SRC 0x0044 /* 16 bit r/o Tx Overflow IRQ Source */
  1176. #define GM_RX_IRQ_SRC 0x0048 /* 16 bit r/o Rx Overflow IRQ Source */
  1177. #define GM_TR_IRQ_SRC 0x004c /* 16 bit r/o Tx/Rx Over. IRQ Source */
  1178. /* Interrupt Mask Registers */
  1179. #define GM_TX_IRQ_MSK 0x0050 /* 16 bit r/w Tx Overflow IRQ Mask */
  1180. #define GM_RX_IRQ_MSK 0x0054 /* 16 bit r/w Rx Overflow IRQ Mask */
  1181. #define GM_TR_IRQ_MSK 0x0058 /* 16 bit r/w Tx/Rx Over. IRQ Mask */
  1182. /* Serial Management Interface (SMI) Registers */
  1183. #define GM_SMI_CTRL 0x0080 /* 16 bit r/w SMI Control Register */
  1184. #define GM_SMI_DATA 0x0084 /* 16 bit r/w SMI Data Register */
  1185. #define GM_PHY_ADDR 0x0088 /* 16 bit r/w GPHY Address Register */
  1186. /* MIB Counters */
  1187. #define GM_MIB_CNT_BASE 0x0100 /* Base Address of MIB Counters */
  1188. #define GM_MIB_CNT_SIZE 44 /* Number of MIB Counters */
  1189. /*
  1190. * MIB Counters base address definitions (low word) -
  1191. * use offset 4 for access to high word (32 bit r/o)
  1192. */
  1193. #define GM_RXF_UC_OK \
  1194. (GM_MIB_CNT_BASE + 0) /* Unicast Frames Received OK */
  1195. #define GM_RXF_BC_OK \
  1196. (GM_MIB_CNT_BASE + 8) /* Broadcast Frames Received OK */
  1197. #define GM_RXF_MPAUSE \
  1198. (GM_MIB_CNT_BASE + 16) /* Pause MAC Ctrl Frames Received */
  1199. #define GM_RXF_MC_OK \
  1200. (GM_MIB_CNT_BASE + 24) /* Multicast Frames Received OK */
  1201. #define GM_RXF_FCS_ERR \
  1202. (GM_MIB_CNT_BASE + 32) /* Rx Frame Check Seq. Error */
  1203. /* GM_MIB_CNT_BASE + 40: reserved */
  1204. #define GM_RXO_OK_LO \
  1205. (GM_MIB_CNT_BASE + 48) /* Octets Received OK Low */
  1206. #define GM_RXO_OK_HI \
  1207. (GM_MIB_CNT_BASE + 56) /* Octets Received OK High */
  1208. #define GM_RXO_ERR_LO \
  1209. (GM_MIB_CNT_BASE + 64) /* Octets Received Invalid Low */
  1210. #define GM_RXO_ERR_HI \
  1211. (GM_MIB_CNT_BASE + 72) /* Octets Received Invalid High */
  1212. #define GM_RXF_SHT \
  1213. (GM_MIB_CNT_BASE + 80) /* Frames <64 Byte Received OK */
  1214. #define GM_RXE_FRAG \
  1215. (GM_MIB_CNT_BASE + 88) /* Frames <64 Byte Received with FCS Err */
  1216. #define GM_RXF_64B \
  1217. (GM_MIB_CNT_BASE + 96) /* 64 Byte Rx Frame */
  1218. #define GM_RXF_127B \
  1219. (GM_MIB_CNT_BASE + 104) /* 65-127 Byte Rx Frame */
  1220. #define GM_RXF_255B \
  1221. (GM_MIB_CNT_BASE + 112) /* 128-255 Byte Rx Frame */
  1222. #define GM_RXF_511B \
  1223. (GM_MIB_CNT_BASE + 120) /* 256-511 Byte Rx Frame */
  1224. #define GM_RXF_1023B \
  1225. (GM_MIB_CNT_BASE + 128) /* 512-1023 Byte Rx Frame */
  1226. #define GM_RXF_1518B \
  1227. (GM_MIB_CNT_BASE + 136) /* 1024-1518 Byte Rx Frame */
  1228. #define GM_RXF_MAX_SZ \
  1229. (GM_MIB_CNT_BASE + 144) /* 1519-MaxSize Byte Rx Frame */
  1230. #define GM_RXF_LNG_ERR \
  1231. (GM_MIB_CNT_BASE + 152) /* Rx Frame too Long Error */
  1232. #define GM_RXF_JAB_PKT \
  1233. (GM_MIB_CNT_BASE + 160) /* Rx Jabber Packet Frame */
  1234. /* GM_MIB_CNT_BASE + 168: reserved */
  1235. #define GM_RXE_FIFO_OV \
  1236. (GM_MIB_CNT_BASE + 176) /* Rx FIFO overflow Event */
  1237. /* GM_MIB_CNT_BASE + 184: reserved */
  1238. #define GM_TXF_UC_OK \
  1239. (GM_MIB_CNT_BASE + 192) /* Unicast Frames Xmitted OK */
  1240. #define GM_TXF_BC_OK \
  1241. (GM_MIB_CNT_BASE + 200) /* Broadcast Frames Xmitted OK */
  1242. #define GM_TXF_MPAUSE \
  1243. (GM_MIB_CNT_BASE + 208) /* Pause MAC Ctrl Frames Xmitted */
  1244. #define GM_TXF_MC_OK \
  1245. (GM_MIB_CNT_BASE + 216) /* Multicast Frames Xmitted OK */
  1246. #define GM_TXO_OK_LO \
  1247. (GM_MIB_CNT_BASE + 224) /* Octets Transmitted OK Low */
  1248. #define GM_TXO_OK_HI \
  1249. (GM_MIB_CNT_BASE + 232) /* Octets Transmitted OK High */
  1250. #define GM_TXF_64B \
  1251. (GM_MIB_CNT_BASE + 240) /* 64 Byte Tx Frame */
  1252. #define GM_TXF_127B \
  1253. (GM_MIB_CNT_BASE + 248) /* 65-127 Byte Tx Frame */
  1254. #define GM_TXF_255B \
  1255. (GM_MIB_CNT_BASE + 256) /* 128-255 Byte Tx Frame */
  1256. #define GM_TXF_511B \
  1257. (GM_MIB_CNT_BASE + 264) /* 256-511 Byte Tx Frame */
  1258. #define GM_TXF_1023B \
  1259. (GM_MIB_CNT_BASE + 272) /* 512-1023 Byte Tx Frame */
  1260. #define GM_TXF_1518B \
  1261. (GM_MIB_CNT_BASE + 280) /* 1024-1518 Byte Tx Frame */
  1262. #define GM_TXF_MAX_SZ \
  1263. (GM_MIB_CNT_BASE + 288) /* 1519-MaxSize Byte Tx Frame */
  1264. /* GM_MIB_CNT_BASE + 296: reserved */
  1265. #define GM_TXF_COL \
  1266. (GM_MIB_CNT_BASE + 304) /* Tx Collision */
  1267. #define GM_TXF_LAT_COL \
  1268. (GM_MIB_CNT_BASE + 312) /* Tx Late Collision */
  1269. #define GM_TXF_ABO_COL \
  1270. (GM_MIB_CNT_BASE + 320) /* Tx aborted due to Exces. Col. */
  1271. #define GM_TXF_MUL_COL \
  1272. (GM_MIB_CNT_BASE + 328) /* Tx Multiple Collision */
  1273. #define GM_TXF_SNG_COL \
  1274. (GM_MIB_CNT_BASE + 336) /* Tx Single Collision */
  1275. #define GM_TXE_FIFO_UR \
  1276. (GM_MIB_CNT_BASE + 344) /* Tx FIFO Underrun Event */
  1277. /*----------------------------------------------------------------------------*/
  1278. /*
  1279. * GMAC Bit Definitions
  1280. *
  1281. * If the bit access behaviour differs from the register access behaviour
  1282. * (r/w, r/o) this is documented after the bit number.
  1283. * The following bit access behaviours are used:
  1284. * (sc) self clearing
  1285. * (r/o) read only
  1286. */
  1287. /* GM_GP_STAT 16 bit r/o General Purpose Status Register */
  1288. #define GM_GPSR_SPEED (1<<15) /* Bit 15: Port Speed (1 = 100 Mbps) */
  1289. #define GM_GPSR_DUPLEX (1<<14) /* Bit 14: Duplex Mode (1 = Full) */
  1290. #define GM_GPSR_FC_TX_DIS (1<<13) /* Bit 13: Tx Flow-Control Mode Disabled */
  1291. #define GM_GPSR_LINK_UP (1<<12) /* Bit 12: Link Up Status */
  1292. #define GM_GPSR_PAUSE (1<<11) /* Bit 11: Pause State */
  1293. #define GM_GPSR_TX_ACTIVE (1<<10) /* Bit 10: Tx in Progress */
  1294. #define GM_GPSR_EXC_COL (1<<9) /* Bit 9: Excessive Collisions Occured */
  1295. #define GM_GPSR_LAT_COL (1<<8) /* Bit 8: Late Collisions Occured */
  1296. /* Bit 7..6: reserved */
  1297. #define GM_GPSR_PHY_ST_CH (1<<5) /* Bit 5: PHY Status Change */
  1298. #define GM_GPSR_GIG_SPEED (1<<4) /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */
  1299. #define GM_GPSR_PART_MODE (1<<3) /* Bit 3: Partition mode */
  1300. #define GM_GPSR_FC_RX_DIS (1<<2) /* Bit 2: Rx Flow-Control Mode Disabled */
  1301. #define GM_GPSR_PROM_EN (1<<1) /* Bit 1: Promiscuous Mode Enabled */
  1302. /* Bit 0: reserved */
  1303. /* GM_GP_CTRL 16 bit r/w General Purpose Control Register */
  1304. /* Bit 15: reserved */
  1305. #define GM_GPCR_PROM_ENA (1<<14) /* Bit 14: Enable Promiscuous Mode */
  1306. #define GM_GPCR_FC_TX_DIS (1<<13) /* Bit 13: Disable Tx Flow-Control Mode */
  1307. #define GM_GPCR_TX_ENA (1<<12) /* Bit 12: Enable Transmit */
  1308. #define GM_GPCR_RX_ENA (1<<11) /* Bit 11: Enable Receive */
  1309. #define GM_GPCR_BURST_ENA (1<<10) /* Bit 10: Enable Burst Mode */
  1310. #define GM_GPCR_LOOP_ENA (1<<9) /* Bit 9: Enable MAC Loopback Mode */
  1311. #define GM_GPCR_PART_ENA (1<<8) /* Bit 8: Enable Partition Mode */
  1312. #define GM_GPCR_GIGS_ENA (1<<7) /* Bit 7: Gigabit Speed (1000 Mbps) */
  1313. #define GM_GPCR_FL_PASS (1<<6) /* Bit 6: Force Link Pass */
  1314. #define GM_GPCR_DUP_FULL (1<<5) /* Bit 5: Full Duplex Mode */
  1315. #define GM_GPCR_FC_RX_DIS (1<<4) /* Bit 4: Disable Rx Flow-Control Mode */
  1316. #define GM_GPCR_SPEED_100 (1<<3) /* Bit 3: Port Speed 100 Mbps */
  1317. #define GM_GPCR_AU_DUP_DIS (1<<2) /* Bit 2: Disable Auto-Update Duplex */
  1318. #define GM_GPCR_AU_FCT_DIS (1<<1) /* Bit 1: Disable Auto-Update Flow-C. */
  1319. #define GM_GPCR_AU_SPD_DIS (1<<0) /* Bit 0: Disable Auto-Update Speed */
  1320. #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
  1321. #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS |\
  1322. GM_GPCR_AU_SPD_DIS)
  1323. /* GM_TX_CTRL 16 bit r/w Transmit Control Register */
  1324. #define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */
  1325. #define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */
  1326. #define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */
  1327. #define GM_TXCR_COL_THR_MSK (1<<10) /* Bit 12..10: Collision Threshold */
  1328. #define TX_COL_THR(x) (SHIFT10(x) & GM_TXCR_COL_THR_MSK)
  1329. #define TX_COL_DEF 0x04
  1330. /* GM_RX_CTRL 16 bit r/w Receive Control Register */
  1331. #define GM_RXCR_UCF_ENA (1<<15) /* Bit 15: Enable Unicast filtering */
  1332. #define GM_RXCR_MCF_ENA (1<<14) /* Bit 14: Enable Multicast filtering */
  1333. #define GM_RXCR_CRC_DIS (1<<13) /* Bit 13: Remove 4-byte CRC */
  1334. #define GM_RXCR_PASS_FC (1<<12) /* Bit 12: Pass FC packets to FIFO */
  1335. /* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */
  1336. #define GM_TXPA_JAMLEN_MSK (0x03<<14) /* Bit 15..14: Jam Length */
  1337. #define GM_TXPA_JAMIPG_MSK (0x1f<<9) /* Bit 13..9: Jam IPG */
  1338. #define GM_TXPA_JAMDAT_MSK (0x1f<<4) /* Bit 8..4: IPG Jam to Data */
  1339. /* Bit 3..0: reserved */
  1340. #define TX_JAM_LEN_VAL(x) (SHIFT14(x) & GM_TXPA_JAMLEN_MSK)
  1341. #define TX_JAM_IPG_VAL(x) (SHIFT9(x) & GM_TXPA_JAMIPG_MSK)
  1342. #define TX_IPG_JAM_DATA(x) (SHIFT4(x) & GM_TXPA_JAMDAT_MSK)
  1343. #define TX_JAM_LEN_DEF 0x03
  1344. #define TX_JAM_IPG_DEF 0x0b
  1345. #define TX_IPG_JAM_DEF 0x1c
  1346. /* GM_SERIAL_MODE 16 bit r/w Serial Mode Register */
  1347. #define GM_SMOD_DATABL_MSK (0x1f<<11) /* Bit 15..11: Data Blinder (r/o) */
  1348. #define GM_SMOD_LIMIT_4 (1<<10) /* Bit 10: 4 consecutive Tx trials */
  1349. #define GM_SMOD_VLAN_ENA (1<<9) /* Bit 9: Enable VLAN (Max. Frame Len) */
  1350. #define GM_SMOD_JUMBO_ENA (1<<8) /* Bit 8: Enable Jumbo (Max. Frame Len) */
  1351. /* Bit 7..5: reserved */
  1352. #define GM_SMOD_IPG_MSK 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */
  1353. #define DATA_BLIND_VAL(x) (SHIFT11(x) & GM_SMOD_DATABL_MSK)
  1354. #define DATA_BLIND_DEF 0x04
  1355. #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
  1356. #define IPG_DATA_DEF 0x1e
  1357. /* GM_SMI_CTRL 16 bit r/w SMI Control Register */
  1358. #define GM_SMI_CT_PHY_A_MSK (0x1f<<11) /* Bit 15..11: PHY Device Address */
  1359. #define GM_SMI_CT_REG_A_MSK (0x1f<<6) /* Bit 10.. 6: PHY Register Address */
  1360. #define GM_SMI_CT_OP_RD (1<<5) /* Bit 5: OpCode Read (0=Write)*/
  1361. #define GM_SMI_CT_RD_VAL (1<<4) /* Bit 4: Read Valid (Read completed) */
  1362. #define GM_SMI_CT_BUSY (1<<3) /* Bit 3: Busy (Operation in progress) */
  1363. /* Bit 2..0: reserved */
  1364. #define GM_SMI_CT_PHY_AD(x) (SHIFT11(x) & GM_SMI_CT_PHY_A_MSK)
  1365. #define GM_SMI_CT_REG_AD(x) (SHIFT6(x) & GM_SMI_CT_REG_A_MSK)
  1366. /* GM_PHY_ADDR 16 bit r/w GPHY Address Register */
  1367. /* Bit 15..6: reserved */
  1368. #define GM_PAR_MIB_CLR (1<<5) /* Bit 5: Set MIB Clear Counter Mode */
  1369. #define GM_PAR_MIB_TST (1<<4) /* Bit 4: MIB Load Counter (Test Mode) */
  1370. /* Bit 3..0: reserved */
  1371. /* Receive Frame Status Encoding */
  1372. #define GMR_FS_LEN (0xffffUL<<16) /* Bit 31..16: Rx Frame Length */
  1373. /* Bit 15..14: reserved */
  1374. #define GMR_FS_VLAN (1L<<13) /* Bit 13: VLAN Packet */
  1375. #define GMR_FS_JABBER (1L<<12) /* Bit 12: Jabber Packet */
  1376. #define GMR_FS_UN_SIZE (1L<<11) /* Bit 11: Undersize Packet */
  1377. #define GMR_FS_MC (1L<<10) /* Bit 10: Multicast Packet */
  1378. #define GMR_FS_BC (1L<<9) /* Bit 9: Broadcast Packet */
  1379. #define GMR_FS_RX_OK (1L<<8) /* Bit 8: Receive OK (Good Packet) */
  1380. #define GMR_FS_GOOD_FC (1L<<7) /* Bit 7: Good Flow-Control Packet */
  1381. #define GMR_FS_BAD_FC (1L<<6) /* Bit 6: Bad Flow-Control Packet */
  1382. #define GMR_FS_MII_ERR (1L<<5) /* Bit 5: MII Error */
  1383. #define GMR_FS_LONG_ERR (1L<<4) /* Bit 4: Too Long Packet */
  1384. #define GMR_FS_FRAGMENT (1L<<3) /* Bit 3: Fragment */
  1385. /* Bit 2: reserved */
  1386. #define GMR_FS_CRC_ERR (1L<<1) /* Bit 1: CRC Error */
  1387. #define GMR_FS_RX_FF_OV (1L<<0) /* Bit 0: Rx FIFO Overflow */
  1388. /*
  1389. * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR)
  1390. */
  1391. #define GMR_FS_ANY_ERR (GMR_FS_CRC_ERR | \
  1392. GMR_FS_LONG_ERR | \
  1393. GMR_FS_MII_ERR | \
  1394. GMR_FS_BAD_FC | \
  1395. GMR_FS_GOOD_FC | \
  1396. GMR_FS_JABBER)
  1397. /* Rx GMAC FIFO Flush Mask (default) */
  1398. #define RX_FF_FL_DEF_MSK (GMR_FS_CRC_ERR | \
  1399. GMR_FS_RX_FF_OV | \
  1400. GMR_FS_MII_ERR | \
  1401. GMR_FS_BAD_FC | \
  1402. GMR_FS_GOOD_FC | \
  1403. GMR_FS_UN_SIZE | \
  1404. GMR_FS_JABBER)
  1405. /* typedefs *******************************************************************/
  1406. /* function prototypes ********************************************************/
  1407. #ifdef __cplusplus
  1408. }
  1409. #endif /* __cplusplus */
  1410. #endif /* __INC_XMAC_H */