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" 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 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); 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"