PDK API Guide for J721E
SGMII Functions

Introduction

Functions

void CSL_SGMII_getVersionInfo (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum, CSL_SGMII_VERSION *sgmiiVersionInfo)
 
void CSL_SGMII_doSoftReset (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_getSoftResetStatus (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_startRxTxSoftReset (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_endRxTxSoftReset (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_getRxTxSoftResetStatus (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_getSerdesPLLLockStatus (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_enableTestPattern (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_DisableTestPattern (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_enableMasterMode (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_disableMasterMode (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_isMasterModeEnabled (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_enableLoopback (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_disableLoopback (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_isLoopbackModeEnabled (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_restartAutoNegotiation (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_enableAutoNegotiation (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_disableAutoNegotiation (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
Uint32 CSL_SGMII_isAutoNegotiationEnabled (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum)
 
void CSL_SGMII_getStatus (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum, CSL_SGMII_STATUS *pSgmiiStatus)
 
void CSL_SGMII_setAdvAbility (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
 
void CSL_SGMII_getAdvAbility (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
 
void CSL_SGMII_getLinkPartnerAdvAbility (CSL_CpsgmiiRegs *hCpSgmiiRegs, Uint32 portNum, CSL_SGMII_ADVABILITY *pSgmiiAdvAbility)
 

Function Documentation

◆ CSL_SGMII_getVersionInfo()

void CSL_SGMII_getVersionInfo ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_doSoftReset()

void CSL_SGMII_doSoftReset ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_getSoftResetStatus()

Uint32 CSL_SGMII_getSoftResetStatus ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_startRxTxSoftReset()

void CSL_SGMII_startRxTxSoftReset ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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);

◆ CSL_SGMII_endRxTxSoftReset()

void CSL_SGMII_endRxTxSoftReset ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_getRxTxSoftResetStatus()

Uint32 CSL_SGMII_getRxTxSoftResetStatus ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_getSerdesPLLLockStatus()

Uint32 CSL_SGMII_getSerdesPLLLockStatus ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
Uint32  portNum 
)

============================================================================
CSL_SGMII_getSerdesPLLLockStatus

Description
This function reads the 'PLL_LOCK' bit of the CPSGMII status register and returns its contents.

Arguments

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

Return Value
None

Pre Condition
None

Post Condition
None

Reads
CPSGMII_STATUS_REG_LOCK

Example

       Uint32  portNum =   1;

       CSL_SGMII_getSerdesPLLLockStatus (portNum);

◆ CSL_SGMII_enableTestPattern()

void CSL_SGMII_enableTestPattern ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
Uint32  portNum 
)

============================================================================
CSL_SGMII_enableTestPattern

Description
This function enables test pattern (Force the output of K28.5 on TX_ENC for test purposes) 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 test-pattern enabled.

Writes
CPSGMII_CONTROL_REG_TEST_PATTERN=1

Example

       Uint32  portNum =   1;

       CSL_SGMII_enableTestPattern (portNum);

◆ CSL_SGMII_DisableTestPattern()

void CSL_SGMII_DisableTestPattern ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
Uint32  portNum 
)

============================================================================
CSL_SGMII_DisableTestPattern

Description
This function clears test pattern enable bit 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 test-pattern disabled.

Writes
CPSGMII_CONTROL_REG_TEST_PATTERN=0

Example

       Uint32  portNum =   1;

       CSL_SGMII_DisableTestPattern (portNum);

◆ CSL_SGMII_enableMasterMode()

void CSL_SGMII_enableMasterMode ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_disableMasterMode()

void CSL_SGMII_disableMasterMode ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_isMasterModeEnabled()

Uint32 CSL_SGMII_isMasterModeEnabled ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_enableLoopback()

void CSL_SGMII_enableLoopback ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_disableLoopback()

void CSL_SGMII_disableLoopback ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_isLoopbackModeEnabled()

Uint32 CSL_SGMII_isLoopbackModeEnabled ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_restartAutoNegotiation()

void CSL_SGMII_restartAutoNegotiation ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_enableAutoNegotiation()

void CSL_SGMII_enableAutoNegotiation ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_disableAutoNegotiation()

void CSL_SGMII_disableAutoNegotiation ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_isAutoNegotiationEnabled()

Uint32 CSL_SGMII_isAutoNegotiationEnabled ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_getStatus()

void CSL_SGMII_getStatus ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_setAdvAbility()

void CSL_SGMII_setAdvAbility ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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;
       sgmiiAdvAbility.sgmiimode   =   CSL_SGMII_MODE_SGMII;

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

◆ CSL_SGMII_getAdvAbility()

void CSL_SGMII_getAdvAbility ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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_SGMII_getLinkPartnerAdvAbility()

void CSL_SGMII_getLinkPartnerAdvAbility ( CSL_CpsgmiiRegs *  hCpSgmiiRegs,
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);