From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
-------------------------------------------------------------
If selftest and reset are performed at the same time, the phy loopback setting may be still in enable state after the reset. As a result, device cannot link up. So we need to disable it before phy_start().
This patch also adds support of dump phy loopback in debugfs.
Signed-off-by: Yufeng Mo moyufeng@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 5 +++++ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 2 ++ 2 files changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 6278ff6..ec6b147 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -1316,6 +1316,7 @@ static void hclge_dbg_dump_ncl_config(struct hclge_dev *hdev, static void hclge_dbg_dump_loopback(struct hclge_dev *hdev, const char *cmd_buf) { + struct phy_device *phydev = hdev->hw.mac.phydev; struct hclge_config_mac_mode_cmd *req_app; struct hclge_serdes_lb_cmd *req_serdes; struct hclge_desc desc; @@ -1356,6 +1357,10 @@ static void hclge_dbg_dump_loopback(struct hclge_dev *hdev, HCLGE_CMD_SERDES_PARALLEL_INNER_LOOP_B; dev_info(&hdev->pdev->dev, "serdes parallel loopback: %s\n", loopback_en ? "on" : "off"); + + if (phydev) + dev_info(&hdev->pdev->dev, "phy loopback: %s\n", + phydev->loopback_enabled ? "on" : "off"); }
/* hclge_dbg_dump_mac_tnl_status: print message about mac tnl interrupt diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c index f31b2e5..d0247f4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c @@ -278,6 +278,8 @@ void hclge_mac_start_phy(struct hclge_dev *hdev) if (!phydev) return;
+ phy_loopback(phydev, false); + phy_start(phydev); }