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