drivers: ethernet: phy_mii: Fix invalid phy_id check

When there'is no phy at the address both registers will return
0xFFFF, giving a phy address of UINT32_MAX, not 0x00FFFFFF.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
This commit is contained in:
Andriy Gelman 2023-11-19 13:46:16 -05:00 committed by Maureen Helm
parent 9080007ef9
commit c6b5c61667

View file

@ -39,6 +39,8 @@ struct phy_mii_dev_data {
/* Offset to align capabilities bits of 1000BASE-T Control and Status regs */
#define MII_1KSTSR_OFFSET 2
#define MII_INVALID_PHY_ID UINT32_MAX
static int phy_mii_get_link_state(const struct device *dev,
struct phy_link_state *state);
@ -436,7 +438,7 @@ static int phy_mii_initialize(const struct device *dev)
}
if (get_id(dev, &phy_id) == 0) {
if (phy_id == 0xFFFFFF) {
if (phy_id == MII_INVALID_PHY_ID) {
LOG_ERR("No PHY found at address %d",
cfg->phy_addr);