et131x.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434
  1. /* Copyright © 2005 Agere Systems Inc.
  2. * All rights reserved.
  3. * http://www.agere.com
  4. *
  5. * SOFTWARE LICENSE
  6. *
  7. * This software is provided subject to the following terms and conditions,
  8. * which you should read carefully before using the software. Using this
  9. * software indicates your acceptance of these terms and conditions. If you do
  10. * not agree with these terms and conditions, do not use the software.
  11. *
  12. * Copyright © 2005 Agere Systems Inc.
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source or binary forms, with or without
  16. * modifications, are permitted provided that the following conditions are met:
  17. *
  18. * . Redistributions of source code must retain the above copyright notice, this
  19. * list of conditions and the following Disclaimer as comments in the code as
  20. * well as in the documentation and/or other materials provided with the
  21. * distribution.
  22. *
  23. * . Redistributions in binary form must reproduce the above copyright notice,
  24. * this list of conditions and the following Disclaimer in the documentation
  25. * and/or other materials provided with the distribution.
  26. *
  27. * . Neither the name of Agere Systems Inc. nor the names of the contributors
  28. * may be used to endorse or promote products derived from this software
  29. * without specific prior written permission.
  30. *
  31. * Disclaimer
  32. *
  33. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  34. * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  35. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
  36. * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
  37. * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
  38. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  39. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  40. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  41. * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
  42. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  43. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  44. * DAMAGE.
  45. *
  46. */
  47. #define DRIVER_NAME "et131x"
  48. #define DRIVER_VERSION "v2.0"
  49. /* EEPROM registers */
  50. /* LBCIF Register Groups (addressed via 32-bit offsets) */
  51. #define LBCIF_DWORD0_GROUP 0xAC
  52. #define LBCIF_DWORD1_GROUP 0xB0
  53. /* LBCIF Registers (addressed via 8-bit offsets) */
  54. #define LBCIF_ADDRESS_REGISTER 0xAC
  55. #define LBCIF_DATA_REGISTER 0xB0
  56. #define LBCIF_CONTROL_REGISTER 0xB1
  57. #define LBCIF_STATUS_REGISTER 0xB2
  58. /* LBCIF Control Register Bits */
  59. #define LBCIF_CONTROL_SEQUENTIAL_READ 0x01
  60. #define LBCIF_CONTROL_PAGE_WRITE 0x02
  61. #define LBCIF_CONTROL_EEPROM_RELOAD 0x08
  62. #define LBCIF_CONTROL_TWO_BYTE_ADDR 0x20
  63. #define LBCIF_CONTROL_I2C_WRITE 0x40
  64. #define LBCIF_CONTROL_LBCIF_ENABLE 0x80
  65. /* LBCIF Status Register Bits */
  66. #define LBCIF_STATUS_PHY_QUEUE_AVAIL 0x01
  67. #define LBCIF_STATUS_I2C_IDLE 0x02
  68. #define LBCIF_STATUS_ACK_ERROR 0x04
  69. #define LBCIF_STATUS_GENERAL_ERROR 0x08
  70. #define LBCIF_STATUS_CHECKSUM_ERROR 0x40
  71. #define LBCIF_STATUS_EEPROM_PRESENT 0x80
  72. /* START OF GLOBAL REGISTER ADDRESS MAP */
  73. /* 10bit registers
  74. *
  75. * Tx queue start address reg in global address map at address 0x0000
  76. * tx queue end address reg in global address map at address 0x0004
  77. * rx queue start address reg in global address map at address 0x0008
  78. * rx queue end address reg in global address map at address 0x000C
  79. */
  80. /* structure for power management control status reg in global address map
  81. * located at address 0x0010
  82. * jagcore_rx_rdy bit 9
  83. * jagcore_tx_rdy bit 8
  84. * phy_lped_en bit 7
  85. * phy_sw_coma bit 6
  86. * rxclk_gate bit 5
  87. * txclk_gate bit 4
  88. * sysclk_gate bit 3
  89. * jagcore_rx_en bit 2
  90. * jagcore_tx_en bit 1
  91. * gigephy_en bit 0
  92. */
  93. #define ET_PM_PHY_SW_COMA 0x40
  94. #define ET_PMCSR_INIT 0x38
  95. /* Interrupt status reg at address 0x0018
  96. */
  97. #define ET_INTR_TXDMA_ISR 0x00000008
  98. #define ET_INTR_TXDMA_ERR 0x00000010
  99. #define ET_INTR_RXDMA_XFR_DONE 0x00000020
  100. #define ET_INTR_RXDMA_FB_R0_LOW 0x00000040
  101. #define ET_INTR_RXDMA_FB_R1_LOW 0x00000080
  102. #define ET_INTR_RXDMA_STAT_LOW 0x00000100
  103. #define ET_INTR_RXDMA_ERR 0x00000200
  104. #define ET_INTR_WATCHDOG 0x00004000
  105. #define ET_INTR_WOL 0x00008000
  106. #define ET_INTR_PHY 0x00010000
  107. #define ET_INTR_TXMAC 0x00020000
  108. #define ET_INTR_RXMAC 0x00040000
  109. #define ET_INTR_MAC_STAT 0x00080000
  110. #define ET_INTR_SLV_TIMEOUT 0x00100000
  111. /* Interrupt mask register at address 0x001C
  112. * Interrupt alias clear mask reg at address 0x0020
  113. * Interrupt status alias reg at address 0x0024
  114. *
  115. * Same masks as above
  116. */
  117. /* Software reset reg at address 0x0028
  118. * 0: txdma_sw_reset
  119. * 1: rxdma_sw_reset
  120. * 2: txmac_sw_reset
  121. * 3: rxmac_sw_reset
  122. * 4: mac_sw_reset
  123. * 5: mac_stat_sw_reset
  124. * 6: mmc_sw_reset
  125. *31: selfclr_disable
  126. */
  127. #define ET_RESET_ALL 0x007F
  128. /* SLV Timer reg at address 0x002C (low 24 bits)
  129. */
  130. /* MSI Configuration reg at address 0x0030
  131. */
  132. #define ET_MSI_VECTOR 0x0000001F
  133. #define ET_MSI_TC 0x00070000
  134. /* Loopback reg located at address 0x0034
  135. */
  136. #define ET_LOOP_MAC 0x00000001
  137. #define ET_LOOP_DMA 0x00000002
  138. /* GLOBAL Module of JAGCore Address Mapping
  139. * Located at address 0x0000
  140. */
  141. struct global_regs { /* Location: */
  142. u32 txq_start_addr; /* 0x0000 */
  143. u32 txq_end_addr; /* 0x0004 */
  144. u32 rxq_start_addr; /* 0x0008 */
  145. u32 rxq_end_addr; /* 0x000C */
  146. u32 pm_csr; /* 0x0010 */
  147. u32 unused; /* 0x0014 */
  148. u32 int_status; /* 0x0018 */
  149. u32 int_mask; /* 0x001C */
  150. u32 int_alias_clr_en; /* 0x0020 */
  151. u32 int_status_alias; /* 0x0024 */
  152. u32 sw_reset; /* 0x0028 */
  153. u32 slv_timer; /* 0x002C */
  154. u32 msi_config; /* 0x0030 */
  155. u32 loopback; /* 0x0034 */
  156. u32 watchdog_timer; /* 0x0038 */
  157. };
  158. /* START OF TXDMA REGISTER ADDRESS MAP */
  159. /* txdma control status reg at address 0x1000
  160. */
  161. #define ET_TXDMA_CSR_HALT 0x00000001
  162. #define ET_TXDMA_DROP_TLP 0x00000002
  163. #define ET_TXDMA_CACHE_THRS 0x000000F0
  164. #define ET_TXDMA_CACHE_SHIFT 4
  165. #define ET_TXDMA_SNGL_EPKT 0x00000100
  166. #define ET_TXDMA_CLASS 0x00001E00
  167. /* structure for txdma packet ring base address hi reg in txdma address map
  168. * located at address 0x1004
  169. * Defined earlier (u32)
  170. */
  171. /* structure for txdma packet ring base address low reg in txdma address map
  172. * located at address 0x1008
  173. * Defined earlier (u32)
  174. */
  175. /* structure for txdma packet ring number of descriptor reg in txdma address
  176. * map. Located at address 0x100C
  177. *
  178. * 31-10: unused
  179. * 9-0: pr ndes
  180. */
  181. #define ET_DMA12_MASK 0x0FFF /* 12 bit mask for DMA12W types */
  182. #define ET_DMA12_WRAP 0x1000
  183. #define ET_DMA10_MASK 0x03FF /* 10 bit mask for DMA10W types */
  184. #define ET_DMA10_WRAP 0x0400
  185. #define ET_DMA4_MASK 0x000F /* 4 bit mask for DMA4W types */
  186. #define ET_DMA4_WRAP 0x0010
  187. #define INDEX12(x) ((x) & ET_DMA12_MASK)
  188. #define INDEX10(x) ((x) & ET_DMA10_MASK)
  189. #define INDEX4(x) ((x) & ET_DMA4_MASK)
  190. /* 10bit DMA with wrap
  191. * txdma tx queue write address reg in txdma address map at 0x1010
  192. * txdma tx queue write address external reg in txdma address map at 0x1014
  193. * txdma tx queue read address reg in txdma address map at 0x1018
  194. *
  195. * u32
  196. * txdma status writeback address hi reg in txdma address map at0x101C
  197. * txdma status writeback address lo reg in txdma address map at 0x1020
  198. *
  199. * 10bit DMA with wrap
  200. * txdma service request reg in txdma address map at 0x1024
  201. * structure for txdma service complete reg in txdma address map at 0x1028
  202. *
  203. * 4bit DMA with wrap
  204. * txdma tx descriptor cache read index reg in txdma address map at 0x102C
  205. * txdma tx descriptor cache write index reg in txdma address map at 0x1030
  206. *
  207. * txdma error reg in txdma address map at address 0x1034
  208. * 0: PyldResend
  209. * 1: PyldRewind
  210. * 4: DescrResend
  211. * 5: DescrRewind
  212. * 8: WrbkResend
  213. * 9: WrbkRewind
  214. */
  215. /* Tx DMA Module of JAGCore Address Mapping
  216. * Located at address 0x1000
  217. */
  218. struct txdma_regs { /* Location: */
  219. u32 csr; /* 0x1000 */
  220. u32 pr_base_hi; /* 0x1004 */
  221. u32 pr_base_lo; /* 0x1008 */
  222. u32 pr_num_des; /* 0x100C */
  223. u32 txq_wr_addr; /* 0x1010 */
  224. u32 txq_wr_addr_ext; /* 0x1014 */
  225. u32 txq_rd_addr; /* 0x1018 */
  226. u32 dma_wb_base_hi; /* 0x101C */
  227. u32 dma_wb_base_lo; /* 0x1020 */
  228. u32 service_request; /* 0x1024 */
  229. u32 service_complete; /* 0x1028 */
  230. u32 cache_rd_index; /* 0x102C */
  231. u32 cache_wr_index; /* 0x1030 */
  232. u32 tx_dma_error; /* 0x1034 */
  233. u32 desc_abort_cnt; /* 0x1038 */
  234. u32 payload_abort_cnt; /* 0x103c */
  235. u32 writeback_abort_cnt; /* 0x1040 */
  236. u32 desc_timeout_cnt; /* 0x1044 */
  237. u32 payload_timeout_cnt; /* 0x1048 */
  238. u32 writeback_timeout_cnt; /* 0x104c */
  239. u32 desc_error_cnt; /* 0x1050 */
  240. u32 payload_error_cnt; /* 0x1054 */
  241. u32 writeback_error_cnt; /* 0x1058 */
  242. u32 dropped_tlp_cnt; /* 0x105c */
  243. u32 new_service_complete; /* 0x1060 */
  244. u32 ethernet_packet_cnt; /* 0x1064 */
  245. };
  246. /* END OF TXDMA REGISTER ADDRESS MAP */
  247. /* START OF RXDMA REGISTER ADDRESS MAP */
  248. /* structure for control status reg in rxdma address map
  249. * Located at address 0x2000
  250. *
  251. * CSR
  252. * 0: halt
  253. * 1-3: tc
  254. * 4: fbr_big_endian
  255. * 5: psr_big_endian
  256. * 6: pkt_big_endian
  257. * 7: dma_big_endian
  258. * 8-9: fbr0_size
  259. * 10: fbr0_enable
  260. * 11-12: fbr1_size
  261. * 13: fbr1_enable
  262. * 14: unused
  263. * 15: pkt_drop_disable
  264. * 16: pkt_done_flush
  265. * 17: halt_status
  266. * 18-31: unused
  267. */
  268. #define ET_RXDMA_CSR_HALT 0x0001
  269. #define ET_RXDMA_CSR_FBR0_SIZE_LO 0x0100
  270. #define ET_RXDMA_CSR_FBR0_SIZE_HI 0x0200
  271. #define ET_RXDMA_CSR_FBR0_ENABLE 0x0400
  272. #define ET_RXDMA_CSR_FBR1_SIZE_LO 0x0800
  273. #define ET_RXDMA_CSR_FBR1_SIZE_HI 0x1000
  274. #define ET_RXDMA_CSR_FBR1_ENABLE 0x2000
  275. #define ET_RXDMA_CSR_HALT_STATUS 0x00020000
  276. /* structure for dma writeback lo reg in rxdma address map
  277. * located at address 0x2004
  278. * Defined earlier (u32)
  279. */
  280. /* structure for dma writeback hi reg in rxdma address map
  281. * located at address 0x2008
  282. * Defined earlier (u32)
  283. */
  284. /* structure for number of packets done reg in rxdma address map
  285. * located at address 0x200C
  286. *
  287. * 31-8: unused
  288. * 7-0: num done
  289. */
  290. /* structure for max packet time reg in rxdma address map
  291. * located at address 0x2010
  292. *
  293. * 31-18: unused
  294. * 17-0: time done
  295. */
  296. /* structure for rx queue read address reg in rxdma address map
  297. * located at address 0x2014
  298. * Defined earlier (u32)
  299. */
  300. /* structure for rx queue read address external reg in rxdma address map
  301. * located at address 0x2018
  302. * Defined earlier (u32)
  303. */
  304. /* structure for rx queue write address reg in rxdma address map
  305. * located at address 0x201C
  306. * Defined earlier (u32)
  307. */
  308. /* structure for packet status ring base address lo reg in rxdma address map
  309. * located at address 0x2020
  310. * Defined earlier (u32)
  311. */
  312. /* structure for packet status ring base address hi reg in rxdma address map
  313. * located at address 0x2024
  314. * Defined earlier (u32)
  315. */
  316. /* structure for packet status ring number of descriptors reg in rxdma address
  317. * map. Located at address 0x2028
  318. *
  319. * 31-12: unused
  320. * 11-0: psr ndes
  321. */
  322. #define ET_RXDMA_PSR_NUM_DES_MASK 0xFFF
  323. /* structure for packet status ring available offset reg in rxdma address map
  324. * located at address 0x202C
  325. *
  326. * 31-13: unused
  327. * 12: psr avail wrap
  328. * 11-0: psr avail
  329. */
  330. /* structure for packet status ring full offset reg in rxdma address map
  331. * located at address 0x2030
  332. *
  333. * 31-13: unused
  334. * 12: psr full wrap
  335. * 11-0: psr full
  336. */
  337. /* structure for packet status ring access index reg in rxdma address map
  338. * located at address 0x2034
  339. *
  340. * 31-5: unused
  341. * 4-0: psr_ai
  342. */
  343. /* structure for packet status ring minimum descriptors reg in rxdma address
  344. * map. Located at address 0x2038
  345. *
  346. * 31-12: unused
  347. * 11-0: psr_min
  348. */
  349. /* structure for free buffer ring base lo address reg in rxdma address map
  350. * located at address 0x203C
  351. * Defined earlier (u32)
  352. */
  353. /* structure for free buffer ring base hi address reg in rxdma address map
  354. * located at address 0x2040
  355. * Defined earlier (u32)
  356. */
  357. /* structure for free buffer ring number of descriptors reg in rxdma address
  358. * map. Located at address 0x2044
  359. *
  360. * 31-10: unused
  361. * 9-0: fbr ndesc
  362. */
  363. /* structure for free buffer ring 0 available offset reg in rxdma address map
  364. * located at address 0x2048
  365. * Defined earlier (u32)
  366. */
  367. /* structure for free buffer ring 0 full offset reg in rxdma address map
  368. * located at address 0x204C
  369. * Defined earlier (u32)
  370. */
  371. /* structure for free buffer cache 0 full offset reg in rxdma address map
  372. * located at address 0x2050
  373. *
  374. * 31-5: unused
  375. * 4-0: fbc rdi
  376. */
  377. /* structure for free buffer ring 0 minimum descriptor reg in rxdma address map
  378. * located at address 0x2054
  379. *
  380. * 31-10: unused
  381. * 9-0: fbr min
  382. */
  383. /* structure for free buffer ring 1 base address lo reg in rxdma address map
  384. * located at address 0x2058 - 0x205C
  385. * Defined earlier (RXDMA_FBR_BASE_LO_t and RXDMA_FBR_BASE_HI_t)
  386. */
  387. /* structure for free buffer ring 1 number of descriptors reg in rxdma address
  388. * map. Located at address 0x2060
  389. * Defined earlier (RXDMA_FBR_NUM_DES_t)
  390. */
  391. /* structure for free buffer ring 1 available offset reg in rxdma address map
  392. * located at address 0x2064
  393. * Defined Earlier (RXDMA_FBR_AVAIL_OFFSET_t)
  394. */
  395. /* structure for free buffer ring 1 full offset reg in rxdma address map
  396. * located at address 0x2068
  397. * Defined Earlier (RXDMA_FBR_FULL_OFFSET_t)
  398. */
  399. /* structure for free buffer cache 1 read index reg in rxdma address map
  400. * located at address 0x206C
  401. * Defined Earlier (RXDMA_FBC_RD_INDEX_t)
  402. */
  403. /* structure for free buffer ring 1 minimum descriptor reg in rxdma address map
  404. * located at address 0x2070
  405. * Defined Earlier (RXDMA_FBR_MIN_DES_t)
  406. */
  407. /* Rx DMA Module of JAGCore Address Mapping
  408. * Located at address 0x2000
  409. */
  410. struct rxdma_regs { /* Location: */
  411. u32 csr; /* 0x2000 */
  412. u32 dma_wb_base_lo; /* 0x2004 */
  413. u32 dma_wb_base_hi; /* 0x2008 */
  414. u32 num_pkt_done; /* 0x200C */
  415. u32 max_pkt_time; /* 0x2010 */
  416. u32 rxq_rd_addr; /* 0x2014 */
  417. u32 rxq_rd_addr_ext; /* 0x2018 */
  418. u32 rxq_wr_addr; /* 0x201C */
  419. u32 psr_base_lo; /* 0x2020 */
  420. u32 psr_base_hi; /* 0x2024 */
  421. u32 psr_num_des; /* 0x2028 */
  422. u32 psr_avail_offset; /* 0x202C */
  423. u32 psr_full_offset; /* 0x2030 */
  424. u32 psr_access_index; /* 0x2034 */
  425. u32 psr_min_des; /* 0x2038 */
  426. u32 fbr0_base_lo; /* 0x203C */
  427. u32 fbr0_base_hi; /* 0x2040 */
  428. u32 fbr0_num_des; /* 0x2044 */
  429. u32 fbr0_avail_offset; /* 0x2048 */
  430. u32 fbr0_full_offset; /* 0x204C */
  431. u32 fbr0_rd_index; /* 0x2050 */
  432. u32 fbr0_min_des; /* 0x2054 */
  433. u32 fbr1_base_lo; /* 0x2058 */
  434. u32 fbr1_base_hi; /* 0x205C */
  435. u32 fbr1_num_des; /* 0x2060 */
  436. u32 fbr1_avail_offset; /* 0x2064 */
  437. u32 fbr1_full_offset; /* 0x2068 */
  438. u32 fbr1_rd_index; /* 0x206C */
  439. u32 fbr1_min_des; /* 0x2070 */
  440. };
  441. /* END OF RXDMA REGISTER ADDRESS MAP */
  442. /* START OF TXMAC REGISTER ADDRESS MAP */
  443. /* structure for control reg in txmac address map
  444. * located at address 0x3000
  445. *
  446. * bits
  447. * 31-8: unused
  448. * 7: cklseg_disable
  449. * 6: ckbcnt_disable
  450. * 5: cksegnum
  451. * 4: async_disable
  452. * 3: fc_disable
  453. * 2: mcif_disable
  454. * 1: mif_disable
  455. * 0: txmac_en
  456. */
  457. #define ET_TX_CTRL_FC_DISABLE 0x0008
  458. #define ET_TX_CTRL_TXMAC_ENABLE 0x0001
  459. /* structure for shadow pointer reg in txmac address map
  460. * located at address 0x3004
  461. * 31-27: reserved
  462. * 26-16: txq rd ptr
  463. * 15-11: reserved
  464. * 10-0: txq wr ptr
  465. */
  466. /* structure for error count reg in txmac address map
  467. * located at address 0x3008
  468. *
  469. * 31-12: unused
  470. * 11-8: reserved
  471. * 7-4: txq_underrun
  472. * 3-0: fifo_underrun
  473. */
  474. /* structure for max fill reg in txmac address map
  475. * located at address 0x300C
  476. * 31-12: unused
  477. * 11-0: max fill
  478. */
  479. /* structure for cf parameter reg in txmac address map
  480. * located at address 0x3010
  481. * 31-16: cfep
  482. * 15-0: cfpt
  483. */
  484. /* structure for tx test reg in txmac address map
  485. * located at address 0x3014
  486. * 31-17: unused
  487. * 16: reserved
  488. * 15: txtest_en
  489. * 14-11: unused
  490. * 10-0: txq test pointer
  491. */
  492. /* structure for error reg in txmac address map
  493. * located at address 0x3018
  494. *
  495. * 31-9: unused
  496. * 8: fifo_underrun
  497. * 7-6: unused
  498. * 5: ctrl2_err
  499. * 4: txq_underrun
  500. * 3: bcnt_err
  501. * 2: lseg_err
  502. * 1: segnum_err
  503. * 0: seg0_err
  504. */
  505. /* structure for error interrupt reg in txmac address map
  506. * located at address 0x301C
  507. *
  508. * 31-9: unused
  509. * 8: fifo_underrun
  510. * 7-6: unused
  511. * 5: ctrl2_err
  512. * 4: txq_underrun
  513. * 3: bcnt_err
  514. * 2: lseg_err
  515. * 1: segnum_err
  516. * 0: seg0_err
  517. */
  518. /* structure for error interrupt reg in txmac address map
  519. * located at address 0x3020
  520. *
  521. * 31-2: unused
  522. * 1: bp_req
  523. * 0: bp_xonxoff
  524. */
  525. /* Tx MAC Module of JAGCore Address Mapping
  526. */
  527. struct txmac_regs { /* Location: */
  528. u32 ctl; /* 0x3000 */
  529. u32 shadow_ptr; /* 0x3004 */
  530. u32 err_cnt; /* 0x3008 */
  531. u32 max_fill; /* 0x300C */
  532. u32 cf_param; /* 0x3010 */
  533. u32 tx_test; /* 0x3014 */
  534. u32 err; /* 0x3018 */
  535. u32 err_int; /* 0x301C */
  536. u32 bp_ctrl; /* 0x3020 */
  537. };
  538. /* END OF TXMAC REGISTER ADDRESS MAP */
  539. /* START OF RXMAC REGISTER ADDRESS MAP */
  540. /* structure for rxmac control reg in rxmac address map
  541. * located at address 0x4000
  542. *
  543. * 31-7: reserved
  544. * 6: rxmac_int_disable
  545. * 5: async_disable
  546. * 4: mif_disable
  547. * 3: wol_disable
  548. * 2: pkt_filter_disable
  549. * 1: mcif_disable
  550. * 0: rxmac_en
  551. */
  552. #define ET_RX_CTRL_WOL_DISABLE 0x0008
  553. #define ET_RX_CTRL_RXMAC_ENABLE 0x0001
  554. /* structure for Wake On Lan Control and CRC 0 reg in rxmac address map
  555. * located at address 0x4004
  556. * 31-16: crc
  557. * 15-12: reserved
  558. * 11: ignore_pp
  559. * 10: ignore_mp
  560. * 9: clr_intr
  561. * 8: ignore_link_chg
  562. * 7: ignore_uni
  563. * 6: ignore_multi
  564. * 5: ignore_broad
  565. * 4-0: valid_crc 4-0
  566. */
  567. /* structure for CRC 1 and CRC 2 reg in rxmac address map
  568. * located at address 0x4008
  569. *
  570. * 31-16: crc2
  571. * 15-0: crc1
  572. */
  573. /* structure for CRC 3 and CRC 4 reg in rxmac address map
  574. * located at address 0x400C
  575. *
  576. * 31-16: crc4
  577. * 15-0: crc3
  578. */
  579. /* structure for Wake On Lan Source Address Lo reg in rxmac address map
  580. * located at address 0x4010
  581. *
  582. * 31-24: sa3
  583. * 23-16: sa4
  584. * 15-8: sa5
  585. * 7-0: sa6
  586. */
  587. #define ET_RX_WOL_LO_SA3_SHIFT 24
  588. #define ET_RX_WOL_LO_SA4_SHIFT 16
  589. #define ET_RX_WOL_LO_SA5_SHIFT 8
  590. /* structure for Wake On Lan Source Address Hi reg in rxmac address map
  591. * located at address 0x4014
  592. *
  593. * 31-16: reserved
  594. * 15-8: sa1
  595. * 7-0: sa2
  596. */
  597. #define ET_RX_WOL_HI_SA1_SHIFT 8
  598. /* structure for Wake On Lan mask reg in rxmac address map
  599. * located at address 0x4018 - 0x4064
  600. * Defined earlier (u32)
  601. */
  602. /* structure for Unicast Packet Filter Address 1 reg in rxmac address map
  603. * located at address 0x4068
  604. *
  605. * 31-24: addr1_3
  606. * 23-16: addr1_4
  607. * 15-8: addr1_5
  608. * 7-0: addr1_6
  609. */
  610. #define ET_RX_UNI_PF_ADDR1_3_SHIFT 24
  611. #define ET_RX_UNI_PF_ADDR1_4_SHIFT 16
  612. #define ET_RX_UNI_PF_ADDR1_5_SHIFT 8
  613. /* structure for Unicast Packet Filter Address 2 reg in rxmac address map
  614. * located at address 0x406C
  615. *
  616. * 31-24: addr2_3
  617. * 23-16: addr2_4
  618. * 15-8: addr2_5
  619. * 7-0: addr2_6
  620. */
  621. #define ET_RX_UNI_PF_ADDR2_3_SHIFT 24
  622. #define ET_RX_UNI_PF_ADDR2_4_SHIFT 16
  623. #define ET_RX_UNI_PF_ADDR2_5_SHIFT 8
  624. /* structure for Unicast Packet Filter Address 1 & 2 reg in rxmac address map
  625. * located at address 0x4070
  626. *
  627. * 31-24: addr2_1
  628. * 23-16: addr2_2
  629. * 15-8: addr1_1
  630. * 7-0: addr1_2
  631. */
  632. #define ET_RX_UNI_PF_ADDR2_1_SHIFT 24
  633. #define ET_RX_UNI_PF_ADDR2_2_SHIFT 16
  634. #define ET_RX_UNI_PF_ADDR1_1_SHIFT 8
  635. /* structure for Multicast Hash reg in rxmac address map
  636. * located at address 0x4074 - 0x4080
  637. * Defined earlier (u32)
  638. */
  639. /* structure for Packet Filter Control reg in rxmac address map
  640. * located at address 0x4084
  641. *
  642. * 31-23: unused
  643. * 22-16: min_pkt_size
  644. * 15-4: unused
  645. * 3: filter_frag_en
  646. * 2: filter_uni_en
  647. * 1: filter_multi_en
  648. * 0: filter_broad_en
  649. */
  650. #define ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT 16
  651. #define ET_RX_PFCTRL_FRAG_FILTER_ENABLE 0x0008
  652. #define ET_RX_PFCTRL_UNICST_FILTER_ENABLE 0x0004
  653. #define ET_RX_PFCTRL_MLTCST_FILTER_ENABLE 0x0002
  654. #define ET_RX_PFCTRL_BRDCST_FILTER_ENABLE 0x0001
  655. /* structure for Memory Controller Interface Control Max Segment reg in rxmac
  656. * address map. Located at address 0x4088
  657. *
  658. * 31-10: reserved
  659. * 9-2: max_size
  660. * 1: fc_en
  661. * 0: seg_en
  662. */
  663. #define ET_RX_MCIF_CTRL_MAX_SEG_SIZE_SHIFT 2
  664. #define ET_RX_MCIF_CTRL_MAX_SEG_FC_ENABLE 0x0002
  665. #define ET_RX_MCIF_CTRL_MAX_SEG_ENABLE 0x0001
  666. /* structure for Memory Controller Interface Water Mark reg in rxmac address
  667. * map. Located at address 0x408C
  668. *
  669. * 31-26: unused
  670. * 25-16: mark_hi
  671. * 15-10: unused
  672. * 9-0: mark_lo
  673. */
  674. /* structure for Rx Queue Dialog reg in rxmac address map.
  675. * located at address 0x4090
  676. *
  677. * 31-26: reserved
  678. * 25-16: rd_ptr
  679. * 15-10: reserved
  680. * 9-0: wr_ptr
  681. */
  682. /* structure for space available reg in rxmac address map.
  683. * located at address 0x4094
  684. *
  685. * 31-17: reserved
  686. * 16: space_avail_en
  687. * 15-10: reserved
  688. * 9-0: space_avail
  689. */
  690. /* structure for management interface reg in rxmac address map.
  691. * located at address 0x4098
  692. *
  693. * 31-18: reserved
  694. * 17: drop_pkt_en
  695. * 16-0: drop_pkt_mask
  696. */
  697. /* structure for Error reg in rxmac address map.
  698. * located at address 0x409C
  699. *
  700. * 31-4: unused
  701. * 3: mif
  702. * 2: async
  703. * 1: pkt_filter
  704. * 0: mcif
  705. */
  706. /* Rx MAC Module of JAGCore Address Mapping
  707. */
  708. struct rxmac_regs { /* Location: */
  709. u32 ctrl; /* 0x4000 */
  710. u32 crc0; /* 0x4004 */
  711. u32 crc12; /* 0x4008 */
  712. u32 crc34; /* 0x400C */
  713. u32 sa_lo; /* 0x4010 */
  714. u32 sa_hi; /* 0x4014 */
  715. u32 mask0_word0; /* 0x4018 */
  716. u32 mask0_word1; /* 0x401C */
  717. u32 mask0_word2; /* 0x4020 */
  718. u32 mask0_word3; /* 0x4024 */
  719. u32 mask1_word0; /* 0x4028 */
  720. u32 mask1_word1; /* 0x402C */
  721. u32 mask1_word2; /* 0x4030 */
  722. u32 mask1_word3; /* 0x4034 */
  723. u32 mask2_word0; /* 0x4038 */
  724. u32 mask2_word1; /* 0x403C */
  725. u32 mask2_word2; /* 0x4040 */
  726. u32 mask2_word3; /* 0x4044 */
  727. u32 mask3_word0; /* 0x4048 */
  728. u32 mask3_word1; /* 0x404C */
  729. u32 mask3_word2; /* 0x4050 */
  730. u32 mask3_word3; /* 0x4054 */
  731. u32 mask4_word0; /* 0x4058 */
  732. u32 mask4_word1; /* 0x405C */
  733. u32 mask4_word2; /* 0x4060 */
  734. u32 mask4_word3; /* 0x4064 */
  735. u32 uni_pf_addr1; /* 0x4068 */
  736. u32 uni_pf_addr2; /* 0x406C */
  737. u32 uni_pf_addr3; /* 0x4070 */
  738. u32 multi_hash1; /* 0x4074 */
  739. u32 multi_hash2; /* 0x4078 */
  740. u32 multi_hash3; /* 0x407C */
  741. u32 multi_hash4; /* 0x4080 */
  742. u32 pf_ctrl; /* 0x4084 */
  743. u32 mcif_ctrl_max_seg; /* 0x4088 */
  744. u32 mcif_water_mark; /* 0x408C */
  745. u32 rxq_diag; /* 0x4090 */
  746. u32 space_avail; /* 0x4094 */
  747. u32 mif_ctrl; /* 0x4098 */
  748. u32 err_reg; /* 0x409C */
  749. };
  750. /* END OF RXMAC REGISTER ADDRESS MAP */
  751. /* START OF MAC REGISTER ADDRESS MAP */
  752. /* structure for configuration #1 reg in mac address map.
  753. * located at address 0x5000
  754. *
  755. * 31: soft reset
  756. * 30: sim reset
  757. * 29-20: reserved
  758. * 19: reset rx mc
  759. * 18: reset tx mc
  760. * 17: reset rx func
  761. * 16: reset tx fnc
  762. * 15-9: reserved
  763. * 8: loopback
  764. * 7-6: reserved
  765. * 5: rx flow
  766. * 4: tx flow
  767. * 3: syncd rx en
  768. * 2: rx enable
  769. * 1: syncd tx en
  770. * 0: tx enable
  771. */
  772. #define ET_MAC_CFG1_SOFT_RESET 0x80000000
  773. #define ET_MAC_CFG1_SIM_RESET 0x40000000
  774. #define ET_MAC_CFG1_RESET_RXMC 0x00080000
  775. #define ET_MAC_CFG1_RESET_TXMC 0x00040000
  776. #define ET_MAC_CFG1_RESET_RXFUNC 0x00020000
  777. #define ET_MAC_CFG1_RESET_TXFUNC 0x00010000
  778. #define ET_MAC_CFG1_LOOPBACK 0x00000100
  779. #define ET_MAC_CFG1_RX_FLOW 0x00000020
  780. #define ET_MAC_CFG1_TX_FLOW 0x00000010
  781. #define ET_MAC_CFG1_RX_ENABLE 0x00000004
  782. #define ET_MAC_CFG1_TX_ENABLE 0x00000001
  783. #define ET_MAC_CFG1_WAIT 0x0000000A /* RX & TX syncd */
  784. /* structure for configuration #2 reg in mac address map.
  785. * located at address 0x5004
  786. * 31-16: reserved
  787. * 15-12: preamble
  788. * 11-10: reserved
  789. * 9-8: if mode
  790. * 7-6: reserved
  791. * 5: huge frame
  792. * 4: length check
  793. * 3: undefined
  794. * 2: pad crc
  795. * 1: crc enable
  796. * 0: full duplex
  797. */
  798. #define ET_MAC_CFG2_PREAMBLE_SHIFT 12
  799. #define ET_MAC_CFG2_IFMODE_MASK 0x0300
  800. #define ET_MAC_CFG2_IFMODE_1000 0x0200
  801. #define ET_MAC_CFG2_IFMODE_100 0x0100
  802. #define ET_MAC_CFG2_IFMODE_HUGE_FRAME 0x0020
  803. #define ET_MAC_CFG2_IFMODE_LEN_CHECK 0x0010
  804. #define ET_MAC_CFG2_IFMODE_PAD_CRC 0x0004
  805. #define ET_MAC_CFG2_IFMODE_CRC_ENABLE 0x0002
  806. #define ET_MAC_CFG2_IFMODE_FULL_DPLX 0x0001
  807. /* structure for Interpacket gap reg in mac address map.
  808. * located at address 0x5008
  809. *
  810. * 31: reserved
  811. * 30-24: non B2B ipg 1
  812. * 23: undefined
  813. * 22-16: non B2B ipg 2
  814. * 15-8: Min ifg enforce
  815. * 7-0: B2B ipg
  816. *
  817. * structure for half duplex reg in mac address map.
  818. * located at address 0x500C
  819. * 31-24: reserved
  820. * 23-20: Alt BEB trunc
  821. * 19: Alt BEB enable
  822. * 18: BP no backoff
  823. * 17: no backoff
  824. * 16: excess defer
  825. * 15-12: re-xmit max
  826. * 11-10: reserved
  827. * 9-0: collision window
  828. */
  829. /* structure for Maximum Frame Length reg in mac address map.
  830. * located at address 0x5010: bits 0-15 hold the length.
  831. */
  832. /* structure for Reserve 1 reg in mac address map.
  833. * located at address 0x5014 - 0x5018
  834. * Defined earlier (u32)
  835. */
  836. /* structure for Test reg in mac address map.
  837. * located at address 0x501C
  838. * test: bits 0-2, rest unused
  839. */
  840. /* structure for MII Management Configuration reg in mac address map.
  841. * located at address 0x5020
  842. *
  843. * 31: reset MII mgmt
  844. * 30-6: unused
  845. * 5: scan auto increment
  846. * 4: preamble suppress
  847. * 3: undefined
  848. * 2-0: mgmt clock reset
  849. */
  850. #define ET_MAC_MIIMGMT_CLK_RST 0x0007
  851. /* structure for MII Management Command reg in mac address map.
  852. * located at address 0x5024
  853. * bit 1: scan cycle
  854. * bit 0: read cycle
  855. */
  856. /* structure for MII Management Address reg in mac address map.
  857. * located at address 0x5028
  858. * 31-13: reserved
  859. * 12-8: phy addr
  860. * 7-5: reserved
  861. * 4-0: register
  862. */
  863. #define ET_MAC_MII_ADDR(phy, reg) ((phy) << 8 | (reg))
  864. /* structure for MII Management Control reg in mac address map.
  865. * located at address 0x502C
  866. * 31-16: reserved
  867. * 15-0: phy control
  868. */
  869. /* structure for MII Management Status reg in mac address map.
  870. * located at address 0x5030
  871. * 31-16: reserved
  872. * 15-0: phy control
  873. */
  874. #define ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK 0xFFFF
  875. /* structure for MII Management Indicators reg in mac address map.
  876. * located at address 0x5034
  877. * 31-3: reserved
  878. * 2: not valid
  879. * 1: scanning
  880. * 0: busy
  881. */
  882. #define ET_MAC_MGMT_BUSY 0x00000001 /* busy */
  883. #define ET_MAC_MGMT_WAIT 0x00000005 /* busy | not valid */
  884. /* structure for Interface Control reg in mac address map.
  885. * located at address 0x5038
  886. *
  887. * 31: reset if module
  888. * 30-28: reserved
  889. * 27: tbi mode
  890. * 26: ghd mode
  891. * 25: lhd mode
  892. * 24: phy mode
  893. * 23: reset per mii
  894. * 22-17: reserved
  895. * 16: speed
  896. * 15: reset pe100x
  897. * 14-11: reserved
  898. * 10: force quiet
  899. * 9: no cipher
  900. * 8: disable link fail
  901. * 7: reset gpsi
  902. * 6-1: reserved
  903. * 0: enable jabber protection
  904. */
  905. #define ET_MAC_IFCTRL_GHDMODE (1 << 26)
  906. #define ET_MAC_IFCTRL_PHYMODE (1 << 24)
  907. /* structure for Interface Status reg in mac address map.
  908. * located at address 0x503C
  909. *
  910. * 31-10: reserved
  911. * 9: excess_defer
  912. * 8: clash
  913. * 7: phy_jabber
  914. * 6: phy_link_ok
  915. * 5: phy_full_duplex
  916. * 4: phy_speed
  917. * 3: pe100x_link_fail
  918. * 2: pe10t_loss_carrier
  919. * 1: pe10t_sqe_error
  920. * 0: pe10t_jabber
  921. */
  922. /* structure for Mac Station Address, Part 1 reg in mac address map.
  923. * located at address 0x5040
  924. *
  925. * 31-24: Octet6
  926. * 23-16: Octet5
  927. * 15-8: Octet4
  928. * 7-0: Octet3
  929. */
  930. #define ET_MAC_STATION_ADDR1_OC6_SHIFT 24
  931. #define ET_MAC_STATION_ADDR1_OC5_SHIFT 16
  932. #define ET_MAC_STATION_ADDR1_OC4_SHIFT 8
  933. /* structure for Mac Station Address, Part 2 reg in mac address map.
  934. * located at address 0x5044
  935. *
  936. * 31-24: Octet2
  937. * 23-16: Octet1
  938. * 15-0: reserved
  939. */
  940. #define ET_MAC_STATION_ADDR2_OC2_SHIFT 24
  941. #define ET_MAC_STATION_ADDR2_OC1_SHIFT 16
  942. /* MAC Module of JAGCore Address Mapping
  943. */
  944. struct mac_regs { /* Location: */
  945. u32 cfg1; /* 0x5000 */
  946. u32 cfg2; /* 0x5004 */
  947. u32 ipg; /* 0x5008 */
  948. u32 hfdp; /* 0x500C */
  949. u32 max_fm_len; /* 0x5010 */
  950. u32 rsv1; /* 0x5014 */
  951. u32 rsv2; /* 0x5018 */
  952. u32 mac_test; /* 0x501C */
  953. u32 mii_mgmt_cfg; /* 0x5020 */
  954. u32 mii_mgmt_cmd; /* 0x5024 */
  955. u32 mii_mgmt_addr; /* 0x5028 */
  956. u32 mii_mgmt_ctrl; /* 0x502C */
  957. u32 mii_mgmt_stat; /* 0x5030 */
  958. u32 mii_mgmt_indicator; /* 0x5034 */
  959. u32 if_ctrl; /* 0x5038 */
  960. u32 if_stat; /* 0x503C */
  961. u32 station_addr_1; /* 0x5040 */
  962. u32 station_addr_2; /* 0x5044 */
  963. };
  964. /* END OF MAC REGISTER ADDRESS MAP */
  965. /* START OF MAC STAT REGISTER ADDRESS MAP */
  966. /* structure for Carry Register One and it's Mask Register reg located in mac
  967. * stat address map address 0x6130 and 0x6138.
  968. *
  969. * 31: tr64
  970. * 30: tr127
  971. * 29: tr255
  972. * 28: tr511
  973. * 27: tr1k
  974. * 26: trmax
  975. * 25: trmgv
  976. * 24-17: unused
  977. * 16: rbyt
  978. * 15: rpkt
  979. * 14: rfcs
  980. * 13: rmca
  981. * 12: rbca
  982. * 11: rxcf
  983. * 10: rxpf
  984. * 9: rxuo
  985. * 8: raln
  986. * 7: rflr
  987. * 6: rcde
  988. * 5: rcse
  989. * 4: rund
  990. * 3: rovr
  991. * 2: rfrg
  992. * 1: rjbr
  993. * 0: rdrp
  994. */
  995. /* structure for Carry Register Two Mask Register reg in mac stat address map.
  996. * located at address 0x613C
  997. *
  998. * 31-20: unused
  999. * 19: tjbr
  1000. * 18: tfcs
  1001. * 17: txcf
  1002. * 16: tovr
  1003. * 15: tund
  1004. * 14: trfg
  1005. * 13: tbyt
  1006. * 12: tpkt
  1007. * 11: tmca
  1008. * 10: tbca
  1009. * 9: txpf
  1010. * 8: tdfr
  1011. * 7: tedf
  1012. * 6: tscl
  1013. * 5: tmcl
  1014. * 4: tlcl
  1015. * 3: txcl
  1016. * 2: tncl
  1017. * 1: tpfh
  1018. * 0: tdrp
  1019. */
  1020. /* MAC STATS Module of JAGCore Address Mapping
  1021. */
  1022. struct macstat_regs { /* Location: */
  1023. u32 pad[32]; /* 0x6000 - 607C */
  1024. /* counters */
  1025. u32 txrx_0_64_byte_frames; /* 0x6080 */
  1026. u32 txrx_65_127_byte_frames; /* 0x6084 */
  1027. u32 txrx_128_255_byte_frames; /* 0x6088 */
  1028. u32 txrx_256_511_byte_frames; /* 0x608C */
  1029. u32 txrx_512_1023_byte_frames; /* 0x6090 */
  1030. u32 txrx_1024_1518_byte_frames; /* 0x6094 */
  1031. u32 txrx_1519_1522_gvln_frames; /* 0x6098 */
  1032. u32 rx_bytes; /* 0x609C */
  1033. u32 rx_packets; /* 0x60A0 */
  1034. u32 rx_fcs_errs; /* 0x60A4 */
  1035. u32 rx_multicast_packets; /* 0x60A8 */
  1036. u32 rx_broadcast_packets; /* 0x60AC */
  1037. u32 rx_control_frames; /* 0x60B0 */
  1038. u32 rx_pause_frames; /* 0x60B4 */
  1039. u32 rx_unknown_opcodes; /* 0x60B8 */
  1040. u32 rx_align_errs; /* 0x60BC */
  1041. u32 rx_frame_len_errs; /* 0x60C0 */
  1042. u32 rx_code_errs; /* 0x60C4 */
  1043. u32 rx_carrier_sense_errs; /* 0x60C8 */
  1044. u32 rx_undersize_packets; /* 0x60CC */
  1045. u32 rx_oversize_packets; /* 0x60D0 */
  1046. u32 rx_fragment_packets; /* 0x60D4 */
  1047. u32 rx_jabbers; /* 0x60D8 */
  1048. u32 rx_drops; /* 0x60DC */
  1049. u32 tx_bytes; /* 0x60E0 */
  1050. u32 tx_packets; /* 0x60E4 */
  1051. u32 tx_multicast_packets; /* 0x60E8 */
  1052. u32 tx_broadcast_packets; /* 0x60EC */
  1053. u32 tx_pause_frames; /* 0x60F0 */
  1054. u32 tx_deferred; /* 0x60F4 */
  1055. u32 tx_excessive_deferred; /* 0x60F8 */
  1056. u32 tx_single_collisions; /* 0x60FC */
  1057. u32 tx_multiple_collisions; /* 0x6100 */
  1058. u32 tx_late_collisions; /* 0x6104 */
  1059. u32 tx_excessive_collisions; /* 0x6108 */
  1060. u32 tx_total_collisions; /* 0x610C */
  1061. u32 tx_pause_honored_frames; /* 0x6110 */
  1062. u32 tx_drops; /* 0x6114 */
  1063. u32 tx_jabbers; /* 0x6118 */
  1064. u32 tx_fcs_errs; /* 0x611C */
  1065. u32 tx_control_frames; /* 0x6120 */
  1066. u32 tx_oversize_frames; /* 0x6124 */
  1067. u32 tx_undersize_frames; /* 0x6128 */
  1068. u32 tx_fragments; /* 0x612C */
  1069. u32 carry_reg1; /* 0x6130 */
  1070. u32 carry_reg2; /* 0x6134 */
  1071. u32 carry_reg1_mask; /* 0x6138 */
  1072. u32 carry_reg2_mask; /* 0x613C */
  1073. };
  1074. /* END OF MAC STAT REGISTER ADDRESS MAP */
  1075. /* START OF MMC REGISTER ADDRESS MAP */
  1076. /* Main Memory Controller Control reg in mmc address map.
  1077. * located at address 0x7000
  1078. */
  1079. #define ET_MMC_ENABLE 1
  1080. #define ET_MMC_ARB_DISABLE 2
  1081. #define ET_MMC_RXMAC_DISABLE 4
  1082. #define ET_MMC_TXMAC_DISABLE 8
  1083. #define ET_MMC_TXDMA_DISABLE 16
  1084. #define ET_MMC_RXDMA_DISABLE 32
  1085. #define ET_MMC_FORCE_CE 64
  1086. /* Main Memory Controller Host Memory Access Address reg in mmc
  1087. * address map. Located at address 0x7004. Top 16 bits hold the address bits
  1088. */
  1089. #define ET_SRAM_REQ_ACCESS 1
  1090. #define ET_SRAM_WR_ACCESS 2
  1091. #define ET_SRAM_IS_CTRL 4
  1092. /* structure for Main Memory Controller Host Memory Access Data reg in mmc
  1093. * address map. Located at address 0x7008 - 0x7014
  1094. * Defined earlier (u32)
  1095. */
  1096. /* Memory Control Module of JAGCore Address Mapping
  1097. */
  1098. struct mmc_regs { /* Location: */
  1099. u32 mmc_ctrl; /* 0x7000 */
  1100. u32 sram_access; /* 0x7004 */
  1101. u32 sram_word1; /* 0x7008 */
  1102. u32 sram_word2; /* 0x700C */
  1103. u32 sram_word3; /* 0x7010 */
  1104. u32 sram_word4; /* 0x7014 */
  1105. };
  1106. /* END OF MMC REGISTER ADDRESS MAP */
  1107. /* JAGCore Address Mapping
  1108. */
  1109. struct address_map {
  1110. struct global_regs global;
  1111. /* unused section of global address map */
  1112. u8 unused_global[4096 - sizeof(struct global_regs)];
  1113. struct txdma_regs txdma;
  1114. /* unused section of txdma address map */
  1115. u8 unused_txdma[4096 - sizeof(struct txdma_regs)];
  1116. struct rxdma_regs rxdma;
  1117. /* unused section of rxdma address map */
  1118. u8 unused_rxdma[4096 - sizeof(struct rxdma_regs)];
  1119. struct txmac_regs txmac;
  1120. /* unused section of txmac address map */
  1121. u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
  1122. struct rxmac_regs rxmac;
  1123. /* unused section of rxmac address map */
  1124. u8 unused_rxmac[4096 - sizeof(struct rxmac_regs)];
  1125. struct mac_regs mac;
  1126. /* unused section of mac address map */
  1127. u8 unused_mac[4096 - sizeof(struct mac_regs)];
  1128. struct macstat_regs macstat;
  1129. /* unused section of mac stat address map */
  1130. u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
  1131. struct mmc_regs mmc;
  1132. /* unused section of mmc address map */
  1133. u8 unused_mmc[4096 - sizeof(struct mmc_regs)];
  1134. /* unused section of address map */
  1135. u8 unused_[1015808];
  1136. u8 unused_exp_rom[4096]; /* MGS-size TBD */
  1137. u8 unused__[524288]; /* unused section of address map */
  1138. };
  1139. /* Defines for generic MII registers 0x00 -> 0x0F can be found in
  1140. * include/linux/mii.h
  1141. */
  1142. /* some defines for modem registers that seem to be 'reserved' */
  1143. #define PHY_INDEX_REG 0x10
  1144. #define PHY_DATA_REG 0x11
  1145. #define PHY_MPHY_CONTROL_REG 0x12
  1146. /* defines for specified registers */
  1147. #define PHY_LOOPBACK_CONTROL 0x13 /* TRU_VMI_LOOPBACK_CONTROL_1_REG 19 */
  1148. /* TRU_VMI_LOOPBACK_CONTROL_2_REG 20 */
  1149. #define PHY_REGISTER_MGMT_CONTROL 0x15 /* TRU_VMI_MI_SEQ_CONTROL_REG 21 */
  1150. #define PHY_CONFIG 0x16 /* TRU_VMI_CONFIGURATION_REG 22 */
  1151. #define PHY_PHY_CONTROL 0x17 /* TRU_VMI_PHY_CONTROL_REG 23 */
  1152. #define PHY_INTERRUPT_MASK 0x18 /* TRU_VMI_INTERRUPT_MASK_REG 24 */
  1153. #define PHY_INTERRUPT_STATUS 0x19 /* TRU_VMI_INTERRUPT_STATUS_REG 25 */
  1154. #define PHY_PHY_STATUS 0x1A /* TRU_VMI_PHY_STATUS_REG 26 */
  1155. #define PHY_LED_1 0x1B /* TRU_VMI_LED_CONTROL_1_REG 27 */
  1156. #define PHY_LED_2 0x1C /* TRU_VMI_LED_CONTROL_2_REG 28 */
  1157. /* TRU_VMI_LINK_CONTROL_REG 29 */
  1158. /* TRU_VMI_TIMING_CONTROL_REG */
  1159. /* MI Register 10: Gigabit basic mode status reg(Reg 0x0A) */
  1160. #define ET_1000BT_MSTR_SLV 0x4000
  1161. /* MI Register 16 - 18: Reserved Reg(0x10-0x12) */
  1162. /* MI Register 19: Loopback Control Reg(0x13)
  1163. * 15: mii_en
  1164. * 14: pcs_en
  1165. * 13: pmd_en
  1166. * 12: all_digital_en
  1167. * 11: replica_en
  1168. * 10: line_driver_en
  1169. * 9-0: reserved
  1170. */
  1171. /* MI Register 20: Reserved Reg(0x14) */
  1172. /* MI Register 21: Management Interface Control Reg(0x15)
  1173. * 15-11: reserved
  1174. * 10-4: mi_error_count
  1175. * 3: reserved
  1176. * 2: ignore_10g_fr
  1177. * 1: reserved
  1178. * 0: preamble_suppress_en
  1179. */
  1180. /* MI Register 22: PHY Configuration Reg(0x16)
  1181. * 15: crs_tx_en
  1182. * 14: reserved
  1183. * 13-12: tx_fifo_depth
  1184. * 11-10: speed_downshift
  1185. * 9: pbi_detect
  1186. * 8: tbi_rate
  1187. * 7: alternate_np
  1188. * 6: group_mdio_en
  1189. * 5: tx_clock_en
  1190. * 4: sys_clock_en
  1191. * 3: reserved
  1192. * 2-0: mac_if_mode
  1193. */
  1194. #define ET_PHY_CONFIG_TX_FIFO_DEPTH 0x3000
  1195. #define ET_PHY_CONFIG_FIFO_DEPTH_8 0x0000
  1196. #define ET_PHY_CONFIG_FIFO_DEPTH_16 0x1000
  1197. #define ET_PHY_CONFIG_FIFO_DEPTH_32 0x2000
  1198. #define ET_PHY_CONFIG_FIFO_DEPTH_64 0x3000
  1199. /* MI Register 23: PHY CONTROL Reg(0x17)
  1200. * 15: reserved
  1201. * 14: tdr_en
  1202. * 13: reserved
  1203. * 12-11: downshift_attempts
  1204. * 10-6: reserved
  1205. * 5: jabber_10baseT
  1206. * 4: sqe_10baseT
  1207. * 3: tp_loopback_10baseT
  1208. * 2: preamble_gen_en
  1209. * 1: reserved
  1210. * 0: force_int
  1211. */
  1212. /* MI Register 24: Interrupt Mask Reg(0x18)
  1213. * 15-10: reserved
  1214. * 9: mdio_sync_lost
  1215. * 8: autoneg_status
  1216. * 7: hi_bit_err
  1217. * 6: np_rx
  1218. * 5: err_counter_full
  1219. * 4: fifo_over_underflow
  1220. * 3: rx_status
  1221. * 2: link_status
  1222. * 1: automatic_speed
  1223. * 0: int_en
  1224. */
  1225. /* MI Register 25: Interrupt Status Reg(0x19)
  1226. * 15-10: reserved
  1227. * 9: mdio_sync_lost
  1228. * 8: autoneg_status
  1229. * 7: hi_bit_err
  1230. * 6: np_rx
  1231. * 5: err_counter_full
  1232. * 4: fifo_over_underflow
  1233. * 3: rx_status
  1234. * 2: link_status
  1235. * 1: automatic_speed
  1236. * 0: int_en
  1237. */
  1238. /* MI Register 26: PHY Status Reg(0x1A)
  1239. * 15: reserved
  1240. * 14-13: autoneg_fault
  1241. * 12: autoneg_status
  1242. * 11: mdi_x_status
  1243. * 10: polarity_status
  1244. * 9-8: speed_status
  1245. * 7: duplex_status
  1246. * 6: link_status
  1247. * 5: tx_status
  1248. * 4: rx_status
  1249. * 3: collision_status
  1250. * 2: autoneg_en
  1251. * 1: pause_en
  1252. * 0: asymmetric_dir
  1253. */
  1254. #define ET_PHY_AUTONEG_STATUS 0x1000
  1255. #define ET_PHY_POLARITY_STATUS 0x0400
  1256. #define ET_PHY_SPEED_STATUS 0x0300
  1257. #define ET_PHY_DUPLEX_STATUS 0x0080
  1258. #define ET_PHY_LSTATUS 0x0040
  1259. #define ET_PHY_AUTONEG_ENABLE 0x0020
  1260. /* MI Register 27: LED Control Reg 1(0x1B)
  1261. * 15-14: reserved
  1262. * 13-12: led_dup_indicate
  1263. * 11-10: led_10baseT
  1264. * 9-8: led_collision
  1265. * 7-4: reserved
  1266. * 3-2: pulse_dur
  1267. * 1: pulse_stretch1
  1268. * 0: pulse_stretch0
  1269. */
  1270. /* MI Register 28: LED Control Reg 2(0x1C)
  1271. * 15-12: led_link
  1272. * 11-8: led_tx_rx
  1273. * 7-4: led_100BaseTX
  1274. * 3-0: led_1000BaseT
  1275. */
  1276. #define ET_LED2_LED_LINK 0xF000
  1277. #define ET_LED2_LED_TXRX 0x0F00
  1278. #define ET_LED2_LED_100TX 0x00F0
  1279. #define ET_LED2_LED_1000T 0x000F
  1280. /* defines for LED control reg 2 values */
  1281. #define LED_VAL_1000BT 0x0
  1282. #define LED_VAL_100BTX 0x1
  1283. #define LED_VAL_10BT 0x2
  1284. #define LED_VAL_1000BT_100BTX 0x3 /* 1000BT on, 100BTX blink */
  1285. #define LED_VAL_LINKON 0x4
  1286. #define LED_VAL_TX 0x5
  1287. #define LED_VAL_RX 0x6
  1288. #define LED_VAL_TXRX 0x7 /* TX or RX */
  1289. #define LED_VAL_DUPLEXFULL 0x8
  1290. #define LED_VAL_COLLISION 0x9
  1291. #define LED_VAL_LINKON_ACTIVE 0xA /* Link on, activity blink */
  1292. #define LED_VAL_LINKON_RECV 0xB /* Link on, receive blink */
  1293. #define LED_VAL_DUPLEXFULL_COLLISION 0xC /* Duplex on, collision blink */
  1294. #define LED_VAL_BLINK 0xD
  1295. #define LED_VAL_ON 0xE
  1296. #define LED_VAL_OFF 0xF
  1297. #define LED_LINK_SHIFT 12
  1298. #define LED_TXRX_SHIFT 8
  1299. #define LED_100TX_SHIFT 4
  1300. /* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */