]> git.droids-corp.org - dpdk.git/commitdiff
net/ngbe: fix reading PHY ID
authorJiawen Wu <jiawenwu@trustnetic.com>
Mon, 30 May 2022 09:30:10 +0000 (17:30 +0800)
committerFerruh Yigit <ferruh.yigit@xilinx.com>
Tue, 31 May 2022 07:42:16 +0000 (09:42 +0200)
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
drivers/net/ngbe/base/ngbe_regs.h

index 81996964288a47c19602a60f114d6fdebcf63c9e..1025d7d3a14a2ee4f76f43e82ad919160d1f1019 100644 (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;
 }
index 6432ad8736b6c38a505137ea47ace877c70a70af..640e385990936ae0ba2979f40b3b3c46aadb1a37 100644 (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;