This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[PHY] where is the code that is using CSL_MDIO_XXX API? (EVMK2H)

I've found the CSL_MDIO_XXX APIs which could control the ethernet PHY.

However, I cannot see the source code which is using above API.

For example, there is CSL_MDIO_isPhyLinked() at PDK_INSTALL_PACKAGE\package\ti\csl\src\ip\mdio\v0\csl_mdioAux.h

The CSL_MDIO_isPhyLinked() is called by other platform(evmAM335XevmAM335x, ...)

However, the EVMK2H does not call CSL_MDIO_isPhyLinked().

$ grep -r -i --include \*.h --include \*.c "CSL_MDIO_isPhyLinked"
board/src/bbbAM335x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/evmAM335x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/evmAM437x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/evmAM571x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/evmAM572x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/icev2AM335x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/idkAM437x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/idkAM571x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/idkAM572x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/skAM335x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
board/src/skAM437x/device/enet_phy.c: if (CSL_MDIO_isPhyLinked((CSL_mdioHandle) ((ENETPHY_DEVICE *) hPhyDev)->miibase, PhyNum))
csl/src/ip/mdio/V0/csl_mdioAux.h: * @n@b CSL_MDIO_isPhyLinked

I'am using EVMK2H and running at dsp_core0 with SYS/BIOS(TI RTOS)

pdk version is pdk_k2hk_4_0_2

  • Hi,

    I've notified the ethernet experts. Their feedback will be posted here.

    Best Regards,
    Yordan
  • Hi,

    For K2H device, it is MDIO V0, see pdk_k2hk_4_0_3\packages\ti\csl\csl_mdio.h:

    #elif defined(SOC_K2H) || defined(SOC_C6678)
    #include <ti/csl/src/ip/mdio/V0/csl_mdio.h>

    The CSL code has many MDIO functions like CSL_MDIO_isPhyLinked() you mentioned. The Chip Support Library constitutes a set of well-defined APIs that abstract low-level details of the underlying SoC device so that a user can configure, control (start/stop, etc.) and have read/write access to peripherals without having to worry about register bit-field details. The CSL services are implemented as distinct modules that correspond with the underlying SoC device modules themselves. By design, CSL APIs follow a consistent style, uniformly across Processor Instruction Set Architecture and are independent of the OS. This helps in improving portability of code written using the CSL.

    In our examples code, we not necessarily call all the CSL APIs. For the PA example, you can see that SGMII init is done in Init_SGMII() function in pdk_k2hk_4_0_3\packages\ti\drv\pa\example\emacExample\src\armv7\bios\cpsw_mgmt.c

    The link status is checked by polling :

    do
    {
    CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
    } while (sgmiiStatus.bIsLinkUp != 1);

    /* Wait for SGMII Autonegotiation to complete without error */
    do
    {
    CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
    if (sgmiiStatus.bIsAutoNegError != 0)
    return -1;
    } while (sgmiiStatus.bIsAutoNegComplete != 1);

    We didn't check MDIO link status, if you want, you can add CSL_MDIO_isPhyLinked() to your code.

    Regards, Eric