[3/9] net/ngbe: fix occasional failure of reading PHY ID
Checks
Commit Message
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: 44e97550ca68 ("net/ngbe: identify and reset PHY")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/ngbe/base/ngbe_phy.c | 7 ++-----
drivers/net/ngbe/base/ngbe_regs.h | 9 +++++++--
2 files changed, 9 insertions(+), 7 deletions(-)
@@ -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;
}
@@ -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;