dwmac5.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  2. // Copyright (c) 2017 Synopsys, Inc. and/or its affiliates.
  3. // stmmac Support for 5.xx Ethernet QoS cores
  4. #ifndef __DWMAC5_H__
  5. #define __DWMAC5_H__
  6. #define MAC_DPP_FSM_INT_STATUS 0x00000140
  7. #define MAC_AXI_SLV_DPE_ADDR_STATUS 0x00000144
  8. #define MAC_FSM_CONTROL 0x00000148
  9. #define PRTYEN BIT(1)
  10. #define TMOUTEN BIT(0)
  11. #define MAC_FPE_CTRL_STS 0x00000234
  12. #define TRSP BIT(19)
  13. #define TVER BIT(18)
  14. #define RRSP BIT(17)
  15. #define RVER BIT(16)
  16. #define SRSP BIT(2)
  17. #define SVER BIT(1)
  18. #define EFPE BIT(0)
  19. #define MAC_PPS_CONTROL 0x00000b70
  20. #define PPS_MAXIDX(x) ((((x) + 1) * 8) - 1)
  21. #define PPS_MINIDX(x) ((x) * 8)
  22. #define PPSx_MASK(x) GENMASK(PPS_MAXIDX(x), PPS_MINIDX(x))
  23. #define MCGRENx(x) BIT(PPS_MAXIDX(x))
  24. #define TRGTMODSELx(x, val) \
  25. GENMASK(PPS_MAXIDX(x) - 1, PPS_MAXIDX(x) - 2) & \
  26. ((val) << (PPS_MAXIDX(x) - 2))
  27. #define PPSCMDx(x, val) \
  28. GENMASK(PPS_MINIDX(x) + 3, PPS_MINIDX(x)) & \
  29. ((val) << PPS_MINIDX(x))
  30. #define PPSEN0 BIT(4)
  31. #define MAC_PPSx_TARGET_TIME_SEC(x) (0x00000b80 + ((x) * 0x10))
  32. #define MAC_PPSx_TARGET_TIME_NSEC(x) (0x00000b84 + ((x) * 0x10))
  33. #define TRGTBUSY0 BIT(31)
  34. #define TTSL0 GENMASK(30, 0)
  35. #define MAC_PPSx_INTERVAL(x) (0x00000b88 + ((x) * 0x10))
  36. #define MAC_PPSx_WIDTH(x) (0x00000b8c + ((x) * 0x10))
  37. #define MTL_EST_CONTROL 0x00000c50
  38. #define PTOV GENMASK(31, 24)
  39. #define PTOV_SHIFT 24
  40. #define SSWL BIT(1)
  41. #define EEST BIT(0)
  42. #define MTL_EST_STATUS 0x00000c58
  43. #define BTRL GENMASK(11, 8)
  44. #define BTRL_SHIFT 8
  45. #define BTRL_MAX (0xF << BTRL_SHIFT)
  46. #define SWOL BIT(7)
  47. #define SWOL_SHIFT 7
  48. #define CGCE BIT(4)
  49. #define HLBS BIT(3)
  50. #define HLBF BIT(2)
  51. #define BTRE BIT(1)
  52. #define SWLC BIT(0)
  53. #define MTL_EST_SCH_ERR 0x00000c60
  54. #define MTL_EST_FRM_SZ_ERR 0x00000c64
  55. #define MTL_EST_FRM_SZ_CAP 0x00000c68
  56. #define SZ_CAP_HBFS_MASK GENMASK(14, 0)
  57. #define SZ_CAP_HBFQ_SHIFT 16
  58. #define SZ_CAP_HBFQ_MASK(_val) ({ typeof(_val) (val) = (_val); \
  59. ((val) > 4 ? GENMASK(18, 16) : \
  60. (val) > 2 ? GENMASK(17, 16) : \
  61. BIT(16)); })
  62. #define MTL_EST_INT_EN 0x00000c70
  63. #define IECGCE CGCE
  64. #define IEHS HLBS
  65. #define IEHF HLBF
  66. #define IEBE BTRE
  67. #define IECC SWLC
  68. #define MTL_EST_GCL_CONTROL 0x00000c80
  69. #define BTR_LOW 0x0
  70. #define BTR_HIGH 0x1
  71. #define CTR_LOW 0x2
  72. #define CTR_HIGH 0x3
  73. #define TER 0x4
  74. #define LLR 0x5
  75. #define ADDR_SHIFT 8
  76. #define GCRR BIT(2)
  77. #define SRWO BIT(0)
  78. #define MTL_EST_GCL_DATA 0x00000c84
  79. #define MTL_RXP_CONTROL_STATUS 0x00000ca0
  80. #define RXPI BIT(31)
  81. #define NPE GENMASK(23, 16)
  82. #define NVE GENMASK(7, 0)
  83. #define MTL_RXP_IACC_CTRL_STATUS 0x00000cb0
  84. #define STARTBUSY BIT(31)
  85. #define RXPEIEC GENMASK(22, 21)
  86. #define RXPEIEE BIT(20)
  87. #define WRRDN BIT(16)
  88. #define ADDR GENMASK(15, 0)
  89. #define MTL_RXP_IACC_DATA 0x00000cb4
  90. #define MTL_ECC_CONTROL 0x00000cc0
  91. #define MEEAO BIT(8)
  92. #define TSOEE BIT(4)
  93. #define MRXPEE BIT(3)
  94. #define MESTEE BIT(2)
  95. #define MRXEE BIT(1)
  96. #define MTXEE BIT(0)
  97. #define MTL_SAFETY_INT_STATUS 0x00000cc4
  98. #define MCSIS BIT(31)
  99. #define MEUIS BIT(1)
  100. #define MECIS BIT(0)
  101. #define MTL_ECC_INT_ENABLE 0x00000cc8
  102. #define RPCEIE BIT(12)
  103. #define ECEIE BIT(8)
  104. #define RXCEIE BIT(4)
  105. #define TXCEIE BIT(0)
  106. #define MTL_ECC_INT_STATUS 0x00000ccc
  107. #define MTL_DPP_CONTROL 0x00000ce0
  108. #define EPSI BIT(2)
  109. #define OPE BIT(1)
  110. #define EDPP BIT(0)
  111. #define DMA_SAFETY_INT_STATUS 0x00001080
  112. #define MSUIS BIT(29)
  113. #define MSCIS BIT(28)
  114. #define DEUIS BIT(1)
  115. #define DECIS BIT(0)
  116. #define DMA_ECC_INT_ENABLE 0x00001084
  117. #define TCEIE BIT(0)
  118. #define DMA_ECC_INT_STATUS 0x00001088
  119. /* EQoS version 5.xx VLAN Tag Filter Fail Packets Queuing */
  120. #define GMAC_RXQ_CTRL4 0x00000094
  121. #define GMAC_RXQCTRL_VFFQ_MASK GENMASK(19, 17)
  122. #define GMAC_RXQCTRL_VFFQ_SHIFT 17
  123. #define GMAC_RXQCTRL_VFFQE BIT(16)
  124. #define GMAC_INT_FPE_EN BIT(17)
  125. int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp,
  126. struct stmmac_safety_feature_cfg *safety_cfg);
  127. int dwmac5_safety_feat_irq_status(struct net_device *ndev,
  128. void __iomem *ioaddr, unsigned int asp,
  129. struct stmmac_safety_stats *stats);
  130. int dwmac5_safety_feat_dump(struct stmmac_safety_stats *stats,
  131. int index, unsigned long *count, const char **desc);
  132. int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries,
  133. unsigned int count);
  134. int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
  135. struct stmmac_pps_cfg *cfg, bool enable,
  136. u32 sub_second_inc, u32 systime_flags);
  137. int dwmac5_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg,
  138. unsigned int ptp_rate);
  139. void dwmac5_est_irq_status(void __iomem *ioaddr, struct net_device *dev,
  140. struct stmmac_extra_stats *x, u32 txqcnt);
  141. void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
  142. u32 num_txq, u32 num_rxq,
  143. bool enable);
  144. void dwmac5_fpe_send_mpacket(void __iomem *ioaddr,
  145. struct stmmac_fpe_cfg *cfg,
  146. enum stmmac_mpacket_type type);
  147. int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev);
  148. #endif /* __DWMAC5_H__ */