Hi experts,
Can you guide me on how to add PHY drivers on my custom board?
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.
Hi,
The AM263x has the DP83869HMRGZT and DP83826ERHBT PHYs on-board. To make the process easy to understand, lets integrate DP83TC812 PHY on a custom board based on the AM263x. The following guide is verified on MCU_PLUS_SDK v09.01 with syscfg v1.18 and CCS v12.5
Adding PHY drivers on a custom board can be divided into 2 parts:
1. Integration of the PHY driver
The first step is to get the Header (.h) and C (.c) files for the PHY driver. Incase you are using a TI PHY, you can find some RTOS and linux drivers at: https://github.com/TexasInstruments/ti-ethernet-software/blob/main/README.md. If you don't find the required driver here, please raise an E2E for the same and TI experts will guide you.
To integrate your PHY driver follow the steps below:
Rebuild the enet cpsw library using the following command: # TO CLEAN
gmake -s -f makefile.am263x enet-cpsw_r5f.ti-arm-clang_clean
# TO BUILD
gmake -s -f makefile.am263x enet-cpsw_r5f.ti-arm-clang
2. Custom board config for the PHY driver
Define a Cfg struct (DP83tc812_Cfg in this case) for the PHY driver. (refer the phy driver include file for the structure)
#include <networking/enet/core/include/phy/dp83tc812.h> /* PHY drivers */ extern EnetPhy_Drv gEnetPhyDrvGeneric; extern EnetPhy_Drv gEnetPhyDrvDp83tc812; /*! \brief All the registered PHY specific drivers. */ static const EnetPhyDrv_Handle gEnetPhyDrvs[] = { &gEnetPhyDrvDp83tc812, &gEnetPhyDrvGeneric, /* Generic PHY - must be last */ }; /* Create a config struct for the PHY */ /*! * \brief Common Processor Board (CPB) board's DP83tc812 PHY configuration. */ static const Dp83tc812_Cfg gEnetCpbBoard_dp83tc812PhyCfg = { .txClkShiftEn = true, .rxClkShiftEn = true, .interruptEn = false, .sgmiiAutoNegEn = true, .MasterSlaveMode = DP83TC812_MASTER_SLAVE_STRAP, }; /* * AM263x board configuration. * * 1 x RGMII PHY connected to AM263x CPSW_3G MAC port. */ static const EnetBoard_PortCfg gEnetCpbBoard_am263xEthPort[] = { { /* "CPSW3G" */ .enetType = ENET_CPSW_3G, .instId = 0U, .macPort = ENET_MAC_PORT_1, .mii = { ENET_MAC_LAYER_GMII, ENET_MAC_SUBLAYER_REDUCED }, .phyCfg = { .phyAddr = 0, .isStrapped = false, .skipExtendedCfg = false, .extendedCfg = &gEnetCpbBoard_dp83tc812PhyCfg, .extendedCfgSize = sizeof(gEnetCpbBoard_dp83tc812PhyCfg), }, .flags = 0U, }, { /* "CPSW3G" */ .enetType = ENET_CPSW_3G, .instId = 0U, .macPort = ENET_MAC_PORT_2, .mii = { ENET_MAC_LAYER_GMII, ENET_MAC_SUBLAYER_REDUCED }, .phyCfg = { .phyAddr = 3, .isStrapped = false, .skipExtendedCfg = false, .extendedCfg = &gEnetCpbBoard_dp83tc812PhyCfg, .extendedCfgSize = sizeof(gEnetCpbBoard_dp83tc812PhyCfg), }, .flags = 0U, }, };Now compile your application with this custom board config file.
Regards,
Shaunak