Commit 7fe5b914 authored by Lin Yun Sheng's avatar Lin Yun Sheng Committed by David S. Miller

net/hns:bugfix of ethtool -t phy self_test

This patch fixes the phy loopback self_test failed issue. when
Marvell Phy Module is loaded, it will powerdown fiber when doing
phy loopback self test, which cause phy loopback self_test fail.
Signed-off-by: default avatarLin Yun Sheng <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9745e362
...@@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) ...@@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en)
/* Force 1000M Link, Default is 0x0200 */ /* Force 1000M Link, Default is 0x0200 */
phy_write(phy_dev, 7, 0x20C); phy_write(phy_dev, 7, 0x20C);
phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
/* Enable PHY loop-back */ /* Powerup Fiber */
phy_write(phy_dev, HNS_PHY_PAGE_REG, 1);
val = phy_read(phy_dev, COPPER_CONTROL_REG);
val &= ~PHY_POWER_DOWN;
phy_write(phy_dev, COPPER_CONTROL_REG, val);
/* Enable Phy Loopback */
phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
val = phy_read(phy_dev, COPPER_CONTROL_REG); val = phy_read(phy_dev, COPPER_CONTROL_REG);
val |= PHY_LOOP_BACK; val |= PHY_LOOP_BACK;
val &= ~PHY_POWER_DOWN; val &= ~PHY_POWER_DOWN;
...@@ -299,6 +305,12 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) ...@@ -299,6 +305,12 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en)
phy_write(phy_dev, HNS_PHY_PAGE_REG, 0xFA); phy_write(phy_dev, HNS_PHY_PAGE_REG, 0xFA);
phy_write(phy_dev, 1, 0x400); phy_write(phy_dev, 1, 0x400);
phy_write(phy_dev, 7, 0x200); phy_write(phy_dev, 7, 0x200);
phy_write(phy_dev, HNS_PHY_PAGE_REG, 1);
val = phy_read(phy_dev, COPPER_CONTROL_REG);
val |= PHY_POWER_DOWN;
phy_write(phy_dev, COPPER_CONTROL_REG, val);
phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
phy_write(phy_dev, 9, 0xF00); phy_write(phy_dev, 9, 0xF00);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment