162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Microsemi Ocelot Switch driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2017 Microsemi Corporation
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _MSCC_OCELOT_SYS_H_
962306a36Sopenharmony_ci#define _MSCC_OCELOT_SYS_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define SYS_COUNT_RX_OCTETS_RSZ                           0x4
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define SYS_COUNT_TX_OCTETS_RSZ                           0x4
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define SYS_FRONT_PORT_MODE_RSZ                           0x4
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define SYS_FRONT_PORT_MODE_HDX_MODE                      BIT(0)
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define SYS_FRM_AGING_AGE_TX_ENA                          BIT(20)
2062306a36Sopenharmony_ci#define SYS_FRM_AGING_MAX_AGE(x)                          ((x) & GENMASK(19, 0))
2162306a36Sopenharmony_ci#define SYS_FRM_AGING_MAX_AGE_M                           GENMASK(19, 0)
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT(x)                   (((x) << 10) & GENMASK(16, 10))
2462306a36Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT_M                    GENMASK(16, 10)
2562306a36Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT_X(x)                 (((x) & GENMASK(16, 10)) >> 10)
2662306a36Sopenharmony_ci#define SYS_STAT_CFG_STAT_VIEW(x)                         ((x) & GENMASK(9, 0))
2762306a36Sopenharmony_ci#define SYS_STAT_CFG_STAT_VIEW_M                          GENMASK(9, 0)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define SYS_SW_STATUS_RSZ                                 0x4
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define SYS_SW_STATUS_PORT_RX_PAUSED                      BIT(0)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define SYS_MISC_CFG_PTP_RSRV_CLR                         BIT(1)
3462306a36Sopenharmony_ci#define SYS_MISC_CFG_PTP_DIS_NEG_RO                       BIT(0)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define SYS_REW_MAC_HIGH_CFG_RSZ                          0x4
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define SYS_REW_MAC_LOW_CFG_RSZ                           0x4
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG(x)              (((x) << 6) & GENMASK(21, 6))
4162306a36Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG_M               GENMASK(21, 6)
4262306a36Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG_X(x)            (((x) & GENMASK(21, 6)) >> 6)
4362306a36Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_TIMESTAMP_OFFSET(x)          ((x) & GENMASK(5, 0))
4462306a36Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_TIMESTAMP_OFFSET_M           GENMASK(5, 0)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START(x)              (((x) << 9) & GENMASK(17, 9))
4762306a36Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START_M               GENMASK(17, 9)
4862306a36Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START_X(x)            (((x) & GENMASK(17, 9)) >> 9)
4962306a36Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_STOP(x)               ((x) & GENMASK(8, 0))
5062306a36Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_STOP_M                GENMASK(8, 0)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define SYS_ATOP_RSZ                                      0x4
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_RSZ                                0x4
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED(x)                   (((x) << 26) & GENMASK(27, 26))
5762306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED_M                    GENMASK(27, 26)
5862306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED_X(x)                 (((x) & GENMASK(27, 26)) >> 26)
5962306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG(x)                  (((x) << 20) & GENMASK(25, 20))
6062306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG_M                   GENMASK(25, 20)
6162306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG_X(x)                (((x) & GENMASK(25, 20)) >> 20)
6262306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_ZERO_PAUSE_ENA                     BIT(18)
6362306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_TX_FC_ENA                          BIT(17)
6462306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_RX_FC_ENA                          BIT(16)
6562306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_PAUSE_VAL_CFG(x)                   ((x) & GENMASK(15, 0))
6662306a36Sopenharmony_ci#define SYS_MAC_FC_CFG_PAUSE_VAL_CFG_M                    GENMASK(15, 0)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define SYS_MMGT_RELCNT(x)                                (((x) << 16) & GENMASK(31, 16))
6962306a36Sopenharmony_ci#define SYS_MMGT_RELCNT_M                                 GENMASK(31, 16)
7062306a36Sopenharmony_ci#define SYS_MMGT_RELCNT_X(x)                              (((x) & GENMASK(31, 16)) >> 16)
7162306a36Sopenharmony_ci#define SYS_MMGT_FREECNT(x)                               ((x) & GENMASK(15, 0))
7262306a36Sopenharmony_ci#define SYS_MMGT_FREECNT_M                                GENMASK(15, 0)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD(x)                          (((x) << 4) & GENMASK(7, 4))
7562306a36Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD_M                           GENMASK(7, 4)
7662306a36Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD_X(x)                        (((x) & GENMASK(7, 4)) >> 4)
7762306a36Sopenharmony_ci#define SYS_MMGT_FAST_RELVLD(x)                           ((x) & GENMASK(3, 0))
7862306a36Sopenharmony_ci#define SYS_MMGT_FAST_RELVLD_M                            GENMASK(3, 0)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define SYS_EVENTS_DIF_RSZ                                0x4
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX(x)                          (((x) << 6) & GENMASK(8, 6))
8362306a36Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX_M                           GENMASK(8, 6)
8462306a36Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX_X(x)                        (((x) & GENMASK(8, 6)) >> 6)
8562306a36Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DTX(x)                          ((x) & GENMASK(5, 0))
8662306a36Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DTX_M                           GENMASK(5, 0)
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#define SYS_EVENTS_CORE_EV_FWR                            BIT(2)
8962306a36Sopenharmony_ci#define SYS_EVENTS_CORE_EV_ANA(x)                         ((x) & GENMASK(1, 0))
9062306a36Sopenharmony_ci#define SYS_EVENTS_CORE_EV_ANA_M                          GENMASK(1, 0)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define SYS_CNT_GSZ                                       0x4
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_TXSTAMP_OAM                    BIT(29)
9562306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_OVFL                           BIT(28)
9662306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_VLD                       BIT(27)
9762306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID(x)                     (((x) << 21) & GENMASK(26, 21))
9862306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID_M                      GENMASK(26, 21)
9962306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID_X(x)                   (((x) & GENMASK(26, 21)) >> 21)
10062306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT(x)                 (((x) << 16) & GENMASK(20, 16))
10162306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT_M                  GENMASK(20, 16)
10262306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT_X(x)               (((x) & GENMASK(20, 16)) >> 16)
10362306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_SEQ_ID(x)                 ((x) & GENMASK(15, 0))
10462306a36Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_SEQ_ID_M                  GENMASK(15, 0)
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP(x)                    ((x) & GENMASK(29, 0))
10762306a36Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP_M                     GENMASK(29, 0)
10862306a36Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP_SEC                   BIT(31)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci#define SYS_PTP_NXT_PTP_NXT                               BIT(0)
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID(x)                      (((x) << 2) & GENMASK(7, 2))
11362306a36Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID_M                       GENMASK(7, 2)
11462306a36Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID_X(x)                    (((x) & GENMASK(7, 2)) >> 2)
11562306a36Sopenharmony_ci#define SYS_PTP_CFG_PTP_CF_ROLL_MODE(x)                   ((x) & GENMASK(1, 0))
11662306a36Sopenharmony_ci#define SYS_PTP_CFG_PTP_CF_ROLL_MODE_M                    GENMASK(1, 0)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define SYS_RAM_INIT_RAM_INIT                             BIT(1)
11962306a36Sopenharmony_ci#define SYS_RAM_INIT_RAM_CFG_HOOK                         BIT(0)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#endif
122