18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Microsemi Ocelot Switch driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2017 Microsemi Corporation
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _MSCC_OCELOT_SYS_H_
98c2ecf20Sopenharmony_ci#define _MSCC_OCELOT_SYS_H_
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define SYS_COUNT_RX_OCTETS_RSZ                           0x4
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define SYS_COUNT_TX_OCTETS_RSZ                           0x4
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define SYS_FRONT_PORT_MODE_RSZ                           0x4
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define SYS_FRONT_PORT_MODE_HDX_MODE                      BIT(0)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define SYS_FRM_AGING_AGE_TX_ENA                          BIT(20)
208c2ecf20Sopenharmony_ci#define SYS_FRM_AGING_MAX_AGE(x)                          ((x) & GENMASK(19, 0))
218c2ecf20Sopenharmony_ci#define SYS_FRM_AGING_MAX_AGE_M                           GENMASK(19, 0)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT(x)                   (((x) << 10) & GENMASK(16, 10))
248c2ecf20Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT_M                    GENMASK(16, 10)
258c2ecf20Sopenharmony_ci#define SYS_STAT_CFG_STAT_CLEAR_SHOT_X(x)                 (((x) & GENMASK(16, 10)) >> 10)
268c2ecf20Sopenharmony_ci#define SYS_STAT_CFG_STAT_VIEW(x)                         ((x) & GENMASK(9, 0))
278c2ecf20Sopenharmony_ci#define SYS_STAT_CFG_STAT_VIEW_M                          GENMASK(9, 0)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define SYS_SW_STATUS_RSZ                                 0x4
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define SYS_SW_STATUS_PORT_RX_PAUSED                      BIT(0)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define SYS_MISC_CFG_PTP_RSRV_CLR                         BIT(1)
348c2ecf20Sopenharmony_ci#define SYS_MISC_CFG_PTP_DIS_NEG_RO                       BIT(0)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define SYS_REW_MAC_HIGH_CFG_RSZ                          0x4
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define SYS_REW_MAC_LOW_CFG_RSZ                           0x4
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG(x)              (((x) << 6) & GENMASK(21, 6))
418c2ecf20Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG_M               GENMASK(21, 6)
428c2ecf20Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_ETH_TYPE_CFG_X(x)            (((x) & GENMASK(21, 6)) >> 6)
438c2ecf20Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_TIMESTAMP_OFFSET(x)          ((x) & GENMASK(5, 0))
448c2ecf20Sopenharmony_ci#define SYS_TIMESTAMP_OFFSET_TIMESTAMP_OFFSET_M           GENMASK(5, 0)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START(x)              (((x) << 9) & GENMASK(17, 9))
478c2ecf20Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START_M               GENMASK(17, 9)
488c2ecf20Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_START_X(x)            (((x) & GENMASK(17, 9)) >> 9)
498c2ecf20Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_STOP(x)               ((x) & GENMASK(8, 0))
508c2ecf20Sopenharmony_ci#define SYS_PAUSE_TOT_CFG_PAUSE_TOT_STOP_M                GENMASK(8, 0)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define SYS_ATOP_RSZ                                      0x4
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_RSZ                                0x4
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED(x)                   (((x) << 26) & GENMASK(27, 26))
578c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED_M                    GENMASK(27, 26)
588c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LINK_SPEED_X(x)                 (((x) & GENMASK(27, 26)) >> 26)
598c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG(x)                  (((x) << 20) & GENMASK(25, 20))
608c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG_M                   GENMASK(25, 20)
618c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_FC_LATENCY_CFG_X(x)                (((x) & GENMASK(25, 20)) >> 20)
628c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_ZERO_PAUSE_ENA                     BIT(18)
638c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_TX_FC_ENA                          BIT(17)
648c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_RX_FC_ENA                          BIT(16)
658c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_PAUSE_VAL_CFG(x)                   ((x) & GENMASK(15, 0))
668c2ecf20Sopenharmony_ci#define SYS_MAC_FC_CFG_PAUSE_VAL_CFG_M                    GENMASK(15, 0)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define SYS_MMGT_RELCNT(x)                                (((x) << 16) & GENMASK(31, 16))
698c2ecf20Sopenharmony_ci#define SYS_MMGT_RELCNT_M                                 GENMASK(31, 16)
708c2ecf20Sopenharmony_ci#define SYS_MMGT_RELCNT_X(x)                              (((x) & GENMASK(31, 16)) >> 16)
718c2ecf20Sopenharmony_ci#define SYS_MMGT_FREECNT(x)                               ((x) & GENMASK(15, 0))
728c2ecf20Sopenharmony_ci#define SYS_MMGT_FREECNT_M                                GENMASK(15, 0)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD(x)                          (((x) << 4) & GENMASK(7, 4))
758c2ecf20Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD_M                           GENMASK(7, 4)
768c2ecf20Sopenharmony_ci#define SYS_MMGT_FAST_FREEVLD_X(x)                        (((x) & GENMASK(7, 4)) >> 4)
778c2ecf20Sopenharmony_ci#define SYS_MMGT_FAST_RELVLD(x)                           ((x) & GENMASK(3, 0))
788c2ecf20Sopenharmony_ci#define SYS_MMGT_FAST_RELVLD_M                            GENMASK(3, 0)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_RSZ                                0x4
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX(x)                          (((x) << 6) & GENMASK(8, 6))
838c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX_M                           GENMASK(8, 6)
848c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DRX_X(x)                        (((x) & GENMASK(8, 6)) >> 6)
858c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DTX(x)                          ((x) & GENMASK(5, 0))
868c2ecf20Sopenharmony_ci#define SYS_EVENTS_DIF_EV_DTX_M                           GENMASK(5, 0)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define SYS_EVENTS_CORE_EV_FWR                            BIT(2)
898c2ecf20Sopenharmony_ci#define SYS_EVENTS_CORE_EV_ANA(x)                         ((x) & GENMASK(1, 0))
908c2ecf20Sopenharmony_ci#define SYS_EVENTS_CORE_EV_ANA_M                          GENMASK(1, 0)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define SYS_CNT_GSZ                                       0x4
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_TXSTAMP_OAM                    BIT(29)
958c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_OVFL                           BIT(28)
968c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_VLD                       BIT(27)
978c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID(x)                     (((x) << 21) & GENMASK(26, 21))
988c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID_M                      GENMASK(26, 21)
998c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_ID_X(x)                   (((x) & GENMASK(26, 21)) >> 21)
1008c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT(x)                 (((x) << 16) & GENMASK(20, 16))
1018c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT_M                  GENMASK(20, 16)
1028c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_TXPORT_X(x)               (((x) & GENMASK(20, 16)) >> 16)
1038c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_SEQ_ID(x)                 ((x) & GENMASK(15, 0))
1048c2ecf20Sopenharmony_ci#define SYS_PTP_STATUS_PTP_MESS_SEQ_ID_M                  GENMASK(15, 0)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP(x)                    ((x) & GENMASK(29, 0))
1078c2ecf20Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP_M                     GENMASK(29, 0)
1088c2ecf20Sopenharmony_ci#define SYS_PTP_TXSTAMP_PTP_TXSTAMP_SEC                   BIT(31)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define SYS_PTP_NXT_PTP_NXT                               BIT(0)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID(x)                      (((x) << 2) & GENMASK(7, 2))
1138c2ecf20Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID_M                       GENMASK(7, 2)
1148c2ecf20Sopenharmony_ci#define SYS_PTP_CFG_PTP_STAMP_WID_X(x)                    (((x) & GENMASK(7, 2)) >> 2)
1158c2ecf20Sopenharmony_ci#define SYS_PTP_CFG_PTP_CF_ROLL_MODE(x)                   ((x) & GENMASK(1, 0))
1168c2ecf20Sopenharmony_ci#define SYS_PTP_CFG_PTP_CF_ROLL_MODE_M                    GENMASK(1, 0)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define SYS_RAM_INIT_RAM_INIT                             BIT(1)
1198c2ecf20Sopenharmony_ci#define SYS_RAM_INIT_RAM_CFG_HOOK                         BIT(0)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#endif
122