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_DEV_H_ 98c2ecf20Sopenharmony_ci#define _MSCC_OCELOT_DEV_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_MAC_TX_RST BIT(7) 128c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_MAC_RX_RST BIT(6) 138c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_PCS_TX_RST BIT(5) 148c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_PCS_RX_RST BIT(4) 158c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_PORT_RST BIT(3) 168c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_PHY_RST BIT(2) 178c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_LINK_SPEED(x) ((x) & GENMASK(1, 0)) 188c2ecf20Sopenharmony_ci#define DEV_CLOCK_CFG_LINK_SPEED_M GENMASK(1, 0) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define DEV_PORT_MISC_FWD_ERROR_ENA BIT(4) 218c2ecf20Sopenharmony_ci#define DEV_PORT_MISC_FWD_PAUSE_ENA BIT(3) 228c2ecf20Sopenharmony_ci#define DEV_PORT_MISC_FWD_CTRL_ENA BIT(2) 238c2ecf20Sopenharmony_ci#define DEV_PORT_MISC_DEV_LOOP_ENA BIT(1) 248c2ecf20Sopenharmony_ci#define DEV_PORT_MISC_HDX_FAST_DIS BIT(0) 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_ENA BIT(22) 278c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_AGE(x) (((x) << 15) & GENMASK(21, 15)) 288c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_AGE_M GENMASK(21, 15) 298c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_AGE_X(x) (((x) & GENMASK(21, 15)) >> 15) 308c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_WAKEUP(x) (((x) << 8) & GENMASK(14, 8)) 318c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_WAKEUP_M GENMASK(14, 8) 328c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_WAKEUP_X(x) (((x) & GENMASK(14, 8)) >> 8) 338c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_HOLDOFF(x) (((x) << 1) & GENMASK(7, 1)) 348c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_HOLDOFF_M GENMASK(7, 1) 358c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_EEE_TIMER_HOLDOFF_X(x) (((x) & GENMASK(7, 1)) >> 1) 368c2ecf20Sopenharmony_ci#define DEV_EEE_CFG_PORT_LPI BIT(0) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG(x) (((x) << 4) & GENMASK(11, 4)) 398c2ecf20Sopenharmony_ci#define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG_M GENMASK(11, 4) 408c2ecf20Sopenharmony_ci#define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG_X(x) (((x) & GENMASK(11, 4)) >> 4) 418c2ecf20Sopenharmony_ci#define DEV_PTP_PREDICT_CFG_PTP_PHASE_PREDICT_CFG(x) ((x) & GENMASK(3, 0)) 428c2ecf20Sopenharmony_ci#define DEV_PTP_PREDICT_CFG_PTP_PHASE_PREDICT_CFG_M GENMASK(3, 0) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define DEV_MAC_ENA_CFG_RX_ENA BIT(4) 458c2ecf20Sopenharmony_ci#define DEV_MAC_ENA_CFG_TX_ENA BIT(0) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define DEV_MAC_MODE_CFG_FC_WORD_SYNC_ENA BIT(8) 488c2ecf20Sopenharmony_ci#define DEV_MAC_MODE_CFG_GIGA_MODE_ENA BIT(4) 498c2ecf20Sopenharmony_ci#define DEV_MAC_MODE_CFG_FDX_ENA BIT(0) 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_TAG_ID(x) (((x) << 16) & GENMASK(31, 16)) 528c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_TAG_ID_M GENMASK(31, 16) 538c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_TAG_ID_X(x) (((x) & GENMASK(31, 16)) >> 16) 548c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA BIT(2) 558c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA BIT(1) 568c2ecf20Sopenharmony_ci#define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA BIT(0) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define DEV_MAC_ADV_CHK_CFG_LEN_DROP_ENA BIT(0) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RESTORE_OLD_IPG_CHECK BIT(17) 618c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_REDUCED_TX_IFG BIT(16) 628c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_TX_IFG(x) (((x) << 8) & GENMASK(12, 8)) 638c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_TX_IFG_M GENMASK(12, 8) 648c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_TX_IFG_X(x) (((x) & GENMASK(12, 8)) >> 8) 658c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RX_IFG2(x) (((x) << 4) & GENMASK(7, 4)) 668c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RX_IFG2_M GENMASK(7, 4) 678c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RX_IFG2_X(x) (((x) & GENMASK(7, 4)) >> 4) 688c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RX_IFG1(x) ((x) & GENMASK(3, 0)) 698c2ecf20Sopenharmony_ci#define DEV_MAC_IFG_CFG_RX_IFG1_M GENMASK(3, 0) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_BYPASS_COL_SYNC BIT(26) 728c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_OB_ENA BIT(25) 738c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_WEXC_DIS BIT(24) 748c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_SEED(x) (((x) << 16) & GENMASK(23, 16)) 758c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_SEED_M GENMASK(23, 16) 768c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_SEED_X(x) (((x) & GENMASK(23, 16)) >> 16) 778c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_SEED_LOAD BIT(12) 788c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_RETRY_AFTER_EXC_COL_ENA BIT(8) 798c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_LATE_COL_POS(x) ((x) & GENMASK(6, 0)) 808c2ecf20Sopenharmony_ci#define DEV_MAC_HDX_CFG_LATE_COL_POS_M GENMASK(6, 0) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define DEV_MAC_DBG_CFG_TBI_MODE BIT(4) 838c2ecf20Sopenharmony_ci#define DEV_MAC_DBG_CFG_IFG_CRS_EXT_CHK_ENA BIT(0) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_RX_IPG_SHRINK_STICKY BIT(9) 868c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_RX_PREAM_SHRINK_STICKY BIT(8) 878c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_RX_CARRIER_EXT_STICKY BIT(7) 888c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_RX_CARRIER_EXT_ERR_STICKY BIT(6) 898c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_RX_JUNK_STICKY BIT(5) 908c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_TX_RETRANSMIT_STICKY BIT(4) 918c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_TX_JAM_STICKY BIT(3) 928c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_TX_FIFO_OFLW_STICKY BIT(2) 938c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_TX_FRM_LEN_OVR_STICKY BIT(1) 948c2ecf20Sopenharmony_ci#define DEV_MAC_STICKY_TX_ABORT_STICKY BIT(0) 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define PCS1G_CFG_LINK_STATUS_TYPE BIT(4) 978c2ecf20Sopenharmony_ci#define PCS1G_CFG_AN_LINK_CTRL_ENA BIT(1) 988c2ecf20Sopenharmony_ci#define PCS1G_CFG_PCS_ENA BIT(0) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define PCS1G_MODE_CFG_UNIDIR_MODE_ENA BIT(4) 1018c2ecf20Sopenharmony_ci#define PCS1G_MODE_CFG_SGMII_MODE_ENA BIT(0) 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define PCS1G_SD_CFG_SD_SEL BIT(8) 1048c2ecf20Sopenharmony_ci#define PCS1G_SD_CFG_SD_POL BIT(4) 1058c2ecf20Sopenharmony_ci#define PCS1G_SD_CFG_SD_ENA BIT(0) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_ADV_ABILITY(x) (((x) << 16) & GENMASK(31, 16)) 1088c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_ADV_ABILITY_M GENMASK(31, 16) 1098c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_ADV_ABILITY_X(x) (((x) & GENMASK(31, 16)) >> 16) 1108c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_SW_RESOLVE_ENA BIT(8) 1118c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_ANEG_RESTART_ONE_SHOT BIT(1) 1128c2ecf20Sopenharmony_ci#define PCS1G_ANEG_CFG_ANEG_ENA BIT(0) 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define PCS1G_ANEG_NP_CFG_NP_TX(x) (((x) << 16) & GENMASK(31, 16)) 1158c2ecf20Sopenharmony_ci#define PCS1G_ANEG_NP_CFG_NP_TX_M GENMASK(31, 16) 1168c2ecf20Sopenharmony_ci#define PCS1G_ANEG_NP_CFG_NP_TX_X(x) (((x) & GENMASK(31, 16)) >> 16) 1178c2ecf20Sopenharmony_ci#define PCS1G_ANEG_NP_CFG_NP_LOADED_ONE_SHOT BIT(0) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define PCS1G_LB_CFG_RA_ENA BIT(4) 1208c2ecf20Sopenharmony_ci#define PCS1G_LB_CFG_GMII_PHY_LB_ENA BIT(1) 1218c2ecf20Sopenharmony_ci#define PCS1G_LB_CFG_TBI_HOST_LB_ENA BIT(0) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define PCS1G_DBG_CFG_UDLT BIT(0) 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define PCS1G_CDET_CFG_CDET_ENA BIT(0) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_LP_ADV_ABILITY(x) (((x) << 16) & GENMASK(31, 16)) 1288c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_LP_ADV_ABILITY_M GENMASK(31, 16) 1298c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_LP_ADV_ABILITY_X(x) (((x) & GENMASK(31, 16)) >> 16) 1308c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_PR BIT(4) 1318c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_PAGE_RX_STICKY BIT(3) 1328c2ecf20Sopenharmony_ci#define PCS1G_ANEG_STATUS_ANEG_COMPLETE BIT(0) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_DELAY_VAR(x) (((x) << 12) & GENMASK(15, 12)) 1358c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_DELAY_VAR_M GENMASK(15, 12) 1368c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_DELAY_VAR_X(x) (((x) & GENMASK(15, 12)) >> 12) 1378c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_SIGNAL_DETECT BIT(8) 1388c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_LINK_STATUS BIT(4) 1398c2ecf20Sopenharmony_ci#define PCS1G_LINK_STATUS_SYNC_STATUS BIT(0) 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define PCS1G_STICKY_LINK_DOWN_STICKY BIT(4) 1428c2ecf20Sopenharmony_ci#define PCS1G_STICKY_OUT_OF_SYNC_STICKY BIT(0) 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_QSGMII_MS_SEL BIT(20) 1458c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_RX_LPI_OUT_DIS BIT(17) 1468c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_LPI_TESTMODE BIT(16) 1478c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_LPI_RX_WTIM(x) (((x) << 4) & GENMASK(5, 4)) 1488c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_LPI_RX_WTIM_M GENMASK(5, 4) 1498c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_LPI_RX_WTIM_X(x) (((x) & GENMASK(5, 4)) >> 4) 1508c2ecf20Sopenharmony_ci#define PCS1G_LPI_CFG_TX_ASSERT_LPIDLE BIT(0) 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_RX_LPI_FAIL BIT(16) 1538c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_RX_LPI_EVENT_STICKY BIT(12) 1548c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_RX_QUIET BIT(9) 1558c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_RX_LPI_MODE BIT(8) 1568c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_TX_LPI_EVENT_STICKY BIT(4) 1578c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_TX_QUIET BIT(1) 1588c2ecf20Sopenharmony_ci#define PCS1G_LPI_STATUS_TX_LPI_MODE BIT(0) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT(x) (((x) << 8) & GENMASK(15, 8)) 1618c2ecf20Sopenharmony_ci#define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT_M GENMASK(15, 8) 1628c2ecf20Sopenharmony_ci#define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT_X(x) (((x) & GENMASK(15, 8)) >> 8) 1638c2ecf20Sopenharmony_ci#define PCS1G_TSTPAT_STATUS_JTP_ERR BIT(4) 1648c2ecf20Sopenharmony_ci#define PCS1G_TSTPAT_STATUS_JTP_LOCK BIT(0) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SD_SEL BIT(26) 1678c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SD_POL BIT(25) 1688c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SD_ENA BIT(24) 1698c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_LOOPBACK_ENA BIT(20) 1708c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SWAP_MII_ENA BIT(16) 1718c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_RXBITSEL(x) (((x) << 12) & GENMASK(15, 12)) 1728c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_RXBITSEL_M GENMASK(15, 12) 1738c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_RXBITSEL_X(x) (((x) & GENMASK(15, 12)) >> 12) 1748c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SIGDET_CFG(x) (((x) << 9) & GENMASK(10, 9)) 1758c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SIGDET_CFG_M GENMASK(10, 9) 1768c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_SIGDET_CFG_X(x) (((x) & GENMASK(10, 9)) >> 9) 1778c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_LINKHYST_TM_ENA BIT(8) 1788c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_LINKHYSTTIMER(x) (((x) << 4) & GENMASK(7, 4)) 1798c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_LINKHYSTTIMER_M GENMASK(7, 4) 1808c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_LINKHYSTTIMER_X(x) (((x) & GENMASK(7, 4)) >> 4) 1818c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_UNIDIR_MODE_ENA BIT(3) 1828c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_FEFCHK_ENA BIT(2) 1838c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_FEFGEN_ENA BIT(1) 1848c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_CFG_PCS_ENA BIT(0) 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_EDGE_POS_PTP(x) (((x) << 8) & GENMASK(11, 8)) 1878c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_EDGE_POS_PTP_M GENMASK(11, 8) 1888c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_EDGE_POS_PTP_X(x) (((x) & GENMASK(11, 8)) >> 8) 1898c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_PCS_ERROR_STICKY BIT(7) 1908c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_FEF_FOUND_STICKY BIT(6) 1918c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_SSD_ERROR_STICKY BIT(5) 1928c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_SYNC_LOST_STICKY BIT(4) 1938c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_FEF_STATUS BIT(2) 1948c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_SIGNAL_DETECT BIT(1) 1958c2ecf20Sopenharmony_ci#define DEV_PCS_FX100_STATUS_SYNC_STATUS BIT(0) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci#endif 198