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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623
  1. /*
  2. * Definitions for the new Marvell Yukon / SysKonnect driver.
  3. */
  4. #ifndef _SKGE_H
  5. #define _SKGE_H
  6. FILE_LICENCE ( GPL2_ONLY );
  7. /* PCI config registers */
  8. #define PCI_DEV_REG1 0x40
  9. #define PCI_PHY_COMA 0x8000000
  10. #define PCI_VIO 0x2000000
  11. #define PCI_DEV_REG2 0x44
  12. #define PCI_VPD_ROM_SZ 7L<<14 /* VPD ROM size 0=256, 1=512, ... */
  13. #define PCI_REV_DESC 1<<2 /* Reverse Descriptor bytes */
  14. #define DRV_NAME "skge"
  15. #define DRV_VERSION "1.13"
  16. #define PFX DRV_NAME " "
  17. #define NUM_TX_DESC 8
  18. #define NUM_RX_DESC 8
  19. /* mdeck used a 16 byte alignment, but datasheet says 8 bytes is sufficient */
  20. #define SKGE_RING_ALIGN 8
  21. #define RX_BUF_SIZE 1536
  22. #define PHY_RETRIES 1000
  23. #define TX_RING_SIZE ( NUM_TX_DESC * sizeof ( struct skge_rx_desc ) )
  24. #define RX_RING_SIZE ( NUM_RX_DESC * sizeof ( struct skge_tx_desc ) )
  25. #define RING_SIZE ( TX_RING_SIZE + RX_RING_SIZE )
  26. #define SKGE_REG_SIZE 0x4000
  27. #define SKGE_EEPROM_MAGIC 0x9933aabb
  28. /* Added for iPXE ------------------ */
  29. /* from ethtool.h */
  30. #define AUTONEG_DISABLE 0x00
  31. #define AUTONEG_ENABLE 0x01
  32. #define DUPLEX_HALF 0x00
  33. #define DUPLEX_FULL 0x01
  34. #define SPEED_10 10
  35. #define SPEED_100 100
  36. #define SPEED_1000 1000
  37. #define ADVERTISED_10baseT_Half (1 << 0)
  38. #define ADVERTISED_10baseT_Full (1 << 1)
  39. #define ADVERTISED_100baseT_Half (1 << 2)
  40. #define ADVERTISED_100baseT_Full (1 << 3)
  41. #define ADVERTISED_1000baseT_Half (1 << 4)
  42. #define ADVERTISED_1000baseT_Full (1 << 5)
  43. #define SUPPORTED_10baseT_Half (1 << 0)
  44. #define SUPPORTED_10baseT_Full (1 << 1)
  45. #define SUPPORTED_100baseT_Half (1 << 2)
  46. #define SUPPORTED_100baseT_Full (1 << 3)
  47. #define SUPPORTED_1000baseT_Half (1 << 4)
  48. #define SUPPORTED_1000baseT_Full (1 << 5)
  49. #define SUPPORTED_Autoneg (1 << 6)
  50. #define SUPPORTED_TP (1 << 7)
  51. #define SUPPORTED_FIBRE (1 << 10)
  52. /* from kernel.h */
  53. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  54. /* ----------------------------------- */
  55. #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
  56. PCI_STATUS_SIG_SYSTEM_ERROR | \
  57. PCI_STATUS_REC_MASTER_ABORT | \
  58. PCI_STATUS_REC_TARGET_ABORT | \
  59. PCI_STATUS_PARITY)
  60. enum csr_regs {
  61. B0_RAP = 0x0000,
  62. B0_CTST = 0x0004,
  63. B0_LED = 0x0006,
  64. B0_POWER_CTRL = 0x0007,
  65. B0_ISRC = 0x0008,
  66. B0_IMSK = 0x000c,
  67. B0_HWE_ISRC = 0x0010,
  68. B0_HWE_IMSK = 0x0014,
  69. B0_SP_ISRC = 0x0018,
  70. B0_XM1_IMSK = 0x0020,
  71. B0_XM1_ISRC = 0x0028,
  72. B0_XM1_PHY_ADDR = 0x0030,
  73. B0_XM1_PHY_DATA = 0x0034,
  74. B0_XM2_IMSK = 0x0040,
  75. B0_XM2_ISRC = 0x0048,
  76. B0_XM2_PHY_ADDR = 0x0050,
  77. B0_XM2_PHY_DATA = 0x0054,
  78. B0_R1_CSR = 0x0060,
  79. B0_R2_CSR = 0x0064,
  80. B0_XS1_CSR = 0x0068,
  81. B0_XA1_CSR = 0x006c,
  82. B0_XS2_CSR = 0x0070,
  83. B0_XA2_CSR = 0x0074,
  84. B2_MAC_1 = 0x0100,
  85. B2_MAC_2 = 0x0108,
  86. B2_MAC_3 = 0x0110,
  87. B2_CONN_TYP = 0x0118,
  88. B2_PMD_TYP = 0x0119,
  89. B2_MAC_CFG = 0x011a,
  90. B2_CHIP_ID = 0x011b,
  91. B2_E_0 = 0x011c,
  92. B2_E_1 = 0x011d,
  93. B2_E_2 = 0x011e,
  94. B2_E_3 = 0x011f,
  95. B2_FAR = 0x0120,
  96. B2_FDP = 0x0124,
  97. B2_LD_CTRL = 0x0128,
  98. B2_LD_TEST = 0x0129,
  99. B2_TI_INI = 0x0130,
  100. B2_TI_VAL = 0x0134,
  101. B2_TI_CTRL = 0x0138,
  102. B2_TI_TEST = 0x0139,
  103. B2_IRQM_INI = 0x0140,
  104. B2_IRQM_VAL = 0x0144,
  105. B2_IRQM_CTRL = 0x0148,
  106. B2_IRQM_TEST = 0x0149,
  107. B2_IRQM_MSK = 0x014c,
  108. B2_IRQM_HWE_MSK = 0x0150,
  109. B2_TST_CTRL1 = 0x0158,
  110. B2_TST_CTRL2 = 0x0159,
  111. B2_GP_IO = 0x015c,
  112. B2_I2C_CTRL = 0x0160,
  113. B2_I2C_DATA = 0x0164,
  114. B2_I2C_IRQ = 0x0168,
  115. B2_I2C_SW = 0x016c,
  116. B2_BSC_INI = 0x0170,
  117. B2_BSC_VAL = 0x0174,
  118. B2_BSC_CTRL = 0x0178,
  119. B2_BSC_STAT = 0x0179,
  120. B2_BSC_TST = 0x017a,
  121. B3_RAM_ADDR = 0x0180,
  122. B3_RAM_DATA_LO = 0x0184,
  123. B3_RAM_DATA_HI = 0x0188,
  124. B3_RI_WTO_R1 = 0x0190,
  125. B3_RI_WTO_XA1 = 0x0191,
  126. B3_RI_WTO_XS1 = 0x0192,
  127. B3_RI_RTO_R1 = 0x0193,
  128. B3_RI_RTO_XA1 = 0x0194,
  129. B3_RI_RTO_XS1 = 0x0195,
  130. B3_RI_WTO_R2 = 0x0196,
  131. B3_RI_WTO_XA2 = 0x0197,
  132. B3_RI_WTO_XS2 = 0x0198,
  133. B3_RI_RTO_R2 = 0x0199,
  134. B3_RI_RTO_XA2 = 0x019a,
  135. B3_RI_RTO_XS2 = 0x019b,
  136. B3_RI_TO_VAL = 0x019c,
  137. B3_RI_CTRL = 0x01a0,
  138. B3_RI_TEST = 0x01a2,
  139. B3_MA_TOINI_RX1 = 0x01b0,
  140. B3_MA_TOINI_RX2 = 0x01b1,
  141. B3_MA_TOINI_TX1 = 0x01b2,
  142. B3_MA_TOINI_TX2 = 0x01b3,
  143. B3_MA_TOVAL_RX1 = 0x01b4,
  144. B3_MA_TOVAL_RX2 = 0x01b5,
  145. B3_MA_TOVAL_TX1 = 0x01b6,
  146. B3_MA_TOVAL_TX2 = 0x01b7,
  147. B3_MA_TO_CTRL = 0x01b8,
  148. B3_MA_TO_TEST = 0x01ba,
  149. B3_MA_RCINI_RX1 = 0x01c0,
  150. B3_MA_RCINI_RX2 = 0x01c1,
  151. B3_MA_RCINI_TX1 = 0x01c2,
  152. B3_MA_RCINI_TX2 = 0x01c3,
  153. B3_MA_RCVAL_RX1 = 0x01c4,
  154. B3_MA_RCVAL_RX2 = 0x01c5,
  155. B3_MA_RCVAL_TX1 = 0x01c6,
  156. B3_MA_RCVAL_TX2 = 0x01c7,
  157. B3_MA_RC_CTRL = 0x01c8,
  158. B3_MA_RC_TEST = 0x01ca,
  159. B3_PA_TOINI_RX1 = 0x01d0,
  160. B3_PA_TOINI_RX2 = 0x01d4,
  161. B3_PA_TOINI_TX1 = 0x01d8,
  162. B3_PA_TOINI_TX2 = 0x01dc,
  163. B3_PA_TOVAL_RX1 = 0x01e0,
  164. B3_PA_TOVAL_RX2 = 0x01e4,
  165. B3_PA_TOVAL_TX1 = 0x01e8,
  166. B3_PA_TOVAL_TX2 = 0x01ec,
  167. B3_PA_CTRL = 0x01f0,
  168. B3_PA_TEST = 0x01f2,
  169. };
  170. /* B0_CTST 16 bit Control/Status register */
  171. enum {
  172. CS_CLK_RUN_HOT = 1<<13,/* CLK_RUN hot m. (YUKON-Lite only) */
  173. CS_CLK_RUN_RST = 1<<12,/* CLK_RUN reset (YUKON-Lite only) */
  174. CS_CLK_RUN_ENA = 1<<11,/* CLK_RUN enable (YUKON-Lite only) */
  175. CS_VAUX_AVAIL = 1<<10,/* VAUX available (YUKON only) */
  176. CS_BUS_CLOCK = 1<<9, /* Bus Clock 0/1 = 33/66 MHz */
  177. CS_BUS_SLOT_SZ = 1<<8, /* Slot Size 0/1 = 32/64 bit slot */
  178. CS_ST_SW_IRQ = 1<<7, /* Set IRQ SW Request */
  179. CS_CL_SW_IRQ = 1<<6, /* Clear IRQ SW Request */
  180. CS_STOP_DONE = 1<<5, /* Stop Master is finished */
  181. CS_STOP_MAST = 1<<4, /* Command Bit to stop the master */
  182. CS_MRST_CLR = 1<<3, /* Clear Master reset */
  183. CS_MRST_SET = 1<<2, /* Set Master reset */
  184. CS_RST_CLR = 1<<1, /* Clear Software reset */
  185. CS_RST_SET = 1, /* Set Software reset */
  186. /* B0_LED 8 Bit LED register */
  187. /* Bit 7.. 2: reserved */
  188. LED_STAT_ON = 1<<1, /* Status LED on */
  189. LED_STAT_OFF = 1, /* Status LED off */
  190. /* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */
  191. PC_VAUX_ENA = 1<<7, /* Switch VAUX Enable */
  192. PC_VAUX_DIS = 1<<6, /* Switch VAUX Disable */
  193. PC_VCC_ENA = 1<<5, /* Switch VCC Enable */
  194. PC_VCC_DIS = 1<<4, /* Switch VCC Disable */
  195. PC_VAUX_ON = 1<<3, /* Switch VAUX On */
  196. PC_VAUX_OFF = 1<<2, /* Switch VAUX Off */
  197. PC_VCC_ON = 1<<1, /* Switch VCC On */
  198. PC_VCC_OFF = 1<<0, /* Switch VCC Off */
  199. };
  200. /* B2_IRQM_MSK 32 bit IRQ Moderation Mask */
  201. enum {
  202. IS_ALL_MSK = 0xbffffffful, /* All Interrupt bits */
  203. IS_HW_ERR = 1<<31, /* Interrupt HW Error */
  204. /* Bit 30: reserved */
  205. IS_PA_TO_RX1 = 1<<29, /* Packet Arb Timeout Rx1 */
  206. IS_PA_TO_RX2 = 1<<28, /* Packet Arb Timeout Rx2 */
  207. IS_PA_TO_TX1 = 1<<27, /* Packet Arb Timeout Tx1 */
  208. IS_PA_TO_TX2 = 1<<26, /* Packet Arb Timeout Tx2 */
  209. IS_I2C_READY = 1<<25, /* IRQ on end of I2C Tx */
  210. IS_IRQ_SW = 1<<24, /* SW forced IRQ */
  211. IS_EXT_REG = 1<<23, /* IRQ from LM80 or PHY (GENESIS only) */
  212. /* IRQ from PHY (YUKON only) */
  213. IS_TIMINT = 1<<22, /* IRQ from Timer */
  214. IS_MAC1 = 1<<21, /* IRQ from MAC 1 */
  215. IS_LNK_SYNC_M1 = 1<<20, /* Link Sync Cnt wrap MAC 1 */
  216. IS_MAC2 = 1<<19, /* IRQ from MAC 2 */
  217. IS_LNK_SYNC_M2 = 1<<18, /* Link Sync Cnt wrap MAC 2 */
  218. /* Receive Queue 1 */
  219. IS_R1_B = 1<<17, /* Q_R1 End of Buffer */
  220. IS_R1_F = 1<<16, /* Q_R1 End of Frame */
  221. IS_R1_C = 1<<15, /* Q_R1 Encoding Error */
  222. /* Receive Queue 2 */
  223. IS_R2_B = 1<<14, /* Q_R2 End of Buffer */
  224. IS_R2_F = 1<<13, /* Q_R2 End of Frame */
  225. IS_R2_C = 1<<12, /* Q_R2 Encoding Error */
  226. /* Synchronous Transmit Queue 1 */
  227. IS_XS1_B = 1<<11, /* Q_XS1 End of Buffer */
  228. IS_XS1_F = 1<<10, /* Q_XS1 End of Frame */
  229. IS_XS1_C = 1<<9, /* Q_XS1 Encoding Error */
  230. /* Asynchronous Transmit Queue 1 */
  231. IS_XA1_B = 1<<8, /* Q_XA1 End of Buffer */
  232. IS_XA1_F = 1<<7, /* Q_XA1 End of Frame */
  233. IS_XA1_C = 1<<6, /* Q_XA1 Encoding Error */
  234. /* Synchronous Transmit Queue 2 */
  235. IS_XS2_B = 1<<5, /* Q_XS2 End of Buffer */
  236. IS_XS2_F = 1<<4, /* Q_XS2 End of Frame */
  237. IS_XS2_C = 1<<3, /* Q_XS2 Encoding Error */
  238. /* Asynchronous Transmit Queue 2 */
  239. IS_XA2_B = 1<<2, /* Q_XA2 End of Buffer */
  240. IS_XA2_F = 1<<1, /* Q_XA2 End of Frame */
  241. IS_XA2_C = 1<<0, /* Q_XA2 Encoding Error */
  242. IS_TO_PORT1 = IS_PA_TO_RX1 | IS_PA_TO_TX1,
  243. IS_TO_PORT2 = IS_PA_TO_RX2 | IS_PA_TO_TX2,
  244. IS_PORT_1 = IS_XA1_F| IS_R1_F | IS_TO_PORT1 | IS_MAC1,
  245. IS_PORT_2 = IS_XA2_F| IS_R2_F | IS_TO_PORT2 | IS_MAC2,
  246. };
  247. /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
  248. enum {
  249. IS_IRQ_TIST_OV = 1<<13, /* Time Stamp Timer Overflow (YUKON only) */
  250. IS_IRQ_SENSOR = 1<<12, /* IRQ from Sensor (YUKON only) */
  251. IS_IRQ_MST_ERR = 1<<11, /* IRQ master error detected */
  252. IS_IRQ_STAT = 1<<10, /* IRQ status exception */
  253. IS_NO_STAT_M1 = 1<<9, /* No Rx Status from MAC 1 */
  254. IS_NO_STAT_M2 = 1<<8, /* No Rx Status from MAC 2 */
  255. IS_NO_TIST_M1 = 1<<7, /* No Time Stamp from MAC 1 */
  256. IS_NO_TIST_M2 = 1<<6, /* No Time Stamp from MAC 2 */
  257. IS_RAM_RD_PAR = 1<<5, /* RAM Read Parity Error */
  258. IS_RAM_WR_PAR = 1<<4, /* RAM Write Parity Error */
  259. IS_M1_PAR_ERR = 1<<3, /* MAC 1 Parity Error */
  260. IS_M2_PAR_ERR = 1<<2, /* MAC 2 Parity Error */
  261. IS_R1_PAR_ERR = 1<<1, /* Queue R1 Parity Error */
  262. IS_R2_PAR_ERR = 1<<0, /* Queue R2 Parity Error */
  263. IS_ERR_MSK = IS_IRQ_MST_ERR | IS_IRQ_STAT
  264. | IS_RAM_RD_PAR | IS_RAM_WR_PAR
  265. | IS_M1_PAR_ERR | IS_M2_PAR_ERR
  266. | IS_R1_PAR_ERR | IS_R2_PAR_ERR,
  267. };
  268. /* B2_TST_CTRL1 8 bit Test Control Register 1 */
  269. enum {
  270. TST_FRC_DPERR_MR = 1<<7, /* force DATAPERR on MST RD */
  271. TST_FRC_DPERR_MW = 1<<6, /* force DATAPERR on MST WR */
  272. TST_FRC_DPERR_TR = 1<<5, /* force DATAPERR on TRG RD */
  273. TST_FRC_DPERR_TW = 1<<4, /* force DATAPERR on TRG WR */
  274. TST_FRC_APERR_M = 1<<3, /* force ADDRPERR on MST */
  275. TST_FRC_APERR_T = 1<<2, /* force ADDRPERR on TRG */
  276. TST_CFG_WRITE_ON = 1<<1, /* Enable Config Reg WR */
  277. TST_CFG_WRITE_OFF= 1<<0, /* Disable Config Reg WR */
  278. };
  279. /* B2_MAC_CFG 8 bit MAC Configuration / Chip Revision */
  280. enum {
  281. CFG_CHIP_R_MSK = 0xf<<4, /* Bit 7.. 4: Chip Revision */
  282. /* Bit 3.. 2: reserved */
  283. CFG_DIS_M2_CLK = 1<<1, /* Disable Clock for 2nd MAC */
  284. CFG_SNG_MAC = 1<<0, /* MAC Config: 0=2 MACs / 1=1 MAC*/
  285. };
  286. /* B2_CHIP_ID 8 bit Chip Identification Number */
  287. enum {
  288. CHIP_ID_GENESIS = 0x0a, /* Chip ID for GENESIS */
  289. CHIP_ID_YUKON = 0xb0, /* Chip ID for YUKON */
  290. CHIP_ID_YUKON_LITE = 0xb1, /* Chip ID for YUKON-Lite (Rev. A1-A3) */
  291. CHIP_ID_YUKON_LP = 0xb2, /* Chip ID for YUKON-LP */
  292. CHIP_ID_YUKON_XL = 0xb3, /* Chip ID for YUKON-2 XL */
  293. CHIP_ID_YUKON_EC = 0xb6, /* Chip ID for YUKON-2 EC */
  294. CHIP_ID_YUKON_FE = 0xb7, /* Chip ID for YUKON-2 FE */
  295. CHIP_REV_YU_LITE_A1 = 3, /* Chip Rev. for YUKON-Lite A1,A2 */
  296. CHIP_REV_YU_LITE_A3 = 7, /* Chip Rev. for YUKON-Lite A3 */
  297. };
  298. /* B2_TI_CTRL 8 bit Timer control */
  299. /* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */
  300. enum {
  301. TIM_START = 1<<2, /* Start Timer */
  302. TIM_STOP = 1<<1, /* Stop Timer */
  303. TIM_CLR_IRQ = 1<<0, /* Clear Timer IRQ (!IRQM) */
  304. };
  305. /* B2_TI_TEST 8 Bit Timer Test */
  306. /* B2_IRQM_TEST 8 bit IRQ Moderation Timer Test */
  307. /* B28_DPT_TST 8 bit Descriptor Poll Timer Test Reg */
  308. enum {
  309. TIM_T_ON = 1<<2, /* Test mode on */
  310. TIM_T_OFF = 1<<1, /* Test mode off */
  311. TIM_T_STEP = 1<<0, /* Test step */
  312. };
  313. /* B2_GP_IO 32 bit General Purpose I/O Register */
  314. enum {
  315. GP_DIR_9 = 1<<25, /* IO_9 direct, 0=In/1=Out */
  316. GP_DIR_8 = 1<<24, /* IO_8 direct, 0=In/1=Out */
  317. GP_DIR_7 = 1<<23, /* IO_7 direct, 0=In/1=Out */
  318. GP_DIR_6 = 1<<22, /* IO_6 direct, 0=In/1=Out */
  319. GP_DIR_5 = 1<<21, /* IO_5 direct, 0=In/1=Out */
  320. GP_DIR_4 = 1<<20, /* IO_4 direct, 0=In/1=Out */
  321. GP_DIR_3 = 1<<19, /* IO_3 direct, 0=In/1=Out */
  322. GP_DIR_2 = 1<<18, /* IO_2 direct, 0=In/1=Out */
  323. GP_DIR_1 = 1<<17, /* IO_1 direct, 0=In/1=Out */
  324. GP_DIR_0 = 1<<16, /* IO_0 direct, 0=In/1=Out */
  325. GP_IO_9 = 1<<9, /* IO_9 pin */
  326. GP_IO_8 = 1<<8, /* IO_8 pin */
  327. GP_IO_7 = 1<<7, /* IO_7 pin */
  328. GP_IO_6 = 1<<6, /* IO_6 pin */
  329. GP_IO_5 = 1<<5, /* IO_5 pin */
  330. GP_IO_4 = 1<<4, /* IO_4 pin */
  331. GP_IO_3 = 1<<3, /* IO_3 pin */
  332. GP_IO_2 = 1<<2, /* IO_2 pin */
  333. GP_IO_1 = 1<<1, /* IO_1 pin */
  334. GP_IO_0 = 1<<0, /* IO_0 pin */
  335. };
  336. /* Descriptor Bit Definition */
  337. /* TxCtrl Transmit Buffer Control Field */
  338. /* RxCtrl Receive Buffer Control Field */
  339. enum {
  340. BMU_OWN = 1<<31, /* OWN bit: 0=host/1=BMU */
  341. BMU_STF = 1<<30, /* Start of Frame */
  342. BMU_EOF = 1<<29, /* End of Frame */
  343. BMU_IRQ_EOB = 1<<28, /* Req "End of Buffer" IRQ */
  344. BMU_IRQ_EOF = 1<<27, /* Req "End of Frame" IRQ */
  345. /* TxCtrl specific bits */
  346. BMU_STFWD = 1<<26, /* (Tx) Store & Forward Frame */
  347. BMU_NO_FCS = 1<<25, /* (Tx) Disable MAC FCS (CRC) generation */
  348. BMU_SW = 1<<24, /* (Tx) 1 bit res. for SW use */
  349. /* RxCtrl specific bits */
  350. BMU_DEV_0 = 1<<26, /* (Rx) Transfer data to Dev0 */
  351. BMU_STAT_VAL = 1<<25, /* (Rx) Rx Status Valid */
  352. BMU_TIST_VAL = 1<<24, /* (Rx) Rx TimeStamp Valid */
  353. /* Bit 23..16: BMU Check Opcodes */
  354. BMU_CHECK = 0x55<<16, /* Default BMU check */
  355. BMU_TCP_CHECK = 0x56<<16, /* Descr with TCP ext */
  356. BMU_UDP_CHECK = 0x57<<16, /* Descr with UDP ext (YUKON only) */
  357. BMU_BBC = 0xffffL, /* Bit 15.. 0: Buffer Byte Counter */
  358. };
  359. /* B2_BSC_CTRL 8 bit Blink Source Counter Control */
  360. enum {
  361. BSC_START = 1<<1, /* Start Blink Source Counter */
  362. BSC_STOP = 1<<0, /* Stop Blink Source Counter */
  363. };
  364. /* B2_BSC_STAT 8 bit Blink Source Counter Status */
  365. enum {
  366. BSC_SRC = 1<<0, /* Blink Source, 0=Off / 1=On */
  367. };
  368. /* B2_BSC_TST 16 bit Blink Source Counter Test Reg */
  369. enum {
  370. BSC_T_ON = 1<<2, /* Test mode on */
  371. BSC_T_OFF = 1<<1, /* Test mode off */
  372. BSC_T_STEP = 1<<0, /* Test step */
  373. };
  374. /* B3_RAM_ADDR 32 bit RAM Address, to read or write */
  375. /* Bit 31..19: reserved */
  376. #define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */
  377. /* RAM Interface Registers */
  378. /* B3_RI_CTRL 16 bit RAM Iface Control Register */
  379. enum {
  380. RI_CLR_RD_PERR = 1<<9, /* Clear IRQ RAM Read Parity Err */
  381. RI_CLR_WR_PERR = 1<<8, /* Clear IRQ RAM Write Parity Err*/
  382. RI_RST_CLR = 1<<1, /* Clear RAM Interface Reset */
  383. RI_RST_SET = 1<<0, /* Set RAM Interface Reset */
  384. };
  385. /* MAC Arbiter Registers */
  386. /* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */
  387. enum {
  388. MA_FOE_ON = 1<<3, /* XMAC Fast Output Enable ON */
  389. MA_FOE_OFF = 1<<2, /* XMAC Fast Output Enable OFF */
  390. MA_RST_CLR = 1<<1, /* Clear MAC Arbiter Reset */
  391. MA_RST_SET = 1<<0, /* Set MAC Arbiter Reset */
  392. };
  393. /* Timeout values */
  394. #define SK_MAC_TO_53 72 /* MAC arbiter timeout */
  395. #define SK_PKT_TO_53 0x2000 /* Packet arbiter timeout */
  396. #define SK_PKT_TO_MAX 0xffff /* Maximum value */
  397. #define SK_RI_TO_53 36 /* RAM interface timeout */
  398. /* Packet Arbiter Registers */
  399. /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */
  400. enum {
  401. PA_CLR_TO_TX2 = 1<<13,/* Clear IRQ Packet Timeout TX2 */
  402. PA_CLR_TO_TX1 = 1<<12,/* Clear IRQ Packet Timeout TX1 */
  403. PA_CLR_TO_RX2 = 1<<11,/* Clear IRQ Packet Timeout RX2 */
  404. PA_CLR_TO_RX1 = 1<<10,/* Clear IRQ Packet Timeout RX1 */
  405. PA_ENA_TO_TX2 = 1<<9, /* Enable Timeout Timer TX2 */
  406. PA_DIS_TO_TX2 = 1<<8, /* Disable Timeout Timer TX2 */
  407. PA_ENA_TO_TX1 = 1<<7, /* Enable Timeout Timer TX1 */
  408. PA_DIS_TO_TX1 = 1<<6, /* Disable Timeout Timer TX1 */
  409. PA_ENA_TO_RX2 = 1<<5, /* Enable Timeout Timer RX2 */
  410. PA_DIS_TO_RX2 = 1<<4, /* Disable Timeout Timer RX2 */
  411. PA_ENA_TO_RX1 = 1<<3, /* Enable Timeout Timer RX1 */
  412. PA_DIS_TO_RX1 = 1<<2, /* Disable Timeout Timer RX1 */
  413. PA_RST_CLR = 1<<1, /* Clear MAC Arbiter Reset */
  414. PA_RST_SET = 1<<0, /* Set MAC Arbiter Reset */
  415. };
  416. #define PA_ENA_TO_ALL (PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\
  417. PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
  418. /* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */
  419. /* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */
  420. /* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */
  421. /* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */
  422. /* TXA_LIM_VAL 32 bit Tx Arb Limit Counter Value */
  423. #define TXA_MAX_VAL 0x00ffffffUL /* Bit 23.. 0: Max TXA Timer/Cnt Val */
  424. /* TXA_CTRL 8 bit Tx Arbiter Control Register */
  425. enum {
  426. TXA_ENA_FSYNC = 1<<7, /* Enable force of sync Tx queue */
  427. TXA_DIS_FSYNC = 1<<6, /* Disable force of sync Tx queue */
  428. TXA_ENA_ALLOC = 1<<5, /* Enable alloc of free bandwidth */
  429. TXA_DIS_ALLOC = 1<<4, /* Disable alloc of free bandwidth */
  430. TXA_START_RC = 1<<3, /* Start sync Rate Control */
  431. TXA_STOP_RC = 1<<2, /* Stop sync Rate Control */
  432. TXA_ENA_ARB = 1<<1, /* Enable Tx Arbiter */
  433. TXA_DIS_ARB = 1<<0, /* Disable Tx Arbiter */
  434. };
  435. /*
  436. * Bank 4 - 5
  437. */
  438. /* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */
  439. enum {
  440. TXA_ITI_INI = 0x0200,/* 32 bit Tx Arb Interval Timer Init Val*/
  441. TXA_ITI_VAL = 0x0204,/* 32 bit Tx Arb Interval Timer Value */
  442. TXA_LIM_INI = 0x0208,/* 32 bit Tx Arb Limit Counter Init Val */
  443. TXA_LIM_VAL = 0x020c,/* 32 bit Tx Arb Limit Counter Value */
  444. TXA_CTRL = 0x0210,/* 8 bit Tx Arbiter Control Register */
  445. TXA_TEST = 0x0211,/* 8 bit Tx Arbiter Test Register */
  446. TXA_STAT = 0x0212,/* 8 bit Tx Arbiter Status Register */
  447. };
  448. enum {
  449. B6_EXT_REG = 0x0300,/* External registers (GENESIS only) */
  450. B7_CFG_SPC = 0x0380,/* copy of the Configuration register */
  451. B8_RQ1_REGS = 0x0400,/* Receive Queue 1 */
  452. B8_RQ2_REGS = 0x0480,/* Receive Queue 2 */
  453. B8_TS1_REGS = 0x0600,/* Transmit sync queue 1 */
  454. B8_TA1_REGS = 0x0680,/* Transmit async queue 1 */
  455. B8_TS2_REGS = 0x0700,/* Transmit sync queue 2 */
  456. B8_TA2_REGS = 0x0780,/* Transmit sync queue 2 */
  457. B16_RAM_REGS = 0x0800,/* RAM Buffer Registers */
  458. };
  459. /* Queue Register Offsets, use Q_ADDR() to access */
  460. enum {
  461. B8_Q_REGS = 0x0400, /* base of Queue registers */
  462. Q_D = 0x00, /* 8*32 bit Current Descriptor */
  463. Q_DA_L = 0x20, /* 32 bit Current Descriptor Address Low dWord */
  464. Q_DA_H = 0x24, /* 32 bit Current Descriptor Address High dWord */
  465. Q_AC_L = 0x28, /* 32 bit Current Address Counter Low dWord */
  466. Q_AC_H = 0x2c, /* 32 bit Current Address Counter High dWord */
  467. Q_BC = 0x30, /* 32 bit Current Byte Counter */
  468. Q_CSR = 0x34, /* 32 bit BMU Control/Status Register */
  469. Q_F = 0x38, /* 32 bit Flag Register */
  470. Q_T1 = 0x3c, /* 32 bit Test Register 1 */
  471. Q_T1_TR = 0x3c, /* 8 bit Test Register 1 Transfer SM */
  472. Q_T1_WR = 0x3d, /* 8 bit Test Register 1 Write Descriptor SM */
  473. Q_T1_RD = 0x3e, /* 8 bit Test Register 1 Read Descriptor SM */
  474. Q_T1_SV = 0x3f, /* 8 bit Test Register 1 Supervisor SM */
  475. Q_T2 = 0x40, /* 32 bit Test Register 2 */
  476. Q_T3 = 0x44, /* 32 bit Test Register 3 */
  477. };
  478. #define Q_ADDR(reg, offs) (B8_Q_REGS + (reg) + (offs))
  479. /* RAM Buffer Register Offsets */
  480. enum {
  481. RB_START= 0x00,/* 32 bit RAM Buffer Start Address */
  482. RB_END = 0x04,/* 32 bit RAM Buffer End Address */
  483. RB_WP = 0x08,/* 32 bit RAM Buffer Write Pointer */
  484. RB_RP = 0x0c,/* 32 bit RAM Buffer Read Pointer */
  485. RB_RX_UTPP= 0x10,/* 32 bit Rx Upper Threshold, Pause Packet */
  486. RB_RX_LTPP= 0x14,/* 32 bit Rx Lower Threshold, Pause Packet */
  487. RB_RX_UTHP= 0x18,/* 32 bit Rx Upper Threshold, High Prio */
  488. RB_RX_LTHP= 0x1c,/* 32 bit Rx Lower Threshold, High Prio */
  489. /* 0x10 - 0x1f: reserved at Tx RAM Buffer Registers */
  490. RB_PC = 0x20,/* 32 bit RAM Buffer Packet Counter */
  491. RB_LEV = 0x24,/* 32 bit RAM Buffer Level Register */
  492. RB_CTRL = 0x28,/* 32 bit RAM Buffer Control Register */
  493. RB_TST1 = 0x29,/* 8 bit RAM Buffer Test Register 1 */
  494. RB_TST2 = 0x2a,/* 8 bit RAM Buffer Test Register 2 */
  495. };
  496. /* Receive and Transmit Queues */
  497. enum {
  498. Q_R1 = 0x0000, /* Receive Queue 1 */
  499. Q_R2 = 0x0080, /* Receive Queue 2 */
  500. Q_XS1 = 0x0200, /* Synchronous Transmit Queue 1 */
  501. Q_XA1 = 0x0280, /* Asynchronous Transmit Queue 1 */
  502. Q_XS2 = 0x0300, /* Synchronous Transmit Queue 2 */
  503. Q_XA2 = 0x0380, /* Asynchronous Transmit Queue 2 */
  504. };
  505. /* Different MAC Types */
  506. enum {
  507. SK_MAC_XMAC = 0, /* Xaqti XMAC II */
  508. SK_MAC_GMAC = 1, /* Marvell GMAC */
  509. };
  510. /* Different PHY Types */
  511. enum {
  512. SK_PHY_XMAC = 0,/* integrated in XMAC II */
  513. SK_PHY_BCOM = 1,/* Broadcom BCM5400 */
  514. SK_PHY_LONE = 2,/* Level One LXT1000 [not supported]*/
  515. SK_PHY_NAT = 3,/* National DP83891 [not supported] */
  516. SK_PHY_MARV_COPPER= 4,/* Marvell 88E1011S */
  517. SK_PHY_MARV_FIBER = 5,/* Marvell 88E1011S working on fiber */
  518. };
  519. /* PHY addresses (bits 12..8 of PHY address reg) */
  520. enum {
  521. PHY_ADDR_XMAC = 0<<8,
  522. PHY_ADDR_BCOM = 1<<8,
  523. /* GPHY address (bits 15..11 of SMI control reg) */
  524. PHY_ADDR_MARV = 0,
  525. };
  526. #define RB_ADDR(offs, queue) ((u16)B16_RAM_REGS + (u16)(queue) + (offs))
  527. /* Receive MAC FIFO, Receive LED, and Link_Sync regs (GENESIS only) */
  528. enum {
  529. RX_MFF_EA = 0x0c00,/* 32 bit Receive MAC FIFO End Address */
  530. RX_MFF_WP = 0x0c04,/* 32 bit Receive MAC FIFO Write Pointer */
  531. RX_MFF_RP = 0x0c0c,/* 32 bit Receive MAC FIFO Read Pointer */
  532. RX_MFF_PC = 0x0c10,/* 32 bit Receive MAC FIFO Packet Cnt */
  533. RX_MFF_LEV = 0x0c14,/* 32 bit Receive MAC FIFO Level */
  534. RX_MFF_CTRL1 = 0x0c18,/* 16 bit Receive MAC FIFO Control Reg 1*/
  535. RX_MFF_STAT_TO = 0x0c1a,/* 8 bit Receive MAC Status Timeout */
  536. RX_MFF_TIST_TO = 0x0c1b,/* 8 bit Receive MAC Time Stamp Timeout */
  537. RX_MFF_CTRL2 = 0x0c1c,/* 8 bit Receive MAC FIFO Control Reg 2*/
  538. RX_MFF_TST1 = 0x0c1d,/* 8 bit Receive MAC FIFO Test Reg 1 */
  539. RX_MFF_TST2 = 0x0c1e,/* 8 bit Receive MAC FIFO Test Reg 2 */
  540. RX_LED_INI = 0x0c20,/* 32 bit Receive LED Cnt Init Value */
  541. RX_LED_VAL = 0x0c24,/* 32 bit Receive LED Cnt Current Value */
  542. RX_LED_CTRL = 0x0c28,/* 8 bit Receive LED Cnt Control Reg */
  543. RX_LED_TST = 0x0c29,/* 8 bit Receive LED Cnt Test Register */
  544. LNK_SYNC_INI = 0x0c30,/* 32 bit Link Sync Cnt Init Value */
  545. LNK_SYNC_VAL = 0x0c34,/* 32 bit Link Sync Cnt Current Value */
  546. LNK_SYNC_CTRL = 0x0c38,/* 8 bit Link Sync Cnt Control Register */
  547. LNK_SYNC_TST = 0x0c39,/* 8 bit Link Sync Cnt Test Register */
  548. LNK_LED_REG = 0x0c3c,/* 8 bit Link LED Register */
  549. };
  550. /* Receive and Transmit MAC FIFO Registers (GENESIS only) */
  551. /* RX_MFF_CTRL1 16 bit Receive MAC FIFO Control Reg 1 */
  552. enum {
  553. MFF_ENA_RDY_PAT = 1<<13, /* Enable Ready Patch */
  554. MFF_DIS_RDY_PAT = 1<<12, /* Disable Ready Patch */
  555. MFF_ENA_TIM_PAT = 1<<11, /* Enable Timing Patch */
  556. MFF_DIS_TIM_PAT = 1<<10, /* Disable Timing Patch */
  557. MFF_ENA_ALM_FUL = 1<<9, /* Enable AlmostFull Sign */
  558. MFF_DIS_ALM_FUL = 1<<8, /* Disable AlmostFull Sign */
  559. MFF_ENA_PAUSE = 1<<7, /* Enable Pause Signaling */
  560. MFF_DIS_PAUSE = 1<<6, /* Disable Pause Signaling */
  561. MFF_ENA_FLUSH = 1<<5, /* Enable Frame Flushing */
  562. MFF_DIS_FLUSH = 1<<4, /* Disable Frame Flushing */
  563. MFF_ENA_TIST = 1<<3, /* Enable Time Stamp Gener */
  564. MFF_DIS_TIST = 1<<2, /* Disable Time Stamp Gener */
  565. MFF_CLR_INTIST = 1<<1, /* Clear IRQ No Time Stamp */
  566. MFF_CLR_INSTAT = 1<<0, /* Clear IRQ No Status */
  567. MFF_RX_CTRL_DEF = MFF_ENA_TIM_PAT,
  568. };
  569. /* TX_MFF_CTRL1 16 bit Transmit MAC FIFO Control Reg 1 */
  570. enum {
  571. MFF_CLR_PERR = 1<<15, /* Clear Parity Error IRQ */
  572. MFF_ENA_PKT_REC = 1<<13, /* Enable Packet Recovery */
  573. MFF_DIS_PKT_REC = 1<<12, /* Disable Packet Recovery */
  574. MFF_ENA_W4E = 1<<7, /* Enable Wait for Empty */
  575. MFF_DIS_W4E = 1<<6, /* Disable Wait for Empty */
  576. MFF_ENA_LOOPB = 1<<3, /* Enable Loopback */
  577. MFF_DIS_LOOPB = 1<<2, /* Disable Loopback */
  578. MFF_CLR_MAC_RST = 1<<1, /* Clear XMAC Reset */
  579. MFF_SET_MAC_RST = 1<<0, /* Set XMAC Reset */
  580. MFF_TX_CTRL_DEF = MFF_ENA_PKT_REC | (u16) MFF_ENA_TIM_PAT | MFF_ENA_FLUSH,
  581. };
  582. /* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */
  583. /* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */
  584. enum {
  585. MFF_WSP_T_ON = 1<<6, /* Tx: Write Shadow Ptr TestOn */
  586. MFF_WSP_T_OFF = 1<<5, /* Tx: Write Shadow Ptr TstOff */
  587. MFF_WSP_INC = 1<<4, /* Tx: Write Shadow Ptr Increment */
  588. MFF_PC_DEC = 1<<3, /* Packet Counter Decrement */
  589. MFF_PC_T_ON = 1<<2, /* Packet Counter Test On */
  590. MFF_PC_T_OFF = 1<<1, /* Packet Counter Test Off */
  591. MFF_PC_INC = 1<<0, /* Packet Counter Increment */
  592. };
  593. /* RX_MFF_TST1 8 bit Receive MAC FIFO Test Register 1 */
  594. /* TX_MFF_TST1 8 bit Transmit MAC FIFO Test Register 1 */
  595. enum {
  596. MFF_WP_T_ON = 1<<6, /* Write Pointer Test On */
  597. MFF_WP_T_OFF = 1<<5, /* Write Pointer Test Off */
  598. MFF_WP_INC = 1<<4, /* Write Pointer Increm */
  599. MFF_RP_T_ON = 1<<2, /* Read Pointer Test On */
  600. MFF_RP_T_OFF = 1<<1, /* Read Pointer Test Off */
  601. MFF_RP_DEC = 1<<0, /* Read Pointer Decrement */
  602. };
  603. /* RX_MFF_CTRL2 8 bit Receive MAC FIFO Control Reg 2 */
  604. /* TX_MFF_CTRL2 8 bit Transmit MAC FIFO Control Reg 2 */
  605. enum {
  606. MFF_ENA_OP_MD = 1<<3, /* Enable Operation Mode */
  607. MFF_DIS_OP_MD = 1<<2, /* Disable Operation Mode */
  608. MFF_RST_CLR = 1<<1, /* Clear MAC FIFO Reset */
  609. MFF_RST_SET = 1<<0, /* Set MAC FIFO Reset */
  610. };
  611. /* Link LED Counter Registers (GENESIS only) */
  612. /* RX_LED_CTRL 8 bit Receive LED Cnt Control Reg */
  613. /* TX_LED_CTRL 8 bit Transmit LED Cnt Control Reg */
  614. /* LNK_SYNC_CTRL 8 bit Link Sync Cnt Control Register */
  615. enum {
  616. LED_START = 1<<2, /* Start Timer */
  617. LED_STOP = 1<<1, /* Stop Timer */
  618. LED_STATE = 1<<0, /* Rx/Tx: LED State, 1=LED on */
  619. };
  620. /* RX_LED_TST 8 bit Receive LED Cnt Test Register */
  621. /* TX_LED_TST 8 bit Transmit LED Cnt Test Register */
  622. /* LNK_SYNC_TST 8 bit Link Sync Cnt Test Register */
  623. enum {
  624. LED_T_ON = 1<<2, /* LED Counter Test mode On */
  625. LED_T_OFF = 1<<1, /* LED Counter Test mode Off */
  626. LED_T_STEP = 1<<0, /* LED Counter Step */
  627. };
  628. /* LNK_LED_REG 8 bit Link LED Register */
  629. enum {
  630. LED_BLK_ON = 1<<5, /* Link LED Blinking On */
  631. LED_BLK_OFF = 1<<4, /* Link LED Blinking Off */
  632. LED_SYNC_ON = 1<<3, /* Use Sync Wire to switch LED */
  633. LED_SYNC_OFF = 1<<2, /* Disable Sync Wire Input */
  634. LED_ON = 1<<1, /* switch LED on */
  635. LED_OFF = 1<<0, /* switch LED off */
  636. };
  637. /* Receive GMAC FIFO (YUKON) */
  638. enum {
  639. RX_GMF_EA = 0x0c40,/* 32 bit Rx GMAC FIFO End Address */
  640. RX_GMF_AF_THR = 0x0c44,/* 32 bit Rx GMAC FIFO Almost Full Thresh. */
  641. RX_GMF_CTRL_T = 0x0c48,/* 32 bit Rx GMAC FIFO Control/Test */
  642. RX_GMF_FL_MSK = 0x0c4c,/* 32 bit Rx GMAC FIFO Flush Mask */
  643. RX_GMF_FL_THR = 0x0c50,/* 32 bit Rx GMAC FIFO Flush Threshold */
  644. RX_GMF_WP = 0x0c60,/* 32 bit Rx GMAC FIFO Write Pointer */
  645. RX_GMF_WLEV = 0x0c68,/* 32 bit Rx GMAC FIFO Write Level */
  646. RX_GMF_RP = 0x0c70,/* 32 bit Rx GMAC FIFO Read Pointer */
  647. RX_GMF_RLEV = 0x0c78,/* 32 bit Rx GMAC FIFO Read Level */
  648. };
  649. /* TXA_TEST 8 bit Tx Arbiter Test Register */
  650. enum {
  651. TXA_INT_T_ON = 1<<5, /* Tx Arb Interval Timer Test On */
  652. TXA_INT_T_OFF = 1<<4, /* Tx Arb Interval Timer Test Off */
  653. TXA_INT_T_STEP = 1<<3, /* Tx Arb Interval Timer Step */
  654. TXA_LIM_T_ON = 1<<2, /* Tx Arb Limit Timer Test On */
  655. TXA_LIM_T_OFF = 1<<1, /* Tx Arb Limit Timer Test Off */
  656. TXA_LIM_T_STEP = 1<<0, /* Tx Arb Limit Timer Step */
  657. };
  658. /* TXA_STAT 8 bit Tx Arbiter Status Register */
  659. enum {
  660. TXA_PRIO_XS = 1<<0, /* sync queue has prio to send */
  661. };
  662. /* Q_BC 32 bit Current Byte Counter */
  663. /* BMU Control Status Registers */
  664. /* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */
  665. /* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */
  666. /* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
  667. /* B0_XS1_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 1 */
  668. /* B0_XA2_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */
  669. /* B0_XS2_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 2 */
  670. /* Q_CSR 32 bit BMU Control/Status Register */
  671. enum {
  672. CSR_SV_IDLE = 1<<24, /* BMU SM Idle */
  673. CSR_DESC_CLR = 1<<21, /* Clear Reset for Descr */
  674. CSR_DESC_SET = 1<<20, /* Set Reset for Descr */
  675. CSR_FIFO_CLR = 1<<19, /* Clear Reset for FIFO */
  676. CSR_FIFO_SET = 1<<18, /* Set Reset for FIFO */
  677. CSR_HPI_RUN = 1<<17, /* Release HPI SM */
  678. CSR_HPI_RST = 1<<16, /* Reset HPI SM to Idle */
  679. CSR_SV_RUN = 1<<15, /* Release Supervisor SM */
  680. CSR_SV_RST = 1<<14, /* Reset Supervisor SM */
  681. CSR_DREAD_RUN = 1<<13, /* Release Descr Read SM */
  682. CSR_DREAD_RST = 1<<12, /* Reset Descr Read SM */
  683. CSR_DWRITE_RUN = 1<<11, /* Release Descr Write SM */
  684. CSR_DWRITE_RST = 1<<10, /* Reset Descr Write SM */
  685. CSR_TRANS_RUN = 1<<9, /* Release Transfer SM */
  686. CSR_TRANS_RST = 1<<8, /* Reset Transfer SM */
  687. CSR_ENA_POL = 1<<7, /* Enable Descr Polling */
  688. CSR_DIS_POL = 1<<6, /* Disable Descr Polling */
  689. CSR_STOP = 1<<5, /* Stop Rx/Tx Queue */
  690. CSR_START = 1<<4, /* Start Rx/Tx Queue */
  691. CSR_IRQ_CL_P = 1<<3, /* (Rx) Clear Parity IRQ */
  692. CSR_IRQ_CL_B = 1<<2, /* Clear EOB IRQ */
  693. CSR_IRQ_CL_F = 1<<1, /* Clear EOF IRQ */
  694. CSR_IRQ_CL_C = 1<<0, /* Clear ERR IRQ */
  695. };
  696. #define CSR_SET_RESET (CSR_DESC_SET | CSR_FIFO_SET | CSR_HPI_RST |\
  697. CSR_SV_RST | CSR_DREAD_RST | CSR_DWRITE_RST |\
  698. CSR_TRANS_RST)
  699. #define CSR_CLR_RESET (CSR_DESC_CLR | CSR_FIFO_CLR | CSR_HPI_RUN |\
  700. CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
  701. CSR_TRANS_RUN)
  702. /* Q_F 32 bit Flag Register */
  703. enum {
  704. F_ALM_FULL = 1<<27, /* Rx FIFO: almost full */
  705. F_EMPTY = 1<<27, /* Tx FIFO: empty flag */
  706. F_FIFO_EOF = 1<<26, /* Tag (EOF Flag) bit in FIFO */
  707. F_WM_REACHED = 1<<25, /* Watermark reached */
  708. F_FIFO_LEVEL = 0x1fL<<16, /* Bit 23..16: # of Qwords in FIFO */
  709. F_WATER_MARK = 0x0007ffL, /* Bit 10.. 0: Watermark */
  710. };
  711. /* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */
  712. /* RB_START 32 bit RAM Buffer Start Address */
  713. /* RB_END 32 bit RAM Buffer End Address */
  714. /* RB_WP 32 bit RAM Buffer Write Pointer */
  715. /* RB_RP 32 bit RAM Buffer Read Pointer */
  716. /* RB_RX_UTPP 32 bit Rx Upper Threshold, Pause Pack */
  717. /* RB_RX_LTPP 32 bit Rx Lower Threshold, Pause Pack */
  718. /* RB_RX_UTHP 32 bit Rx Upper Threshold, High Prio */
  719. /* RB_RX_LTHP 32 bit Rx Lower Threshold, High Prio */
  720. /* RB_PC 32 bit RAM Buffer Packet Counter */
  721. /* RB_LEV 32 bit RAM Buffer Level Register */
  722. #define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */
  723. /* RB_TST2 8 bit RAM Buffer Test Register 2 */
  724. /* RB_TST1 8 bit RAM Buffer Test Register 1 */
  725. /* RB_CTRL 8 bit RAM Buffer Control Register */
  726. enum {
  727. RB_ENA_STFWD = 1<<5, /* Enable Store & Forward */
  728. RB_DIS_STFWD = 1<<4, /* Disable Store & Forward */
  729. RB_ENA_OP_MD = 1<<3, /* Enable Operation Mode */
  730. RB_DIS_OP_MD = 1<<2, /* Disable Operation Mode */
  731. RB_RST_CLR = 1<<1, /* Clear RAM Buf STM Reset */
  732. RB_RST_SET = 1<<0, /* Set RAM Buf STM Reset */
  733. };
  734. /* Transmit MAC FIFO and Transmit LED Registers (GENESIS only), */
  735. enum {
  736. TX_MFF_EA = 0x0d00,/* 32 bit Transmit MAC FIFO End Address */
  737. TX_MFF_WP = 0x0d04,/* 32 bit Transmit MAC FIFO WR Pointer */
  738. TX_MFF_WSP = 0x0d08,/* 32 bit Transmit MAC FIFO WR Shadow Ptr */
  739. TX_MFF_RP = 0x0d0c,/* 32 bit Transmit MAC FIFO RD Pointer */
  740. TX_MFF_PC = 0x0d10,/* 32 bit Transmit MAC FIFO Packet Cnt */
  741. TX_MFF_LEV = 0x0d14,/* 32 bit Transmit MAC FIFO Level */
  742. TX_MFF_CTRL1 = 0x0d18,/* 16 bit Transmit MAC FIFO Ctrl Reg 1 */
  743. TX_MFF_WAF = 0x0d1a,/* 8 bit Transmit MAC Wait after flush */
  744. TX_MFF_CTRL2 = 0x0d1c,/* 8 bit Transmit MAC FIFO Ctrl Reg 2 */
  745. TX_MFF_TST1 = 0x0d1d,/* 8 bit Transmit MAC FIFO Test Reg 1 */
  746. TX_MFF_TST2 = 0x0d1e,/* 8 bit Transmit MAC FIFO Test Reg 2 */
  747. TX_LED_INI = 0x0d20,/* 32 bit Transmit LED Cnt Init Value */
  748. TX_LED_VAL = 0x0d24,/* 32 bit Transmit LED Cnt Current Val */
  749. TX_LED_CTRL = 0x0d28,/* 8 bit Transmit LED Cnt Control Reg */
  750. TX_LED_TST = 0x0d29,/* 8 bit Transmit LED Cnt Test Reg */
  751. };
  752. /* Counter and Timer constants, for a host clock of 62.5 MHz */
  753. #define SK_XMIT_DUR 0x002faf08UL /* 50 ms */
  754. #define SK_BLK_DUR 0x01dcd650UL /* 500 ms */
  755. #define SK_DPOLL_DEF 0x00ee6b28UL /* 250 ms at 62.5 MHz */
  756. #define SK_DPOLL_MAX 0x00ffffffUL /* 268 ms at 62.5 MHz */
  757. /* 215 ms at 78.12 MHz */
  758. #define SK_FACT_62 100 /* is given in percent */
  759. #define SK_FACT_53 85 /* on GENESIS: 53.12 MHz */
  760. #define SK_FACT_78 125 /* on YUKON: 78.12 MHz */
  761. /* Transmit GMAC FIFO (YUKON only) */
  762. enum {
  763. TX_GMF_EA = 0x0d40,/* 32 bit Tx GMAC FIFO End Address */
  764. TX_GMF_AE_THR = 0x0d44,/* 32 bit Tx GMAC FIFO Almost Empty Thresh.*/
  765. TX_GMF_CTRL_T = 0x0d48,/* 32 bit Tx GMAC FIFO Control/Test */
  766. TX_GMF_WP = 0x0d60,/* 32 bit Tx GMAC FIFO Write Pointer */
  767. TX_GMF_WSP = 0x0d64,/* 32 bit Tx GMAC FIFO Write Shadow Ptr. */
  768. TX_GMF_WLEV = 0x0d68,/* 32 bit Tx GMAC FIFO Write Level */
  769. TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */
  770. TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */
  771. TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */
  772. /* Descriptor Poll Timer Registers */
  773. B28_DPT_INI = 0x0e00,/* 24 bit Descriptor Poll Timer Init Val */
  774. B28_DPT_VAL = 0x0e04,/* 24 bit Descriptor Poll Timer Curr Val */
  775. B28_DPT_CTRL = 0x0e08,/* 8 bit Descriptor Poll Timer Ctrl Reg */
  776. B28_DPT_TST = 0x0e0a,/* 8 bit Descriptor Poll Timer Test Reg */
  777. /* Time Stamp Timer Registers (YUKON only) */
  778. GMAC_TI_ST_VAL = 0x0e14,/* 32 bit Time Stamp Timer Curr Val */
  779. GMAC_TI_ST_CTRL = 0x0e18,/* 8 bit Time Stamp Timer Ctrl Reg */
  780. GMAC_TI_ST_TST = 0x0e1a,/* 8 bit Time Stamp Timer Test Reg */
  781. };
  782. enum {
  783. LINKLED_OFF = 0x01,
  784. LINKLED_ON = 0x02,
  785. LINKLED_LINKSYNC_OFF = 0x04,
  786. LINKLED_LINKSYNC_ON = 0x08,
  787. LINKLED_BLINK_OFF = 0x10,
  788. LINKLED_BLINK_ON = 0x20,
  789. };
  790. /* GMAC and GPHY Control Registers (YUKON only) */
  791. enum {
  792. GMAC_CTRL = 0x0f00,/* 32 bit GMAC Control Reg */
  793. GPHY_CTRL = 0x0f04,/* 32 bit GPHY Control Reg */
  794. GMAC_IRQ_SRC = 0x0f08,/* 8 bit GMAC Interrupt Source Reg */
  795. GMAC_IRQ_MSK = 0x0f0c,/* 8 bit GMAC Interrupt Mask Reg */
  796. GMAC_LINK_CTRL = 0x0f10,/* 16 bit Link Control Reg */
  797. /* Wake-up Frame Pattern Match Control Registers (YUKON only) */
  798. WOL_REG_OFFS = 0x20,/* HW-Bug: Address is + 0x20 against spec. */
  799. WOL_CTRL_STAT = 0x0f20,/* 16 bit WOL Control/Status Reg */
  800. WOL_MATCH_CTL = 0x0f22,/* 8 bit WOL Match Control Reg */
  801. WOL_MATCH_RES = 0x0f23,/* 8 bit WOL Match Result Reg */
  802. WOL_MAC_ADDR = 0x0f24,/* 32 bit WOL MAC Address */
  803. WOL_PATT_RPTR = 0x0f2c,/* 8 bit WOL Pattern Read Pointer */
  804. /* WOL Pattern Length Registers (YUKON only) */
  805. WOL_PATT_LEN_LO = 0x0f30,/* 32 bit WOL Pattern Length 3..0 */
  806. WOL_PATT_LEN_HI = 0x0f34,/* 24 bit WOL Pattern Length 6..4 */
  807. /* WOL Pattern Counter Registers (YUKON only) */
  808. WOL_PATT_CNT_0 = 0x0f38,/* 32 bit WOL Pattern Counter 3..0 */
  809. WOL_PATT_CNT_4 = 0x0f3c,/* 24 bit WOL Pattern Counter 6..4 */
  810. };
  811. #define WOL_REGS(port, x) (x + (port)*0x80)
  812. enum {
  813. WOL_PATT_RAM_1 = 0x1000,/* WOL Pattern RAM Link 1 */
  814. WOL_PATT_RAM_2 = 0x1400,/* WOL Pattern RAM Link 2 */
  815. };
  816. #define WOL_PATT_RAM_BASE(port) (WOL_PATT_RAM_1 + (port)*0x400)
  817. enum {
  818. BASE_XMAC_1 = 0x2000,/* XMAC 1 registers */
  819. BASE_GMAC_1 = 0x2800,/* GMAC 1 registers */
  820. BASE_XMAC_2 = 0x3000,/* XMAC 2 registers */
  821. BASE_GMAC_2 = 0x3800,/* GMAC 2 registers */
  822. };
  823. /*
  824. * Receive Frame Status Encoding
  825. */
  826. enum {
  827. XMR_FS_LEN = 0x3fff<<18, /* Bit 31..18: Rx Frame Length */
  828. XMR_FS_LEN_SHIFT = 18,
  829. XMR_FS_2L_VLAN = 1<<17, /* Bit 17: tagged wh 2Lev VLAN ID*/
  830. XMR_FS_1_VLAN = 1<<16, /* Bit 16: tagged wh 1ev VLAN ID*/
  831. XMR_FS_BC = 1<<15, /* Bit 15: Broadcast Frame */
  832. XMR_FS_MC = 1<<14, /* Bit 14: Multicast Frame */
  833. XMR_FS_UC = 1<<13, /* Bit 13: Unicast Frame */
  834. XMR_FS_BURST = 1<<11, /* Bit 11: Burst Mode */
  835. XMR_FS_CEX_ERR = 1<<10, /* Bit 10: Carrier Ext. Error */
  836. XMR_FS_802_3 = 1<<9, /* Bit 9: 802.3 Frame */
  837. XMR_FS_COL_ERR = 1<<8, /* Bit 8: Collision Error */
  838. XMR_FS_CAR_ERR = 1<<7, /* Bit 7: Carrier Event Error */
  839. XMR_FS_LEN_ERR = 1<<6, /* Bit 6: In-Range Length Error */
  840. XMR_FS_FRA_ERR = 1<<5, /* Bit 5: Framing Error */
  841. XMR_FS_RUNT = 1<<4, /* Bit 4: Runt Frame */
  842. XMR_FS_LNG_ERR = 1<<3, /* Bit 3: Giant (Jumbo) Frame */
  843. XMR_FS_FCS_ERR = 1<<2, /* Bit 2: Frame Check Sequ Err */
  844. XMR_FS_ERR = 1<<1, /* Bit 1: Frame Error */
  845. XMR_FS_MCTRL = 1<<0, /* Bit 0: MAC Control Packet */
  846. /*
  847. * XMR_FS_ERR will be set if
  848. * XMR_FS_FCS_ERR, XMR_FS_LNG_ERR, XMR_FS_RUNT,
  849. * XMR_FS_FRA_ERR, XMR_FS_LEN_ERR, or XMR_FS_CEX_ERR
  850. * is set. XMR_FS_LNG_ERR and XMR_FS_LEN_ERR will issue
  851. * XMR_FS_ERR unless the corresponding bit in the Receive Command
  852. * Register is set.
  853. */
  854. };
  855. /*
  856. ,* XMAC-PHY Registers, indirect addressed over the XMAC
  857. */
  858. enum {
  859. PHY_XMAC_CTRL = 0x00,/* 16 bit r/w PHY Control Register */
  860. PHY_XMAC_STAT = 0x01,/* 16 bit r/w PHY Status Register */
  861. PHY_XMAC_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */
  862. PHY_XMAC_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */
  863. PHY_XMAC_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
  864. PHY_XMAC_AUNE_LP = 0x05,/* 16 bit r/o Link Partner Abi Reg */
  865. PHY_XMAC_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
  866. PHY_XMAC_NEPG = 0x07,/* 16 bit r/w Next Page Register */
  867. PHY_XMAC_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */
  868. PHY_XMAC_EXT_STAT = 0x0f,/* 16 bit r/o Ext Status Register */
  869. PHY_XMAC_RES_ABI = 0x10,/* 16 bit r/o PHY Resolved Ability */
  870. };
  871. /*
  872. * Broadcom-PHY Registers, indirect addressed over XMAC
  873. */
  874. enum {
  875. PHY_BCOM_CTRL = 0x00,/* 16 bit r/w PHY Control Register */
  876. PHY_BCOM_STAT = 0x01,/* 16 bit r/o PHY Status Register */
  877. PHY_BCOM_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */
  878. PHY_BCOM_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */
  879. PHY_BCOM_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
  880. PHY_BCOM_AUNE_LP = 0x05,/* 16 bit r/o Link Part Ability Reg */
  881. PHY_BCOM_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
  882. PHY_BCOM_NEPG = 0x07,/* 16 bit r/w Next Page Register */
  883. PHY_BCOM_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */
  884. /* Broadcom-specific registers */
  885. PHY_BCOM_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */
  886. PHY_BCOM_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */
  887. PHY_BCOM_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Reg */
  888. PHY_BCOM_P_EXT_CTRL = 0x10,/* 16 bit r/w PHY Extended Ctrl Reg */
  889. PHY_BCOM_P_EXT_STAT = 0x11,/* 16 bit r/o PHY Extended Stat Reg */
  890. PHY_BCOM_RE_CTR = 0x12,/* 16 bit r/w Receive Error Counter */
  891. PHY_BCOM_FC_CTR = 0x13,/* 16 bit r/w False Carrier Sense Cnt */
  892. PHY_BCOM_RNO_CTR = 0x14,/* 16 bit r/w Receiver NOT_OK Cnt */
  893. PHY_BCOM_AUX_CTRL = 0x18,/* 16 bit r/w Auxiliary Control Reg */
  894. PHY_BCOM_AUX_STAT = 0x19,/* 16 bit r/o Auxiliary Stat Summary */
  895. PHY_BCOM_INT_STAT = 0x1a,/* 16 bit r/o Interrupt Status Reg */
  896. PHY_BCOM_INT_MASK = 0x1b,/* 16 bit r/w Interrupt Mask Reg */
  897. };
  898. /*
  899. * Marvel-PHY Registers, indirect addressed over GMAC
  900. */
  901. enum {
  902. PHY_MARV_CTRL = 0x00,/* 16 bit r/w PHY Control Register */
  903. PHY_MARV_STAT = 0x01,/* 16 bit r/o PHY Status Register */
  904. PHY_MARV_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */
  905. PHY_MARV_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */
  906. PHY_MARV_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
  907. PHY_MARV_AUNE_LP = 0x05,/* 16 bit r/o Link Part Ability Reg */
  908. PHY_MARV_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
  909. PHY_MARV_NEPG = 0x07,/* 16 bit r/w Next Page Register */
  910. PHY_MARV_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */
  911. /* Marvel-specific registers */
  912. PHY_MARV_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */
  913. PHY_MARV_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */
  914. PHY_MARV_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Reg */
  915. PHY_MARV_PHY_CTRL = 0x10,/* 16 bit r/w PHY Specific Ctrl Reg */
  916. PHY_MARV_PHY_STAT = 0x11,/* 16 bit r/o PHY Specific Stat Reg */
  917. PHY_MARV_INT_MASK = 0x12,/* 16 bit r/w Interrupt Mask Reg */
  918. PHY_MARV_INT_STAT = 0x13,/* 16 bit r/o Interrupt Status Reg */
  919. PHY_MARV_EXT_CTRL = 0x14,/* 16 bit r/w Ext. PHY Specific Ctrl */
  920. PHY_MARV_RXE_CNT = 0x15,/* 16 bit r/w Receive Error Counter */
  921. PHY_MARV_EXT_ADR = 0x16,/* 16 bit r/w Ext. Ad. for Cable Diag. */
  922. PHY_MARV_PORT_IRQ = 0x17,/* 16 bit r/o Port 0 IRQ (88E1111 only) */
  923. PHY_MARV_LED_CTRL = 0x18,/* 16 bit r/w LED Control Reg */
  924. PHY_MARV_LED_OVER = 0x19,/* 16 bit r/w Manual LED Override Reg */
  925. PHY_MARV_EXT_CTRL_2 = 0x1a,/* 16 bit r/w Ext. PHY Specific Ctrl 2 */
  926. PHY_MARV_EXT_P_STAT = 0x1b,/* 16 bit r/w Ext. PHY Spec. Stat Reg */
  927. PHY_MARV_CABLE_DIAG = 0x1c,/* 16 bit r/o Cable Diagnostic Reg */
  928. PHY_MARV_PAGE_ADDR = 0x1d,/* 16 bit r/w Extended Page Address Reg */
  929. PHY_MARV_PAGE_DATA = 0x1e,/* 16 bit r/w Extended Page Data Reg */
  930. /* for 10/100 Fast Ethernet PHY (88E3082 only) */
  931. PHY_MARV_FE_LED_PAR = 0x16,/* 16 bit r/w LED Parallel Select Reg. */
  932. PHY_MARV_FE_LED_SER = 0x17,/* 16 bit r/w LED Stream Select S. LED */
  933. PHY_MARV_FE_VCT_TX = 0x1a,/* 16 bit r/w VCT Reg. for TXP/N Pins */
  934. PHY_MARV_FE_VCT_RX = 0x1b,/* 16 bit r/o VCT Reg. for RXP/N Pins */
  935. PHY_MARV_FE_SPEC_2 = 0x1c,/* 16 bit r/w Specific Control Reg. 2 */
  936. };
  937. enum {
  938. PHY_CT_RESET = 1<<15, /* Bit 15: (sc) clear all PHY related regs */
  939. PHY_CT_LOOP = 1<<14, /* Bit 14: enable Loopback over PHY */
  940. PHY_CT_SPS_LSB = 1<<13, /* Bit 13: Speed select, lower bit */
  941. PHY_CT_ANE = 1<<12, /* Bit 12: Auto-Negotiation Enabled */
  942. PHY_CT_PDOWN = 1<<11, /* Bit 11: Power Down Mode */
  943. PHY_CT_ISOL = 1<<10, /* Bit 10: Isolate Mode */
  944. PHY_CT_RE_CFG = 1<<9, /* Bit 9: (sc) Restart Auto-Negotiation */
  945. PHY_CT_DUP_MD = 1<<8, /* Bit 8: Duplex Mode */
  946. PHY_CT_COL_TST = 1<<7, /* Bit 7: Collision Test enabled */
  947. PHY_CT_SPS_MSB = 1<<6, /* Bit 6: Speed select, upper bit */
  948. };
  949. enum {
  950. PHY_CT_SP1000 = PHY_CT_SPS_MSB, /* enable speed of 1000 Mbps */
  951. PHY_CT_SP100 = PHY_CT_SPS_LSB, /* enable speed of 100 Mbps */
  952. PHY_CT_SP10 = 0, /* enable speed of 10 Mbps */
  953. };
  954. enum {
  955. PHY_ST_EXT_ST = 1<<8, /* Bit 8: Extended Status Present */
  956. PHY_ST_PRE_SUP = 1<<6, /* Bit 6: Preamble Suppression */
  957. PHY_ST_AN_OVER = 1<<5, /* Bit 5: Auto-Negotiation Over */
  958. PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occurred */
  959. PHY_ST_AN_CAP = 1<<3, /* Bit 3: Auto-Negotiation Capability */
  960. PHY_ST_LSYNC = 1<<2, /* Bit 2: Link Synchronized */
  961. PHY_ST_JAB_DET = 1<<1, /* Bit 1: Jabber Detected */
  962. PHY_ST_EXT_REG = 1<<0, /* Bit 0: Extended Register available */
  963. };
  964. enum {
  965. PHY_I1_OUI_MSK = 0x3f<<10, /* Bit 15..10: Organization Unique ID */
  966. PHY_I1_MOD_NUM = 0x3f<<4, /* Bit 9.. 4: Model Number */
  967. PHY_I1_REV_MSK = 0xf, /* Bit 3.. 0: Revision Number */
  968. };
  969. /* different Broadcom PHY Ids */
  970. enum {
  971. PHY_BCOM_ID1_A1 = 0x6041,
  972. PHY_BCOM_ID1_B2 = 0x6043,
  973. PHY_BCOM_ID1_C0 = 0x6044,
  974. PHY_BCOM_ID1_C5 = 0x6047,
  975. };
  976. /* different Marvell PHY Ids */
  977. enum {
  978. PHY_MARV_ID0_VAL= 0x0141, /* Marvell Unique Identifier */
  979. PHY_MARV_ID1_B0 = 0x0C23, /* Yukon (PHY 88E1011) */
  980. PHY_MARV_ID1_B2 = 0x0C25, /* Yukon-Plus (PHY 88E1011) */
  981. PHY_MARV_ID1_C2 = 0x0CC2, /* Yukon-EC (PHY 88E1111) */
  982. PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */
  983. };
  984. /* Advertisement register bits */
  985. enum {
  986. PHY_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */
  987. PHY_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */
  988. PHY_AN_RF = 1<<13, /* Bit 13: Remote Fault Bits */
  989. PHY_AN_PAUSE_ASYM = 1<<11,/* Bit 11: Try for asymmetric */
  990. PHY_AN_PAUSE_CAP = 1<<10, /* Bit 10: Try for pause */
  991. PHY_AN_100BASE4 = 1<<9, /* Bit 9: Try for 100mbps 4k packets */
  992. PHY_AN_100FULL = 1<<8, /* Bit 8: Try for 100mbps full-duplex */
  993. PHY_AN_100HALF = 1<<7, /* Bit 7: Try for 100mbps half-duplex */
  994. PHY_AN_10FULL = 1<<6, /* Bit 6: Try for 10mbps full-duplex */
  995. PHY_AN_10HALF = 1<<5, /* Bit 5: Try for 10mbps half-duplex */
  996. PHY_AN_CSMA = 1<<0, /* Bit 0: Only selector supported */
  997. PHY_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/
  998. PHY_AN_FULL = PHY_AN_100FULL | PHY_AN_10FULL | PHY_AN_CSMA,
  999. PHY_AN_ALL = PHY_AN_10HALF | PHY_AN_10FULL |
  1000. PHY_AN_100HALF | PHY_AN_100FULL,
  1001. };
  1002. /* Xmac Specific */
  1003. enum {
  1004. PHY_X_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */
  1005. PHY_X_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */
  1006. PHY_X_AN_RFB = 3<<12,/* Bit 13..12: Remote Fault Bits */
  1007. PHY_X_AN_PAUSE = 3<<7,/* Bit 8.. 7: Pause Bits */
  1008. PHY_X_AN_HD = 1<<6, /* Bit 6: Half Duplex */
  1009. PHY_X_AN_FD = 1<<5, /* Bit 5: Full Duplex */
  1010. };
  1011. /* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */
  1012. enum {
  1013. PHY_X_P_NO_PAUSE= 0<<7,/* Bit 8..7: no Pause Mode */
  1014. PHY_X_P_SYM_MD = 1<<7, /* Bit 8..7: symmetric Pause Mode */
  1015. PHY_X_P_ASYM_MD = 2<<7,/* Bit 8..7: asymmetric Pause Mode */
  1016. PHY_X_P_BOTH_MD = 3<<7,/* Bit 8..7: both Pause Mode */
  1017. };
  1018. /***** PHY_XMAC_EXT_STAT 16 bit r/w Extended Status Register *****/
  1019. enum {
  1020. PHY_X_EX_FD = 1<<15, /* Bit 15: Device Supports Full Duplex */
  1021. PHY_X_EX_HD = 1<<14, /* Bit 14: Device Supports Half Duplex */
  1022. };
  1023. /***** PHY_XMAC_RES_ABI 16 bit r/o PHY Resolved Ability *****/
  1024. enum {
  1025. PHY_X_RS_PAUSE = 3<<7, /* Bit 8..7: selected Pause Mode */
  1026. PHY_X_RS_HD = 1<<6, /* Bit 6: Half Duplex Mode selected */
  1027. PHY_X_RS_FD = 1<<5, /* Bit 5: Full Duplex Mode selected */
  1028. PHY_X_RS_ABLMIS = 1<<4, /* Bit 4: duplex or pause cap mismatch */
  1029. PHY_X_RS_PAUMIS = 1<<3, /* Bit 3: pause capability mismatch */
  1030. };
  1031. /* Remote Fault Bits (PHY_X_AN_RFB) encoding */
  1032. enum {
  1033. X_RFB_OK = 0<<12,/* Bit 13..12 No errors, Link OK */
  1034. X_RFB_LF = 1<<12,/* Bit 13..12 Link Failure */
  1035. X_RFB_OFF = 2<<12,/* Bit 13..12 Offline */
  1036. X_RFB_AN_ERR = 3<<12,/* Bit 13..12 Auto-Negotiation Error */
  1037. };
  1038. /* Broadcom-Specific */
  1039. /***** PHY_BCOM_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  1040. enum {
  1041. PHY_B_1000C_TEST = 7<<13,/* Bit 15..13: Test Modes */
  1042. PHY_B_1000C_MSE = 1<<12, /* Bit 12: Master/Slave Enable */
  1043. PHY_B_1000C_MSC = 1<<11, /* Bit 11: M/S Configuration */
  1044. PHY_B_1000C_RD = 1<<10, /* Bit 10: Repeater/DTE */
  1045. PHY_B_1000C_AFD = 1<<9, /* Bit 9: Advertise Full Duplex */
  1046. PHY_B_1000C_AHD = 1<<8, /* Bit 8: Advertise Half Duplex */
  1047. };
  1048. /***** PHY_BCOM_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  1049. /***** PHY_MARV_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/
  1050. enum {
  1051. PHY_B_1000S_MSF = 1<<15, /* Bit 15: Master/Slave Fault */
  1052. PHY_B_1000S_MSR = 1<<14, /* Bit 14: Master/Slave Result */
  1053. PHY_B_1000S_LRS = 1<<13, /* Bit 13: Local Receiver Status */
  1054. PHY_B_1000S_RRS = 1<<12, /* Bit 12: Remote Receiver Status */
  1055. PHY_B_1000S_LP_FD = 1<<11, /* Bit 11: Link Partner can FD */
  1056. PHY_B_1000S_LP_HD = 1<<10, /* Bit 10: Link Partner can HD */
  1057. /* Bit 9..8: reserved */
  1058. PHY_B_1000S_IEC = 0xff, /* Bit 7..0: Idle Error Count */
  1059. };
  1060. /***** PHY_BCOM_EXT_STAT 16 bit r/o Extended Status Register *****/
  1061. enum {
  1062. PHY_B_ES_X_FD_CAP = 1<<15, /* Bit 15: 1000Base-X FD capable */
  1063. PHY_B_ES_X_HD_CAP = 1<<14, /* Bit 14: 1000Base-X HD capable */
  1064. PHY_B_ES_T_FD_CAP = 1<<13, /* Bit 13: 1000Base-T FD capable */
  1065. PHY_B_ES_T_HD_CAP = 1<<12, /* Bit 12: 1000Base-T HD capable */
  1066. };
  1067. /***** PHY_BCOM_P_EXT_CTRL 16 bit r/w PHY Extended Control Reg *****/
  1068. enum {
  1069. PHY_B_PEC_MAC_PHY = 1<<15, /* Bit 15: 10BIT/GMI-Interface */
  1070. PHY_B_PEC_DIS_CROSS = 1<<14, /* Bit 14: Disable MDI Crossover */
  1071. PHY_B_PEC_TX_DIS = 1<<13, /* Bit 13: Tx output Disabled */
  1072. PHY_B_PEC_INT_DIS = 1<<12, /* Bit 12: Interrupts Disabled */
  1073. PHY_B_PEC_F_INT = 1<<11, /* Bit 11: Force Interrupt */
  1074. PHY_B_PEC_BY_45 = 1<<10, /* Bit 10: Bypass 4B5B-Decoder */
  1075. PHY_B_PEC_BY_SCR = 1<<9, /* Bit 9: Bypass Scrambler */
  1076. PHY_B_PEC_BY_MLT3 = 1<<8, /* Bit 8: Bypass MLT3 Encoder */
  1077. PHY_B_PEC_BY_RXA = 1<<7, /* Bit 7: Bypass Rx Alignm. */
  1078. PHY_B_PEC_RES_SCR = 1<<6, /* Bit 6: Reset Scrambler */
  1079. PHY_B_PEC_EN_LTR = 1<<5, /* Bit 5: Ena LED Traffic Mode */
  1080. PHY_B_PEC_LED_ON = 1<<4, /* Bit 4: Force LED's on */
  1081. PHY_B_PEC_LED_OFF = 1<<3, /* Bit 3: Force LED's off */
  1082. PHY_B_PEC_EX_IPG = 1<<2, /* Bit 2: Extend Tx IPG Mode */
  1083. PHY_B_PEC_3_LED = 1<<1, /* Bit 1: Three Link LED mode */
  1084. PHY_B_PEC_HIGH_LA = 1<<0, /* Bit 0: GMII FIFO Elasticy */
  1085. };
  1086. /***** PHY_BCOM_P_EXT_STAT 16 bit r/o PHY Extended Status Reg *****/
  1087. enum {
  1088. PHY_B_PES_CROSS_STAT = 1<<13, /* Bit 13: MDI Crossover Status */
  1089. PHY_B_PES_INT_STAT = 1<<12, /* Bit 12: Interrupt Status */
  1090. PHY_B_PES_RRS = 1<<11, /* Bit 11: Remote Receiver Stat. */
  1091. PHY_B_PES_LRS = 1<<10, /* Bit 10: Local Receiver Stat. */
  1092. PHY_B_PES_LOCKED = 1<<9, /* Bit 9: Locked */
  1093. PHY_B_PES_LS = 1<<8, /* Bit 8: Link Status */
  1094. PHY_B_PES_RF = 1<<7, /* Bit 7: Remote Fault */
  1095. PHY_B_PES_CE_ER = 1<<6, /* Bit 6: Carrier Ext Error */
  1096. PHY_B_PES_BAD_SSD = 1<<5, /* Bit 5: Bad SSD */
  1097. PHY_B_PES_BAD_ESD = 1<<4, /* Bit 4: Bad ESD */
  1098. PHY_B_PES_RX_ER = 1<<3, /* Bit 3: Receive Error */
  1099. PHY_B_PES_TX_ER = 1<<2, /* Bit 2: Transmit Error */
  1100. PHY_B_PES_LOCK_ER = 1<<1, /* Bit 1: Lock Error */
  1101. PHY_B_PES_MLT3_ER = 1<<0, /* Bit 0: MLT3 code Error */
  1102. };
  1103. /* PHY_BCOM_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/
  1104. /* PHY_BCOM_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/
  1105. enum {
  1106. PHY_B_AN_RF = 1<<13, /* Bit 13: Remote Fault */
  1107. PHY_B_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */
  1108. PHY_B_AN_PC = 1<<10, /* Bit 10: Pause Capable */
  1109. };
  1110. /***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/
  1111. enum {
  1112. PHY_B_FC_CTR = 0xff, /* Bit 7..0: False Carrier Counter */
  1113. /***** PHY_BCOM_RNO_CTR 16 bit r/w Receive NOT_OK Counter *****/
  1114. PHY_B_RC_LOC_MSK = 0xff00, /* Bit 15..8: Local Rx NOT_OK cnt */
  1115. PHY_B_RC_REM_MSK = 0x00ff, /* Bit 7..0: Remote Rx NOT_OK cnt */
  1116. /***** PHY_BCOM_AUX_CTRL 16 bit r/w Auxiliary Control Reg *****/
  1117. PHY_B_AC_L_SQE = 1<<15, /* Bit 15: Low Squelch */
  1118. PHY_B_AC_LONG_PACK = 1<<14, /* Bit 14: Rx Long Packets */
  1119. PHY_B_AC_ER_CTRL = 3<<12,/* Bit 13..12: Edgerate Control */
  1120. /* Bit 11: reserved */
  1121. PHY_B_AC_TX_TST = 1<<10, /* Bit 10: Tx test bit, always 1 */
  1122. /* Bit 9.. 8: reserved */
  1123. PHY_B_AC_DIS_PRF = 1<<7, /* Bit 7: dis part resp filter */
  1124. /* Bit 6: reserved */
  1125. PHY_B_AC_DIS_PM = 1<<5, /* Bit 5: dis power management */
  1126. /* Bit 4: reserved */
  1127. PHY_B_AC_DIAG = 1<<3, /* Bit 3: Diagnostic Mode */
  1128. };
  1129. /***** PHY_BCOM_AUX_STAT 16 bit r/o Auxiliary Status Reg *****/
  1130. enum {
  1131. PHY_B_AS_AN_C = 1<<15, /* Bit 15: AutoNeg complete */
  1132. PHY_B_AS_AN_CA = 1<<14, /* Bit 14: AN Complete Ack */
  1133. PHY_B_AS_ANACK_D = 1<<13, /* Bit 13: AN Ack Detect */
  1134. PHY_B_AS_ANAB_D = 1<<12, /* Bit 12: AN Ability Detect */
  1135. PHY_B_AS_NPW = 1<<11, /* Bit 11: AN Next Page Wait */
  1136. PHY_B_AS_AN_RES_MSK = 7<<8,/* Bit 10..8: AN HDC */
  1137. PHY_B_AS_PDF = 1<<7, /* Bit 7: Parallel Detect. Fault */
  1138. PHY_B_AS_RF = 1<<6, /* Bit 6: Remote Fault */
  1139. PHY_B_AS_ANP_R = 1<<5, /* Bit 5: AN Page Received */
  1140. PHY_B_AS_LP_ANAB = 1<<4, /* Bit 4: LP AN Ability */
  1141. PHY_B_AS_LP_NPAB = 1<<3, /* Bit 3: LP Next Page Ability */
  1142. PHY_B_AS_LS = 1<<2, /* Bit 2: Link Status */
  1143. PHY_B_AS_PRR = 1<<1, /* Bit 1: Pause Resolution-Rx */
  1144. PHY_B_AS_PRT = 1<<0, /* Bit 0: Pause Resolution-Tx */
  1145. };
  1146. #define PHY_B_AS_PAUSE_MSK (PHY_B_AS_PRR | PHY_B_AS_PRT)
  1147. /***** PHY_BCOM_INT_STAT 16 bit r/o Interrupt Status Reg *****/
  1148. /***** PHY_BCOM_INT_MASK 16 bit r/w Interrupt Mask Reg *****/
  1149. enum {
  1150. PHY_B_IS_PSE = 1<<14, /* Bit 14: Pair Swap Error */
  1151. PHY_B_IS_MDXI_SC = 1<<13, /* Bit 13: MDIX Status Change */
  1152. PHY_B_IS_HCT = 1<<12, /* Bit 12: counter above 32k */
  1153. PHY_B_IS_LCT = 1<<11, /* Bit 11: counter above 128 */
  1154. PHY_B_IS_AN_PR = 1<<10, /* Bit 10: Page Received */
  1155. PHY_B_IS_NO_HDCL = 1<<9, /* Bit 9: No HCD Link */
  1156. PHY_B_IS_NO_HDC = 1<<8, /* Bit 8: No HCD */
  1157. PHY_B_IS_NEG_USHDC = 1<<7, /* Bit 7: Negotiated Unsup. HCD */
  1158. PHY_B_IS_SCR_S_ER = 1<<6, /* Bit 6: Scrambler Sync Error */
  1159. PHY_B_IS_RRS_CHANGE = 1<<5, /* Bit 5: Remote Rx Stat Change */
  1160. PHY_B_IS_LRS_CHANGE = 1<<4, /* Bit 4: Local Rx Stat Change */
  1161. PHY_B_IS_DUP_CHANGE = 1<<3, /* Bit 3: Duplex Mode Change */
  1162. PHY_B_IS_LSP_CHANGE = 1<<2, /* Bit 2: Link Speed Change */
  1163. PHY_B_IS_LST_CHANGE = 1<<1, /* Bit 1: Link Status Changed */
  1164. PHY_B_IS_CRC_ER = 1<<0, /* Bit 0: CRC Error */
  1165. };
  1166. #define PHY_B_DEF_MSK \
  1167. (~(PHY_B_IS_PSE | PHY_B_IS_AN_PR | PHY_B_IS_DUP_CHANGE | \
  1168. PHY_B_IS_LSP_CHANGE | PHY_B_IS_LST_CHANGE))
  1169. /* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */
  1170. enum {
  1171. PHY_B_P_NO_PAUSE = 0<<10,/* Bit 11..10: no Pause Mode */
  1172. PHY_B_P_SYM_MD = 1<<10, /* Bit 11..10: symmetric Pause Mode */
  1173. PHY_B_P_ASYM_MD = 2<<10,/* Bit 11..10: asymmetric Pause Mode */
  1174. PHY_B_P_BOTH_MD = 3<<10,/* Bit 11..10: both Pause Mode */
  1175. };
  1176. /*
  1177. * Resolved Duplex mode and Capabilities (Aux Status Summary Reg)
  1178. */
  1179. enum {
  1180. PHY_B_RES_1000FD = 7<<8,/* Bit 10..8: 1000Base-T Full Dup. */
  1181. PHY_B_RES_1000HD = 6<<8,/* Bit 10..8: 1000Base-T Half Dup. */
  1182. };
  1183. /** Marvell-Specific */
  1184. enum {
  1185. PHY_M_AN_NXT_PG = 1<<15, /* Request Next Page */
  1186. PHY_M_AN_ACK = 1<<14, /* (ro) Acknowledge Received */
  1187. PHY_M_AN_RF = 1<<13, /* Remote Fault */
  1188. PHY_M_AN_ASP = 1<<11, /* Asymmetric Pause */
  1189. PHY_M_AN_PC = 1<<10, /* MAC Pause implemented */
  1190. PHY_M_AN_100_T4 = 1<<9, /* Not cap. 100Base-T4 (always 0) */
  1191. PHY_M_AN_100_FD = 1<<8, /* Advertise 100Base-TX Full Duplex */
  1192. PHY_M_AN_100_HD = 1<<7, /* Advertise 100Base-TX Half Duplex */
  1193. PHY_M_AN_10_FD = 1<<6, /* Advertise 10Base-TX Full Duplex */
  1194. PHY_M_AN_10_HD = 1<<5, /* Advertise 10Base-TX Half Duplex */
  1195. PHY_M_AN_SEL_MSK =0x1f<<4, /* Bit 4.. 0: Selector Field Mask */
  1196. };
  1197. /* special defines for FIBER (88E1011S only) */
  1198. enum {
  1199. PHY_M_AN_ASP_X = 1<<8, /* Asymmetric Pause */
  1200. PHY_M_AN_PC_X = 1<<7, /* MAC Pause implemented */
  1201. PHY_M_AN_1000X_AHD = 1<<6, /* Advertise 10000Base-X Half Duplex */
  1202. PHY_M_AN_1000X_AFD = 1<<5, /* Advertise 10000Base-X Full Duplex */
  1203. };
  1204. /* Pause Bits (PHY_M_AN_ASP_X and PHY_M_AN_PC_X) encoding */
  1205. enum {
  1206. PHY_M_P_NO_PAUSE_X = 0<<7,/* Bit 8.. 7: no Pause Mode */
  1207. PHY_M_P_SYM_MD_X = 1<<7, /* Bit 8.. 7: symmetric Pause Mode */
  1208. PHY_M_P_ASYM_MD_X = 2<<7,/* Bit 8.. 7: asymmetric Pause Mode */
  1209. PHY_M_P_BOTH_MD_X = 3<<7,/* Bit 8.. 7: both Pause Mode */
  1210. };
  1211. /***** PHY_MARV_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
  1212. enum {
  1213. PHY_M_1000C_TEST= 7<<13,/* Bit 15..13: Test Modes */
  1214. PHY_M_1000C_MSE = 1<<12, /* Manual Master/Slave Enable */
  1215. PHY_M_1000C_MSC = 1<<11, /* M/S Configuration (1=Master) */
  1216. PHY_M_1000C_MPD = 1<<10, /* Multi-Port Device */
  1217. PHY_M_1000C_AFD = 1<<9, /* Advertise Full Duplex */
  1218. PHY_M_1000C_AHD = 1<<8, /* Advertise Half Duplex */
  1219. };
  1220. /***** PHY_MARV_PHY_CTRL 16 bit r/w PHY Specific Ctrl Reg *****/
  1221. enum {
  1222. PHY_M_PC_TX_FFD_MSK = 3<<14,/* Bit 15..14: Tx FIFO Depth Mask */
  1223. PHY_M_PC_RX_FFD_MSK = 3<<12,/* Bit 13..12: Rx FIFO Depth Mask */
  1224. PHY_M_PC_ASS_CRS_TX = 1<<11, /* Assert CRS on Transmit */
  1225. PHY_M_PC_FL_GOOD = 1<<10, /* Force Link Good */
  1226. PHY_M_PC_EN_DET_MSK = 3<<8,/* Bit 9.. 8: Energy Detect Mask */
  1227. PHY_M_PC_ENA_EXT_D = 1<<7, /* Enable Ext. Distance (10BT) */
  1228. PHY_M_PC_MDIX_MSK = 3<<5,/* Bit 6.. 5: MDI/MDIX Config. Mask */
  1229. PHY_M_PC_DIS_125CLK = 1<<4, /* Disable 125 CLK */
  1230. PHY_M_PC_MAC_POW_UP = 1<<3, /* MAC Power up */
  1231. PHY_M_PC_SQE_T_ENA = 1<<2, /* SQE Test Enabled */
  1232. PHY_M_PC_POL_R_DIS = 1<<1, /* Polarity Reversal Disabled */
  1233. PHY_M_PC_DIS_JABBER = 1<<0, /* Disable Jabber */
  1234. };
  1235. enum {
  1236. PHY_M_PC_EN_DET = 2<<8, /* Energy Detect (Mode 1) */
  1237. PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */
  1238. };
  1239. enum {
  1240. PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */
  1241. PHY_M_PC_MAN_MDIX = 1, /* 01 = Manual MDIX configuration */
  1242. PHY_M_PC_ENA_AUTO = 3, /* 11 = Enable Automatic Crossover */
  1243. };
  1244. /* for 10/100 Fast Ethernet PHY (88E3082 only) */
  1245. enum {
  1246. PHY_M_PC_ENA_DTE_DT = 1<<15, /* Enable Data Terminal Equ. (DTE) Detect */
  1247. PHY_M_PC_ENA_ENE_DT = 1<<14, /* Enable Energy Detect (sense & pulse) */
  1248. PHY_M_PC_DIS_NLP_CK = 1<<13, /* Disable Normal Link Puls (NLP) Check */
  1249. PHY_M_PC_ENA_LIP_NP = 1<<12, /* Enable Link Partner Next Page Reg. */
  1250. PHY_M_PC_DIS_NLP_GN = 1<<11, /* Disable Normal Link Puls Generation */
  1251. PHY_M_PC_DIS_SCRAMB = 1<<9, /* Disable Scrambler */
  1252. PHY_M_PC_DIS_FEFI = 1<<8, /* Disable Far End Fault Indic. (FEFI) */
  1253. PHY_M_PC_SH_TP_SEL = 1<<6, /* Shielded Twisted Pair Select */
  1254. PHY_M_PC_RX_FD_MSK = 3<<2,/* Bit 3.. 2: Rx FIFO Depth Mask */
  1255. };
  1256. /***** PHY_MARV_PHY_STAT 16 bit r/o PHY Specific Status Reg *****/
  1257. enum {
  1258. PHY_M_PS_SPEED_MSK = 3<<14, /* Bit 15..14: Speed Mask */
  1259. PHY_M_PS_SPEED_1000 = 1<<15, /* 10 = 1000 Mbps */
  1260. PHY_M_PS_SPEED_100 = 1<<14, /* 01 = 100 Mbps */
  1261. PHY_M_PS_SPEED_10 = 0, /* 00 = 10 Mbps */
  1262. PHY_M_PS_FULL_DUP = 1<<13, /* Full Duplex */
  1263. PHY_M_PS_PAGE_REC = 1<<12, /* Page Received */
  1264. PHY_M_PS_SPDUP_RES = 1<<11, /* Speed & Duplex Resolved */
  1265. PHY_M_PS_LINK_UP = 1<<10, /* Link Up */
  1266. PHY_M_PS_CABLE_MSK = 7<<7, /* Bit 9.. 7: Cable Length Mask */
  1267. PHY_M_PS_MDI_X_STAT = 1<<6, /* MDI Crossover Stat (1=MDIX) */
  1268. PHY_M_PS_DOWNS_STAT = 1<<5, /* Downshift Status (1=downsh.) */
  1269. PHY_M_PS_ENDET_STAT = 1<<4, /* Energy Detect Status (1=act) */
  1270. PHY_M_PS_TX_P_EN = 1<<3, /* Tx Pause Enabled */
  1271. PHY_M_PS_RX_P_EN = 1<<2, /* Rx Pause Enabled */
  1272. PHY_M_PS_POL_REV = 1<<1, /* Polarity Reversed */
  1273. PHY_M_PS_JABBER = 1<<0, /* Jabber */
  1274. };
  1275. #define PHY_M_PS_PAUSE_MSK (PHY_M_PS_TX_P_EN | PHY_M_PS_RX_P_EN)
  1276. /* for 10/100 Fast Ethernet PHY (88E3082 only) */
  1277. enum {
  1278. PHY_M_PS_DTE_DETECT = 1<<15, /* Data Terminal Equipment (DTE) Detected */
  1279. PHY_M_PS_RES_SPEED = 1<<14, /* Resolved Speed (1=100 Mbps, 0=10 Mbps */
  1280. };
  1281. enum {
  1282. PHY_M_IS_AN_ERROR = 1<<15, /* Auto-Negotiation Error */
  1283. PHY_M_IS_LSP_CHANGE = 1<<14, /* Link Speed Changed */
  1284. PHY_M_IS_DUP_CHANGE = 1<<13, /* Duplex Mode Changed */
  1285. PHY_M_IS_AN_PR = 1<<12, /* Page Received */
  1286. PHY_M_IS_AN_COMPL = 1<<11, /* Auto-Negotiation Completed */
  1287. PHY_M_IS_LST_CHANGE = 1<<10, /* Link Status Changed */
  1288. PHY_M_IS_SYMB_ERROR = 1<<9, /* Symbol Error */
  1289. PHY_M_IS_FALSE_CARR = 1<<8, /* False Carrier */
  1290. PHY_M_IS_FIFO_ERROR = 1<<7, /* FIFO Overflow/Underrun Error */
  1291. PHY_M_IS_MDI_CHANGE = 1<<6, /* MDI Crossover Changed */
  1292. PHY_M_IS_DOWNSH_DET = 1<<5, /* Downshift Detected */
  1293. PHY_M_IS_END_CHANGE = 1<<4, /* Energy Detect Changed */
  1294. PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */
  1295. PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */
  1296. PHY_M_IS_JABBER = 1<<0, /* Jabber */
  1297. PHY_M_IS_DEF_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE |
  1298. PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR,
  1299. PHY_M_IS_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL,
  1300. };
  1301. /***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/
  1302. enum {
  1303. PHY_M_EC_ENA_BC_EXT = 1<<15, /* Enable Block Carr. Ext. (88E1111 only) */
  1304. PHY_M_EC_ENA_LIN_LB = 1<<14, /* Enable Line Loopback (88E1111 only) */
  1305. PHY_M_EC_DIS_LINK_P = 1<<12, /* Disable Link Pulses (88E1111 only) */
  1306. PHY_M_EC_M_DSC_MSK = 3<<10, /* Bit 11..10: Master Downshift Counter */
  1307. /* (88E1011 only) */
  1308. PHY_M_EC_S_DSC_MSK = 3<<8, /* Bit 9.. 8: Slave Downshift Counter */
  1309. /* (88E1011 only) */
  1310. PHY_M_EC_M_DSC_MSK2 = 7<<9, /* Bit 11.. 9: Master Downshift Counter */
  1311. /* (88E1111 only) */
  1312. PHY_M_EC_DOWN_S_ENA = 1<<8, /* Downshift Enable (88E1111 only) */
  1313. /* !!! Errata in spec. (1 = disable) */
  1314. PHY_M_EC_RX_TIM_CT = 1<<7, /* RGMII Rx Timing Control*/
  1315. PHY_M_EC_MAC_S_MSK = 7<<4, /* Bit 6.. 4: Def. MAC interface speed */
  1316. PHY_M_EC_FIB_AN_ENA = 1<<3, /* Fiber Auto-Neg. Enable (88E1011S only) */
  1317. PHY_M_EC_DTE_D_ENA = 1<<2, /* DTE Detect Enable (88E1111 only) */
  1318. PHY_M_EC_TX_TIM_CT = 1<<1, /* RGMII Tx Timing Control */
  1319. PHY_M_EC_TRANS_DIS = 1<<0, /* Transmitter Disable (88E1111 only) */};
  1320. #define PHY_M_EC_M_DSC(x) ((u16)(x)<<10) /* 00=1x; 01=2x; 10=3x; 11=4x */
  1321. #define PHY_M_EC_S_DSC(x) ((u16)(x)<<8) /* 00=dis; 01=1x; 10=2x; 11=3x */
  1322. #define PHY_M_EC_MAC_S(x) ((u16)(x)<<4) /* 01X=0; 110=2.5; 111=25 (MHz) */
  1323. #define PHY_M_EC_M_DSC_2(x) ((u16)(x)<<9) /* 000=1x; 001=2x; 010=3x; 011=4x */
  1324. /* 100=5x; 101=6x; 110=7x; 111=8x */
  1325. enum {
  1326. MAC_TX_CLK_0_MHZ = 2,
  1327. MAC_TX_CLK_2_5_MHZ = 6,
  1328. MAC_TX_CLK_25_MHZ = 7,
  1329. };
  1330. /***** PHY_MARV_LED_CTRL 16 bit r/w LED Control Reg *****/
  1331. enum {
  1332. PHY_M_LEDC_DIS_LED = 1<<15, /* Disable LED */
  1333. PHY_M_LEDC_PULS_MSK = 7<<12,/* Bit 14..12: Pulse Stretch Mask */
  1334. PHY_M_LEDC_F_INT = 1<<11, /* Force Interrupt */
  1335. PHY_M_LEDC_BL_R_MSK = 7<<8,/* Bit 10.. 8: Blink Rate Mask */
  1336. PHY_M_LEDC_DP_C_LSB = 1<<7, /* Duplex Control (LSB, 88E1111 only) */
  1337. PHY_M_LEDC_TX_C_LSB = 1<<6, /* Tx Control (LSB, 88E1111 only) */
  1338. PHY_M_LEDC_LK_C_MSK = 7<<3,/* Bit 5.. 3: Link Control Mask */
  1339. /* (88E1111 only) */
  1340. };
  1341. #define PHY_M_LED_PULS_DUR(x) (((u16)(x)<<12) & PHY_M_LEDC_PULS_MSK)
  1342. #define PHY_M_LED_BLINK_RT(x) (((u16)(x)<<8) & PHY_M_LEDC_BL_R_MSK)
  1343. enum {
  1344. PHY_M_LEDC_LINK_MSK = 3<<3, /* Bit 4.. 3: Link Control Mask */
  1345. /* (88E1011 only) */
  1346. PHY_M_LEDC_DP_CTRL = 1<<2, /* Duplex Control */
  1347. PHY_M_LEDC_DP_C_MSB = 1<<2, /* Duplex Control (MSB, 88E1111 only) */
  1348. PHY_M_LEDC_RX_CTRL = 1<<1, /* Rx Activity / Link */
  1349. PHY_M_LEDC_TX_CTRL = 1<<0, /* Tx Activity / Link */
  1350. PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */
  1351. };
  1352. enum {
  1353. PULS_NO_STR = 0, /* no pulse stretching */
  1354. PULS_21MS = 1, /* 21 ms to 42 ms */
  1355. PULS_42MS = 2, /* 42 ms to 84 ms */
  1356. PULS_84MS = 3, /* 84 ms to 170 ms */
  1357. PULS_170MS = 4, /* 170 ms to 340 ms */
  1358. PULS_340MS = 5, /* 340 ms to 670 ms */
  1359. PULS_670MS = 6, /* 670 ms to 1.3 s */
  1360. PULS_1300MS = 7, /* 1.3 s to 2.7 s */
  1361. };
  1362. enum {
  1363. BLINK_42MS = 0, /* 42 ms */
  1364. BLINK_84MS = 1, /* 84 ms */
  1365. BLINK_170MS = 2, /* 170 ms */
  1366. BLINK_340MS = 3, /* 340 ms */
  1367. BLINK_670MS = 4, /* 670 ms */
  1368. };
  1369. /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/
  1370. #define PHY_M_LED_MO_SGMII(x) ((x)<<14) /* Bit 15..14: SGMII AN Timer */
  1371. /* Bit 13..12: reserved */
  1372. #define PHY_M_LED_MO_DUP(x) ((x)<<10) /* Bit 11..10: Duplex */
  1373. #define PHY_M_LED_MO_10(x) ((x)<<8) /* Bit 9.. 8: Link 10 */
  1374. #define PHY_M_LED_MO_100(x) ((x)<<6) /* Bit 7.. 6: Link 100 */
  1375. #define PHY_M_LED_MO_1000(x) ((x)<<4) /* Bit 5.. 4: Link 1000 */
  1376. #define PHY_M_LED_MO_RX(x) ((x)<<2) /* Bit 3.. 2: Rx */
  1377. #define PHY_M_LED_MO_TX(x) ((x)<<0) /* Bit 1.. 0: Tx */
  1378. enum {
  1379. MO_LED_NORM = 0,
  1380. MO_LED_BLINK = 1,
  1381. MO_LED_OFF = 2,
  1382. MO_LED_ON = 3,
  1383. };
  1384. /***** PHY_MARV_EXT_CTRL_2 16 bit r/w Ext. PHY Specific Ctrl 2 *****/
  1385. enum {
  1386. PHY_M_EC2_FI_IMPED = 1<<6, /* Fiber Input Impedance */
  1387. PHY_M_EC2_FO_IMPED = 1<<5, /* Fiber Output Impedance */
  1388. PHY_M_EC2_FO_M_CLK = 1<<4, /* Fiber Mode Clock Enable */
  1389. PHY_M_EC2_FO_BOOST = 1<<3, /* Fiber Output Boost */
  1390. PHY_M_EC2_FO_AM_MSK = 7, /* Bit 2.. 0: Fiber Output Amplitude */
  1391. };
  1392. /***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/
  1393. enum {
  1394. PHY_M_FC_AUTO_SEL = 1<<15, /* Fiber/Copper Auto Sel. Dis. */
  1395. PHY_M_FC_AN_REG_ACC = 1<<14, /* Fiber/Copper AN Reg. Access */
  1396. PHY_M_FC_RESOLUTION = 1<<13, /* Fiber/Copper Resolution */
  1397. PHY_M_SER_IF_AN_BP = 1<<12, /* Ser. IF AN Bypass Enable */
  1398. PHY_M_SER_IF_BP_ST = 1<<11, /* Ser. IF AN Bypass Status */
  1399. PHY_M_IRQ_POLARITY = 1<<10, /* IRQ polarity */
  1400. PHY_M_DIS_AUT_MED = 1<<9, /* Disable Aut. Medium Reg. Selection */
  1401. /* (88E1111 only) */
  1402. /* Bit 9.. 4: reserved (88E1011 only) */
  1403. PHY_M_UNDOC1 = 1<<7, /* undocumented bit !! */
  1404. PHY_M_DTE_POW_STAT = 1<<4, /* DTE Power Status (88E1111 only) */
  1405. PHY_M_MODE_MASK = 0xf, /* Bit 3.. 0: copy of HWCFG MODE[3:0] */
  1406. };
  1407. /***** PHY_MARV_CABLE_DIAG 16 bit r/o Cable Diagnostic Reg *****/
  1408. enum {
  1409. PHY_M_CABD_ENA_TEST = 1<<15, /* Enable Test (Page 0) */
  1410. PHY_M_CABD_DIS_WAIT = 1<<15, /* Disable Waiting Period (Page 1) */
  1411. /* (88E1111 only) */
  1412. PHY_M_CABD_STAT_MSK = 3<<13, /* Bit 14..13: Status Mask */
  1413. PHY_M_CABD_AMPL_MSK = 0x1f<<8, /* Bit 12.. 8: Amplitude Mask */
  1414. /* (88E1111 only) */
  1415. PHY_M_CABD_DIST_MSK = 0xff, /* Bit 7.. 0: Distance Mask */
  1416. };
  1417. /* values for Cable Diagnostic Status (11=fail; 00=OK; 10=open; 01=short) */
  1418. enum {
  1419. CABD_STAT_NORMAL= 0,
  1420. CABD_STAT_SHORT = 1,
  1421. CABD_STAT_OPEN = 2,
  1422. CABD_STAT_FAIL = 3,
  1423. };
  1424. /* for 10/100 Fast Ethernet PHY (88E3082 only) */
  1425. /***** PHY_MARV_FE_LED_PAR 16 bit r/w LED Parallel Select Reg. *****/
  1426. /* Bit 15..12: reserved (used internally) */
  1427. enum {
  1428. PHY_M_FELP_LED2_MSK = 0xf<<8, /* Bit 11.. 8: LED2 Mask (LINK) */
  1429. PHY_M_FELP_LED1_MSK = 0xf<<4, /* Bit 7.. 4: LED1 Mask (ACT) */
  1430. PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */
  1431. };
  1432. #define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK)
  1433. #define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK)
  1434. #define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK)
  1435. enum {
  1436. LED_PAR_CTRL_COLX = 0x00,
  1437. LED_PAR_CTRL_ERROR = 0x01,
  1438. LED_PAR_CTRL_DUPLEX = 0x02,
  1439. LED_PAR_CTRL_DP_COL = 0x03,
  1440. LED_PAR_CTRL_SPEED = 0x04,
  1441. LED_PAR_CTRL_LINK = 0x05,
  1442. LED_PAR_CTRL_TX = 0x06,
  1443. LED_PAR_CTRL_RX = 0x07,
  1444. LED_PAR_CTRL_ACT = 0x08,
  1445. LED_PAR_CTRL_LNK_RX = 0x09,
  1446. LED_PAR_CTRL_LNK_AC = 0x0a,
  1447. LED_PAR_CTRL_ACT_BL = 0x0b,
  1448. LED_PAR_CTRL_TX_BL = 0x0c,
  1449. LED_PAR_CTRL_RX_BL = 0x0d,
  1450. LED_PAR_CTRL_COL_BL = 0x0e,
  1451. LED_PAR_CTRL_INACT = 0x0f
  1452. };
  1453. /*****,PHY_MARV_FE_SPEC_2 16 bit r/w Specific Control Reg. 2 *****/
  1454. enum {
  1455. PHY_M_FESC_DIS_WAIT = 1<<2, /* Disable TDR Waiting Period */
  1456. PHY_M_FESC_ENA_MCLK = 1<<1, /* Enable MAC Rx Clock in sleep mode */
  1457. PHY_M_FESC_SEL_CL_A = 1<<0, /* Select Class A driver (100B-TX) */
  1458. };
  1459. /***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/
  1460. enum {
  1461. PHY_M_LEDC_LOS_MSK = 0xf<<12, /* Bit 15..12: LOS LED Ctrl. Mask */
  1462. PHY_M_LEDC_INIT_MSK = 0xf<<8, /* Bit 11.. 8: INIT LED Ctrl. Mask */
  1463. PHY_M_LEDC_STA1_MSK = 0xf<<4, /* Bit 7.. 4: STAT1 LED Ctrl. Mask */
  1464. PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */
  1465. };
  1466. #define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK)
  1467. #define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK)
  1468. #define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK)
  1469. #define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK)
  1470. /* GMAC registers */
  1471. /* Port Registers */
  1472. enum {
  1473. GM_GP_STAT = 0x0000, /* 16 bit r/o General Purpose Status */
  1474. GM_GP_CTRL = 0x0004, /* 16 bit r/w General Purpose Control */
  1475. GM_TX_CTRL = 0x0008, /* 16 bit r/w Transmit Control Reg. */
  1476. GM_RX_CTRL = 0x000c, /* 16 bit r/w Receive Control Reg. */
  1477. GM_TX_FLOW_CTRL = 0x0010, /* 16 bit r/w Transmit Flow-Control */
  1478. GM_TX_PARAM = 0x0014, /* 16 bit r/w Transmit Parameter Reg. */
  1479. GM_SERIAL_MODE = 0x0018, /* 16 bit r/w Serial Mode Register */
  1480. /* Source Address Registers */
  1481. GM_SRC_ADDR_1L = 0x001c, /* 16 bit r/w Source Address 1 (low) */
  1482. GM_SRC_ADDR_1M = 0x0020, /* 16 bit r/w Source Address 1 (middle) */
  1483. GM_SRC_ADDR_1H = 0x0024, /* 16 bit r/w Source Address 1 (high) */
  1484. GM_SRC_ADDR_2L = 0x0028, /* 16 bit r/w Source Address 2 (low) */
  1485. GM_SRC_ADDR_2M = 0x002c, /* 16 bit r/w Source Address 2 (middle) */
  1486. GM_SRC_ADDR_2H = 0x0030, /* 16 bit r/w Source Address 2 (high) */
  1487. /* Multicast Address Hash Registers */
  1488. GM_MC_ADDR_H1 = 0x0034, /* 16 bit r/w Multicast Address Hash 1 */
  1489. GM_MC_ADDR_H2 = 0x0038, /* 16 bit r/w Multicast Address Hash 2 */
  1490. GM_MC_ADDR_H3 = 0x003c, /* 16 bit r/w Multicast Address Hash 3 */
  1491. GM_MC_ADDR_H4 = 0x0040, /* 16 bit r/w Multicast Address Hash 4 */
  1492. /* Interrupt Source Registers */
  1493. GM_TX_IRQ_SRC = 0x0044, /* 16 bit r/o Tx Overflow IRQ Source */
  1494. GM_RX_IRQ_SRC = 0x0048, /* 16 bit r/o Rx Overflow IRQ Source */
  1495. GM_TR_IRQ_SRC = 0x004c, /* 16 bit r/o Tx/Rx Over. IRQ Source */
  1496. /* Interrupt Mask Registers */
  1497. GM_TX_IRQ_MSK = 0x0050, /* 16 bit r/w Tx Overflow IRQ Mask */
  1498. GM_RX_IRQ_MSK = 0x0054, /* 16 bit r/w Rx Overflow IRQ Mask */
  1499. GM_TR_IRQ_MSK = 0x0058, /* 16 bit r/w Tx/Rx Over. IRQ Mask */
  1500. /* Serial Management Interface (SMI) Registers */
  1501. GM_SMI_CTRL = 0x0080, /* 16 bit r/w SMI Control Register */
  1502. GM_SMI_DATA = 0x0084, /* 16 bit r/w SMI Data Register */
  1503. GM_PHY_ADDR = 0x0088, /* 16 bit r/w GPHY Address Register */
  1504. };
  1505. /* MIB Counters */
  1506. #define GM_MIB_CNT_BASE 0x0100 /* Base Address of MIB Counters */
  1507. #define GM_MIB_CNT_SIZE 44 /* Number of MIB Counters */
  1508. /*
  1509. * MIB Counters base address definitions (low word) -
  1510. * use offset 4 for access to high word (32 bit r/o)
  1511. */
  1512. enum {
  1513. GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0, /* Unicast Frames Received OK */
  1514. GM_RXF_BC_OK = GM_MIB_CNT_BASE + 8, /* Broadcast Frames Received OK */
  1515. GM_RXF_MPAUSE = GM_MIB_CNT_BASE + 16, /* Pause MAC Ctrl Frames Received */
  1516. GM_RXF_MC_OK = GM_MIB_CNT_BASE + 24, /* Multicast Frames Received OK */
  1517. GM_RXF_FCS_ERR = GM_MIB_CNT_BASE + 32, /* Rx Frame Check Seq. Error */
  1518. /* GM_MIB_CNT_BASE + 40: reserved */
  1519. GM_RXO_OK_LO = GM_MIB_CNT_BASE + 48, /* Octets Received OK Low */
  1520. GM_RXO_OK_HI = GM_MIB_CNT_BASE + 56, /* Octets Received OK High */
  1521. GM_RXO_ERR_LO = GM_MIB_CNT_BASE + 64, /* Octets Received Invalid Low */
  1522. GM_RXO_ERR_HI = GM_MIB_CNT_BASE + 72, /* Octets Received Invalid High */
  1523. GM_RXF_SHT = GM_MIB_CNT_BASE + 80, /* Frames <64 Byte Received OK */
  1524. GM_RXE_FRAG = GM_MIB_CNT_BASE + 88, /* Frames <64 Byte Received with FCS Err */
  1525. GM_RXF_64B = GM_MIB_CNT_BASE + 96, /* 64 Byte Rx Frame */
  1526. GM_RXF_127B = GM_MIB_CNT_BASE + 104, /* 65-127 Byte Rx Frame */
  1527. GM_RXF_255B = GM_MIB_CNT_BASE + 112, /* 128-255 Byte Rx Frame */
  1528. GM_RXF_511B = GM_MIB_CNT_BASE + 120, /* 256-511 Byte Rx Frame */
  1529. GM_RXF_1023B = GM_MIB_CNT_BASE + 128, /* 512-1023 Byte Rx Frame */
  1530. GM_RXF_1518B = GM_MIB_CNT_BASE + 136, /* 1024-1518 Byte Rx Frame */
  1531. GM_RXF_MAX_SZ = GM_MIB_CNT_BASE + 144, /* 1519-MaxSize Byte Rx Frame */
  1532. GM_RXF_LNG_ERR = GM_MIB_CNT_BASE + 152, /* Rx Frame too Long Error */
  1533. GM_RXF_JAB_PKT = GM_MIB_CNT_BASE + 160, /* Rx Jabber Packet Frame */
  1534. /* GM_MIB_CNT_BASE + 168: reserved */
  1535. GM_RXE_FIFO_OV = GM_MIB_CNT_BASE + 176, /* Rx FIFO overflow Event */
  1536. /* GM_MIB_CNT_BASE + 184: reserved */
  1537. GM_TXF_UC_OK = GM_MIB_CNT_BASE + 192, /* Unicast Frames Xmitted OK */
  1538. GM_TXF_BC_OK = GM_MIB_CNT_BASE + 200, /* Broadcast Frames Xmitted OK */
  1539. GM_TXF_MPAUSE = GM_MIB_CNT_BASE + 208, /* Pause MAC Ctrl Frames Xmitted */
  1540. GM_TXF_MC_OK = GM_MIB_CNT_BASE + 216, /* Multicast Frames Xmitted OK */
  1541. GM_TXO_OK_LO = GM_MIB_CNT_BASE + 224, /* Octets Transmitted OK Low */
  1542. GM_TXO_OK_HI = GM_MIB_CNT_BASE + 232, /* Octets Transmitted OK High */
  1543. GM_TXF_64B = GM_MIB_CNT_BASE + 240, /* 64 Byte Tx Frame */
  1544. GM_TXF_127B = GM_MIB_CNT_BASE + 248, /* 65-127 Byte Tx Frame */
  1545. GM_TXF_255B = GM_MIB_CNT_BASE + 256, /* 128-255 Byte Tx Frame */
  1546. GM_TXF_511B = GM_MIB_CNT_BASE + 264, /* 256-511 Byte Tx Frame */
  1547. GM_TXF_1023B = GM_MIB_CNT_BASE + 272, /* 512-1023 Byte Tx Frame */
  1548. GM_TXF_1518B = GM_MIB_CNT_BASE + 280, /* 1024-1518 Byte Tx Frame */
  1549. GM_TXF_MAX_SZ = GM_MIB_CNT_BASE + 288, /* 1519-MaxSize Byte Tx Frame */
  1550. GM_TXF_COL = GM_MIB_CNT_BASE + 304, /* Tx Collision */
  1551. GM_TXF_LAT_COL = GM_MIB_CNT_BASE + 312, /* Tx Late Collision */
  1552. GM_TXF_ABO_COL = GM_MIB_CNT_BASE + 320, /* Tx aborted due to Exces. Col. */
  1553. GM_TXF_MUL_COL = GM_MIB_CNT_BASE + 328, /* Tx Multiple Collision */
  1554. GM_TXF_SNG_COL = GM_MIB_CNT_BASE + 336, /* Tx Single Collision */
  1555. GM_TXE_FIFO_UR = GM_MIB_CNT_BASE + 344, /* Tx FIFO Underrun Event */
  1556. };
  1557. /* GMAC Bit Definitions */
  1558. /* GM_GP_STAT 16 bit r/o General Purpose Status Register */
  1559. enum {
  1560. GM_GPSR_SPEED = 1<<15, /* Bit 15: Port Speed (1 = 100 Mbps) */
  1561. GM_GPSR_DUPLEX = 1<<14, /* Bit 14: Duplex Mode (1 = Full) */
  1562. GM_GPSR_FC_TX_DIS = 1<<13, /* Bit 13: Tx Flow-Control Mode Disabled */
  1563. GM_GPSR_LINK_UP = 1<<12, /* Bit 12: Link Up Status */
  1564. GM_GPSR_PAUSE = 1<<11, /* Bit 11: Pause State */
  1565. GM_GPSR_TX_ACTIVE = 1<<10, /* Bit 10: Tx in Progress */
  1566. GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occurred */
  1567. GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occurred */
  1568. GM_GPSR_PHY_ST_CH = 1<<5, /* Bit 5: PHY Status Change */
  1569. GM_GPSR_GIG_SPEED = 1<<4, /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */
  1570. GM_GPSR_PART_MODE = 1<<3, /* Bit 3: Partition mode */
  1571. GM_GPSR_FC_RX_DIS = 1<<2, /* Bit 2: Rx Flow-Control Mode Disabled */
  1572. GM_GPSR_PROM_EN = 1<<1, /* Bit 1: Promiscuous Mode Enabled */
  1573. };
  1574. /* GM_GP_CTRL 16 bit r/w General Purpose Control Register */
  1575. enum {
  1576. GM_GPCR_PROM_ENA = 1<<14, /* Bit 14: Enable Promiscuous Mode */
  1577. GM_GPCR_FC_TX_DIS = 1<<13, /* Bit 13: Disable Tx Flow-Control Mode */
  1578. GM_GPCR_TX_ENA = 1<<12, /* Bit 12: Enable Transmit */
  1579. GM_GPCR_RX_ENA = 1<<11, /* Bit 11: Enable Receive */
  1580. GM_GPCR_BURST_ENA = 1<<10, /* Bit 10: Enable Burst Mode */
  1581. GM_GPCR_LOOP_ENA = 1<<9, /* Bit 9: Enable MAC Loopback Mode */
  1582. GM_GPCR_PART_ENA = 1<<8, /* Bit 8: Enable Partition Mode */
  1583. GM_GPCR_GIGS_ENA = 1<<7, /* Bit 7: Gigabit Speed (1000 Mbps) */
  1584. GM_GPCR_FL_PASS = 1<<6, /* Bit 6: Force Link Pass */
  1585. GM_GPCR_DUP_FULL = 1<<5, /* Bit 5: Full Duplex Mode */
  1586. GM_GPCR_FC_RX_DIS = 1<<4, /* Bit 4: Disable Rx Flow-Control Mode */
  1587. GM_GPCR_SPEED_100 = 1<<3, /* Bit 3: Port Speed 100 Mbps */
  1588. GM_GPCR_AU_DUP_DIS = 1<<2, /* Bit 2: Disable Auto-Update Duplex */
  1589. GM_GPCR_AU_FCT_DIS = 1<<1, /* Bit 1: Disable Auto-Update Flow-C. */
  1590. GM_GPCR_AU_SPD_DIS = 1<<0, /* Bit 0: Disable Auto-Update Speed */
  1591. };
  1592. #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
  1593. #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS)
  1594. /* GM_TX_CTRL 16 bit r/w Transmit Control Register */
  1595. enum {
  1596. GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */
  1597. GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */
  1598. GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */
  1599. GM_TXCR_COL_THR_MSK = 7<<10, /* Bit 12..10: Collision Threshold */
  1600. };
  1601. #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK)
  1602. #define TX_COL_DEF 0x04 /* late collision after 64 byte */
  1603. /* GM_RX_CTRL 16 bit r/w Receive Control Register */
  1604. enum {
  1605. GM_RXCR_UCF_ENA = 1<<15, /* Bit 15: Enable Unicast filtering */
  1606. GM_RXCR_MCF_ENA = 1<<14, /* Bit 14: Enable Multicast filtering */
  1607. GM_RXCR_CRC_DIS = 1<<13, /* Bit 13: Remove 4-byte CRC */
  1608. GM_RXCR_PASS_FC = 1<<12, /* Bit 12: Pass FC packets to FIFO */
  1609. };
  1610. /* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */
  1611. enum {
  1612. GM_TXPA_JAMLEN_MSK = 0x03<<14, /* Bit 15..14: Jam Length */
  1613. GM_TXPA_JAMIPG_MSK = 0x1f<<9, /* Bit 13..9: Jam IPG */
  1614. GM_TXPA_JAMDAT_MSK = 0x1f<<4, /* Bit 8..4: IPG Jam to Data */
  1615. TX_JAM_LEN_DEF = 0x03,
  1616. TX_JAM_IPG_DEF = 0x0b,
  1617. TX_IPG_JAM_DEF = 0x1c,
  1618. };
  1619. #define TX_JAM_LEN_VAL(x) (((x)<<14) & GM_TXPA_JAMLEN_MSK)
  1620. #define TX_JAM_IPG_VAL(x) (((x)<<9) & GM_TXPA_JAMIPG_MSK)
  1621. #define TX_IPG_JAM_DATA(x) (((x)<<4) & GM_TXPA_JAMDAT_MSK)
  1622. /* GM_SERIAL_MODE 16 bit r/w Serial Mode Register */
  1623. enum {
  1624. GM_SMOD_DATABL_MSK = 0x1f<<11, /* Bit 15..11: Data Blinder (r/o) */
  1625. GM_SMOD_LIMIT_4 = 1<<10, /* Bit 10: 4 consecutive Tx trials */
  1626. GM_SMOD_VLAN_ENA = 1<<9, /* Bit 9: Enable VLAN (Max. Frame Len) */
  1627. GM_SMOD_JUMBO_ENA = 1<<8, /* Bit 8: Enable Jumbo (Max. Frame Len) */
  1628. GM_SMOD_IPG_MSK = 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */
  1629. };
  1630. #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK)
  1631. #define DATA_BLIND_DEF 0x04
  1632. #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
  1633. #define IPG_DATA_DEF 0x1e
  1634. /* GM_SMI_CTRL 16 bit r/w SMI Control Register */
  1635. enum {
  1636. GM_SMI_CT_PHY_A_MSK = 0x1f<<11, /* Bit 15..11: PHY Device Address */
  1637. GM_SMI_CT_REG_A_MSK = 0x1f<<6, /* Bit 10.. 6: PHY Register Address */
  1638. GM_SMI_CT_OP_RD = 1<<5, /* Bit 5: OpCode Read (0=Write)*/
  1639. GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */
  1640. GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */
  1641. };
  1642. #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK)
  1643. #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK)
  1644. /* GM_PHY_ADDR 16 bit r/w GPHY Address Register */
  1645. enum {
  1646. GM_PAR_MIB_CLR = 1<<5, /* Bit 5: Set MIB Clear Counter Mode */
  1647. GM_PAR_MIB_TST = 1<<4, /* Bit 4: MIB Load Counter (Test Mode) */
  1648. };
  1649. /* Receive Frame Status Encoding */
  1650. enum {
  1651. GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */
  1652. GMR_FS_LEN_SHIFT = 16,
  1653. GMR_FS_VLAN = 1<<13, /* Bit 13: VLAN Packet */
  1654. GMR_FS_JABBER = 1<<12, /* Bit 12: Jabber Packet */
  1655. GMR_FS_UN_SIZE = 1<<11, /* Bit 11: Undersize Packet */
  1656. GMR_FS_MC = 1<<10, /* Bit 10: Multicast Packet */
  1657. GMR_FS_BC = 1<<9, /* Bit 9: Broadcast Packet */
  1658. GMR_FS_RX_OK = 1<<8, /* Bit 8: Receive OK (Good Packet) */
  1659. GMR_FS_GOOD_FC = 1<<7, /* Bit 7: Good Flow-Control Packet */
  1660. GMR_FS_BAD_FC = 1<<6, /* Bit 6: Bad Flow-Control Packet */
  1661. GMR_FS_MII_ERR = 1<<5, /* Bit 5: MII Error */
  1662. GMR_FS_LONG_ERR = 1<<4, /* Bit 4: Too Long Packet */
  1663. GMR_FS_FRAGMENT = 1<<3, /* Bit 3: Fragment */
  1664. GMR_FS_CRC_ERR = 1<<1, /* Bit 1: CRC Error */
  1665. GMR_FS_RX_FF_OV = 1<<0, /* Bit 0: Rx FIFO Overflow */
  1666. /*
  1667. * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR)
  1668. */
  1669. GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR |
  1670. GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC |
  1671. GMR_FS_JABBER,
  1672. /* Rx GMAC FIFO Flush Mask (default) */
  1673. RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR |
  1674. GMR_FS_BAD_FC | GMR_FS_UN_SIZE | GMR_FS_JABBER,
  1675. };
  1676. /* RX_GMF_CTRL_T 32 bit Rx GMAC FIFO Control/Test */
  1677. enum {
  1678. GMF_WP_TST_ON = 1<<14, /* Write Pointer Test On */
  1679. GMF_WP_TST_OFF = 1<<13, /* Write Pointer Test Off */
  1680. GMF_WP_STEP = 1<<12, /* Write Pointer Step/Increment */
  1681. GMF_RP_TST_ON = 1<<10, /* Read Pointer Test On */
  1682. GMF_RP_TST_OFF = 1<<9, /* Read Pointer Test Off */
  1683. GMF_RP_STEP = 1<<8, /* Read Pointer Step/Increment */
  1684. GMF_RX_F_FL_ON = 1<<7, /* Rx FIFO Flush Mode On */
  1685. GMF_RX_F_FL_OFF = 1<<6, /* Rx FIFO Flush Mode Off */
  1686. GMF_CLI_RX_FO = 1<<5, /* Clear IRQ Rx FIFO Overrun */
  1687. GMF_CLI_RX_FC = 1<<4, /* Clear IRQ Rx Frame Complete */
  1688. GMF_OPER_ON = 1<<3, /* Operational Mode On */
  1689. GMF_OPER_OFF = 1<<2, /* Operational Mode Off */
  1690. GMF_RST_CLR = 1<<1, /* Clear GMAC FIFO Reset */
  1691. GMF_RST_SET = 1<<0, /* Set GMAC FIFO Reset */
  1692. RX_GMF_FL_THR_DEF = 0xa, /* flush threshold (default) */
  1693. };
  1694. /* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */
  1695. enum {
  1696. GMF_WSP_TST_ON = 1<<18, /* Write Shadow Pointer Test On */
  1697. GMF_WSP_TST_OFF = 1<<17, /* Write Shadow Pointer Test Off */
  1698. GMF_WSP_STEP = 1<<16, /* Write Shadow Pointer Step/Increment */
  1699. GMF_CLI_TX_FU = 1<<6, /* Clear IRQ Tx FIFO Underrun */
  1700. GMF_CLI_TX_FC = 1<<5, /* Clear IRQ Tx Frame Complete */
  1701. GMF_CLI_TX_PE = 1<<4, /* Clear IRQ Tx Parity Error */
  1702. };
  1703. /* GMAC_TI_ST_CTRL 8 bit Time Stamp Timer Ctrl Reg (YUKON only) */
  1704. enum {
  1705. GMT_ST_START = 1<<2, /* Start Time Stamp Timer */
  1706. GMT_ST_STOP = 1<<1, /* Stop Time Stamp Timer */
  1707. GMT_ST_CLR_IRQ = 1<<0, /* Clear Time Stamp Timer IRQ */
  1708. };
  1709. /* GMAC_CTRL 32 bit GMAC Control Reg (YUKON only) */
  1710. enum {
  1711. GMC_H_BURST_ON = 1<<7, /* Half Duplex Burst Mode On */
  1712. GMC_H_BURST_OFF = 1<<6, /* Half Duplex Burst Mode Off */
  1713. GMC_F_LOOPB_ON = 1<<5, /* FIFO Loopback On */
  1714. GMC_F_LOOPB_OFF = 1<<4, /* FIFO Loopback Off */
  1715. GMC_PAUSE_ON = 1<<3, /* Pause On */
  1716. GMC_PAUSE_OFF = 1<<2, /* Pause Off */
  1717. GMC_RST_CLR = 1<<1, /* Clear GMAC Reset */
  1718. GMC_RST_SET = 1<<0, /* Set GMAC Reset */
  1719. };
  1720. /* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */
  1721. enum {
  1722. GPC_SEL_BDT = 1<<28, /* Select Bi-Dir. Transfer for MDC/MDIO */
  1723. GPC_INT_POL_HI = 1<<27, /* IRQ Polarity is Active HIGH */
  1724. GPC_75_OHM = 1<<26, /* Use 75 Ohm Termination instead of 50 */
  1725. GPC_DIS_FC = 1<<25, /* Disable Automatic Fiber/Copper Detection */
  1726. GPC_DIS_SLEEP = 1<<24, /* Disable Energy Detect */
  1727. GPC_HWCFG_M_3 = 1<<23, /* HWCFG_MODE[3] */
  1728. GPC_HWCFG_M_2 = 1<<22, /* HWCFG_MODE[2] */
  1729. GPC_HWCFG_M_1 = 1<<21, /* HWCFG_MODE[1] */
  1730. GPC_HWCFG_M_0 = 1<<20, /* HWCFG_MODE[0] */
  1731. GPC_ANEG_0 = 1<<19, /* ANEG[0] */
  1732. GPC_ENA_XC = 1<<18, /* Enable MDI crossover */
  1733. GPC_DIS_125 = 1<<17, /* Disable 125 MHz clock */
  1734. GPC_ANEG_3 = 1<<16, /* ANEG[3] */
  1735. GPC_ANEG_2 = 1<<15, /* ANEG[2] */
  1736. GPC_ANEG_1 = 1<<14, /* ANEG[1] */
  1737. GPC_ENA_PAUSE = 1<<13, /* Enable Pause (SYM_OR_REM) */
  1738. GPC_PHYADDR_4 = 1<<12, /* Bit 4 of Phy Addr */
  1739. GPC_PHYADDR_3 = 1<<11, /* Bit 3 of Phy Addr */
  1740. GPC_PHYADDR_2 = 1<<10, /* Bit 2 of Phy Addr */
  1741. GPC_PHYADDR_1 = 1<<9, /* Bit 1 of Phy Addr */
  1742. GPC_PHYADDR_0 = 1<<8, /* Bit 0 of Phy Addr */
  1743. /* Bits 7..2: reserved */
  1744. GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */
  1745. GPC_RST_SET = 1<<0, /* Set GPHY Reset */
  1746. };
  1747. #define GPC_HWCFG_GMII_COP (GPC_HWCFG_M_3|GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
  1748. #define GPC_HWCFG_GMII_FIB (GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
  1749. #define GPC_ANEG_ADV_ALL_M (GPC_ANEG_3 | GPC_ANEG_2 | GPC_ANEG_1 | GPC_ANEG_0)
  1750. /* forced speed and duplex mode (don't mix with other ANEG bits) */
  1751. #define GPC_FRC10MBIT_HALF 0
  1752. #define GPC_FRC10MBIT_FULL GPC_ANEG_0
  1753. #define GPC_FRC100MBIT_HALF GPC_ANEG_1
  1754. #define GPC_FRC100MBIT_FULL (GPC_ANEG_0 | GPC_ANEG_1)
  1755. /* auto-negotiation with limited advertised speeds */
  1756. /* mix only with master/slave settings (for copper) */
  1757. #define GPC_ADV_1000_HALF GPC_ANEG_2
  1758. #define GPC_ADV_1000_FULL GPC_ANEG_3
  1759. #define GPC_ADV_ALL (GPC_ANEG_2 | GPC_ANEG_3)
  1760. /* master/slave settings */
  1761. /* only for copper with 1000 Mbps */
  1762. #define GPC_FORCE_MASTER 0
  1763. #define GPC_FORCE_SLAVE GPC_ANEG_0
  1764. #define GPC_PREF_MASTER GPC_ANEG_1
  1765. #define GPC_PREF_SLAVE (GPC_ANEG_1 | GPC_ANEG_0)
  1766. /* GMAC_IRQ_SRC 8 bit GMAC Interrupt Source Reg (YUKON only) */
  1767. /* GMAC_IRQ_MSK 8 bit GMAC Interrupt Mask Reg (YUKON only) */
  1768. enum {
  1769. GM_IS_TX_CO_OV = 1<<5, /* Transmit Counter Overflow IRQ */
  1770. GM_IS_RX_CO_OV = 1<<4, /* Receive Counter Overflow IRQ */
  1771. GM_IS_TX_FF_UR = 1<<3, /* Transmit FIFO Underrun */
  1772. GM_IS_TX_COMPL = 1<<2, /* Frame Transmission Complete */
  1773. GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
  1774. GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
  1775. #define GMAC_DEF_MSK (GM_IS_RX_FF_OR | GM_IS_TX_FF_UR)
  1776. /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
  1777. /* Bits 15.. 2: reserved */
  1778. GMLC_RST_CLR = 1<<1, /* Clear GMAC Link Reset */
  1779. GMLC_RST_SET = 1<<0, /* Set GMAC Link Reset */
  1780. /* WOL_CTRL_STAT 16 bit WOL Control/Status Reg */
  1781. WOL_CTL_LINK_CHG_OCC = 1<<15,
  1782. WOL_CTL_MAGIC_PKT_OCC = 1<<14,
  1783. WOL_CTL_PATTERN_OCC = 1<<13,
  1784. WOL_CTL_CLEAR_RESULT = 1<<12,
  1785. WOL_CTL_ENA_PME_ON_LINK_CHG = 1<<11,
  1786. WOL_CTL_DIS_PME_ON_LINK_CHG = 1<<10,
  1787. WOL_CTL_ENA_PME_ON_MAGIC_PKT = 1<<9,
  1788. WOL_CTL_DIS_PME_ON_MAGIC_PKT = 1<<8,
  1789. WOL_CTL_ENA_PME_ON_PATTERN = 1<<7,
  1790. WOL_CTL_DIS_PME_ON_PATTERN = 1<<6,
  1791. WOL_CTL_ENA_LINK_CHG_UNIT = 1<<5,
  1792. WOL_CTL_DIS_LINK_CHG_UNIT = 1<<4,
  1793. WOL_CTL_ENA_MAGIC_PKT_UNIT = 1<<3,
  1794. WOL_CTL_DIS_MAGIC_PKT_UNIT = 1<<2,
  1795. WOL_CTL_ENA_PATTERN_UNIT = 1<<1,
  1796. WOL_CTL_DIS_PATTERN_UNIT = 1<<0,
  1797. };
  1798. #define WOL_CTL_DEFAULT \
  1799. (WOL_CTL_DIS_PME_ON_LINK_CHG | \
  1800. WOL_CTL_DIS_PME_ON_PATTERN | \
  1801. WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
  1802. WOL_CTL_DIS_LINK_CHG_UNIT | \
  1803. WOL_CTL_DIS_PATTERN_UNIT | \
  1804. WOL_CTL_DIS_MAGIC_PKT_UNIT)
  1805. /* WOL_MATCH_CTL 8 bit WOL Match Control Reg */
  1806. #define WOL_CTL_PATT_ENA(x) (1 << (x))
  1807. /* XMAC II registers */
  1808. enum {
  1809. XM_MMU_CMD = 0x0000, /* 16 bit r/w MMU Command Register */
  1810. XM_POFF = 0x0008, /* 32 bit r/w Packet Offset Register */
  1811. XM_BURST = 0x000c, /* 32 bit r/w Burst Register for half duplex*/
  1812. XM_1L_VLAN_TAG = 0x0010, /* 16 bit r/w One Level VLAN Tag ID */
  1813. XM_2L_VLAN_TAG = 0x0014, /* 16 bit r/w Two Level VLAN Tag ID */
  1814. XM_TX_CMD = 0x0020, /* 16 bit r/w Transmit Command Register */
  1815. XM_TX_RT_LIM = 0x0024, /* 16 bit r/w Transmit Retry Limit Register */
  1816. XM_TX_STIME = 0x0028, /* 16 bit r/w Transmit Slottime Register */
  1817. XM_TX_IPG = 0x002c, /* 16 bit r/w Transmit Inter Packet Gap */
  1818. XM_RX_CMD = 0x0030, /* 16 bit r/w Receive Command Register */
  1819. XM_PHY_ADDR = 0x0034, /* 16 bit r/w PHY Address Register */
  1820. XM_PHY_DATA = 0x0038, /* 16 bit r/w PHY Data Register */
  1821. XM_GP_PORT = 0x0040, /* 32 bit r/w General Purpose Port Register */
  1822. XM_IMSK = 0x0044, /* 16 bit r/w Interrupt Mask Register */
  1823. XM_ISRC = 0x0048, /* 16 bit r/o Interrupt Status Register */
  1824. XM_HW_CFG = 0x004c, /* 16 bit r/w Hardware Config Register */
  1825. XM_TX_LO_WM = 0x0060, /* 16 bit r/w Tx FIFO Low Water Mark */
  1826. XM_TX_HI_WM = 0x0062, /* 16 bit r/w Tx FIFO High Water Mark */
  1827. XM_TX_THR = 0x0064, /* 16 bit r/w Tx Request Threshold */
  1828. XM_HT_THR = 0x0066, /* 16 bit r/w Host Request Threshold */
  1829. XM_PAUSE_DA = 0x0068, /* NA reg r/w Pause Destination Address */
  1830. XM_CTL_PARA = 0x0070, /* 32 bit r/w Control Parameter Register */
  1831. XM_MAC_OPCODE = 0x0074, /* 16 bit r/w Opcode for MAC control frames */
  1832. XM_MAC_PTIME = 0x0076, /* 16 bit r/w Pause time for MAC ctrl frames*/
  1833. XM_TX_STAT = 0x0078, /* 32 bit r/o Tx Status LIFO Register */
  1834. XM_EXM_START = 0x0080, /* r/w Start Address of the EXM Regs */
  1835. #define XM_EXM(reg) (XM_EXM_START + ((reg) << 3))
  1836. };
  1837. enum {
  1838. XM_SRC_CHK = 0x0100, /* NA reg r/w Source Check Address Register */
  1839. XM_SA = 0x0108, /* NA reg r/w Station Address Register */
  1840. XM_HSM = 0x0110, /* 64 bit r/w Hash Match Address Registers */
  1841. XM_RX_LO_WM = 0x0118, /* 16 bit r/w Receive Low Water Mark */
  1842. XM_RX_HI_WM = 0x011a, /* 16 bit r/w Receive High Water Mark */
  1843. XM_RX_THR = 0x011c, /* 32 bit r/w Receive Request Threshold */
  1844. XM_DEV_ID = 0x0120, /* 32 bit r/o Device ID Register */
  1845. XM_MODE = 0x0124, /* 32 bit r/w Mode Register */
  1846. XM_LSA = 0x0128, /* NA reg r/o Last Source Register */
  1847. XM_TS_READ = 0x0130, /* 32 bit r/o Time Stamp Read Register */
  1848. XM_TS_LOAD = 0x0134, /* 32 bit r/o Time Stamp Load Value */
  1849. XM_STAT_CMD = 0x0200, /* 16 bit r/w Statistics Command Register */
  1850. XM_RX_CNT_EV = 0x0204, /* 32 bit r/o Rx Counter Event Register */
  1851. XM_TX_CNT_EV = 0x0208, /* 32 bit r/o Tx Counter Event Register */
  1852. XM_RX_EV_MSK = 0x020c, /* 32 bit r/w Rx Counter Event Mask */
  1853. XM_TX_EV_MSK = 0x0210, /* 32 bit r/w Tx Counter Event Mask */
  1854. XM_TXF_OK = 0x0280, /* 32 bit r/o Frames Transmitted OK Conuter */
  1855. XM_TXO_OK_HI = 0x0284, /* 32 bit r/o Octets Transmitted OK High Cnt*/
  1856. XM_TXO_OK_LO = 0x0288, /* 32 bit r/o Octets Transmitted OK Low Cnt */
  1857. XM_TXF_BC_OK = 0x028c, /* 32 bit r/o Broadcast Frames Xmitted OK */
  1858. XM_TXF_MC_OK = 0x0290, /* 32 bit r/o Multicast Frames Xmitted OK */
  1859. XM_TXF_UC_OK = 0x0294, /* 32 bit r/o Unicast Frames Xmitted OK */
  1860. XM_TXF_LONG = 0x0298, /* 32 bit r/o Tx Long Frame Counter */
  1861. XM_TXE_BURST = 0x029c, /* 32 bit r/o Tx Burst Event Counter */
  1862. XM_TXF_MPAUSE = 0x02a0, /* 32 bit r/o Tx Pause MAC Ctrl Frame Cnt */
  1863. XM_TXF_MCTRL = 0x02a4, /* 32 bit r/o Tx MAC Ctrl Frame Counter */
  1864. XM_TXF_SNG_COL = 0x02a8, /* 32 bit r/o Tx Single Collision Counter */
  1865. XM_TXF_MUL_COL = 0x02ac, /* 32 bit r/o Tx Multiple Collision Counter */
  1866. XM_TXF_ABO_COL = 0x02b0, /* 32 bit r/o Tx aborted due to Exces. Col. */
  1867. XM_TXF_LAT_COL = 0x02b4, /* 32 bit r/o Tx Late Collision Counter */
  1868. XM_TXF_DEF = 0x02b8, /* 32 bit r/o Tx Deferred Frame Counter */
  1869. XM_TXF_EX_DEF = 0x02bc, /* 32 bit r/o Tx Excessive Deferall Counter */
  1870. XM_TXE_FIFO_UR = 0x02c0, /* 32 bit r/o Tx FIFO Underrun Event Cnt */
  1871. XM_TXE_CS_ERR = 0x02c4, /* 32 bit r/o Tx Carrier Sense Error Cnt */
  1872. XM_TXP_UTIL = 0x02c8, /* 32 bit r/o Tx Utilization in % */
  1873. XM_TXF_64B = 0x02d0, /* 32 bit r/o 64 Byte Tx Frame Counter */
  1874. XM_TXF_127B = 0x02d4, /* 32 bit r/o 65-127 Byte Tx Frame Counter */
  1875. XM_TXF_255B = 0x02d8, /* 32 bit r/o 128-255 Byte Tx Frame Counter */
  1876. XM_TXF_511B = 0x02dc, /* 32 bit r/o 256-511 Byte Tx Frame Counter */
  1877. XM_TXF_1023B = 0x02e0, /* 32 bit r/o 512-1023 Byte Tx Frame Counter*/
  1878. XM_TXF_MAX_SZ = 0x02e4, /* 32 bit r/o 1024-MaxSize Byte Tx Frame Cnt*/
  1879. XM_RXF_OK = 0x0300, /* 32 bit r/o Frames Received OK */
  1880. XM_RXO_OK_HI = 0x0304, /* 32 bit r/o Octets Received OK High Cnt */
  1881. XM_RXO_OK_LO = 0x0308, /* 32 bit r/o Octets Received OK Low Counter*/
  1882. XM_RXF_BC_OK = 0x030c, /* 32 bit r/o Broadcast Frames Received OK */
  1883. XM_RXF_MC_OK = 0x0310, /* 32 bit r/o Multicast Frames Received OK */
  1884. XM_RXF_UC_OK = 0x0314, /* 32 bit r/o Unicast Frames Received OK */
  1885. XM_RXF_MPAUSE = 0x0318, /* 32 bit r/o Rx Pause MAC Ctrl Frame Cnt */
  1886. XM_RXF_MCTRL = 0x031c, /* 32 bit r/o Rx MAC Ctrl Frame Counter */
  1887. XM_RXF_INV_MP = 0x0320, /* 32 bit r/o Rx invalid Pause Frame Cnt */
  1888. XM_RXF_INV_MOC = 0x0324, /* 32 bit r/o Rx Frames with inv. MAC Opcode*/
  1889. XM_RXE_BURST = 0x0328, /* 32 bit r/o Rx Burst Event Counter */
  1890. XM_RXE_FMISS = 0x032c, /* 32 bit r/o Rx Missed Frames Event Cnt */
  1891. XM_RXF_FRA_ERR = 0x0330, /* 32 bit r/o Rx Framing Error Counter */
  1892. XM_RXE_FIFO_OV = 0x0334, /* 32 bit r/o Rx FIFO overflow Event Cnt */
  1893. XM_RXF_JAB_PKT = 0x0338, /* 32 bit r/o Rx Jabber Packet Frame Cnt */
  1894. XM_RXE_CAR_ERR = 0x033c, /* 32 bit r/o Rx Carrier Event Error Cnt */
  1895. XM_RXF_LEN_ERR = 0x0340, /* 32 bit r/o Rx in Range Length Error */
  1896. XM_RXE_SYM_ERR = 0x0344, /* 32 bit r/o Rx Symbol Error Counter */
  1897. XM_RXE_SHT_ERR = 0x0348, /* 32 bit r/o Rx Short Event Error Cnt */
  1898. XM_RXE_RUNT = 0x034c, /* 32 bit r/o Rx Runt Event Counter */
  1899. XM_RXF_LNG_ERR = 0x0350, /* 32 bit r/o Rx Frame too Long Error Cnt */
  1900. XM_RXF_FCS_ERR = 0x0354, /* 32 bit r/o Rx Frame Check Seq. Error Cnt */
  1901. XM_RXF_CEX_ERR = 0x035c, /* 32 bit r/o Rx Carrier Ext Error Frame Cnt*/
  1902. XM_RXP_UTIL = 0x0360, /* 32 bit r/o Rx Utilization in % */
  1903. XM_RXF_64B = 0x0368, /* 32 bit r/o 64 Byte Rx Frame Counter */
  1904. XM_RXF_127B = 0x036c, /* 32 bit r/o 65-127 Byte Rx Frame Counter */
  1905. XM_RXF_255B = 0x0370, /* 32 bit r/o 128-255 Byte Rx Frame Counter */
  1906. XM_RXF_511B = 0x0374, /* 32 bit r/o 256-511 Byte Rx Frame Counter */
  1907. XM_RXF_1023B = 0x0378, /* 32 bit r/o 512-1023 Byte Rx Frame Counter*/
  1908. XM_RXF_MAX_SZ = 0x037c, /* 32 bit r/o 1024-MaxSize Byte Rx Frame Cnt*/
  1909. };
  1910. /* XM_MMU_CMD 16 bit r/w MMU Command Register */
  1911. enum {
  1912. XM_MMU_PHY_RDY = 1<<12, /* Bit 12: PHY Read Ready */
  1913. XM_MMU_PHY_BUSY = 1<<11, /* Bit 11: PHY Busy */
  1914. XM_MMU_IGN_PF = 1<<10, /* Bit 10: Ignore Pause Frame */
  1915. XM_MMU_MAC_LB = 1<<9, /* Bit 9: Enable MAC Loopback */
  1916. XM_MMU_FRC_COL = 1<<7, /* Bit 7: Force Collision */
  1917. XM_MMU_SIM_COL = 1<<6, /* Bit 6: Simulate Collision */
  1918. XM_MMU_NO_PRE = 1<<5, /* Bit 5: No MDIO Preamble */
  1919. XM_MMU_GMII_FD = 1<<4, /* Bit 4: GMII uses Full Duplex */
  1920. XM_MMU_RAT_CTRL = 1<<3, /* Bit 3: Enable Rate Control */
  1921. XM_MMU_GMII_LOOP= 1<<2, /* Bit 2: PHY is in Loopback Mode */
  1922. XM_MMU_ENA_RX = 1<<1, /* Bit 1: Enable Receiver */
  1923. XM_MMU_ENA_TX = 1<<0, /* Bit 0: Enable Transmitter */
  1924. };
  1925. /* XM_TX_CMD 16 bit r/w Transmit Command Register */
  1926. enum {
  1927. XM_TX_BK2BK = 1<<6, /* Bit 6: Ignor Carrier Sense (Tx Bk2Bk)*/
  1928. XM_TX_ENC_BYP = 1<<5, /* Bit 5: Set Encoder in Bypass Mode */
  1929. XM_TX_SAM_LINE = 1<<4, /* Bit 4: (sc) Start utilization calculation */
  1930. XM_TX_NO_GIG_MD = 1<<3, /* Bit 3: Disable Carrier Extension */
  1931. XM_TX_NO_PRE = 1<<2, /* Bit 2: Disable Preamble Generation */
  1932. XM_TX_NO_CRC = 1<<1, /* Bit 1: Disable CRC Generation */
  1933. XM_TX_AUTO_PAD = 1<<0, /* Bit 0: Enable Automatic Padding */
  1934. };
  1935. /* XM_TX_RT_LIM 16 bit r/w Transmit Retry Limit Register */
  1936. #define XM_RT_LIM_MSK 0x1f /* Bit 4..0: Tx Retry Limit */
  1937. /* XM_TX_STIME 16 bit r/w Transmit Slottime Register */
  1938. #define XM_STIME_MSK 0x7f /* Bit 6..0: Tx Slottime bits */
  1939. /* XM_TX_IPG 16 bit r/w Transmit Inter Packet Gap */
  1940. #define XM_IPG_MSK 0xff /* Bit 7..0: IPG value bits */
  1941. /* XM_RX_CMD 16 bit r/w Receive Command Register */
  1942. enum {
  1943. XM_RX_LENERR_OK = 1<<8, /* Bit 8 don't set Rx Err bit for */
  1944. /* inrange error packets */
  1945. XM_RX_BIG_PK_OK = 1<<7, /* Bit 7 don't set Rx Err bit for */
  1946. /* jumbo packets */
  1947. XM_RX_IPG_CAP = 1<<6, /* Bit 6 repl. type field with IPG */
  1948. XM_RX_TP_MD = 1<<5, /* Bit 5: Enable transparent Mode */
  1949. XM_RX_STRIP_FCS = 1<<4, /* Bit 4: Enable FCS Stripping */
  1950. XM_RX_SELF_RX = 1<<3, /* Bit 3: Enable Rx of own packets */
  1951. XM_RX_SAM_LINE = 1<<2, /* Bit 2: (sc) Start utilization calculation */
  1952. XM_RX_STRIP_PAD = 1<<1, /* Bit 1: Strip pad bytes of Rx frames */
  1953. XM_RX_DIS_CEXT = 1<<0, /* Bit 0: Disable carrier ext. check */
  1954. };
  1955. /* XM_GP_PORT 32 bit r/w General Purpose Port Register */
  1956. enum {
  1957. XM_GP_ANIP = 1<<6, /* Bit 6: (ro) Auto-Neg. in progress */
  1958. XM_GP_FRC_INT = 1<<5, /* Bit 5: (sc) Force Interrupt */
  1959. XM_GP_RES_MAC = 1<<3, /* Bit 3: (sc) Reset MAC and FIFOs */
  1960. XM_GP_RES_STAT = 1<<2, /* Bit 2: (sc) Reset the statistics module */
  1961. XM_GP_INP_ASS = 1<<0, /* Bit 0: (ro) GP Input Pin asserted */
  1962. };
  1963. /* XM_IMSK 16 bit r/w Interrupt Mask Register */
  1964. /* XM_ISRC 16 bit r/o Interrupt Status Register */
  1965. enum {
  1966. XM_IS_LNK_AE = 1<<14, /* Bit 14: Link Asynchronous Event */
  1967. XM_IS_TX_ABORT = 1<<13, /* Bit 13: Transmit Abort, late Col. etc */
  1968. XM_IS_FRC_INT = 1<<12, /* Bit 12: Force INT bit set in GP */
  1969. XM_IS_INP_ASS = 1<<11, /* Bit 11: Input Asserted, GP bit 0 set */
  1970. XM_IS_LIPA_RC = 1<<10, /* Bit 10: Link Partner requests config */
  1971. XM_IS_RX_PAGE = 1<<9, /* Bit 9: Page Received */
  1972. XM_IS_TX_PAGE = 1<<8, /* Bit 8: Next Page Loaded for Transmit */
  1973. XM_IS_AND = 1<<7, /* Bit 7: Auto-Negotiation Done */
  1974. XM_IS_TSC_OV = 1<<6, /* Bit 6: Time Stamp Counter Overflow */
  1975. XM_IS_RXC_OV = 1<<5, /* Bit 5: Rx Counter Event Overflow */
  1976. XM_IS_TXC_OV = 1<<4, /* Bit 4: Tx Counter Event Overflow */
  1977. XM_IS_RXF_OV = 1<<3, /* Bit 3: Receive FIFO Overflow */
  1978. XM_IS_TXF_UR = 1<<2, /* Bit 2: Transmit FIFO Underrun */
  1979. XM_IS_TX_COMP = 1<<1, /* Bit 1: Frame Tx Complete */
  1980. XM_IS_RX_COMP = 1<<0, /* Bit 0: Frame Rx Complete */
  1981. XM_IMSK_DISABLE = 0xffff,
  1982. };
  1983. /* XM_HW_CFG 16 bit r/w Hardware Config Register */
  1984. enum {
  1985. XM_HW_GEN_EOP = 1<<3, /* Bit 3: generate End of Packet pulse */
  1986. XM_HW_COM4SIG = 1<<2, /* Bit 2: use Comma Detect for Sig. Det.*/
  1987. XM_HW_GMII_MD = 1<<0, /* Bit 0: GMII Interface selected */
  1988. };
  1989. /* XM_TX_LO_WM 16 bit r/w Tx FIFO Low Water Mark */
  1990. /* XM_TX_HI_WM 16 bit r/w Tx FIFO High Water Mark */
  1991. #define XM_TX_WM_MSK 0x01ff /* Bit 9.. 0 Tx FIFO Watermark bits */
  1992. /* XM_TX_THR 16 bit r/w Tx Request Threshold */
  1993. /* XM_HT_THR 16 bit r/w Host Request Threshold */
  1994. /* XM_RX_THR 16 bit r/w Rx Request Threshold */
  1995. #define XM_THR_MSK 0x03ff /* Bit 10.. 0 Rx/Tx Request Threshold bits */
  1996. /* XM_TX_STAT 32 bit r/o Tx Status LIFO Register */
  1997. enum {
  1998. XM_ST_VALID = (1UL<<31), /* Bit 31: Status Valid */
  1999. XM_ST_BYTE_CNT = (0x3fffL<<17), /* Bit 30..17: Tx frame Length */
  2000. XM_ST_RETRY_CNT = (0x1fL<<12), /* Bit 16..12: Retry Count */
  2001. XM_ST_EX_COL = 1<<11, /* Bit 11: Excessive Collisions */
  2002. XM_ST_EX_DEF = 1<<10, /* Bit 10: Excessive Deferral */
  2003. XM_ST_BURST = 1<<9, /* Bit 9: p. xmitted in burst md*/
  2004. XM_ST_DEFER = 1<<8, /* Bit 8: packet was defered */
  2005. XM_ST_BC = 1<<7, /* Bit 7: Broadcast packet */
  2006. XM_ST_MC = 1<<6, /* Bit 6: Multicast packet */
  2007. XM_ST_UC = 1<<5, /* Bit 5: Unicast packet */
  2008. XM_ST_TX_UR = 1<<4, /* Bit 4: FIFO Underrun occurred */
  2009. XM_ST_CS_ERR = 1<<3, /* Bit 3: Carrier Sense Error */
  2010. XM_ST_LAT_COL = 1<<2, /* Bit 2: Late Collision Error */
  2011. XM_ST_MUL_COL = 1<<1, /* Bit 1: Multiple Collisions */
  2012. XM_ST_SGN_COL = 1<<0, /* Bit 0: Single Collision */
  2013. };
  2014. /* XM_RX_LO_WM 16 bit r/w Receive Low Water Mark */
  2015. /* XM_RX_HI_WM 16 bit r/w Receive High Water Mark */
  2016. #define XM_RX_WM_MSK 0x03ff /* Bit 11.. 0: Rx FIFO Watermark bits */
  2017. /* XM_DEV_ID 32 bit r/o Device ID Register */
  2018. #define XM_DEV_OUI (0x00ffffffUL<<8) /* Bit 31..8: Device OUI */
  2019. #define XM_DEV_REV (0x07L << 5) /* Bit 7..5: Chip Rev Num */
  2020. /* XM_MODE 32 bit r/w Mode Register */
  2021. enum {
  2022. XM_MD_ENA_REJ = 1<<26, /* Bit 26: Enable Frame Reject */
  2023. XM_MD_SPOE_E = 1<<25, /* Bit 25: Send Pause on Edge */
  2024. /* extern generated */
  2025. XM_MD_TX_REP = 1<<24, /* Bit 24: Transmit Repeater Mode */
  2026. XM_MD_SPOFF_I = 1<<23, /* Bit 23: Send Pause on FIFO full */
  2027. /* intern generated */
  2028. XM_MD_LE_STW = 1<<22, /* Bit 22: Rx Stat Word in Little Endian */
  2029. XM_MD_TX_CONT = 1<<21, /* Bit 21: Send Continuous */
  2030. XM_MD_TX_PAUSE = 1<<20, /* Bit 20: (sc) Send Pause Frame */
  2031. XM_MD_ATS = 1<<19, /* Bit 19: Append Time Stamp */
  2032. XM_MD_SPOL_I = 1<<18, /* Bit 18: Send Pause on Low */
  2033. /* intern generated */
  2034. XM_MD_SPOH_I = 1<<17, /* Bit 17: Send Pause on High */
  2035. /* intern generated */
  2036. XM_MD_CAP = 1<<16, /* Bit 16: Check Address Pair */
  2037. XM_MD_ENA_HASH = 1<<15, /* Bit 15: Enable Hashing */
  2038. XM_MD_CSA = 1<<14, /* Bit 14: Check Station Address */
  2039. XM_MD_CAA = 1<<13, /* Bit 13: Check Address Array */
  2040. XM_MD_RX_MCTRL = 1<<12, /* Bit 12: Rx MAC Control Frame */
  2041. XM_MD_RX_RUNT = 1<<11, /* Bit 11: Rx Runt Frames */
  2042. XM_MD_RX_IRLE = 1<<10, /* Bit 10: Rx in Range Len Err Frame */
  2043. XM_MD_RX_LONG = 1<<9, /* Bit 9: Rx Long Frame */
  2044. XM_MD_RX_CRCE = 1<<8, /* Bit 8: Rx CRC Error Frame */
  2045. XM_MD_RX_ERR = 1<<7, /* Bit 7: Rx Error Frame */
  2046. XM_MD_DIS_UC = 1<<6, /* Bit 6: Disable Rx Unicast */
  2047. XM_MD_DIS_MC = 1<<5, /* Bit 5: Disable Rx Multicast */
  2048. XM_MD_DIS_BC = 1<<4, /* Bit 4: Disable Rx Broadcast */
  2049. XM_MD_ENA_PROM = 1<<3, /* Bit 3: Enable Promiscuous */
  2050. XM_MD_ENA_BE = 1<<2, /* Bit 2: Enable Big Endian */
  2051. XM_MD_FTF = 1<<1, /* Bit 1: (sc) Flush Tx FIFO */
  2052. XM_MD_FRF = 1<<0, /* Bit 0: (sc) Flush Rx FIFO */
  2053. };
  2054. #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I)
  2055. #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\
  2056. XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA)
  2057. /* XM_STAT_CMD 16 bit r/w Statistics Command Register */
  2058. enum {
  2059. XM_SC_SNP_RXC = 1<<5, /* Bit 5: (sc) Snap Rx Counters */
  2060. XM_SC_SNP_TXC = 1<<4, /* Bit 4: (sc) Snap Tx Counters */
  2061. XM_SC_CP_RXC = 1<<3, /* Bit 3: Copy Rx Counters Continuously */
  2062. XM_SC_CP_TXC = 1<<2, /* Bit 2: Copy Tx Counters Continuously */
  2063. XM_SC_CLR_RXC = 1<<1, /* Bit 1: (sc) Clear Rx Counters */
  2064. XM_SC_CLR_TXC = 1<<0, /* Bit 0: (sc) Clear Tx Counters */
  2065. };
  2066. /* XM_RX_CNT_EV 32 bit r/o Rx Counter Event Register */
  2067. /* XM_RX_EV_MSK 32 bit r/w Rx Counter Event Mask */
  2068. enum {
  2069. XMR_MAX_SZ_OV = 1<<31, /* Bit 31: 1024-MaxSize Rx Cnt Ov*/
  2070. XMR_1023B_OV = 1<<30, /* Bit 30: 512-1023Byte Rx Cnt Ov*/
  2071. XMR_511B_OV = 1<<29, /* Bit 29: 256-511 Byte Rx Cnt Ov*/
  2072. XMR_255B_OV = 1<<28, /* Bit 28: 128-255 Byte Rx Cnt Ov*/
  2073. XMR_127B_OV = 1<<27, /* Bit 27: 65-127 Byte Rx Cnt Ov */
  2074. XMR_64B_OV = 1<<26, /* Bit 26: 64 Byte Rx Cnt Ov */
  2075. XMR_UTIL_OV = 1<<25, /* Bit 25: Rx Util Cnt Overflow */
  2076. XMR_UTIL_UR = 1<<24, /* Bit 24: Rx Util Cnt Underrun */
  2077. XMR_CEX_ERR_OV = 1<<23, /* Bit 23: CEXT Err Cnt Ov */
  2078. XMR_FCS_ERR_OV = 1<<21, /* Bit 21: Rx FCS Error Cnt Ov */
  2079. XMR_LNG_ERR_OV = 1<<20, /* Bit 20: Rx too Long Err Cnt Ov*/
  2080. XMR_RUNT_OV = 1<<19, /* Bit 19: Runt Event Cnt Ov */
  2081. XMR_SHT_ERR_OV = 1<<18, /* Bit 18: Rx Short Ev Err Cnt Ov*/
  2082. XMR_SYM_ERR_OV = 1<<17, /* Bit 17: Rx Sym Err Cnt Ov */
  2083. XMR_CAR_ERR_OV = 1<<15, /* Bit 15: Rx Carr Ev Err Cnt Ov */
  2084. XMR_JAB_PKT_OV = 1<<14, /* Bit 14: Rx Jabb Packet Cnt Ov */
  2085. XMR_FIFO_OV = 1<<13, /* Bit 13: Rx FIFO Ov Ev Cnt Ov */
  2086. XMR_FRA_ERR_OV = 1<<12, /* Bit 12: Rx Framing Err Cnt Ov */
  2087. XMR_FMISS_OV = 1<<11, /* Bit 11: Rx Missed Ev Cnt Ov */
  2088. XMR_BURST = 1<<10, /* Bit 10: Rx Burst Event Cnt Ov */
  2089. XMR_INV_MOC = 1<<9, /* Bit 9: Rx with inv. MAC OC Ov*/
  2090. XMR_INV_MP = 1<<8, /* Bit 8: Rx inv Pause Frame Ov */
  2091. XMR_MCTRL_OV = 1<<7, /* Bit 7: Rx MAC Ctrl-F Cnt Ov */
  2092. XMR_MPAUSE_OV = 1<<6, /* Bit 6: Rx Pause MAC Ctrl-F Ov*/
  2093. XMR_UC_OK_OV = 1<<5, /* Bit 5: Rx Unicast Frame CntOv*/
  2094. XMR_MC_OK_OV = 1<<4, /* Bit 4: Rx Multicast Cnt Ov */
  2095. XMR_BC_OK_OV = 1<<3, /* Bit 3: Rx Broadcast Cnt Ov */
  2096. XMR_OK_LO_OV = 1<<2, /* Bit 2: Octets Rx OK Low CntOv*/
  2097. XMR_OK_HI_OV = 1<<1, /* Bit 1: Octets Rx OK Hi Cnt Ov*/
  2098. XMR_OK_OV = 1<<0, /* Bit 0: Frames Received Ok Ov */
  2099. };
  2100. #define XMR_DEF_MSK (XMR_OK_LO_OV | XMR_OK_HI_OV)
  2101. /* XM_TX_CNT_EV 32 bit r/o Tx Counter Event Register */
  2102. /* XM_TX_EV_MSK 32 bit r/w Tx Counter Event Mask */
  2103. enum {
  2104. XMT_MAX_SZ_OV = 1<<25, /* Bit 25: 1024-MaxSize Tx Cnt Ov*/
  2105. XMT_1023B_OV = 1<<24, /* Bit 24: 512-1023Byte Tx Cnt Ov*/
  2106. XMT_511B_OV = 1<<23, /* Bit 23: 256-511 Byte Tx Cnt Ov*/
  2107. XMT_255B_OV = 1<<22, /* Bit 22: 128-255 Byte Tx Cnt Ov*/
  2108. XMT_127B_OV = 1<<21, /* Bit 21: 65-127 Byte Tx Cnt Ov */
  2109. XMT_64B_OV = 1<<20, /* Bit 20: 64 Byte Tx Cnt Ov */
  2110. XMT_UTIL_OV = 1<<19, /* Bit 19: Tx Util Cnt Overflow */
  2111. XMT_UTIL_UR = 1<<18, /* Bit 18: Tx Util Cnt Underrun */
  2112. XMT_CS_ERR_OV = 1<<17, /* Bit 17: Tx Carr Sen Err Cnt Ov*/
  2113. XMT_FIFO_UR_OV = 1<<16, /* Bit 16: Tx FIFO Ur Ev Cnt Ov */
  2114. XMT_EX_DEF_OV = 1<<15, /* Bit 15: Tx Ex Deferall Cnt Ov */
  2115. XMT_DEF = 1<<14, /* Bit 14: Tx Deferred Cnt Ov */
  2116. XMT_LAT_COL_OV = 1<<13, /* Bit 13: Tx Late Col Cnt Ov */
  2117. XMT_ABO_COL_OV = 1<<12, /* Bit 12: Tx abo dueto Ex Col Ov*/
  2118. XMT_MUL_COL_OV = 1<<11, /* Bit 11: Tx Mult Col Cnt Ov */
  2119. XMT_SNG_COL = 1<<10, /* Bit 10: Tx Single Col Cnt Ov */
  2120. XMT_MCTRL_OV = 1<<9, /* Bit 9: Tx MAC Ctrl Counter Ov*/
  2121. XMT_MPAUSE = 1<<8, /* Bit 8: Tx Pause MAC Ctrl-F Ov*/
  2122. XMT_BURST = 1<<7, /* Bit 7: Tx Burst Event Cnt Ov */
  2123. XMT_LONG = 1<<6, /* Bit 6: Tx Long Frame Cnt Ov */
  2124. XMT_UC_OK_OV = 1<<5, /* Bit 5: Tx Unicast Cnt Ov */
  2125. XMT_MC_OK_OV = 1<<4, /* Bit 4: Tx Multicast Cnt Ov */
  2126. XMT_BC_OK_OV = 1<<3, /* Bit 3: Tx Broadcast Cnt Ov */
  2127. XMT_OK_LO_OV = 1<<2, /* Bit 2: Octets Tx OK Low CntOv*/
  2128. XMT_OK_HI_OV = 1<<1, /* Bit 1: Octets Tx OK Hi Cnt Ov*/
  2129. XMT_OK_OV = 1<<0, /* Bit 0: Frames Tx Ok Ov */
  2130. };
  2131. #define XMT_DEF_MSK (XMT_OK_LO_OV | XMT_OK_HI_OV)
  2132. struct skge_rx_desc {
  2133. u32 control;
  2134. u32 next_offset;
  2135. u32 dma_lo;
  2136. u32 dma_hi;
  2137. u32 status;
  2138. u32 timestamp;
  2139. u16 csum2;
  2140. u16 csum1;
  2141. u16 csum2_start;
  2142. u16 csum1_start;
  2143. };
  2144. struct skge_tx_desc {
  2145. u32 control;
  2146. u32 next_offset;
  2147. u32 dma_lo;
  2148. u32 dma_hi;
  2149. u32 status;
  2150. u32 csum_offs;
  2151. u16 csum_write;
  2152. u16 csum_start;
  2153. u32 rsvd;
  2154. };
  2155. struct skge_element {
  2156. struct skge_element *next;
  2157. void *desc;
  2158. struct io_buffer *iob;
  2159. };
  2160. struct skge_ring {
  2161. struct skge_element *to_clean;
  2162. struct skge_element *to_use;
  2163. struct skge_element *start;
  2164. };
  2165. struct skge_hw {
  2166. unsigned long regs;
  2167. struct pci_device *pdev;
  2168. u32 intr_mask;
  2169. struct net_device *dev[2];
  2170. u8 chip_id;
  2171. u8 chip_rev;
  2172. u8 copper;
  2173. u8 ports;
  2174. u8 phy_type;
  2175. u32 ram_size;
  2176. u32 ram_offset;
  2177. u16 phy_addr;
  2178. };
  2179. enum pause_control {
  2180. FLOW_MODE_NONE = 1, /* No Flow-Control */
  2181. FLOW_MODE_LOC_SEND = 2, /* Local station sends PAUSE */
  2182. FLOW_MODE_SYMMETRIC = 3, /* Both stations may send PAUSE */
  2183. FLOW_MODE_SYM_OR_REM = 4, /* Both stations may send PAUSE or
  2184. * just the remote station may send PAUSE
  2185. */
  2186. };
  2187. enum pause_status {
  2188. FLOW_STAT_INDETERMINATED=0, /* indeterminated */
  2189. FLOW_STAT_NONE, /* No Flow Control */
  2190. FLOW_STAT_REM_SEND, /* Remote Station sends PAUSE */
  2191. FLOW_STAT_LOC_SEND, /* Local station sends PAUSE */
  2192. FLOW_STAT_SYMMETRIC, /* Both station may send PAUSE */
  2193. };
  2194. struct skge_port {
  2195. struct skge_hw *hw;
  2196. struct net_device *netdev;
  2197. int port;
  2198. struct skge_ring tx_ring;
  2199. struct skge_ring rx_ring;
  2200. enum pause_control flow_control;
  2201. enum pause_status flow_status;
  2202. u8 autoneg; /* AUTONEG_ENABLE, AUTONEG_DISABLE */
  2203. u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */
  2204. u16 speed; /* SPEED_1000, SPEED_100, ... */
  2205. u32 advertising;
  2206. void *mem; /* PCI memory for rings */
  2207. u32 dma;
  2208. int use_xm_link_timer;
  2209. };
  2210. /* Register accessor for memory mapped device */
  2211. static inline u32 skge_read32(const struct skge_hw *hw, int reg)
  2212. {
  2213. return readl(hw->regs + reg);
  2214. }
  2215. static inline u16 skge_read16(const struct skge_hw *hw, int reg)
  2216. {
  2217. return readw(hw->regs + reg);
  2218. }
  2219. static inline u8 skge_read8(const struct skge_hw *hw, int reg)
  2220. {
  2221. return readb(hw->regs + reg);
  2222. }
  2223. static inline void skge_write32(const struct skge_hw *hw, int reg, u32 val)
  2224. {
  2225. writel(val, hw->regs + reg);
  2226. }
  2227. static inline void skge_write16(const struct skge_hw *hw, int reg, u16 val)
  2228. {
  2229. writew(val, hw->regs + reg);
  2230. }
  2231. static inline void skge_write8(const struct skge_hw *hw, int reg, u8 val)
  2232. {
  2233. writeb(val, hw->regs + reg);
  2234. }
  2235. /* MAC Related Registers inside the device. */
  2236. #define SK_REG(port,reg) (((port)<<7)+(u16)(reg))
  2237. #define SK_XMAC_REG(port, reg) \
  2238. ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1)
  2239. static inline u32 xm_read32(const struct skge_hw *hw, int port, int reg)
  2240. {
  2241. u32 v;
  2242. v = skge_read16(hw, SK_XMAC_REG(port, reg));
  2243. v |= (u32)skge_read16(hw, SK_XMAC_REG(port, reg+2)) << 16;
  2244. return v;
  2245. }
  2246. static inline u16 xm_read16(const struct skge_hw *hw, int port, int reg)
  2247. {
  2248. return skge_read16(hw, SK_XMAC_REG(port,reg));
  2249. }
  2250. static inline void xm_write32(const struct skge_hw *hw, int port, int r, u32 v)
  2251. {
  2252. skge_write16(hw, SK_XMAC_REG(port,r), v & 0xffff);
  2253. skge_write16(hw, SK_XMAC_REG(port,r+2), v >> 16);
  2254. }
  2255. static inline void xm_write16(const struct skge_hw *hw, int port, int r, u16 v)
  2256. {
  2257. skge_write16(hw, SK_XMAC_REG(port,r), v);
  2258. }
  2259. static inline void xm_outhash(const struct skge_hw *hw, int port, int reg,
  2260. const u8 *hash)
  2261. {
  2262. xm_write16(hw, port, reg, (u16)hash[0] | ((u16)hash[1] << 8));
  2263. xm_write16(hw, port, reg+2, (u16)hash[2] | ((u16)hash[3] << 8));
  2264. xm_write16(hw, port, reg+4, (u16)hash[4] | ((u16)hash[5] << 8));
  2265. xm_write16(hw, port, reg+6, (u16)hash[6] | ((u16)hash[7] << 8));
  2266. }
  2267. static inline void xm_outaddr(const struct skge_hw *hw, int port, int reg,
  2268. const u8 *addr)
  2269. {
  2270. xm_write16(hw, port, reg, (u16)addr[0] | ((u16)addr[1] << 8));
  2271. xm_write16(hw, port, reg+2, (u16)addr[2] | ((u16)addr[3] << 8));
  2272. xm_write16(hw, port, reg+4, (u16)addr[4] | ((u16)addr[5] << 8));
  2273. }
  2274. #define SK_GMAC_REG(port,reg) \
  2275. (BASE_GMAC_1 + (port) * (BASE_GMAC_2-BASE_GMAC_1) + (reg))
  2276. static inline u16 gma_read16(const struct skge_hw *hw, int port, int reg)
  2277. {
  2278. return skge_read16(hw, SK_GMAC_REG(port,reg));
  2279. }
  2280. static inline u32 gma_read32(const struct skge_hw *hw, int port, int reg)
  2281. {
  2282. return (u32) skge_read16(hw, SK_GMAC_REG(port,reg))
  2283. | ((u32)skge_read16(hw, SK_GMAC_REG(port,reg+4)) << 16);
  2284. }
  2285. static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
  2286. {
  2287. skge_write16(hw, SK_GMAC_REG(port,r), v);
  2288. }
  2289. static inline void gma_set_addr(struct skge_hw *hw, int port, int reg,
  2290. const u8 *addr)
  2291. {
  2292. gma_write16(hw, port, reg, (u16) addr[0] | ((u16) addr[1] << 8));
  2293. gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
  2294. gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
  2295. }
  2296. #endif