Skip to content

Commit

Permalink
net/ngbe: fix reading PHY ID
Browse files Browse the repository at this point in the history
[ upstream commit abe02c6 ]

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: 44e9755 ("net/ngbe: identify and reset PHY")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and kevintraynor committed Jun 8, 2022
1 parent c2f1874 commit fe6c80f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 2 additions & 5 deletions drivers/net/ngbe/base/ngbe_phy.c
Expand Up @@ -121,17 +121,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;
}
Expand Down
9 changes: 7 additions & 2 deletions drivers/net/ngbe/base/ngbe_regs.h
Expand Up @@ -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;

Expand Down

0 comments on commit fe6c80f

Please sign in to comment.