With a YT8531S-CA PHY in UTP_FIBER_TO_RGMII combo mode, the copper port
raises interrupts and links up, but the fiber side raises none and never
links up.

ngbe_init_phy_yt() enables the interrupts straight away, without the
extra configuration such a part needs. Apply that configuration first,
and skip it for parts that read 0x31 or 0x32 in YT_INTR.

Fixes: 79be49dd2d65 ("net/ngbe: add special config for YT8531SH-CA PHY")
Cc: [email protected]

Signed-off-by: Zaiyu Wang <[email protected]>
---
 drivers/net/ngbe/base/ngbe_phy_yt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ngbe/base/ngbe_phy_yt.c 
b/drivers/net/ngbe/base/ngbe_phy_yt.c
index ab0778d246..f9230266e9 100644
--- a/drivers/net/ngbe/base/ngbe_phy_yt.c
+++ b/drivers/net/ngbe/base/ngbe_phy_yt.c
@@ -100,8 +100,25 @@ s32 ngbe_write_phy_reg_sds_ext_yt(struct ngbe_hw *hw,
 
 s32 ngbe_init_phy_yt(struct ngbe_hw *hw)
 {
+       u16 value = 0;
+
        rte_spinlock_init(&hw->phy_lock);
 
+       rte_spinlock_lock(&hw->phy_lock);
+       ngbe_write_phy_reg_ext_yt(hw, YT_SPEC_CONF, 0,
+                                 YT_SPEC_CONF_8531SH_CA);
+       ngbe_write_phy_reg_ext_yt(hw, YT_SMI_PHY, 0, 0);
+       ngbe_read_phy_reg_mdi(hw, YT_INTR, 0, &value);
+
+       if (value != 0x31 && value != 0x32) {
+               ngbe_write_phy_reg_ext_yt(hw, 0xa071, 0, 0x9007);
+               ngbe_write_phy_reg_ext_yt(hw, 0x52, 0, 0x231d);
+               ngbe_write_phy_reg_ext_yt(hw, 0x51, 0, 0x04a9);
+               ngbe_write_phy_reg_ext_yt(hw, 0x57, 0, 0x274c);
+               ngbe_write_phy_reg_ext_yt(hw, YT_MISC, 0, 0x10d);
+       }
+       rte_spinlock_unlock(&hw->phy_lock);
+
        if (hw->lsc) {
                rte_spinlock_lock(&hw->phy_lock);
                /* close sds area register */
-- 
2.55.0.windows.2

Reply via email to