All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH NET] net/hns:bugfix of ethtool -t phy self_test
@ 2017-06-16  9:24 Lin Yun Sheng
  2017-06-19 18:21 ` David Miller
  2017-06-19 21:00 ` Florian Fainelli
  0 siblings, 2 replies; 16+ messages in thread
From: Lin Yun Sheng @ 2017-06-16  9:24 UTC (permalink / raw)
  To: davem
  Cc: huangdaode, xuwei5, liguozhu, Yisen.Zhuang, gabriele.paoloni,
	john.garry, linuxarm, yisen.zhuang, salil.mehta, lipeng321,
	yankejian, tremyfr, xieqianqian, netdev, linux-kernel

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: Lin Yun Sheng <linyunsheng@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index b8fab14..e95795b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en)
 
 		/* Force 1000M Link, Default is 0x0200 */
 		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_LOOP_BACK;
 		val &= ~PHY_POWER_DOWN;
@@ -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, 1, 0x400);
 		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, 9, 0xF00);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-06-22  3:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16  9:24 [PATCH NET] net/hns:bugfix of ethtool -t phy self_test Lin Yun Sheng
2017-06-19 18:21 ` David Miller
2017-06-19 21:00 ` Florian Fainelli
2017-06-19 21:54   ` Andrew Lunn
2017-06-20  3:18     ` l00371289
2017-06-20 13:28       ` Andrew Lunn
2017-06-21  2:06         ` l00371289
2017-06-20  3:05   ` l00371289
2017-06-20 13:27     ` Andrew Lunn
2017-06-21  2:03       ` l00371289
2017-06-21  3:13         ` Andrew Lunn
2017-06-21  3:42           ` l00371289
2017-06-21 13:34             ` Andrew Lunn
2017-06-22  1:41               ` l00371289
2017-06-22  3:35                 ` Andrew Lunn
2017-06-22  3:49                   ` l00371289

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.