dwmac5.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_FPE_CTRL_STS 0x00000c90
  38. /* Preemption Classification */
  39. #define DWMAC5_PREEMPTION_CLASS GENMASK(15, 8)
  40. /* Additional Fragment Size of preempted frames */
  41. #define DWMAC5_ADD_FRAG_SZ GENMASK(1, 0)
  42. #define MTL_RXP_CONTROL_STATUS 0x00000ca0
  43. #define RXPI BIT(31)
  44. #define NPE GENMASK(23, 16)
  45. #define NVE GENMASK(7, 0)
  46. #define MTL_RXP_IACC_CTRL_STATUS 0x00000cb0
  47. #define STARTBUSY BIT(31)
  48. #define RXPEIEC GENMASK(22, 21)
  49. #define RXPEIEE BIT(20)
  50. #define WRRDN BIT(16)
  51. #define ADDR GENMASK(15, 0)
  52. #define MTL_RXP_IACC_DATA 0x00000cb4
  53. #define MTL_ECC_CONTROL 0x00000cc0
  54. #define MEEAO BIT(8)
  55. #define TSOEE BIT(4)
  56. #define MRXPEE BIT(3)
  57. #define MESTEE BIT(2)
  58. #define MRXEE BIT(1)
  59. #define MTXEE BIT(0)
  60. #define MTL_SAFETY_INT_STATUS 0x00000cc4
  61. #define MCSIS BIT(31)
  62. #define MEUIS BIT(1)
  63. #define MECIS BIT(0)
  64. #define MTL_ECC_INT_ENABLE 0x00000cc8
  65. #define RPCEIE BIT(12)
  66. #define ECEIE BIT(8)
  67. #define RXCEIE BIT(4)
  68. #define TXCEIE BIT(0)
  69. #define MTL_ECC_INT_STATUS 0x00000ccc
  70. #define MTL_DPP_CONTROL 0x00000ce0
  71. #define EPSI BIT(2)
  72. #define OPE BIT(1)
  73. #define EDPP BIT(0)
  74. #define DMA_SAFETY_INT_STATUS 0x00001080
  75. #define MSUIS BIT(29)
  76. #define MSCIS BIT(28)
  77. #define DEUIS BIT(1)
  78. #define DECIS BIT(0)
  79. #define DMA_ECC_INT_ENABLE 0x00001084
  80. #define TCEIE BIT(0)
  81. #define DMA_ECC_INT_STATUS 0x00001088
  82. /* EQoS version 5.xx VLAN Tag Filter Fail Packets Queuing */
  83. #define GMAC_RXQ_CTRL4 0x00000094
  84. #define GMAC_RXQCTRL_VFFQ_MASK GENMASK(19, 17)
  85. #define GMAC_RXQCTRL_VFFQ_SHIFT 17
  86. #define GMAC_RXQCTRL_VFFQE BIT(16)
  87. #define GMAC_INT_FPE_EN BIT(17)
  88. int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp,
  89. struct stmmac_safety_feature_cfg *safety_cfg);
  90. int dwmac5_safety_feat_irq_status(struct net_device *ndev,
  91. void __iomem *ioaddr, unsigned int asp,
  92. struct stmmac_safety_stats *stats);
  93. int dwmac5_safety_feat_dump(struct stmmac_safety_stats *stats,
  94. int index, unsigned long *count, const char **desc);
  95. int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries,
  96. unsigned int count);
  97. int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
  98. struct stmmac_pps_cfg *cfg, bool enable,
  99. u32 sub_second_inc, u32 systime_flags);
  100. void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
  101. u32 num_txq, u32 num_rxq,
  102. bool tx_enable, bool pmac_enable);
  103. void dwmac5_fpe_send_mpacket(void __iomem *ioaddr,
  104. struct stmmac_fpe_cfg *cfg,
  105. enum stmmac_mpacket_type type);
  106. int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev);
  107. int dwmac5_fpe_get_add_frag_size(const void __iomem *ioaddr);
  108. void dwmac5_fpe_set_add_frag_size(void __iomem *ioaddr, u32 add_frag_size);
  109. int dwmac5_fpe_map_preemption_class(struct net_device *ndev,
  110. struct netlink_ext_ack *extack, u32 pclass);
  111. #endif /* __DWMAC5_H__ */