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_QS_H_ 962306a36Sopenharmony_ci#define _MSCC_OCELOT_QS_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* TODO handle BE */ 1262306a36Sopenharmony_ci#define XTR_EOF_0 0x00000080U 1362306a36Sopenharmony_ci#define XTR_EOF_1 0x01000080U 1462306a36Sopenharmony_ci#define XTR_EOF_2 0x02000080U 1562306a36Sopenharmony_ci#define XTR_EOF_3 0x03000080U 1662306a36Sopenharmony_ci#define XTR_PRUNED 0x04000080U 1762306a36Sopenharmony_ci#define XTR_ABORT 0x05000080U 1862306a36Sopenharmony_ci#define XTR_ESCAPE 0x06000080U 1962306a36Sopenharmony_ci#define XTR_NOT_READY 0x07000080U 2062306a36Sopenharmony_ci#define XTR_VALID_BYTES(x) (4 - (((x) >> 24) & 3)) 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_RSZ 0x4 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_MODE(x) (((x) << 2) & GENMASK(3, 2)) 2562306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_MODE_M GENMASK(3, 2) 2662306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_MODE_X(x) (((x) & GENMASK(3, 2)) >> 2) 2762306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_STATUS_WORD_POS BIT(1) 2862306a36Sopenharmony_ci#define QS_XTR_GRP_CFG_BYTE_SWAP BIT(0) 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define QS_XTR_RD_RSZ 0x4 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#define QS_XTR_FRM_PRUNING_RSZ 0x4 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define QS_XTR_CFG_DP_WM(x) (((x) << 5) & GENMASK(7, 5)) 3562306a36Sopenharmony_ci#define QS_XTR_CFG_DP_WM_M GENMASK(7, 5) 3662306a36Sopenharmony_ci#define QS_XTR_CFG_DP_WM_X(x) (((x) & GENMASK(7, 5)) >> 5) 3762306a36Sopenharmony_ci#define QS_XTR_CFG_SCH_WM(x) (((x) << 2) & GENMASK(4, 2)) 3862306a36Sopenharmony_ci#define QS_XTR_CFG_SCH_WM_M GENMASK(4, 2) 3962306a36Sopenharmony_ci#define QS_XTR_CFG_SCH_WM_X(x) (((x) & GENMASK(4, 2)) >> 2) 4062306a36Sopenharmony_ci#define QS_XTR_CFG_OFLW_ERR_STICKY(x) ((x) & GENMASK(1, 0)) 4162306a36Sopenharmony_ci#define QS_XTR_CFG_OFLW_ERR_STICKY_M GENMASK(1, 0) 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define QS_INJ_GRP_CFG_RSZ 0x4 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define QS_INJ_GRP_CFG_MODE(x) (((x) << 2) & GENMASK(3, 2)) 4662306a36Sopenharmony_ci#define QS_INJ_GRP_CFG_MODE_M GENMASK(3, 2) 4762306a36Sopenharmony_ci#define QS_INJ_GRP_CFG_MODE_X(x) (((x) & GENMASK(3, 2)) >> 2) 4862306a36Sopenharmony_ci#define QS_INJ_GRP_CFG_BYTE_SWAP BIT(0) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define QS_INJ_WR_RSZ 0x4 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define QS_INJ_CTRL_RSZ 0x4 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define QS_INJ_CTRL_GAP_SIZE(x) (((x) << 21) & GENMASK(24, 21)) 5562306a36Sopenharmony_ci#define QS_INJ_CTRL_GAP_SIZE_M GENMASK(24, 21) 5662306a36Sopenharmony_ci#define QS_INJ_CTRL_GAP_SIZE_X(x) (((x) & GENMASK(24, 21)) >> 21) 5762306a36Sopenharmony_ci#define QS_INJ_CTRL_ABORT BIT(20) 5862306a36Sopenharmony_ci#define QS_INJ_CTRL_EOF BIT(19) 5962306a36Sopenharmony_ci#define QS_INJ_CTRL_SOF BIT(18) 6062306a36Sopenharmony_ci#define QS_INJ_CTRL_VLD_BYTES(x) (((x) << 16) & GENMASK(17, 16)) 6162306a36Sopenharmony_ci#define QS_INJ_CTRL_VLD_BYTES_M GENMASK(17, 16) 6262306a36Sopenharmony_ci#define QS_INJ_CTRL_VLD_BYTES_X(x) (((x) & GENMASK(17, 16)) >> 16) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define QS_INJ_STATUS_WMARK_REACHED(x) (((x) << 4) & GENMASK(5, 4)) 6562306a36Sopenharmony_ci#define QS_INJ_STATUS_WMARK_REACHED_M GENMASK(5, 4) 6662306a36Sopenharmony_ci#define QS_INJ_STATUS_WMARK_REACHED_X(x) (((x) & GENMASK(5, 4)) >> 4) 6762306a36Sopenharmony_ci#define QS_INJ_STATUS_FIFO_RDY(x) (((x) << 2) & GENMASK(3, 2)) 6862306a36Sopenharmony_ci#define QS_INJ_STATUS_FIFO_RDY_M GENMASK(3, 2) 6962306a36Sopenharmony_ci#define QS_INJ_STATUS_FIFO_RDY_X(x) (((x) & GENMASK(3, 2)) >> 2) 7062306a36Sopenharmony_ci#define QS_INJ_STATUS_INJ_IN_PROGRESS(x) ((x) & GENMASK(1, 0)) 7162306a36Sopenharmony_ci#define QS_INJ_STATUS_INJ_IN_PROGRESS_M GENMASK(1, 0) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define QS_INJ_ERR_RSZ 0x4 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define QS_INJ_ERR_ABORT_ERR_STICKY BIT(1) 7662306a36Sopenharmony_ci#define QS_INJ_ERR_WR_ERR_STICKY BIT(0) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#endif 79