linux/drivers/net/pcs/pcs-xpcs.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
 * Synopsys DesignWare XPCS helpers
 *
 * Author: Jose Abreu <[email protected]>
 */

#include <linux/bits.h>
#include <linux/pcs/pcs-xpcs.h>

/* Vendor regs access */
#define DW_VENDOR

/* VR_XS_PCS */
#define DW_USXGMII_RST
#define DW_USXGMII_EN
#define DW_VR_XS_PCS_DIG_CTRL1
#define DW_VR_RST
#define DW_EN_VSMMD1
#define DW_CL37_BP
#define DW_VR_XS_PCS_DIG_STS
#define DW_RXFIFO_ERR
#define DW_PSEQ_ST
#define DW_PSEQ_ST_GOOD

/* SR_MII */
#define DW_USXGMII_FULL
#define DW_USXGMII_SS_MASK
#define DW_USXGMII_10000
#define DW_USXGMII_5000
#define DW_USXGMII_2500
#define DW_USXGMII_1000
#define DW_USXGMII_100
#define DW_USXGMII_10

/* SR_AN */
#define DW_SR_AN_ADV1
#define DW_SR_AN_ADV2
#define DW_SR_AN_ADV3

/* Clause 73 Defines */
/* AN_LP_ABL1 */
#define DW_C73_PAUSE
#define DW_C73_ASYM_PAUSE
#define DW_C73_AN_ADV_SF
/* AN_LP_ABL2 */
#define DW_C73_1000KX
#define DW_C73_10000KX4
#define DW_C73_10000KR
/* AN_LP_ABL3 */
#define DW_C73_2500KX
#define DW_C73_5000KR

/* Clause 37 Defines */
/* VR MII MMD registers offsets */
#define DW_VR_MII_MMD_CTRL
#define DW_VR_MII_MMD_STS
#define DW_VR_MII_MMD_STS_LINK_STS
#define DW_VR_MII_DIG_CTRL1
#define DW_VR_MII_AN_CTRL
#define DW_VR_MII_AN_INTR_STS
/* Enable 2.5G Mode */
#define DW_VR_MII_DIG_CTRL1_2G5_EN
/* EEE Mode Control Register */
#define DW_VR_MII_EEE_MCTRL0
#define DW_VR_MII_EEE_MCTRL1
#define DW_VR_MII_DIG_CTRL2

/* VR_MII_DIG_CTRL1 */
#define DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW
#define DW_VR_MII_DIG_CTRL1_PHY_MODE_CTRL

/* VR_MII_DIG_CTRL2 */
#define DW_VR_MII_DIG_CTRL2_TX_POL_INV
#define DW_VR_MII_DIG_CTRL2_RX_POL_INV

/* VR_MII_AN_CTRL */
#define DW_VR_MII_AN_CTRL_8BIT
#define DW_VR_MII_AN_CTRL_TX_CONFIG_SHIFT
#define DW_VR_MII_TX_CONFIG_MASK
#define DW_VR_MII_TX_CONFIG_PHY_SIDE_SGMII
#define DW_VR_MII_TX_CONFIG_MAC_SIDE_SGMII
#define DW_VR_MII_AN_CTRL_PCS_MODE_SHIFT
#define DW_VR_MII_PCS_MODE_MASK
#define DW_VR_MII_PCS_MODE_C37_1000BASEX
#define DW_VR_MII_PCS_MODE_C37_SGMII
#define DW_VR_MII_AN_INTR_EN

/* VR_MII_AN_INTR_STS */
#define DW_VR_MII_AN_STS_C37_ANCMPLT_INTR
#define DW_VR_MII_AN_STS_C37_ANSGM_FD
#define DW_VR_MII_AN_STS_C37_ANSGM_SP_SHIFT
#define DW_VR_MII_AN_STS_C37_ANSGM_SP
#define DW_VR_MII_C37_ANSGM_SP_10
#define DW_VR_MII_C37_ANSGM_SP_100
#define DW_VR_MII_C37_ANSGM_SP_1000
#define DW_VR_MII_C37_ANSGM_SP_LNKSTS

/* SR MII MMD Control defines */
#define AN_CL37_EN
#define SGMII_SPEED_SS13
#define SGMII_SPEED_SS6

/* SR MII MMD AN Advertisement defines */
#define DW_HALF_DUPLEX
#define DW_FULL_DUPLEX

/* VR MII EEE Control 0 defines */
#define DW_VR_MII_EEE_LTX_EN
#define DW_VR_MII_EEE_LRX_EN
#define DW_VR_MII_EEE_TX_QUIET_EN
#define DW_VR_MII_EEE_RX_QUIET_EN
#define DW_VR_MII_EEE_TX_EN_CTRL
#define DW_VR_MII_EEE_RX_EN_CTRL

#define DW_VR_MII_EEE_MULT_FACT_100NS_SHIFT
#define DW_VR_MII_EEE_MULT_FACT_100NS

/* VR MII EEE Control 1 defines */
#define DW_VR_MII_EEE_TRN_LPI

#define DW_XPCS_INFO_DECLARE(_name, _pcs, _pma)

int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg);
int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val);
int xpcs_read_vpcs(struct dw_xpcs *xpcs, int reg);
int xpcs_write_vpcs(struct dw_xpcs *xpcs, int reg, u16 val);
int nxp_sja1105_sgmii_pma_config(struct dw_xpcs *xpcs);
int nxp_sja1110_sgmii_pma_config(struct dw_xpcs *xpcs);
int nxp_sja1110_2500basex_pma_config(struct dw_xpcs *xpcs);
int txgbe_xpcs_switch_mode(struct dw_xpcs *xpcs, phy_interface_t interface);