diff --git a/drivers/ethernet/phy/phy_mii.c b/drivers/ethernet/phy/phy_mii.c index 2f7654a4f14..a623685b8b5 100644 --- a/drivers/ethernet/phy/phy_mii.c +++ b/drivers/ethernet/phy/phy_mii.c @@ -41,7 +41,7 @@ struct phy_mii_dev_data { struct k_work_delayable autoneg_work; bool gigabit_supported; bool restart_autoneg; - uint32_t autoneg_timeout; + k_timepoint_t autoneg_timeout; #endif }; @@ -213,7 +213,7 @@ static int update_link_state(const struct device *dev) data->restart_autoneg = false; /* We have to wait for the auto-negotiation process to complete */ - data->autoneg_timeout = CONFIG_PHY_AUTONEG_TIMEOUT_MS / MII_AUTONEG_POLL_INTERVAL_MS; + data->autoneg_timeout = sys_timepoint_calc(K_MSEC(CONFIG_PHY_AUTONEG_TIMEOUT_MS)); return -EINPROGRESS; } @@ -245,7 +245,7 @@ static int check_autonegotiation_completion(const struct device *dev) } if (!(bmsr_reg & MII_BMSR_AUTONEG_COMPLETE)) { - if (data->autoneg_timeout-- == 0U) { + if (sys_timepoint_expired(data->autoneg_timeout)) { LOG_DBG("PHY (%d) auto-negotiate timedout", cfg->phy_addr); return -ETIMEDOUT; }