et131x.h 37 KB

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