net/ngbe: fix reading PHY ID

Change to check low ID register to determine the valid PHY address,
for yt8521s PHY with high ID register value 0. And fix polling
register when expect value is 0, to complete MDIO read.

Fixes: 44e97550ca ("net/ngbe: identify and reset PHY")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This commit is contained in:
Jiawen Wu 2022-05-30 17:30:10 +08:00 committed by Ferruh Yigit
parent 5eade8a363
commit abe02c6c4c
2 changed files with 9 additions and 7 deletions

View File

@ -120,17 +120,14 @@ bool ngbe_validate_phy_addr(struct ngbe_hw *hw, u32 phy_addr)
u16 phy_id = 0;
bool valid = false;
if (hw->sub_device_id == NGBE_SUB_DEV_ID_EM_YT8521S_SFP)
return true;
hw->phy.addr = phy_addr;
hw->phy.read_reg(hw, NGBE_MD_PHY_ID_HIGH,
hw->phy.read_reg(hw, NGBE_MD_PHY_ID_LOW,
NGBE_MD_DEV_PMA_PMD, &phy_id);
if (phy_id != 0xFFFF && phy_id != 0x0)
valid = true;
DEBUGOUT("PHY ID HIGH is 0x%04X", phy_id);
DEBUGOUT("PHY ID LOW is 0x%04X", phy_id);
return valid;
}

View File

@ -1422,8 +1422,13 @@ po32m(struct ngbe_hw *hw, u32 reg, u32 mask, u32 expect, u32 *actual,
}
do {
all |= rd32(hw, reg);
value |= mask & all;
if (expect != 0) {
all |= rd32(hw, reg);
value |= mask & all;
} else {
all = rd32(hw, reg);
value = mask & all;
}
if (value == expect)
break;