SGMII Functions
[SGMII]

Functions

CSL_IDEF_INLINE void CSL_SGMII_getVersionInfo (Uint32 portNum, CSL_SGMII_VERSION *sgmiiVersionInfo)
CSL_IDEF_INLINE void CSL_SGMII_doSoftReset (Uint32 portNum)
CSL_IDEF_INLINE Uint32 CSL_SGMII_getSoftResetStatus (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_startRxTxSoftReset (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_endRxTxSoftReset (Uint32 portNum)
CSL_IDEF_INLINE Uint32 CSL_SGMII_getRxTxSoftResetStatus (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_enableMasterMode (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_disableMasterMode (Uint32 portNum)
CSL_IDEF_INLINE Uint32 CSL_SGMII_isMasterModeEnabled (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_enableLoopback (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_disableLoopback (Uint32 portNum)
CSL_IDEF_INLINE Uint32 CSL_SGMII_isLoopbackModeEnabled (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_restartAutoNegotiation (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_enableAutoNegotiation (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_disableAutoNegotiation (Uint32 portNum)
CSL_IDEF_INLINE Uint32 CSL_SGMII_isAutoNegotiationEnabled (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_getStatus (Uint32 portNum, CSL_SGMII_STATUS *pSgmiiStatus)
CSL_IDEF_INLINE void CSL_SGMII_setAdvAbility (Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
CSL_IDEF_INLINE void CSL_SGMII_getAdvAbility (Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
CSL_IDEF_INLINE void CSL_SGMII_getLinkPartnerAdvAbility (Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
CSL_IDEF_INLINE Uint32 CSL_SGMII_getTxConfig (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_setTxConfig (Uint32 portNum, Uint32 txCfgVal)
CSL_IDEF_INLINE Uint32 CSL_SGMII_getRxConfig (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_setRxConfig (Uint32 portNum, Uint32 rxCfgVal)
CSL_IDEF_INLINE Uint32 CSL_SGMII_getAuxConfig (Uint32 portNum)
CSL_IDEF_INLINE void CSL_SGMII_setAuxConfig (Uint32 portNum, Uint32 auxCfgVal)

Function Documentation

CSL_IDEF_INLINE void CSL_SGMII_disableAutoNegotiation ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_disableAutoNegotiation

Description
This function disables auto-negotiation process for the port number specified.

Arguments

        portNum             SGMII port number for which the operation must be 
                            performed
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII auto-negotiation disabled.

Writes
CPSGMII_CONTROL_REG_MR_AN_ENABLE=0

Example

        Uint32  portNum =   1;

        CSL_SGMII_disableAutoNegotiation (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_disableLoopback ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_disableLoopback

Description
This function disables CPSGMII internal loopback for the port specified.

Arguments

        portNum             SGMII port number for which loopback must be disabled
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII loopback mode disabled.

Writes
CPSGMII_CONTROL_REG_LOOPBACK=0

Example

        Uint32  portNum =   1;

        CSL_SGMII_disableLoopback (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_disableMasterMode ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_disableMasterMode

Description
This function configures the CPSGMII in 'Slave' mode or in other words disables the master mode for the port specified.

Arguments

        portNum             SGMII port number for which settings must be configured.
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII Master mode disabled, slave mode enabled.

Writes
CPSGMII_CONTROL_REG_MASTER=0

Example

        Uint32  portNum =   1;

        CSL_SGMII_disableMasterMode (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_doSoftReset ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_doSoftReset

Description
This function initiates a CPSGMII logic software reset for the SGMII port specified by setting the 'SOFT_RESET' bit of the CPSGMII Software Reset register to 1.

Arguments

        portNum             SGMII port number for which reset must be performed.
 *	 

Return Value
None

Pre Condition
None

Post Condition
Software reset on CPSGMII port is initiated. The Soft reset bit is set back to 0 once the reset operation is completed.

Writes
CPSGMII_SOFT_RESET_REG_SOFT_RESET=1

Affects
CPSGMII_SOFT_RESET_REG_SOFT_RESET=0

Example

        Uint32  portNum = 1;

        CSL_SGMII_doSoftReset (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_enableAutoNegotiation ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_enableAutoNegotiation

Description
This function enables auto-negotiation process for the port specified.

Arguments

        portNum             SGMII port number for which the operation must be
                            performed.
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII auto-negotiation enabled.

Writes
CPSGMII_CONTROL_REG_MR_AN_ENABLE=1

Example

        Uint32  portNum =   1;

        CSL_SGMII_enableAutoNegotiation (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_enableLoopback ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_enableLoopback

Description
This function configures the CPSGMII in internal loopback mode for the port number specified.

Arguments

        portNum             SGMII port number for which loopback must be enabled.
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII internal loopback mode enabled.

Writes
CPSGMII_CONTROL_REG_LOOPBACK=1

Example

        Uint32  portNum =   1;

        CSL_SGMII_enableLoopback (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_enableMasterMode ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_enableMasterMode

Description
This function configures the CPSGMII in 'Master' mode. Master mode allows a CPSGMII direct connection with auto-negotiation or with forced link.

Arguments

        portNum             SGMII port number for which settings must be configured
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII Master mode enabled.

Writes
CPSGMII_CONTROL_REG_MASTER=1

Example

        Uint32  portNum =   1;

        CSL_SGMII_enableMasterMode (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_endRxTxSoftReset ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_endRxTxSoftReset

Description
This function terminates a SGMII Receive and Transmit logic software reset initiated earlier by calling CSL_SGMII_startRxTxSoftReset () API. This API sets the 'RT_SOFT_RESET' bit of the CPSGMII Software Reset register to 0 to do so. This API is to be called once the loopback/normal switch is done.

Arguments

        portNum             SGMII port number for which reset must be ended.
 *	 

Return Value
None

Pre Condition
CSL_SGMII_startRxTxSoftReset () API must have been called earlier to initiate the Rx/Tx Soft reset before calling this API.

Post Condition
CPSGMII Rx/Tx Software logic reset cleared.

Writes
CPSGMII_SOFT_RESET_REG_RT_SOFT_RESET=0

Example

        Uint32  portNum =   1;

        CSL_SGMII_endRxTxSoftReset (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_getAdvAbility ( Uint32  portNum,
CSL_SGMII_ADVABILITY pSgmiiAdvAbility 
)

============================================================================
CSL_SGMII_getAdvAbility

Description
This function rerturns the contents of 'MR_ADV_ABILITY' register in the output parameter 'pSgmiiAdvAbility'.

Arguments

        portNum             SGMII port number for which the read operation must
                            be done.
 *      pSgmiiAdvAbility    CSL_SGMII_ADVABILITY output param structure pointer
 *                          that needs to be populated with advertised ability
 *                          register contents.
 *   

Return Value None

Pre Condition
None

Post Condition
None

Reads
CPSGMII_MR_ADV_ABILITY_REG

Example

 *      CSL_SGMII_STATUS    sgmiiAdvAbility;
        Uint32  portNum =   1;

        // Get SGMII Advertised ability info
        CSL_SGMII_getAdvAbility (portNum, &sgmiiAdvAbility);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_getAuxConfig ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_getAuxConfig

Description
This function retrieves the contents of the Auxilliary configuration register (AUX_CFG) for the port number specified.

Arguments

        portNum             SGMII port number for which read operation must be performed.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_AUX_CFG_REG

Example

        Uint32      auxCfgVal;
        Uint32      portNum =   1;

        auxCfgVal = CSL_SGMII_getAuxConfig (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_getLinkPartnerAdvAbility ( Uint32  portNum,
CSL_SGMII_ADVABILITY pSgmiiAdvAbility 
)

============================================================================
CSL_SGMII_getLinkPartnerAdvAbility

Description
This function rerturns the contents of 'MR_LP_ADV_ABILITY' register in the output parameter 'pSgmiiAdvAbility'.

Arguments

        portNum             SGMII port number for which read operation must be done
 *      pSgmiiAdvAbility    CSL_SGMII_ADVABILITY output param structure pointer
 *                          that needs to be populated with link partnet advertised 
 *                          ability register contents.
 *   

Return Value None

Pre Condition
None

Post Condition
None

Reads
CPSGMII_MR_LP_ADV_ABILITY_REG

Example

 *      CSL_SGMII_STATUS    sgmiiAdvAbility;
        Uint32  portNum =   1;

        // Get SGMII Advertised ability info
        CSL_SGMII_getLinkPartnerAdvAbility (portNum, &sgmiiAdvAbility);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_getRxConfig ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_getRxConfig

Description
This function retrieves the contents of the Receive configuration register (RX_CFG) for the port number specified.

Arguments

        portNum             SGMII port number for which read operation must be done
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_RX_CFG_REG

Example

        Uint32      rxCfgVal;
        Uint32      portNum =   1;

        rxCfgVal = CSL_SGMII_getRxConfig (portNum);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_getRxTxSoftResetStatus ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_getRxTxSoftResetStatus

Description
This function reads the 'RT_SOFT_RESET' bit of the CPSGMII Software Reset register and returns its contents.

Arguments

        portNum             SGMII port number for which reset status must be 
                            retrieved.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_SOFT_RESET_REG_RT_SOFT_RESET

Example

        Uint32  portNum =   1;

        if (!CSL_SGMII_getRxTxSoftResetStatus (portNum))
        {
            // Software reset is completed.
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_getSoftResetStatus ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_getSoftResetStatus

Description
This function reads the 'SOFT_RESET' bit of the CPSGMII Software Reset register and returns its contents for the port specified.

Arguments

        portNum             SGMII port number for which reset status must be 
                            retrieved.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_SOFT_RESET_REG_SOFT_RESET

Example

        Uint32  portNum = 1;

        if (!CSL_SGMII_getSoftResetStatus (portNum))
        {
            // Software reset is completed.
        }

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_getStatus ( Uint32  portNum,
CSL_SGMII_STATUS pSgmiiStatus 
)

============================================================================
CSL_SGMII_getStatus

Description
This function retrieves the SGMII status information from the hardware. The status info returned by this function are valid only if the 'bIsLocked' bit of status info is set to 1 and must be disregarded otherwise.

Arguments

        portNum             SGMII port number for which status must be retrieved.
 *      pSgmiiStatus        CSL_SGMII_STATUS structure pointer that needs to be
 *                          populated with link status information.
 *   

Return Value None

Pre Condition
None

Post Condition
None

Reads
CPSGMII_STATUS_REG_LINK, CPSGMII_STATUS_REG_AN_ERROR, CPSGMII_STATUS_REG_MR_AN_COMPLETE, CPSGMII_STATUS_REG_LOCK

Example

        Uint32  portNum =   1;
        CSL_SGMII_STATUS    sgmiiStatus;

        // Get link status info
        CSL_SGMII_getStatus (portNum, &sgmiiStatus);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_getTxConfig ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_getTxConfig

Description
This function retrieves the contents of the Transmit configuration register (TX_CFG).

Arguments

        portNum             SGMII port number for which read operation must be done.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_TX_CFG_REG

Example

        Uint32      txCfgVal;
        Uint32      portNum =   1;

        txCfgVal = CSL_SGMII_getTxConfig (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_getVersionInfo ( Uint32  portNum,
CSL_SGMII_VERSION sgmiiVersionInfo 
)

============================================================================
CSL_SGMII_getVersionInfo

Description
This function retrieves the SGMII version information for the SGMII port specified.

Arguments

        portNum             SGMII port number for which settings must be retrieved.
        sgmiiVersionInfo    CSL_SGMII_VERSION structure that needs to be populated
                            with the version info read from the SGMII_IDVER register.
 *	 

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPSGMII_IDVER_REG_MINOR_VER, CPSGMII_IDVER_REG_MAJOR_VER, CPSGMII_IDVER_REG_RTL_VER, CPSGMII_IDVER_REG_TX_IDENT

Example

        CSL_SGMII_VERSION   sgmiiVersionInfo;
        Uint32              portNum = 1;

        CSL_SGMII_getVersion (portNum, &sgmiiVersionInfo);

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_isAutoNegotiationEnabled ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_isAutoNegotiationEnabled

Description
This function reads the 'MR_AN_ENABLE' bit of the CPSGMII Control register and returns 1 to indicate that the CPSGMII is configured in 'auto-negotiate' mode and 0 otherwise.

Arguments

        portNum             SGMII port number for which autonegotiation must be enabled.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_CONTROL_REG_MR_AN_ENABLE

Example

        Uint32  portNum =   1;

        if (CSL_SGMII_isAutoNegotiationEnabled (portNum))
        {
            // auto-negotiation enabled.
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_isLoopbackModeEnabled ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_isLoopbackModeEnabled

Description
This function reads the 'LOOPBACK' bit of the CPSGMII Control register and returns 1 to indicate that the CPSGMII is configured in 'Loopback' mode and 0 otherwise.

Arguments

        portNum             SGMII port number for which loopback mode must be read.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_CONTROL_REG_LOOPBACK

Example

        Uint32  portNum =   1;

        if (CSL_SGMII_isLoopbackModeEnabled (portNum))
        {
            // Loopback mode enabled.
        }

	 

=============================================================================

CSL_IDEF_INLINE Uint32 CSL_SGMII_isMasterModeEnabled ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_isMasterModeEnabled

Description
This function reads the 'MASTER' bit of the CPSGMII Control register and returns 1 to indicate that the CPSGMII is configured in 'Master' mode and 0 otherwise to indicate 'Slave' mode.

Arguments

        portNum             SGMII port number for which settings must be retrieved.
 *	 

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
CPSGMII_CONTROL_REG_MASTER

Example

        Uint32  portNum =   1;

        if (!CSL_SGMII_isMasterModeEnabled (portNum))
        {
            // Slave Mode
        }
        else
        {
            // Master mode
        }

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_restartAutoNegotiation ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_restartAutoNegotiation

Description
This function restarts link auto-negotiation process for the port specified.

Arguments

        portNum             SGMII port number for which the operation must be 
                            performed
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII auto-negotiation restarted.

Writes
CPSGMII_CONTROL_REG_MR_AN_RESTART=1, CPSGMII_CONTROL_REG_MR_AN_RESTART=0

Example

        Uint32  portNum =   1;

        CSL_SGMII_restartAutoNegotiation (portNum);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_setAdvAbility ( Uint32  portNum,
CSL_SGMII_ADVABILITY pSgmiiAdvAbility 
)

============================================================================
CSL_SGMII_setAdvAbility

Description
This function sets up the 'MR_ADV_ABILITY' register as per the input specified to this function in 'pSgmiiAdvAbility' param.

Arguments

        portNum             SGMII port number for which configuration must be done.
 *      pSgmiiAdvAbility    CSL_SGMII_ADVABILITY input params structure that contains
 *                          the advertised ability configuration that needs to be
 *                          populated to the hardware registers.
 *   

Return Value None

Pre Condition
None

Post Condition
MR_ADV_ABILITY register setup accordingly.

Writes
CPSGMII_MR_ADV_ABILITY_REG

Example

        Uint32  portNum =   1;
        CSL_SGMII_STATUS    sgmiiAdvAbility;
        
        sgmiiAdvAbility.bLinkUp     =   1;
        sgmiiAdvAbility.duplexMode  =   CSL_SGMII_FULL_DUPLEX;
        sgmiiAdvAbility.linkSpeed   =   CSL_SGMII_1000_MBPS;

        // Configure SGMII Advertised ability info
        CSL_SGMII_setAdvAbility (portNum, &sgmiiAdvAbility);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_setAuxConfig ( Uint32  portNum,
Uint32  auxCfgVal 
)

============================================================================
CSL_SGMII_setAuxConfig

Description
This function sets up the contents of the Auxilliary configuration register (AUX_CFG) for the port specified.

Arguments

        portNum             SGMII port number for which configuration must be done
 *      auxCfgVal           SERDES PLL configuration value.
 *   

Return Value None

Pre Condition
None

Post Condition
AUX_CFG register setup with the value provided.

Writes
CPSGMII_AUX_CFG_REG

Example

        Uint32      auxCfgVal = 0x0000000b;
        Uint32      portNum =   1;

        CSL_SGMII_setAuxConfig (portNum, auxCfgVal);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_setRxConfig ( Uint32  portNum,
Uint32  rxCfgVal 
)

============================================================================
CSL_SGMII_setRxConfig

Description
This function sets up the contents of the Receive configuration register (RX_CFG) for the port number specified

Arguments

        portNum             SGMII port number for which configuration must be done
 *      rxCfgVal            SERDES receive configuration value.
 *   

Return Value None

Pre Condition
None

Post Condition
RX_CFG register setup with the value provided.

Writes
CPSGMII_RX_CFG_REG

Example

        Uint32      rxCfgVal = 0x00081021;
        Uint32      portNum =   1;

        CSL_SGMII_setRxConfig (portNum, rxCfgVal);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_setTxConfig ( Uint32  portNum,
Uint32  txCfgVal 
)

============================================================================
CSL_SGMII_setTxConfig

Description
This function sets up the contents of the Transmit configuration register (TX_CFG) for the port specified.

Arguments

        portNum             SGMII port number for which configuration must be done
 *      txCfgVal            SERDES transmit configuration value.
 *   

Return Value None

Pre Condition
None

Post Condition
TX_CFG register setup with the value provided.

Writes
CPSGMII_TX_CFG_REG

Example

        Uint32      txCfgVal = 0x00000ea1;
        Uint32      portNum =   1;

        CSL_SGMII_setTxConfig (portNum, txCfgVal);

	 

=============================================================================

CSL_IDEF_INLINE void CSL_SGMII_startRxTxSoftReset ( Uint32  portNum  ) 

============================================================================
CSL_SGMII_startRxTxSoftReset

Description
This function initiates a SGMII Receive and Transmit logic software reset by setting the 'RT_SOFT_RESET' bit of the CPSGMII Software Reset register to 1. This reset is to be started when switching between normal and loopback modes of operation.

Arguments

        portNum             SGMII port number for which reset must started.
 *	 

Return Value
None

Pre Condition
None

Post Condition
CPSGMII Rx/Tx Software logic reset initiated.

Writes
CPSGMII_SOFT_RESET_REG_RT_SOFT_RESET=1

Example

        Uint32  portNum = 1;

        CSL_SGMII_startRxTxSoftReset (portNum);

	 

=============================================================================


Copyright 2012, Texas Instruments Incorporated