From cfe5d163356d8583f385a3ef2a0133c2e87d408b Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 1 Dec 2025 17:02:36 +0800 Subject: [PATCH 1/4] [Drivers/phy] Fixup header include for v2 Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/include/rtdevice.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index 7007441c6bc..fbed6c829d7 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -170,9 +170,9 @@ extern "C" { #endif /* RT_USING_DM */ #endif /* RT_USING_I2C */ -#ifdef RT_USING_PHY +#if defined(RT_USING_PHY) || defined(RT_USING_PHY_V2) #include "drivers/phy.h" -#endif /* RT_USING_PHY */ +#endif /* RT_USING_PHY || RT_USING_PHY_V2 */ #ifdef RT_USING_SDIO #include "drivers/dev_mmcsd_core.h" From 22df532a6d87cd1f81b1c6ebcf7a192547fbd088 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 1 Dec 2025 17:03:18 +0800 Subject: [PATCH 2/4] [DM/PHY] Make Kconfig import for DM Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/phy/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/drivers/phy/Kconfig b/components/drivers/phy/Kconfig index 92dcba8c4e3..cf0560aed58 100644 --- a/components/drivers/phy/Kconfig +++ b/components/drivers/phy/Kconfig @@ -1,8 +1,12 @@ -config RT_USING_PHY +menuconfig RT_USING_PHY bool "Using ethernet phy device drivers" default n -config RT_USING_PHY_V2 +menuconfig RT_USING_PHY_V2 bool "Using phy device and mii bus v2" depends on !RT_USING_PHY default n + +if RT_USING_DM && RT_USING_PHY_V2 + osource "$(SOC_DM_PHY_DIR)/Kconfig" +endif From 6f987af5a374ed891daa7136188707381f05b49d Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 1 Dec 2025 17:03:51 +0800 Subject: [PATCH 3/4] [PHY/OFW] Change the log level Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/phy/ofw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/phy/ofw.c b/components/drivers/phy/ofw.c index 316bbc2fde3..933255e8222 100644 --- a/components/drivers/phy/ofw.c +++ b/components/drivers/phy/ofw.c @@ -11,7 +11,7 @@ #include #include #define DBG_TAG "rtdm.phy" -#define DBG_LVL DBG_INFO +#define DBG_LVL DBG_LOG #include #include "ofw.h" From c2a5a8fa58ce08c07a9a1448f52e7f11c86d0d65 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 1 Dec 2025 17:04:26 +0800 Subject: [PATCH 4/4] [PHY/OFW] Fixup the phy link up waiting forever Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/phy/general.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/drivers/phy/general.c b/components/drivers/phy/general.c index 969c38c3686..a75d76468a1 100644 --- a/components/drivers/phy/general.c +++ b/components/drivers/phy/general.c @@ -172,13 +172,13 @@ int rt_genphy_update_link(struct rt_phy_device *phydev) !(mii_reg & RT_BMSR_ANEGCOMPLETE)) { int i = 0; - rt_kprintf("Waiting for PHY auto negotiation to complete"); + LOG_I("Waiting for PHY auto negotiation to complete"); while (!(mii_reg & RT_BMSR_ANEGCOMPLETE)) { if (i > (RT_PHY_ANEG_TIMEOUT)) { - LOG_E(" TIMEOUT !\n"); + LOG_E(" TIMEOUT!"); phydev->link = 0; return -ETIMEDOUT; } @@ -186,8 +186,9 @@ int rt_genphy_update_link(struct rt_phy_device *phydev) mii_reg = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMSR); rt_thread_delay(100); + i += 100; } - LOG_D(" done\n"); + LOG_D(" Done"); phydev->link = 1; } else { mii_reg = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMSR);