ocelot_rew.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  2. /*
  3. * Microsemi Ocelot Switch driver
  4. *
  5. * Copyright (c) 2017 Microsemi Corporation
  6. */
  7. #ifndef _MSCC_OCELOT_REW_H_
  8. #define _MSCC_OCELOT_REW_H_
  9. #define REW_PORT_VLAN_CFG_GSZ 0x80
  10. #define REW_PORT_VLAN_CFG_PORT_TPID(x) (((x) << 16) & GENMASK(31, 16))
  11. #define REW_PORT_VLAN_CFG_PORT_TPID_M GENMASK(31, 16)
  12. #define REW_PORT_VLAN_CFG_PORT_TPID_X(x) (((x) & GENMASK(31, 16)) >> 16)
  13. #define REW_PORT_VLAN_CFG_PORT_DEI BIT(15)
  14. #define REW_PORT_VLAN_CFG_PORT_PCP(x) (((x) << 12) & GENMASK(14, 12))
  15. #define REW_PORT_VLAN_CFG_PORT_PCP_M GENMASK(14, 12)
  16. #define REW_PORT_VLAN_CFG_PORT_PCP_X(x) (((x) & GENMASK(14, 12)) >> 12)
  17. #define REW_PORT_VLAN_CFG_PORT_VID(x) ((x) & GENMASK(11, 0))
  18. #define REW_PORT_VLAN_CFG_PORT_VID_M GENMASK(11, 0)
  19. #define REW_TAG_CFG_GSZ 0x80
  20. #define REW_TAG_CFG_TAG_CFG(x) (((x) << 7) & GENMASK(8, 7))
  21. #define REW_TAG_CFG_TAG_CFG_M GENMASK(8, 7)
  22. #define REW_TAG_CFG_TAG_CFG_X(x) (((x) & GENMASK(8, 7)) >> 7)
  23. #define REW_TAG_CFG_TAG_TPID_CFG(x) (((x) << 5) & GENMASK(6, 5))
  24. #define REW_TAG_CFG_TAG_TPID_CFG_M GENMASK(6, 5)
  25. #define REW_TAG_CFG_TAG_TPID_CFG_X(x) (((x) & GENMASK(6, 5)) >> 5)
  26. #define REW_TAG_CFG_TAG_VID_CFG BIT(4)
  27. #define REW_TAG_CFG_TAG_PCP_CFG(x) (((x) << 2) & GENMASK(3, 2))
  28. #define REW_TAG_CFG_TAG_PCP_CFG_M GENMASK(3, 2)
  29. #define REW_TAG_CFG_TAG_PCP_CFG_X(x) (((x) & GENMASK(3, 2)) >> 2)
  30. #define REW_TAG_CFG_TAG_DEI_CFG(x) ((x) & GENMASK(1, 0))
  31. #define REW_TAG_CFG_TAG_DEI_CFG_M GENMASK(1, 0)
  32. #define REW_PORT_CFG_GSZ 0x80
  33. #define REW_PORT_CFG_ES0_EN BIT(5)
  34. #define REW_PORT_CFG_FCS_UPDATE_NONCPU_CFG(x) (((x) << 3) & GENMASK(4, 3))
  35. #define REW_PORT_CFG_FCS_UPDATE_NONCPU_CFG_M GENMASK(4, 3)
  36. #define REW_PORT_CFG_FCS_UPDATE_NONCPU_CFG_X(x) (((x) & GENMASK(4, 3)) >> 3)
  37. #define REW_PORT_CFG_FCS_UPDATE_CPU_ENA BIT(2)
  38. #define REW_PORT_CFG_FLUSH_ENA BIT(1)
  39. #define REW_PORT_CFG_AGE_DIS BIT(0)
  40. #define REW_DSCP_CFG_GSZ 0x80
  41. #define REW_PCP_DEI_QOS_MAP_CFG_GSZ 0x80
  42. #define REW_PCP_DEI_QOS_MAP_CFG_RSZ 0x4
  43. #define REW_PCP_DEI_QOS_MAP_CFG_DEI_QOS_VAL BIT(3)
  44. #define REW_PCP_DEI_QOS_MAP_CFG_PCP_QOS_VAL(x) ((x) & GENMASK(2, 0))
  45. #define REW_PCP_DEI_QOS_MAP_CFG_PCP_QOS_VAL_M GENMASK(2, 0)
  46. #define REW_PTP_CFG_GSZ 0x80
  47. #define REW_PTP_CFG_PTP_BACKPLANE_MODE BIT(7)
  48. #define REW_PTP_CFG_GP_CFG_UNUSED(x) (((x) << 3) & GENMASK(6, 3))
  49. #define REW_PTP_CFG_GP_CFG_UNUSED_M GENMASK(6, 3)
  50. #define REW_PTP_CFG_GP_CFG_UNUSED_X(x) (((x) & GENMASK(6, 3)) >> 3)
  51. #define REW_PTP_CFG_PTP_1STEP_DIS BIT(2)
  52. #define REW_PTP_CFG_PTP_2STEP_DIS BIT(1)
  53. #define REW_PTP_CFG_PTP_UDP_KEEP BIT(0)
  54. #define REW_PTP_DLY1_CFG_GSZ 0x80
  55. #define REW_RED_TAG_CFG_GSZ 0x80
  56. #define REW_RED_TAG_CFG_RED_TAG_CFG BIT(0)
  57. #define REW_DSCP_REMAP_DP1_CFG_RSZ 0x4
  58. #define REW_DSCP_REMAP_CFG_RSZ 0x4
  59. #define REW_REW_STICKY_ES0_TAGB_PUSH_FAILED BIT(0)
  60. #define REW_PPT_RSZ 0x4
  61. #endif