18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* ********************************************************************* 38c2ecf20Sopenharmony_ci * SB1250 Board Support Package 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * MAC constants and macros File: sb1250_mac.h 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This module contains constants and macros for the SB1250's 88c2ecf20Sopenharmony_ci * ethernet controllers. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * SB1250 specification level: User's manual 1/02/02 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci ********************************************************************* 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * Copyright 2000,2001,2002,2003 158c2ecf20Sopenharmony_ci * Broadcom Corporation. All rights reserved. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci ********************************************************************* */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifndef _SB1250_MAC_H 218c2ecf20Sopenharmony_ci#define _SB1250_MAC_H 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include <asm/sibyte/sb1250_defs.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* ********************************************************************* 268c2ecf20Sopenharmony_ci * Ethernet MAC Registers 278c2ecf20Sopenharmony_ci ********************************************************************* */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* 308c2ecf20Sopenharmony_ci * MAC Configuration Register (Table 9-13) 318c2ecf20Sopenharmony_ci * Register: MAC_CFG_0 328c2ecf20Sopenharmony_ci * Register: MAC_CFG_1 338c2ecf20Sopenharmony_ci * Register: MAC_CFG_2 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define M_MAC_RESERVED0 _SB_MAKEMASK1(0) 388c2ecf20Sopenharmony_ci#define M_MAC_TX_HOLD_SOP_EN _SB_MAKEMASK1(1) 398c2ecf20Sopenharmony_ci#define M_MAC_RETRY_EN _SB_MAKEMASK1(2) 408c2ecf20Sopenharmony_ci#define M_MAC_RET_DRPREQ_EN _SB_MAKEMASK1(3) 418c2ecf20Sopenharmony_ci#define M_MAC_RET_UFL_EN _SB_MAKEMASK1(4) 428c2ecf20Sopenharmony_ci#define M_MAC_BURST_EN _SB_MAKEMASK1(5) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define S_MAC_TX_PAUSE _SB_MAKE64(6) 458c2ecf20Sopenharmony_ci#define M_MAC_TX_PAUSE_CNT _SB_MAKEMASK(3, S_MAC_TX_PAUSE) 468c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT(x) _SB_MAKEVALUE(x, S_MAC_TX_PAUSE) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_512 0 498c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_1K 1 508c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_2K 2 518c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_4K 3 528c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_8K 4 538c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_16K 5 548c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_32K 6 558c2ecf20Sopenharmony_ci#define K_MAC_TX_PAUSE_CNT_64K 7 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_512 V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_512) 588c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_1K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_1K) 598c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_2K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_2K) 608c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_4K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_4K) 618c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_8K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_8K) 628c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_16K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_16K) 638c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_32K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_32K) 648c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_CNT_64K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_64K) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define M_MAC_RESERVED1 _SB_MAKEMASK(8, 9) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE_CHIP(1480) 718c2ecf20Sopenharmony_ci#define M_MAC_TIMESTAMP _SB_MAKEMASK1(18) 728c2ecf20Sopenharmony_ci#endif 738c2ecf20Sopenharmony_ci#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19) 748c2ecf20Sopenharmony_ci#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20) 758c2ecf20Sopenharmony_ci#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21) 768c2ecf20Sopenharmony_ci#define M_MAC_DRP_DRBLERRPKT_EN _SB_MAKEMASK1(22) 778c2ecf20Sopenharmony_ci#define M_MAC_DRP_RNTPKT_EN _SB_MAKEMASK1(23) 788c2ecf20Sopenharmony_ci#define M_MAC_DRP_OSZPKT_EN _SB_MAKEMASK1(24) 798c2ecf20Sopenharmony_ci#define M_MAC_DRP_LENERRPKT_EN _SB_MAKEMASK1(25) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define M_MAC_RESERVED3 _SB_MAKEMASK(6, 26) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define M_MAC_BYPASS_SEL _SB_MAKEMASK1(32) 848c2ecf20Sopenharmony_ci#define M_MAC_HDX_EN _SB_MAKEMASK1(33) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define S_MAC_SPEED_SEL _SB_MAKE64(34) 878c2ecf20Sopenharmony_ci#define M_MAC_SPEED_SEL _SB_MAKEMASK(2, S_MAC_SPEED_SEL) 888c2ecf20Sopenharmony_ci#define V_MAC_SPEED_SEL(x) _SB_MAKEVALUE(x, S_MAC_SPEED_SEL) 898c2ecf20Sopenharmony_ci#define G_MAC_SPEED_SEL(x) _SB_GETVALUE(x, S_MAC_SPEED_SEL, M_MAC_SPEED_SEL) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define K_MAC_SPEED_SEL_10MBPS 0 928c2ecf20Sopenharmony_ci#define K_MAC_SPEED_SEL_100MBPS 1 938c2ecf20Sopenharmony_ci#define K_MAC_SPEED_SEL_1000MBPS 2 948c2ecf20Sopenharmony_ci#define K_MAC_SPEED_SEL_RESERVED 3 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define V_MAC_SPEED_SEL_10MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_10MBPS) 978c2ecf20Sopenharmony_ci#define V_MAC_SPEED_SEL_100MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_100MBPS) 988c2ecf20Sopenharmony_ci#define V_MAC_SPEED_SEL_1000MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_1000MBPS) 998c2ecf20Sopenharmony_ci#define V_MAC_SPEED_SEL_RESERVED V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_RESERVED) 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define M_MAC_TX_CLK_EDGE_SEL _SB_MAKEMASK1(36) 1028c2ecf20Sopenharmony_ci#define M_MAC_LOOPBACK_SEL _SB_MAKEMASK1(37) 1038c2ecf20Sopenharmony_ci#define M_MAC_FAST_SYNC _SB_MAKEMASK1(38) 1048c2ecf20Sopenharmony_ci#define M_MAC_SS_EN _SB_MAKEMASK1(39) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define S_MAC_BYPASS_CFG _SB_MAKE64(40) 1078c2ecf20Sopenharmony_ci#define M_MAC_BYPASS_CFG _SB_MAKEMASK(2, S_MAC_BYPASS_CFG) 1088c2ecf20Sopenharmony_ci#define V_MAC_BYPASS_CFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_CFG) 1098c2ecf20Sopenharmony_ci#define G_MAC_BYPASS_CFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_CFG, M_MAC_BYPASS_CFG) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define K_MAC_BYPASS_GMII 0 1128c2ecf20Sopenharmony_ci#define K_MAC_BYPASS_ENCODED 1 1138c2ecf20Sopenharmony_ci#define K_MAC_BYPASS_SOP 2 1148c2ecf20Sopenharmony_ci#define K_MAC_BYPASS_EOP 3 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) 1178c2ecf20Sopenharmony_ci#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 1208c2ecf20Sopenharmony_ci#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) 1218c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480*/ 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 1248c2ecf20Sopenharmony_ci#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) 1258c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 || 1480 */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define S_MAC_BYPASS_IFG _SB_MAKE64(46) 1288c2ecf20Sopenharmony_ci#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8, S_MAC_BYPASS_IFG) 1298c2ecf20Sopenharmony_ci#define V_MAC_BYPASS_IFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_IFG) 1308c2ecf20Sopenharmony_ci#define G_MAC_BYPASS_IFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_IFG, M_MAC_BYPASS_IFG) 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define K_MAC_FC_CMD_DISABLED 0 1338c2ecf20Sopenharmony_ci#define K_MAC_FC_CMD_ENABLED 1 1348c2ecf20Sopenharmony_ci#define K_MAC_FC_CMD_ENAB_FALSECARR 2 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#define V_MAC_FC_CMD_DISABLED V_MAC_FC_CMD(K_MAC_FC_CMD_DISABLED) 1378c2ecf20Sopenharmony_ci#define V_MAC_FC_CMD_ENABLED V_MAC_FC_CMD(K_MAC_FC_CMD_ENABLED) 1388c2ecf20Sopenharmony_ci#define V_MAC_FC_CMD_ENAB_FALSECARR V_MAC_FC_CMD(K_MAC_FC_CMD_ENAB_FALSECARR) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci#define M_MAC_FC_SEL _SB_MAKEMASK1(54) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define S_MAC_FC_CMD _SB_MAKE64(55) 1438c2ecf20Sopenharmony_ci#define M_MAC_FC_CMD _SB_MAKEMASK(2, S_MAC_FC_CMD) 1448c2ecf20Sopenharmony_ci#define V_MAC_FC_CMD(x) _SB_MAKEVALUE(x, S_MAC_FC_CMD) 1458c2ecf20Sopenharmony_ci#define G_MAC_FC_CMD(x) _SB_GETVALUE(x, S_MAC_FC_CMD, M_MAC_FC_CMD) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define S_MAC_RX_CH_SEL _SB_MAKE64(57) 1488c2ecf20Sopenharmony_ci#define M_MAC_RX_CH_SEL _SB_MAKEMASK(7, S_MAC_RX_CH_SEL) 1498c2ecf20Sopenharmony_ci#define V_MAC_RX_CH_SEL(x) _SB_MAKEVALUE(x, S_MAC_RX_CH_SEL) 1508c2ecf20Sopenharmony_ci#define G_MAC_RX_CH_SEL(x) _SB_GETVALUE(x, S_MAC_RX_CH_SEL, M_MAC_RX_CH_SEL) 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci/* 1548c2ecf20Sopenharmony_ci * MAC Enable Registers 1558c2ecf20Sopenharmony_ci * Register: MAC_ENABLE_0 1568c2ecf20Sopenharmony_ci * Register: MAC_ENABLE_1 1578c2ecf20Sopenharmony_ci * Register: MAC_ENABLE_2 1588c2ecf20Sopenharmony_ci */ 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define M_MAC_RXDMA_EN0 _SB_MAKEMASK1(0) 1618c2ecf20Sopenharmony_ci#define M_MAC_RXDMA_EN1 _SB_MAKEMASK1(1) 1628c2ecf20Sopenharmony_ci#define M_MAC_TXDMA_EN0 _SB_MAKEMASK1(4) 1638c2ecf20Sopenharmony_ci#define M_MAC_TXDMA_EN1 _SB_MAKEMASK1(5) 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define M_MAC_PORT_RESET _SB_MAKEMASK1(8) 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#if (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x)) 1688c2ecf20Sopenharmony_ci#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10) 1698c2ecf20Sopenharmony_ci#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11) 1708c2ecf20Sopenharmony_ci#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12) 1718c2ecf20Sopenharmony_ci#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13) 1728c2ecf20Sopenharmony_ci#endif 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* 1758c2ecf20Sopenharmony_ci * MAC reset information register (1280/1255) 1768c2ecf20Sopenharmony_ci */ 1778c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE_CHIP(1480) 1788c2ecf20Sopenharmony_ci#define M_MAC_RX_CH0_PAUSE_ON _SB_MAKEMASK1(8) 1798c2ecf20Sopenharmony_ci#define M_MAC_RX_CH1_PAUSE_ON _SB_MAKEMASK1(16) 1808c2ecf20Sopenharmony_ci#define M_MAC_TX_CH0_PAUSE_ON _SB_MAKEMASK1(24) 1818c2ecf20Sopenharmony_ci#define M_MAC_TX_CH1_PAUSE_ON _SB_MAKEMASK1(32) 1828c2ecf20Sopenharmony_ci#endif 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci/* 1858c2ecf20Sopenharmony_ci * MAC DMA Control Register 1868c2ecf20Sopenharmony_ci * Register: MAC_TXD_CTL_0 1878c2ecf20Sopenharmony_ci * Register: MAC_TXD_CTL_1 1888c2ecf20Sopenharmony_ci * Register: MAC_TXD_CTL_2 1898c2ecf20Sopenharmony_ci */ 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#define S_MAC_TXD_WEIGHT0 _SB_MAKE64(0) 1928c2ecf20Sopenharmony_ci#define M_MAC_TXD_WEIGHT0 _SB_MAKEMASK(4, S_MAC_TXD_WEIGHT0) 1938c2ecf20Sopenharmony_ci#define V_MAC_TXD_WEIGHT0(x) _SB_MAKEVALUE(x, S_MAC_TXD_WEIGHT0) 1948c2ecf20Sopenharmony_ci#define G_MAC_TXD_WEIGHT0(x) _SB_GETVALUE(x, S_MAC_TXD_WEIGHT0, M_MAC_TXD_WEIGHT0) 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define S_MAC_TXD_WEIGHT1 _SB_MAKE64(4) 1978c2ecf20Sopenharmony_ci#define M_MAC_TXD_WEIGHT1 _SB_MAKEMASK(4, S_MAC_TXD_WEIGHT1) 1988c2ecf20Sopenharmony_ci#define V_MAC_TXD_WEIGHT1(x) _SB_MAKEVALUE(x, S_MAC_TXD_WEIGHT1) 1998c2ecf20Sopenharmony_ci#define G_MAC_TXD_WEIGHT1(x) _SB_GETVALUE(x, S_MAC_TXD_WEIGHT1, M_MAC_TXD_WEIGHT1) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* 2028c2ecf20Sopenharmony_ci * MAC Fifo Threshold registers (Table 9-14) 2038c2ecf20Sopenharmony_ci * Register: MAC_THRSH_CFG_0 2048c2ecf20Sopenharmony_ci * Register: MAC_THRSH_CFG_1 2058c2ecf20Sopenharmony_ci * Register: MAC_THRSH_CFG_2 2068c2ecf20Sopenharmony_ci */ 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define S_MAC_TX_WR_THRSH _SB_MAKE64(0) 2098c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1) 2108c2ecf20Sopenharmony_ci/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 2118c2ecf20Sopenharmony_ci/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6, S_MAC_TX_WR_THRSH) */ 2128c2ecf20Sopenharmony_ci#endif /* up to 1250 PASS1 */ 2138c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 2148c2ecf20Sopenharmony_ci#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7, S_MAC_TX_WR_THRSH) 2158c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 2168c2ecf20Sopenharmony_ci#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x, S_MAC_TX_WR_THRSH) 2178c2ecf20Sopenharmony_ci#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x, S_MAC_TX_WR_THRSH, M_MAC_TX_WR_THRSH) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define S_MAC_TX_RD_THRSH _SB_MAKE64(8) 2208c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1) 2218c2ecf20Sopenharmony_ci/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 2228c2ecf20Sopenharmony_ci/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6, S_MAC_TX_RD_THRSH) */ 2238c2ecf20Sopenharmony_ci#endif /* up to 1250 PASS1 */ 2248c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 2258c2ecf20Sopenharmony_ci#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7, S_MAC_TX_RD_THRSH) 2268c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 2278c2ecf20Sopenharmony_ci#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x, S_MAC_TX_RD_THRSH) 2288c2ecf20Sopenharmony_ci#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x, S_MAC_TX_RD_THRSH, M_MAC_TX_RD_THRSH) 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci#define S_MAC_TX_RL_THRSH _SB_MAKE64(16) 2318c2ecf20Sopenharmony_ci#define M_MAC_TX_RL_THRSH _SB_MAKEMASK(4, S_MAC_TX_RL_THRSH) 2328c2ecf20Sopenharmony_ci#define V_MAC_TX_RL_THRSH(x) _SB_MAKEVALUE(x, S_MAC_TX_RL_THRSH) 2338c2ecf20Sopenharmony_ci#define G_MAC_TX_RL_THRSH(x) _SB_GETVALUE(x, S_MAC_TX_RL_THRSH, M_MAC_TX_RL_THRSH) 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci#define S_MAC_RX_PL_THRSH _SB_MAKE64(24) 2368c2ecf20Sopenharmony_ci#define M_MAC_RX_PL_THRSH _SB_MAKEMASK(6, S_MAC_RX_PL_THRSH) 2378c2ecf20Sopenharmony_ci#define V_MAC_RX_PL_THRSH(x) _SB_MAKEVALUE(x, S_MAC_RX_PL_THRSH) 2388c2ecf20Sopenharmony_ci#define G_MAC_RX_PL_THRSH(x) _SB_GETVALUE(x, S_MAC_RX_PL_THRSH, M_MAC_RX_PL_THRSH) 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci#define S_MAC_RX_RD_THRSH _SB_MAKE64(32) 2418c2ecf20Sopenharmony_ci#define M_MAC_RX_RD_THRSH _SB_MAKEMASK(6, S_MAC_RX_RD_THRSH) 2428c2ecf20Sopenharmony_ci#define V_MAC_RX_RD_THRSH(x) _SB_MAKEVALUE(x, S_MAC_RX_RD_THRSH) 2438c2ecf20Sopenharmony_ci#define G_MAC_RX_RD_THRSH(x) _SB_GETVALUE(x, S_MAC_RX_RD_THRSH, M_MAC_RX_RD_THRSH) 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#define S_MAC_RX_RL_THRSH _SB_MAKE64(40) 2468c2ecf20Sopenharmony_ci#define M_MAC_RX_RL_THRSH _SB_MAKEMASK(6, S_MAC_RX_RL_THRSH) 2478c2ecf20Sopenharmony_ci#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x, S_MAC_RX_RL_THRSH) 2488c2ecf20Sopenharmony_ci#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x, S_MAC_RX_RL_THRSH, M_MAC_RX_RL_THRSH) 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 2518c2ecf20Sopenharmony_ci#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) 2528c2ecf20Sopenharmony_ci#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6, S_MAC_ENC_FC_THRSH) 2538c2ecf20Sopenharmony_ci#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x, S_MAC_ENC_FC_THRSH) 2548c2ecf20Sopenharmony_ci#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x, S_MAC_ENC_FC_THRSH, M_MAC_ENC_FC_THRSH) 2558c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/* 2588c2ecf20Sopenharmony_ci * MAC Frame Configuration Registers (Table 9-15) 2598c2ecf20Sopenharmony_ci * Register: MAC_FRAME_CFG_0 2608c2ecf20Sopenharmony_ci * Register: MAC_FRAME_CFG_1 2618c2ecf20Sopenharmony_ci * Register: MAC_FRAME_CFG_2 2628c2ecf20Sopenharmony_ci */ 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci/* XXXCGD: ??? Unused in pass2? */ 2658c2ecf20Sopenharmony_ci#define S_MAC_IFG_RX _SB_MAKE64(0) 2668c2ecf20Sopenharmony_ci#define M_MAC_IFG_RX _SB_MAKEMASK(6, S_MAC_IFG_RX) 2678c2ecf20Sopenharmony_ci#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x, S_MAC_IFG_RX) 2688c2ecf20Sopenharmony_ci#define G_MAC_IFG_RX(x) _SB_GETVALUE(x, S_MAC_IFG_RX, M_MAC_IFG_RX) 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 2718c2ecf20Sopenharmony_ci#define S_MAC_PRE_LEN _SB_MAKE64(0) 2728c2ecf20Sopenharmony_ci#define M_MAC_PRE_LEN _SB_MAKEMASK(6, S_MAC_PRE_LEN) 2738c2ecf20Sopenharmony_ci#define V_MAC_PRE_LEN(x) _SB_MAKEVALUE(x, S_MAC_PRE_LEN) 2748c2ecf20Sopenharmony_ci#define G_MAC_PRE_LEN(x) _SB_GETVALUE(x, S_MAC_PRE_LEN, M_MAC_PRE_LEN) 2758c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 || 1480 */ 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci#define S_MAC_IFG_TX _SB_MAKE64(6) 2788c2ecf20Sopenharmony_ci#define M_MAC_IFG_TX _SB_MAKEMASK(6, S_MAC_IFG_TX) 2798c2ecf20Sopenharmony_ci#define V_MAC_IFG_TX(x) _SB_MAKEVALUE(x, S_MAC_IFG_TX) 2808c2ecf20Sopenharmony_ci#define G_MAC_IFG_TX(x) _SB_GETVALUE(x, S_MAC_IFG_TX, M_MAC_IFG_TX) 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci#define S_MAC_IFG_THRSH _SB_MAKE64(12) 2838c2ecf20Sopenharmony_ci#define M_MAC_IFG_THRSH _SB_MAKEMASK(6, S_MAC_IFG_THRSH) 2848c2ecf20Sopenharmony_ci#define V_MAC_IFG_THRSH(x) _SB_MAKEVALUE(x, S_MAC_IFG_THRSH) 2858c2ecf20Sopenharmony_ci#define G_MAC_IFG_THRSH(x) _SB_GETVALUE(x, S_MAC_IFG_THRSH, M_MAC_IFG_THRSH) 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci#define S_MAC_BACKOFF_SEL _SB_MAKE64(18) 2888c2ecf20Sopenharmony_ci#define M_MAC_BACKOFF_SEL _SB_MAKEMASK(4, S_MAC_BACKOFF_SEL) 2898c2ecf20Sopenharmony_ci#define V_MAC_BACKOFF_SEL(x) _SB_MAKEVALUE(x, S_MAC_BACKOFF_SEL) 2908c2ecf20Sopenharmony_ci#define G_MAC_BACKOFF_SEL(x) _SB_GETVALUE(x, S_MAC_BACKOFF_SEL, M_MAC_BACKOFF_SEL) 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci#define S_MAC_LFSR_SEED _SB_MAKE64(22) 2938c2ecf20Sopenharmony_ci#define M_MAC_LFSR_SEED _SB_MAKEMASK(8, S_MAC_LFSR_SEED) 2948c2ecf20Sopenharmony_ci#define V_MAC_LFSR_SEED(x) _SB_MAKEVALUE(x, S_MAC_LFSR_SEED) 2958c2ecf20Sopenharmony_ci#define G_MAC_LFSR_SEED(x) _SB_GETVALUE(x, S_MAC_LFSR_SEED, M_MAC_LFSR_SEED) 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci#define S_MAC_SLOT_SIZE _SB_MAKE64(30) 2988c2ecf20Sopenharmony_ci#define M_MAC_SLOT_SIZE _SB_MAKEMASK(10, S_MAC_SLOT_SIZE) 2998c2ecf20Sopenharmony_ci#define V_MAC_SLOT_SIZE(x) _SB_MAKEVALUE(x, S_MAC_SLOT_SIZE) 3008c2ecf20Sopenharmony_ci#define G_MAC_SLOT_SIZE(x) _SB_GETVALUE(x, S_MAC_SLOT_SIZE, M_MAC_SLOT_SIZE) 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci#define S_MAC_MIN_FRAMESZ _SB_MAKE64(40) 3038c2ecf20Sopenharmony_ci#define M_MAC_MIN_FRAMESZ _SB_MAKEMASK(8, S_MAC_MIN_FRAMESZ) 3048c2ecf20Sopenharmony_ci#define V_MAC_MIN_FRAMESZ(x) _SB_MAKEVALUE(x, S_MAC_MIN_FRAMESZ) 3058c2ecf20Sopenharmony_ci#define G_MAC_MIN_FRAMESZ(x) _SB_GETVALUE(x, S_MAC_MIN_FRAMESZ, M_MAC_MIN_FRAMESZ) 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#define S_MAC_MAX_FRAMESZ _SB_MAKE64(48) 3088c2ecf20Sopenharmony_ci#define M_MAC_MAX_FRAMESZ _SB_MAKEMASK(16, S_MAC_MAX_FRAMESZ) 3098c2ecf20Sopenharmony_ci#define V_MAC_MAX_FRAMESZ(x) _SB_MAKEVALUE(x, S_MAC_MAX_FRAMESZ) 3108c2ecf20Sopenharmony_ci#define G_MAC_MAX_FRAMESZ(x) _SB_GETVALUE(x, S_MAC_MAX_FRAMESZ, M_MAC_MAX_FRAMESZ) 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/* 3138c2ecf20Sopenharmony_ci * These constants are used to configure the fields within the Frame 3148c2ecf20Sopenharmony_ci * Configuration Register. 3158c2ecf20Sopenharmony_ci */ 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define K_MAC_IFG_RX_10 _SB_MAKE64(0) /* See table 176, not used */ 3188c2ecf20Sopenharmony_ci#define K_MAC_IFG_RX_100 _SB_MAKE64(0) 3198c2ecf20Sopenharmony_ci#define K_MAC_IFG_RX_1000 _SB_MAKE64(0) 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci#define K_MAC_IFG_TX_10 _SB_MAKE64(20) 3228c2ecf20Sopenharmony_ci#define K_MAC_IFG_TX_100 _SB_MAKE64(20) 3238c2ecf20Sopenharmony_ci#define K_MAC_IFG_TX_1000 _SB_MAKE64(8) 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci#define K_MAC_IFG_THRSH_10 _SB_MAKE64(4) 3268c2ecf20Sopenharmony_ci#define K_MAC_IFG_THRSH_100 _SB_MAKE64(4) 3278c2ecf20Sopenharmony_ci#define K_MAC_IFG_THRSH_1000 _SB_MAKE64(0) 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define K_MAC_SLOT_SIZE_10 _SB_MAKE64(0) 3308c2ecf20Sopenharmony_ci#define K_MAC_SLOT_SIZE_100 _SB_MAKE64(0) 3318c2ecf20Sopenharmony_ci#define K_MAC_SLOT_SIZE_1000 _SB_MAKE64(0) 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci#define V_MAC_IFG_RX_10 V_MAC_IFG_RX(K_MAC_IFG_RX_10) 3348c2ecf20Sopenharmony_ci#define V_MAC_IFG_RX_100 V_MAC_IFG_RX(K_MAC_IFG_RX_100) 3358c2ecf20Sopenharmony_ci#define V_MAC_IFG_RX_1000 V_MAC_IFG_RX(K_MAC_IFG_RX_1000) 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci#define V_MAC_IFG_TX_10 V_MAC_IFG_TX(K_MAC_IFG_TX_10) 3388c2ecf20Sopenharmony_ci#define V_MAC_IFG_TX_100 V_MAC_IFG_TX(K_MAC_IFG_TX_100) 3398c2ecf20Sopenharmony_ci#define V_MAC_IFG_TX_1000 V_MAC_IFG_TX(K_MAC_IFG_TX_1000) 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci#define V_MAC_IFG_THRSH_10 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_10) 3428c2ecf20Sopenharmony_ci#define V_MAC_IFG_THRSH_100 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_100) 3438c2ecf20Sopenharmony_ci#define V_MAC_IFG_THRSH_1000 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_1000) 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define V_MAC_SLOT_SIZE_10 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_10) 3468c2ecf20Sopenharmony_ci#define V_MAC_SLOT_SIZE_100 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_100) 3478c2ecf20Sopenharmony_ci#define V_MAC_SLOT_SIZE_1000 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_1000) 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci#define K_MAC_MIN_FRAMESZ_FIFO _SB_MAKE64(9) 3508c2ecf20Sopenharmony_ci#define K_MAC_MIN_FRAMESZ_DEFAULT _SB_MAKE64(64) 3518c2ecf20Sopenharmony_ci#define K_MAC_MAX_FRAMESZ_DEFAULT _SB_MAKE64(1518) 3528c2ecf20Sopenharmony_ci#define K_MAC_MAX_FRAMESZ_JUMBO _SB_MAKE64(9216) 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci#define V_MAC_MIN_FRAMESZ_FIFO V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_FIFO) 3558c2ecf20Sopenharmony_ci#define V_MAC_MIN_FRAMESZ_DEFAULT V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_DEFAULT) 3568c2ecf20Sopenharmony_ci#define V_MAC_MAX_FRAMESZ_DEFAULT V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_DEFAULT) 3578c2ecf20Sopenharmony_ci#define V_MAC_MAX_FRAMESZ_JUMBO V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_JUMBO) 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci/* 3608c2ecf20Sopenharmony_ci * MAC VLAN Tag Registers (Table 9-16) 3618c2ecf20Sopenharmony_ci * Register: MAC_VLANTAG_0 3628c2ecf20Sopenharmony_ci * Register: MAC_VLANTAG_1 3638c2ecf20Sopenharmony_ci * Register: MAC_VLANTAG_2 3648c2ecf20Sopenharmony_ci */ 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#define S_MAC_VLAN_TAG _SB_MAKE64(0) 3678c2ecf20Sopenharmony_ci#define M_MAC_VLAN_TAG _SB_MAKEMASK(32, S_MAC_VLAN_TAG) 3688c2ecf20Sopenharmony_ci#define V_MAC_VLAN_TAG(x) _SB_MAKEVALUE(x, S_MAC_VLAN_TAG) 3698c2ecf20Sopenharmony_ci#define G_MAC_VLAN_TAG(x) _SB_GETVALUE(x, S_MAC_VLAN_TAG, M_MAC_VLAN_TAG) 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 3728c2ecf20Sopenharmony_ci#define S_MAC_TX_PKT_OFFSET _SB_MAKE64(32) 3738c2ecf20Sopenharmony_ci#define M_MAC_TX_PKT_OFFSET _SB_MAKEMASK(8, S_MAC_TX_PKT_OFFSET) 3748c2ecf20Sopenharmony_ci#define V_MAC_TX_PKT_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_TX_PKT_OFFSET) 3758c2ecf20Sopenharmony_ci#define G_MAC_TX_PKT_OFFSET(x) _SB_GETVALUE(x, S_MAC_TX_PKT_OFFSET, M_MAC_TX_PKT_OFFSET) 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define S_MAC_TX_CRC_OFFSET _SB_MAKE64(40) 3788c2ecf20Sopenharmony_ci#define M_MAC_TX_CRC_OFFSET _SB_MAKEMASK(8, S_MAC_TX_CRC_OFFSET) 3798c2ecf20Sopenharmony_ci#define V_MAC_TX_CRC_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_TX_CRC_OFFSET) 3808c2ecf20Sopenharmony_ci#define G_MAC_TX_CRC_OFFSET(x) _SB_GETVALUE(x, S_MAC_TX_CRC_OFFSET, M_MAC_TX_CRC_OFFSET) 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci#define M_MAC_CH_BASE_FC_EN _SB_MAKEMASK1(48) 3838c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 */ 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci/* 3868c2ecf20Sopenharmony_ci * MAC Status Registers (Table 9-17) 3878c2ecf20Sopenharmony_ci * Also used for the MAC Interrupt Mask Register (Table 9-18) 3888c2ecf20Sopenharmony_ci * Register: MAC_STATUS_0 3898c2ecf20Sopenharmony_ci * Register: MAC_STATUS_1 3908c2ecf20Sopenharmony_ci * Register: MAC_STATUS_2 3918c2ecf20Sopenharmony_ci * Register: MAC_INT_MASK_0 3928c2ecf20Sopenharmony_ci * Register: MAC_INT_MASK_1 3938c2ecf20Sopenharmony_ci * Register: MAC_INT_MASK_2 3948c2ecf20Sopenharmony_ci */ 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci/* 3978c2ecf20Sopenharmony_ci * Use these constants to shift the appropriate channel 3988c2ecf20Sopenharmony_ci * into the CH0 position so the same tests can be used 3998c2ecf20Sopenharmony_ci * on each channel. 4008c2ecf20Sopenharmony_ci */ 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci#define S_MAC_RX_CH0 _SB_MAKE64(0) 4038c2ecf20Sopenharmony_ci#define S_MAC_RX_CH1 _SB_MAKE64(8) 4048c2ecf20Sopenharmony_ci#define S_MAC_TX_CH0 _SB_MAKE64(16) 4058c2ecf20Sopenharmony_ci#define S_MAC_TX_CH1 _SB_MAKE64(24) 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci#define S_MAC_TXCHANNELS _SB_MAKE64(16) /* this is 1st TX chan */ 4088c2ecf20Sopenharmony_ci#define S_MAC_CHANWIDTH _SB_MAKE64(8) /* bits between channels */ 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci/* 4118c2ecf20Sopenharmony_ci * These are the same as RX channel 0. The idea here 4128c2ecf20Sopenharmony_ci * is that you'll use one of the "S_" things above 4138c2ecf20Sopenharmony_ci * and pass just the six bits to a DMA-channel-specific ISR 4148c2ecf20Sopenharmony_ci */ 4158c2ecf20Sopenharmony_ci#define M_MAC_INT_CHANNEL _SB_MAKEMASK(8, 0) 4168c2ecf20Sopenharmony_ci#define M_MAC_INT_EOP_COUNT _SB_MAKEMASK1(0) 4178c2ecf20Sopenharmony_ci#define M_MAC_INT_EOP_TIMER _SB_MAKEMASK1(1) 4188c2ecf20Sopenharmony_ci#define M_MAC_INT_EOP_SEEN _SB_MAKEMASK1(2) 4198c2ecf20Sopenharmony_ci#define M_MAC_INT_HWM _SB_MAKEMASK1(3) 4208c2ecf20Sopenharmony_ci#define M_MAC_INT_LWM _SB_MAKEMASK1(4) 4218c2ecf20Sopenharmony_ci#define M_MAC_INT_DSCR _SB_MAKEMASK1(5) 4228c2ecf20Sopenharmony_ci#define M_MAC_INT_ERR _SB_MAKEMASK1(6) 4238c2ecf20Sopenharmony_ci#define M_MAC_INT_DZERO _SB_MAKEMASK1(7) /* only for TX channels */ 4248c2ecf20Sopenharmony_ci#define M_MAC_INT_DROP _SB_MAKEMASK1(7) /* only for RX channels */ 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci/* 4278c2ecf20Sopenharmony_ci * In the following definitions we use ch (0/1) and txrx (TX=1, RX=0, see 4288c2ecf20Sopenharmony_ci * also DMA_TX/DMA_RX in sb_regs.h). 4298c2ecf20Sopenharmony_ci */ 4308c2ecf20Sopenharmony_ci#define S_MAC_STATUS_CH_OFFSET(ch, txrx) _SB_MAKE64(((ch) + 2 * (txrx)) * S_MAC_CHANWIDTH) 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci#define M_MAC_STATUS_CHANNEL(ch, txrx) _SB_MAKEVALUE(_SB_MAKEMASK(8, 0), S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4338c2ecf20Sopenharmony_ci#define M_MAC_STATUS_EOP_COUNT(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_COUNT, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4348c2ecf20Sopenharmony_ci#define M_MAC_STATUS_EOP_TIMER(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_TIMER, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4358c2ecf20Sopenharmony_ci#define M_MAC_STATUS_EOP_SEEN(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_SEEN, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4368c2ecf20Sopenharmony_ci#define M_MAC_STATUS_HWM(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_HWM, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4378c2ecf20Sopenharmony_ci#define M_MAC_STATUS_LWM(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_LWM, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4388c2ecf20Sopenharmony_ci#define M_MAC_STATUS_DSCR(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DSCR, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4398c2ecf20Sopenharmony_ci#define M_MAC_STATUS_ERR(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_ERR, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4408c2ecf20Sopenharmony_ci#define M_MAC_STATUS_DZERO(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DZERO, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4418c2ecf20Sopenharmony_ci#define M_MAC_STATUS_DROP(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DROP, S_MAC_STATUS_CH_OFFSET(ch, txrx)) 4428c2ecf20Sopenharmony_ci#define M_MAC_STATUS_OTHER_ERR _SB_MAKEVALUE(_SB_MAKEMASK(7, 0), 40) 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_ci#define M_MAC_RX_UNDRFL _SB_MAKEMASK1(40) 4468c2ecf20Sopenharmony_ci#define M_MAC_RX_OVRFL _SB_MAKEMASK1(41) 4478c2ecf20Sopenharmony_ci#define M_MAC_TX_UNDRFL _SB_MAKEMASK1(42) 4488c2ecf20Sopenharmony_ci#define M_MAC_TX_OVRFL _SB_MAKEMASK1(43) 4498c2ecf20Sopenharmony_ci#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) 4508c2ecf20Sopenharmony_ci#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) 4518c2ecf20Sopenharmony_ci#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) 4528c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 4538c2ecf20Sopenharmony_ci#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ 4548c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci#define S_MAC_COUNTER_ADDR _SB_MAKE64(47) 4578c2ecf20Sopenharmony_ci#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5, S_MAC_COUNTER_ADDR) 4588c2ecf20Sopenharmony_ci#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x, S_MAC_COUNTER_ADDR) 4598c2ecf20Sopenharmony_ci#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x, S_MAC_COUNTER_ADDR, M_MAC_COUNTER_ADDR) 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 4628c2ecf20Sopenharmony_ci#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52) 4638c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 || 1480 */ 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci/* 4668c2ecf20Sopenharmony_ci * MAC Fifo Pointer Registers (Table 9-19) [Debug register] 4678c2ecf20Sopenharmony_ci * Register: MAC_FIFO_PTRS_0 4688c2ecf20Sopenharmony_ci * Register: MAC_FIFO_PTRS_1 4698c2ecf20Sopenharmony_ci * Register: MAC_FIFO_PTRS_2 4708c2ecf20Sopenharmony_ci */ 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci#define S_MAC_TX_WRPTR _SB_MAKE64(0) 4738c2ecf20Sopenharmony_ci#define M_MAC_TX_WRPTR _SB_MAKEMASK(6, S_MAC_TX_WRPTR) 4748c2ecf20Sopenharmony_ci#define V_MAC_TX_WRPTR(x) _SB_MAKEVALUE(x, S_MAC_TX_WRPTR) 4758c2ecf20Sopenharmony_ci#define G_MAC_TX_WRPTR(x) _SB_GETVALUE(x, S_MAC_TX_WRPTR, M_MAC_TX_WRPTR) 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci#define S_MAC_TX_RDPTR _SB_MAKE64(8) 4788c2ecf20Sopenharmony_ci#define M_MAC_TX_RDPTR _SB_MAKEMASK(6, S_MAC_TX_RDPTR) 4798c2ecf20Sopenharmony_ci#define V_MAC_TX_RDPTR(x) _SB_MAKEVALUE(x, S_MAC_TX_RDPTR) 4808c2ecf20Sopenharmony_ci#define G_MAC_TX_RDPTR(x) _SB_GETVALUE(x, S_MAC_TX_RDPTR, M_MAC_TX_RDPTR) 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci#define S_MAC_RX_WRPTR _SB_MAKE64(16) 4838c2ecf20Sopenharmony_ci#define M_MAC_RX_WRPTR _SB_MAKEMASK(6, S_MAC_RX_WRPTR) 4848c2ecf20Sopenharmony_ci#define V_MAC_RX_WRPTR(x) _SB_MAKEVALUE(x, S_MAC_RX_WRPTR) 4858c2ecf20Sopenharmony_ci#define G_MAC_RX_WRPTR(x) _SB_GETVALUE(x, S_MAC_RX_WRPTR, M_MAC_TX_WRPTR) 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci#define S_MAC_RX_RDPTR _SB_MAKE64(24) 4888c2ecf20Sopenharmony_ci#define M_MAC_RX_RDPTR _SB_MAKEMASK(6, S_MAC_RX_RDPTR) 4898c2ecf20Sopenharmony_ci#define V_MAC_RX_RDPTR(x) _SB_MAKEVALUE(x, S_MAC_RX_RDPTR) 4908c2ecf20Sopenharmony_ci#define G_MAC_RX_RDPTR(x) _SB_GETVALUE(x, S_MAC_RX_RDPTR, M_MAC_TX_RDPTR) 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci/* 4938c2ecf20Sopenharmony_ci * MAC Fifo End Of Packet Count Registers (Table 9-20) [Debug register] 4948c2ecf20Sopenharmony_ci * Register: MAC_EOPCNT_0 4958c2ecf20Sopenharmony_ci * Register: MAC_EOPCNT_1 4968c2ecf20Sopenharmony_ci * Register: MAC_EOPCNT_2 4978c2ecf20Sopenharmony_ci */ 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci#define S_MAC_TX_EOP_COUNTER _SB_MAKE64(0) 5008c2ecf20Sopenharmony_ci#define M_MAC_TX_EOP_COUNTER _SB_MAKEMASK(6, S_MAC_TX_EOP_COUNTER) 5018c2ecf20Sopenharmony_ci#define V_MAC_TX_EOP_COUNTER(x) _SB_MAKEVALUE(x, S_MAC_TX_EOP_COUNTER) 5028c2ecf20Sopenharmony_ci#define G_MAC_TX_EOP_COUNTER(x) _SB_GETVALUE(x, S_MAC_TX_EOP_COUNTER, M_MAC_TX_EOP_COUNTER) 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci#define S_MAC_RX_EOP_COUNTER _SB_MAKE64(8) 5058c2ecf20Sopenharmony_ci#define M_MAC_RX_EOP_COUNTER _SB_MAKEMASK(6, S_MAC_RX_EOP_COUNTER) 5068c2ecf20Sopenharmony_ci#define V_MAC_RX_EOP_COUNTER(x) _SB_MAKEVALUE(x, S_MAC_RX_EOP_COUNTER) 5078c2ecf20Sopenharmony_ci#define G_MAC_RX_EOP_COUNTER(x) _SB_GETVALUE(x, S_MAC_RX_EOP_COUNTER, M_MAC_RX_EOP_COUNTER) 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci/* 5108c2ecf20Sopenharmony_ci * MAC Receive Address Filter Exact Match Registers (Table 9-21) 5118c2ecf20Sopenharmony_ci * Registers: MAC_ADDR0_0 through MAC_ADDR7_0 5128c2ecf20Sopenharmony_ci * Registers: MAC_ADDR0_1 through MAC_ADDR7_1 5138c2ecf20Sopenharmony_ci * Registers: MAC_ADDR0_2 through MAC_ADDR7_2 5148c2ecf20Sopenharmony_ci */ 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci/* No bitfields */ 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci/* 5198c2ecf20Sopenharmony_ci * MAC Receive Address Filter Mask Registers 5208c2ecf20Sopenharmony_ci * Registers: MAC_ADDRMASK0_0 and MAC_ADDRMASK0_1 5218c2ecf20Sopenharmony_ci * Registers: MAC_ADDRMASK1_0 and MAC_ADDRMASK1_1 5228c2ecf20Sopenharmony_ci * Registers: MAC_ADDRMASK2_0 and MAC_ADDRMASK2_1 5238c2ecf20Sopenharmony_ci */ 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci/* No bitfields */ 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci/* 5288c2ecf20Sopenharmony_ci * MAC Receive Address Filter Hash Match Registers (Table 9-22) 5298c2ecf20Sopenharmony_ci * Registers: MAC_HASH0_0 through MAC_HASH7_0 5308c2ecf20Sopenharmony_ci * Registers: MAC_HASH0_1 through MAC_HASH7_1 5318c2ecf20Sopenharmony_ci * Registers: MAC_HASH0_2 through MAC_HASH7_2 5328c2ecf20Sopenharmony_ci */ 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci/* No bitfields */ 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci/* 5378c2ecf20Sopenharmony_ci * MAC Transmit Source Address Registers (Table 9-23) 5388c2ecf20Sopenharmony_ci * Register: MAC_ETHERNET_ADDR_0 5398c2ecf20Sopenharmony_ci * Register: MAC_ETHERNET_ADDR_1 5408c2ecf20Sopenharmony_ci * Register: MAC_ETHERNET_ADDR_2 5418c2ecf20Sopenharmony_ci */ 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci/* No bitfields */ 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci/* 5468c2ecf20Sopenharmony_ci * MAC Packet Type Configuration Register 5478c2ecf20Sopenharmony_ci * Register: MAC_TYPE_CFG_0 5488c2ecf20Sopenharmony_ci * Register: MAC_TYPE_CFG_1 5498c2ecf20Sopenharmony_ci * Register: MAC_TYPE_CFG_2 5508c2ecf20Sopenharmony_ci */ 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci#define S_TYPECFG_TYPESIZE _SB_MAKE64(16) 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci#define S_TYPECFG_TYPE0 _SB_MAKE64(0) 5558c2ecf20Sopenharmony_ci#define M_TYPECFG_TYPE0 _SB_MAKEMASK(16, S_TYPECFG_TYPE0) 5568c2ecf20Sopenharmony_ci#define V_TYPECFG_TYPE0(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE0) 5578c2ecf20Sopenharmony_ci#define G_TYPECFG_TYPE0(x) _SB_GETVALUE(x, S_TYPECFG_TYPE0, M_TYPECFG_TYPE0) 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci#define S_TYPECFG_TYPE1 _SB_MAKE64(0) 5608c2ecf20Sopenharmony_ci#define M_TYPECFG_TYPE1 _SB_MAKEMASK(16, S_TYPECFG_TYPE1) 5618c2ecf20Sopenharmony_ci#define V_TYPECFG_TYPE1(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE1) 5628c2ecf20Sopenharmony_ci#define G_TYPECFG_TYPE1(x) _SB_GETVALUE(x, S_TYPECFG_TYPE1, M_TYPECFG_TYPE1) 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ci#define S_TYPECFG_TYPE2 _SB_MAKE64(0) 5658c2ecf20Sopenharmony_ci#define M_TYPECFG_TYPE2 _SB_MAKEMASK(16, S_TYPECFG_TYPE2) 5668c2ecf20Sopenharmony_ci#define V_TYPECFG_TYPE2(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE2) 5678c2ecf20Sopenharmony_ci#define G_TYPECFG_TYPE2(x) _SB_GETVALUE(x, S_TYPECFG_TYPE2, M_TYPECFG_TYPE2) 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci#define S_TYPECFG_TYPE3 _SB_MAKE64(0) 5708c2ecf20Sopenharmony_ci#define M_TYPECFG_TYPE3 _SB_MAKEMASK(16, S_TYPECFG_TYPE3) 5718c2ecf20Sopenharmony_ci#define V_TYPECFG_TYPE3(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE3) 5728c2ecf20Sopenharmony_ci#define G_TYPECFG_TYPE3(x) _SB_GETVALUE(x, S_TYPECFG_TYPE3, M_TYPECFG_TYPE3) 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci/* 5758c2ecf20Sopenharmony_ci * MAC Receive Address Filter Control Registers (Table 9-24) 5768c2ecf20Sopenharmony_ci * Register: MAC_ADFILTER_CFG_0 5778c2ecf20Sopenharmony_ci * Register: MAC_ADFILTER_CFG_1 5788c2ecf20Sopenharmony_ci * Register: MAC_ADFILTER_CFG_2 5798c2ecf20Sopenharmony_ci */ 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci#define M_MAC_ALLPKT_EN _SB_MAKEMASK1(0) 5828c2ecf20Sopenharmony_ci#define M_MAC_UCAST_EN _SB_MAKEMASK1(1) 5838c2ecf20Sopenharmony_ci#define M_MAC_UCAST_INV _SB_MAKEMASK1(2) 5848c2ecf20Sopenharmony_ci#define M_MAC_MCAST_EN _SB_MAKEMASK1(3) 5858c2ecf20Sopenharmony_ci#define M_MAC_MCAST_INV _SB_MAKEMASK1(4) 5868c2ecf20Sopenharmony_ci#define M_MAC_BCAST_EN _SB_MAKEMASK1(5) 5878c2ecf20Sopenharmony_ci#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) 5888c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 5898c2ecf20Sopenharmony_ci#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) 5908c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) 5938c2ecf20Sopenharmony_ci#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8, S_MAC_IPHDR_OFFSET) 5948c2ecf20Sopenharmony_ci#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_IPHDR_OFFSET) 5958c2ecf20Sopenharmony_ci#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x, S_MAC_IPHDR_OFFSET, M_MAC_IPHDR_OFFSET) 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 5988c2ecf20Sopenharmony_ci#define S_MAC_RX_CRC_OFFSET _SB_MAKE64(16) 5998c2ecf20Sopenharmony_ci#define M_MAC_RX_CRC_OFFSET _SB_MAKEMASK(8, S_MAC_RX_CRC_OFFSET) 6008c2ecf20Sopenharmony_ci#define V_MAC_RX_CRC_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_RX_CRC_OFFSET) 6018c2ecf20Sopenharmony_ci#define G_MAC_RX_CRC_OFFSET(x) _SB_GETVALUE(x, S_MAC_RX_CRC_OFFSET, M_MAC_RX_CRC_OFFSET) 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci#define S_MAC_RX_PKT_OFFSET _SB_MAKE64(24) 6048c2ecf20Sopenharmony_ci#define M_MAC_RX_PKT_OFFSET _SB_MAKEMASK(8, S_MAC_RX_PKT_OFFSET) 6058c2ecf20Sopenharmony_ci#define V_MAC_RX_PKT_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_RX_PKT_OFFSET) 6068c2ecf20Sopenharmony_ci#define G_MAC_RX_PKT_OFFSET(x) _SB_GETVALUE(x, S_MAC_RX_PKT_OFFSET, M_MAC_RX_PKT_OFFSET) 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci#define M_MAC_FWDPAUSE_EN _SB_MAKEMASK1(32) 6098c2ecf20Sopenharmony_ci#define M_MAC_VLAN_DET_EN _SB_MAKEMASK1(33) 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci#define S_MAC_RX_CH_MSN_SEL _SB_MAKE64(34) 6128c2ecf20Sopenharmony_ci#define M_MAC_RX_CH_MSN_SEL _SB_MAKEMASK(8, S_MAC_RX_CH_MSN_SEL) 6138c2ecf20Sopenharmony_ci#define V_MAC_RX_CH_MSN_SEL(x) _SB_MAKEVALUE(x, S_MAC_RX_CH_MSN_SEL) 6148c2ecf20Sopenharmony_ci#define G_MAC_RX_CH_MSN_SEL(x) _SB_GETVALUE(x, S_MAC_RX_CH_MSN_SEL, M_MAC_RX_CH_MSN_SEL) 6158c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 || 1480 */ 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci/* 6188c2ecf20Sopenharmony_ci * MAC Receive Channel Select Registers (Table 9-25) 6198c2ecf20Sopenharmony_ci */ 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci/* no bitfields */ 6228c2ecf20Sopenharmony_ci 6238c2ecf20Sopenharmony_ci/* 6248c2ecf20Sopenharmony_ci * MAC MII Management Interface Registers (Table 9-26) 6258c2ecf20Sopenharmony_ci * Register: MAC_MDIO_0 6268c2ecf20Sopenharmony_ci * Register: MAC_MDIO_1 6278c2ecf20Sopenharmony_ci * Register: MAC_MDIO_2 6288c2ecf20Sopenharmony_ci */ 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci#define S_MAC_MDC 0 6318c2ecf20Sopenharmony_ci#define S_MAC_MDIO_DIR 1 6328c2ecf20Sopenharmony_ci#define S_MAC_MDIO_OUT 2 6338c2ecf20Sopenharmony_ci#define S_MAC_GENC 3 6348c2ecf20Sopenharmony_ci#define S_MAC_MDIO_IN 4 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ci#define M_MAC_MDC _SB_MAKEMASK1(S_MAC_MDC) 6378c2ecf20Sopenharmony_ci#define M_MAC_MDIO_DIR _SB_MAKEMASK1(S_MAC_MDIO_DIR) 6388c2ecf20Sopenharmony_ci#define M_MAC_MDIO_DIR_INPUT _SB_MAKEMASK1(S_MAC_MDIO_DIR) 6398c2ecf20Sopenharmony_ci#define M_MAC_MDIO_OUT _SB_MAKEMASK1(S_MAC_MDIO_OUT) 6408c2ecf20Sopenharmony_ci#define M_MAC_GENC _SB_MAKEMASK1(S_MAC_GENC) 6418c2ecf20Sopenharmony_ci#define M_MAC_MDIO_IN _SB_MAKEMASK1(S_MAC_MDIO_IN) 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci#endif 644