dwmac4.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. /*
  2. * DWMAC4 Header file.
  3. *
  4. * Copyright (C) 2015 STMicroelectronics Ltd
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * Author: Alexandre Torgue <alexandre.torgue@st.com>
  11. */
  12. #ifndef __DWMAC4_H__
  13. #define __DWMAC4_H__
  14. #include "common.h"
  15. /* MAC registers */
  16. #define GMAC_CONFIG 0x00000000
  17. #define GMAC_PACKET_FILTER 0x00000008
  18. #define GMAC_HASH_TAB_0_31 0x00000010
  19. #define GMAC_HASH_TAB_32_63 0x00000014
  20. #define GMAC_RX_FLOW_CTRL 0x00000090
  21. #define GMAC_QX_TX_FLOW_CTRL(x) (0x70 + x * 4)
  22. #define GMAC_TXQ_PRTY_MAP0 0x98
  23. #define GMAC_TXQ_PRTY_MAP1 0x9C
  24. #define GMAC_RXQ_CTRL0 0x000000a0
  25. #define GMAC_RXQ_CTRL1 0x000000a4
  26. #define GMAC_RXQ_CTRL2 0x000000a8
  27. #define GMAC_RXQ_CTRL3 0x000000ac
  28. #define GMAC_INT_STATUS 0x000000b0
  29. #define GMAC_INT_EN 0x000000b4
  30. #define GMAC_1US_TIC_COUNTER 0x000000dc
  31. #define GMAC_PCS_BASE 0x000000e0
  32. #define GMAC_PHYIF_CONTROL_STATUS 0x000000f8
  33. #define GMAC_PMT 0x000000c0
  34. #define GMAC_DEBUG 0x00000114
  35. #define GMAC_HW_FEATURE0 0x0000011c
  36. #define GMAC_HW_FEATURE1 0x00000120
  37. #define GMAC_HW_FEATURE2 0x00000124
  38. #define GMAC_HW_FEATURE3 0x00000128
  39. #define GMAC_MDIO_ADDR 0x00000200
  40. #define GMAC_MDIO_DATA 0x00000204
  41. #define GMAC_ADDR_HIGH(reg) (0x300 + reg * 8)
  42. #define GMAC_ADDR_LOW(reg) (0x304 + reg * 8)
  43. /* RX Queues Routing */
  44. #define GMAC_RXQCTRL_AVCPQ_MASK GENMASK(2, 0)
  45. #define GMAC_RXQCTRL_AVCPQ_SHIFT 0
  46. #define GMAC_RXQCTRL_PTPQ_MASK GENMASK(6, 4)
  47. #define GMAC_RXQCTRL_PTPQ_SHIFT 4
  48. #define GMAC_RXQCTRL_DCBCPQ_MASK GENMASK(10, 8)
  49. #define GMAC_RXQCTRL_DCBCPQ_SHIFT 8
  50. #define GMAC_RXQCTRL_UPQ_MASK GENMASK(14, 12)
  51. #define GMAC_RXQCTRL_UPQ_SHIFT 12
  52. #define GMAC_RXQCTRL_MCBCQ_MASK GENMASK(18, 16)
  53. #define GMAC_RXQCTRL_MCBCQ_SHIFT 16
  54. #define GMAC_RXQCTRL_MCBCQEN BIT(20)
  55. #define GMAC_RXQCTRL_MCBCQEN_SHIFT 20
  56. #define GMAC_RXQCTRL_TACPQE BIT(21)
  57. #define GMAC_RXQCTRL_TACPQE_SHIFT 21
  58. /* MAC Packet Filtering */
  59. #define GMAC_PACKET_FILTER_PR BIT(0)
  60. #define GMAC_PACKET_FILTER_HMC BIT(2)
  61. #define GMAC_PACKET_FILTER_PM BIT(4)
  62. #define GMAC_MAX_PERFECT_ADDRESSES 128
  63. /* MAC RX Queue Enable */
  64. #define GMAC_RX_QUEUE_CLEAR(queue) ~(GENMASK(1, 0) << ((queue) * 2))
  65. #define GMAC_RX_AV_QUEUE_ENABLE(queue) BIT((queue) * 2)
  66. #define GMAC_RX_DCB_QUEUE_ENABLE(queue) BIT(((queue) * 2) + 1)
  67. /* MAC Flow Control RX */
  68. #define GMAC_RX_FLOW_CTRL_RFE BIT(0)
  69. /* RX Queues Priorities */
  70. #define GMAC_RXQCTRL_PSRQX_MASK(x) GENMASK(7 + ((x) * 8), 0 + ((x) * 8))
  71. #define GMAC_RXQCTRL_PSRQX_SHIFT(x) ((x) * 8)
  72. /* TX Queues Priorities */
  73. #define GMAC_TXQCTRL_PSTQX_MASK(x) GENMASK(7 + ((x) * 8), 0 + ((x) * 8))
  74. #define GMAC_TXQCTRL_PSTQX_SHIFT(x) ((x) * 8)
  75. /* MAC Flow Control TX */
  76. #define GMAC_TX_FLOW_CTRL_TFE BIT(1)
  77. #define GMAC_TX_FLOW_CTRL_PT_SHIFT 16
  78. /* MAC Interrupt bitmap*/
  79. #define GMAC_INT_RGSMIIS BIT(0)
  80. #define GMAC_INT_PCS_LINK BIT(1)
  81. #define GMAC_INT_PCS_ANE BIT(2)
  82. #define GMAC_INT_PCS_PHYIS BIT(3)
  83. #define GMAC_INT_PMT_EN BIT(4)
  84. #define GMAC_INT_LPI_EN BIT(5)
  85. #define GMAC_PCS_IRQ_DEFAULT (GMAC_INT_RGSMIIS | GMAC_INT_PCS_LINK | \
  86. GMAC_INT_PCS_ANE)
  87. #define GMAC_INT_DEFAULT_ENABLE (GMAC_INT_PMT_EN | GMAC_INT_LPI_EN)
  88. enum dwmac4_irq_status {
  89. time_stamp_irq = 0x00001000,
  90. mmc_rx_csum_offload_irq = 0x00000800,
  91. mmc_tx_irq = 0x00000400,
  92. mmc_rx_irq = 0x00000200,
  93. mmc_irq = 0x00000100,
  94. lpi_irq = 0x00000020,
  95. pmt_irq = 0x00000010,
  96. };
  97. /* MAC PMT bitmap */
  98. enum power_event {
  99. pointer_reset = 0x80000000,
  100. global_unicast = 0x00000200,
  101. wake_up_rx_frame = 0x00000040,
  102. magic_frame = 0x00000020,
  103. wake_up_frame_en = 0x00000004,
  104. magic_pkt_en = 0x00000002,
  105. power_down = 0x00000001,
  106. };
  107. /* Energy Efficient Ethernet (EEE) for GMAC4
  108. *
  109. * LPI status, timer and control register offset
  110. */
  111. #define GMAC4_LPI_CTRL_STATUS 0xd0
  112. #define GMAC4_LPI_TIMER_CTRL 0xd4
  113. /* LPI control and status defines */
  114. #define GMAC4_LPI_CTRL_STATUS_LPITCSE BIT(21) /* LPI Tx Clock Stop Enable */
  115. #define GMAC4_LPI_CTRL_STATUS_LPITXA BIT(19) /* Enable LPI TX Automate */
  116. #define GMAC4_LPI_CTRL_STATUS_PLS BIT(17) /* PHY Link Status */
  117. #define GMAC4_LPI_CTRL_STATUS_LPIEN BIT(16) /* LPI Enable */
  118. #define GMAC4_LPI_CTRL_STATUS_RLPIEX BIT(3) /* Receive LPI Exit */
  119. #define GMAC4_LPI_CTRL_STATUS_RLPIEN BIT(2) /* Receive LPI Entry */
  120. #define GMAC4_LPI_CTRL_STATUS_TLPIEX BIT(1) /* Transmit LPI Exit */
  121. #define GMAC4_LPI_CTRL_STATUS_TLPIEN BIT(0) /* Transmit LPI Entry */
  122. /* MAC Debug bitmap */
  123. #define GMAC_DEBUG_TFCSTS_MASK GENMASK(18, 17)
  124. #define GMAC_DEBUG_TFCSTS_SHIFT 17
  125. #define GMAC_DEBUG_TFCSTS_IDLE 0
  126. #define GMAC_DEBUG_TFCSTS_WAIT 1
  127. #define GMAC_DEBUG_TFCSTS_GEN_PAUSE 2
  128. #define GMAC_DEBUG_TFCSTS_XFER 3
  129. #define GMAC_DEBUG_TPESTS BIT(16)
  130. #define GMAC_DEBUG_RFCFCSTS_MASK GENMASK(2, 1)
  131. #define GMAC_DEBUG_RFCFCSTS_SHIFT 1
  132. #define GMAC_DEBUG_RPESTS BIT(0)
  133. /* MAC config */
  134. #define GMAC_CONFIG_IPC BIT(27)
  135. #define GMAC_CONFIG_2K BIT(22)
  136. #define GMAC_CONFIG_ACS BIT(20)
  137. #define GMAC_CONFIG_BE BIT(18)
  138. #define GMAC_CONFIG_JD BIT(17)
  139. #define GMAC_CONFIG_JE BIT(16)
  140. #define GMAC_CONFIG_PS BIT(15)
  141. #define GMAC_CONFIG_FES BIT(14)
  142. #define GMAC_CONFIG_DM BIT(13)
  143. #define GMAC_CONFIG_DCRS BIT(9)
  144. #define GMAC_CONFIG_TE BIT(1)
  145. #define GMAC_CONFIG_RE BIT(0)
  146. /* MAC HW features0 bitmap */
  147. #define GMAC_HW_FEAT_ADDMAC BIT(18)
  148. #define GMAC_HW_FEAT_RXCOESEL BIT(16)
  149. #define GMAC_HW_FEAT_TXCOSEL BIT(14)
  150. #define GMAC_HW_FEAT_EEESEL BIT(13)
  151. #define GMAC_HW_FEAT_TSSEL BIT(12)
  152. #define GMAC_HW_FEAT_MMCSEL BIT(8)
  153. #define GMAC_HW_FEAT_MGKSEL BIT(7)
  154. #define GMAC_HW_FEAT_RWKSEL BIT(6)
  155. #define GMAC_HW_FEAT_SMASEL BIT(5)
  156. #define GMAC_HW_FEAT_VLHASH BIT(4)
  157. #define GMAC_HW_FEAT_PCSSEL BIT(3)
  158. #define GMAC_HW_FEAT_HDSEL BIT(2)
  159. #define GMAC_HW_FEAT_GMIISEL BIT(1)
  160. #define GMAC_HW_FEAT_MIISEL BIT(0)
  161. /* MAC HW features1 bitmap */
  162. #define GMAC_HW_FEAT_AVSEL BIT(20)
  163. #define GMAC_HW_TSOEN BIT(18)
  164. #define GMAC_HW_TXFIFOSIZE GENMASK(10, 6)
  165. #define GMAC_HW_RXFIFOSIZE GENMASK(4, 0)
  166. /* MAC HW features2 bitmap */
  167. #define GMAC_HW_FEAT_PPSOUTNUM GENMASK(26, 24)
  168. #define GMAC_HW_FEAT_TXCHCNT GENMASK(21, 18)
  169. #define GMAC_HW_FEAT_RXCHCNT GENMASK(15, 12)
  170. #define GMAC_HW_FEAT_TXQCNT GENMASK(9, 6)
  171. #define GMAC_HW_FEAT_RXQCNT GENMASK(3, 0)
  172. /* MAC HW features3 bitmap */
  173. #define GMAC_HW_FEAT_ASP GENMASK(29, 28)
  174. #define GMAC_HW_FEAT_FRPES GENMASK(14, 13)
  175. #define GMAC_HW_FEAT_FRPBS GENMASK(12, 11)
  176. #define GMAC_HW_FEAT_FRPSEL BIT(10)
  177. /* MAC HW ADDR regs */
  178. #define GMAC_HI_DCS GENMASK(18, 16)
  179. #define GMAC_HI_DCS_SHIFT 16
  180. #define GMAC_HI_REG_AE BIT(31)
  181. /* MTL registers */
  182. #define MTL_OPERATION_MODE 0x00000c00
  183. #define MTL_FRPE BIT(15)
  184. #define MTL_OPERATION_SCHALG_MASK GENMASK(6, 5)
  185. #define MTL_OPERATION_SCHALG_WRR (0x0 << 5)
  186. #define MTL_OPERATION_SCHALG_WFQ (0x1 << 5)
  187. #define MTL_OPERATION_SCHALG_DWRR (0x2 << 5)
  188. #define MTL_OPERATION_SCHALG_SP (0x3 << 5)
  189. #define MTL_OPERATION_RAA BIT(2)
  190. #define MTL_OPERATION_RAA_SP (0x0 << 2)
  191. #define MTL_OPERATION_RAA_WSP (0x1 << 2)
  192. #define MTL_INT_STATUS 0x00000c20
  193. #define MTL_INT_QX(x) BIT(x)
  194. #define MTL_RXQ_DMA_MAP0 0x00000c30 /* queue 0 to 3 */
  195. #define MTL_RXQ_DMA_MAP1 0x00000c34 /* queue 4 to 7 */
  196. #define MTL_RXQ_DMA_Q04MDMACH_MASK GENMASK(3, 0)
  197. #define MTL_RXQ_DMA_Q04MDMACH(x) ((x) << 0)
  198. #define MTL_RXQ_DMA_QXMDMACH_MASK(x) GENMASK(11 + (8 * ((x) - 1)), 8 * (x))
  199. #define MTL_RXQ_DMA_QXMDMACH(chan, q) ((chan) << (8 * (q)))
  200. #define MTL_CHAN_BASE_ADDR 0x00000d00
  201. #define MTL_CHAN_BASE_OFFSET 0x40
  202. #define MTL_CHANX_BASE_ADDR(x) (MTL_CHAN_BASE_ADDR + \
  203. (x * MTL_CHAN_BASE_OFFSET))
  204. #define MTL_CHAN_TX_OP_MODE(x) MTL_CHANX_BASE_ADDR(x)
  205. #define MTL_CHAN_TX_DEBUG(x) (MTL_CHANX_BASE_ADDR(x) + 0x8)
  206. #define MTL_CHAN_INT_CTRL(x) (MTL_CHANX_BASE_ADDR(x) + 0x2c)
  207. #define MTL_CHAN_RX_OP_MODE(x) (MTL_CHANX_BASE_ADDR(x) + 0x30)
  208. #define MTL_CHAN_RX_DEBUG(x) (MTL_CHANX_BASE_ADDR(x) + 0x38)
  209. #define MTL_OP_MODE_RSF BIT(5)
  210. #define MTL_OP_MODE_TXQEN_MASK GENMASK(3, 2)
  211. #define MTL_OP_MODE_TXQEN_AV BIT(2)
  212. #define MTL_OP_MODE_TXQEN BIT(3)
  213. #define MTL_OP_MODE_TSF BIT(1)
  214. #define MTL_OP_MODE_TQS_MASK GENMASK(24, 16)
  215. #define MTL_OP_MODE_TQS_SHIFT 16
  216. #define MTL_OP_MODE_TTC_MASK 0x70
  217. #define MTL_OP_MODE_TTC_SHIFT 4
  218. #define MTL_OP_MODE_TTC_32 0
  219. #define MTL_OP_MODE_TTC_64 (1 << MTL_OP_MODE_TTC_SHIFT)
  220. #define MTL_OP_MODE_TTC_96 (2 << MTL_OP_MODE_TTC_SHIFT)
  221. #define MTL_OP_MODE_TTC_128 (3 << MTL_OP_MODE_TTC_SHIFT)
  222. #define MTL_OP_MODE_TTC_192 (4 << MTL_OP_MODE_TTC_SHIFT)
  223. #define MTL_OP_MODE_TTC_256 (5 << MTL_OP_MODE_TTC_SHIFT)
  224. #define MTL_OP_MODE_TTC_384 (6 << MTL_OP_MODE_TTC_SHIFT)
  225. #define MTL_OP_MODE_TTC_512 (7 << MTL_OP_MODE_TTC_SHIFT)
  226. #define MTL_OP_MODE_RQS_MASK GENMASK(29, 20)
  227. #define MTL_OP_MODE_RQS_SHIFT 20
  228. #define MTL_OP_MODE_RFD_MASK GENMASK(19, 14)
  229. #define MTL_OP_MODE_RFD_SHIFT 14
  230. #define MTL_OP_MODE_RFA_MASK GENMASK(13, 8)
  231. #define MTL_OP_MODE_RFA_SHIFT 8
  232. #define MTL_OP_MODE_EHFC BIT(7)
  233. #define MTL_OP_MODE_RTC_MASK 0x18
  234. #define MTL_OP_MODE_RTC_SHIFT 3
  235. #define MTL_OP_MODE_RTC_32 (1 << MTL_OP_MODE_RTC_SHIFT)
  236. #define MTL_OP_MODE_RTC_64 0
  237. #define MTL_OP_MODE_RTC_96 (2 << MTL_OP_MODE_RTC_SHIFT)
  238. #define MTL_OP_MODE_RTC_128 (3 << MTL_OP_MODE_RTC_SHIFT)
  239. /* MTL ETS Control register */
  240. #define MTL_ETS_CTRL_BASE_ADDR 0x00000d10
  241. #define MTL_ETS_CTRL_BASE_OFFSET 0x40
  242. #define MTL_ETSX_CTRL_BASE_ADDR(x) (MTL_ETS_CTRL_BASE_ADDR + \
  243. ((x) * MTL_ETS_CTRL_BASE_OFFSET))
  244. #define MTL_ETS_CTRL_CC BIT(3)
  245. #define MTL_ETS_CTRL_AVALG BIT(2)
  246. /* MTL Queue Quantum Weight */
  247. #define MTL_TXQ_WEIGHT_BASE_ADDR 0x00000d18
  248. #define MTL_TXQ_WEIGHT_BASE_OFFSET 0x40
  249. #define MTL_TXQX_WEIGHT_BASE_ADDR(x) (MTL_TXQ_WEIGHT_BASE_ADDR + \
  250. ((x) * MTL_TXQ_WEIGHT_BASE_OFFSET))
  251. #define MTL_TXQ_WEIGHT_ISCQW_MASK GENMASK(20, 0)
  252. /* MTL sendSlopeCredit register */
  253. #define MTL_SEND_SLP_CRED_BASE_ADDR 0x00000d1c
  254. #define MTL_SEND_SLP_CRED_OFFSET 0x40
  255. #define MTL_SEND_SLP_CREDX_BASE_ADDR(x) (MTL_SEND_SLP_CRED_BASE_ADDR + \
  256. ((x) * MTL_SEND_SLP_CRED_OFFSET))
  257. #define MTL_SEND_SLP_CRED_SSC_MASK GENMASK(13, 0)
  258. /* MTL hiCredit register */
  259. #define MTL_HIGH_CRED_BASE_ADDR 0x00000d20
  260. #define MTL_HIGH_CRED_OFFSET 0x40
  261. #define MTL_HIGH_CREDX_BASE_ADDR(x) (MTL_HIGH_CRED_BASE_ADDR + \
  262. ((x) * MTL_HIGH_CRED_OFFSET))
  263. #define MTL_HIGH_CRED_HC_MASK GENMASK(28, 0)
  264. /* MTL loCredit register */
  265. #define MTL_LOW_CRED_BASE_ADDR 0x00000d24
  266. #define MTL_LOW_CRED_OFFSET 0x40
  267. #define MTL_LOW_CREDX_BASE_ADDR(x) (MTL_LOW_CRED_BASE_ADDR + \
  268. ((x) * MTL_LOW_CRED_OFFSET))
  269. #define MTL_HIGH_CRED_LC_MASK GENMASK(28, 0)
  270. /* MTL debug */
  271. #define MTL_DEBUG_TXSTSFSTS BIT(5)
  272. #define MTL_DEBUG_TXFSTS BIT(4)
  273. #define MTL_DEBUG_TWCSTS BIT(3)
  274. /* MTL debug: Tx FIFO Read Controller Status */
  275. #define MTL_DEBUG_TRCSTS_MASK GENMASK(2, 1)
  276. #define MTL_DEBUG_TRCSTS_SHIFT 1
  277. #define MTL_DEBUG_TRCSTS_IDLE 0
  278. #define MTL_DEBUG_TRCSTS_READ 1
  279. #define MTL_DEBUG_TRCSTS_TXW 2
  280. #define MTL_DEBUG_TRCSTS_WRITE 3
  281. #define MTL_DEBUG_TXPAUSED BIT(0)
  282. /* MAC debug: GMII or MII Transmit Protocol Engine Status */
  283. #define MTL_DEBUG_RXFSTS_MASK GENMASK(5, 4)
  284. #define MTL_DEBUG_RXFSTS_SHIFT 4
  285. #define MTL_DEBUG_RXFSTS_EMPTY 0
  286. #define MTL_DEBUG_RXFSTS_BT 1
  287. #define MTL_DEBUG_RXFSTS_AT 2
  288. #define MTL_DEBUG_RXFSTS_FULL 3
  289. #define MTL_DEBUG_RRCSTS_MASK GENMASK(2, 1)
  290. #define MTL_DEBUG_RRCSTS_SHIFT 1
  291. #define MTL_DEBUG_RRCSTS_IDLE 0
  292. #define MTL_DEBUG_RRCSTS_RDATA 1
  293. #define MTL_DEBUG_RRCSTS_RSTAT 2
  294. #define MTL_DEBUG_RRCSTS_FLUSH 3
  295. #define MTL_DEBUG_RWCSTS BIT(0)
  296. /* MTL interrupt */
  297. #define MTL_RX_OVERFLOW_INT_EN BIT(24)
  298. #define MTL_RX_OVERFLOW_INT BIT(16)
  299. /* Default operating mode of the MAC */
  300. #define GMAC_CORE_INIT (GMAC_CONFIG_JD | GMAC_CONFIG_PS | \
  301. GMAC_CONFIG_BE | GMAC_CONFIG_DCRS)
  302. /* To dump the core regs excluding the Address Registers */
  303. #define GMAC_REG_NUM 132
  304. /* MTL debug */
  305. #define MTL_DEBUG_TXSTSFSTS BIT(5)
  306. #define MTL_DEBUG_TXFSTS BIT(4)
  307. #define MTL_DEBUG_TWCSTS BIT(3)
  308. /* MTL debug: Tx FIFO Read Controller Status */
  309. #define MTL_DEBUG_TRCSTS_MASK GENMASK(2, 1)
  310. #define MTL_DEBUG_TRCSTS_SHIFT 1
  311. #define MTL_DEBUG_TRCSTS_IDLE 0
  312. #define MTL_DEBUG_TRCSTS_READ 1
  313. #define MTL_DEBUG_TRCSTS_TXW 2
  314. #define MTL_DEBUG_TRCSTS_WRITE 3
  315. #define MTL_DEBUG_TXPAUSED BIT(0)
  316. /* MAC debug: GMII or MII Transmit Protocol Engine Status */
  317. #define MTL_DEBUG_RXFSTS_MASK GENMASK(5, 4)
  318. #define MTL_DEBUG_RXFSTS_SHIFT 4
  319. #define MTL_DEBUG_RXFSTS_EMPTY 0
  320. #define MTL_DEBUG_RXFSTS_BT 1
  321. #define MTL_DEBUG_RXFSTS_AT 2
  322. #define MTL_DEBUG_RXFSTS_FULL 3
  323. #define MTL_DEBUG_RRCSTS_MASK GENMASK(2, 1)
  324. #define MTL_DEBUG_RRCSTS_SHIFT 1
  325. #define MTL_DEBUG_RRCSTS_IDLE 0
  326. #define MTL_DEBUG_RRCSTS_RDATA 1
  327. #define MTL_DEBUG_RRCSTS_RSTAT 2
  328. #define MTL_DEBUG_RRCSTS_FLUSH 3
  329. #define MTL_DEBUG_RWCSTS BIT(0)
  330. /* SGMII/RGMII status register */
  331. #define GMAC_PHYIF_CTRLSTATUS_TC BIT(0)
  332. #define GMAC_PHYIF_CTRLSTATUS_LUD BIT(1)
  333. #define GMAC_PHYIF_CTRLSTATUS_SMIDRXS BIT(4)
  334. #define GMAC_PHYIF_CTRLSTATUS_LNKMOD BIT(16)
  335. #define GMAC_PHYIF_CTRLSTATUS_SPEED GENMASK(18, 17)
  336. #define GMAC_PHYIF_CTRLSTATUS_SPEED_SHIFT 17
  337. #define GMAC_PHYIF_CTRLSTATUS_LNKSTS BIT(19)
  338. #define GMAC_PHYIF_CTRLSTATUS_JABTO BIT(20)
  339. #define GMAC_PHYIF_CTRLSTATUS_FALSECARDET BIT(21)
  340. /* LNKMOD */
  341. #define GMAC_PHYIF_CTRLSTATUS_LNKMOD_MASK 0x1
  342. /* LNKSPEED */
  343. #define GMAC_PHYIF_CTRLSTATUS_SPEED_125 0x2
  344. #define GMAC_PHYIF_CTRLSTATUS_SPEED_25 0x1
  345. #define GMAC_PHYIF_CTRLSTATUS_SPEED_2_5 0x0
  346. extern const struct stmmac_dma_ops dwmac4_dma_ops;
  347. extern const struct stmmac_dma_ops dwmac410_dma_ops;
  348. #endif /* __DWMAC4_H__ */