phy: keep the BCMR_LOOPBACK bit while setup forced mode
Subsystems (3)
PATCH RESEND 1/1 phy: keep the BCMR_LOOPBACK bit while setup forced mode
When tested the PHY SGMII Loopback,:
1.set the LOOPBACK bit,
2.set the autoneg to AUTONEG_DISABLE, it calls the genphy_setup_forced which will clear the bit.
So just keep the LOOPBACK bit while setup forced mode.
--- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/phy_device.c +2 -0
@@ -1124,7 +1124,9 @@ static int genphy_config_advert(struct phy_device *phydev)int genphy_setup_forced (struct phy_device *phydev) {int ctl =0 ; +int val =phy_read (phydev,MII_BMCR ); + ctl |= val &BMCR_LOOPBACK ; phydev->pause =0 ; phydev->asym_pause =0 ;
-- 2.7.0
Hello.
Quoted 17 lines · Weidong Wang
When tested the PHY SGMII Loopback,:
1.set the LOOPBACK bit,
2.set the autoneg toAUTONEG_DISABLE, it calls thegenphy_setup_forcedwhich will clear the bit.So just keep the LOOPBACK bit while setup forced mode.
Signed-off-by Weidong Wang <[email protected]>--- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/phy/phy_device.c +0
-0
drivers/net/phy/phy_device.c static int genphy_config_advert(struct phy_device *phydev) · line 1127
Quoted 4 lines
drivers/net/phy/phy_device.c +1
-0@@ -1124,7 +1124,9 @@ static int genphy_config_advert(struct phy_device *phydev)int genphy_setup_forced (struct phy_device *phydev) {int ctl =0 ; +int val =phy_read (phydev,MII_BMCR );
Please place this declaration first, DaveM prefers declarations to be
sorted from longest to shortest.
drivers/net/phy/phy_device.c static int genphy_config_advert(struct phy_device *phydev) · line 1129
Quoted 2 lines
drivers/net/phy/phy_device.c +1
-0+ ctl |= val &BMCR_LOOPBACK ;
Just =, removing the 'ctl' initializer, please.
[...]
MBR, Sergei
Quoted 29 lines · Sergei Shtylyov
Hello.
Quoted 17 lines · Weidong Wang
When tested the PHY SGMII Loopback,:
1.set the LOOPBACK bit,
2.set the autoneg toAUTONEG_DISABLE, it calls thegenphy_setup_forcedwhich will clear the bit.So just keep the LOOPBACK bit while setup forced mode.
Signed-off-by Weidong Wang <[email protected]>--- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/phy/phy_device.c +0
-0drivers/net/phy/phy_device.c static int genphy_config_advert(struct phy_device *phydev) · line 1127
Quoted 4 lines
drivers/net/phy/phy_device.c +1
-0@@ -1124,7 +1124,9 @@ static int genphy_config_advert(struct phy_device *phydev)int genphy_setup_forced (struct phy_device *phydev) {int ctl =0 ; +int val =phy_read (phydev,MII_BMCR );Please place this declaration first, DaveM prefers declarations to be sorted from longest to shortest.
Quoted 1 line
Quoted 8 lines
Quoted 1 line
+ ctl |= val &
BMCR_LOOPBACK;Just =, removing the 'ctl' initializer, please.
[...]
MBR, Sergei
Got it.
Regards,
Weidong
Quoted 2 lines
Quoted 6 lines · Weidong Wang
When tested the PHY SGMII Loopback,:
1.set the LOOPBACK bit,
2.set the autoneg toAUTONEG_DISABLE, it calls thegenphy_setup_forcedwhich will clear the bit.So just keep the LOOPBACK bit while setup forced mode.
Humm, it makes sense why we want this one, but maybe we want other bits to be preserved too, like MII_ISOLATE for instance?
Or maybe we should have a separate way to put the PHY into loopback mode which is deterministic and takes care of forcing the link at the same time?
Quoted 22 lines
Signed-off-by Weidong Wang <[email protected]>--- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/phy/phy_device.c +2
-1@@ -1124,7 +1124,9 @@ static int genphy_config_advert(struct phy_device *phydev)int genphy_setup_forced (struct phy_device *phydev) {int ctl =0 ; +int val =phy_read (phydev,MII_BMCR ); + ctl |= val &BMCR_LOOPBACK ; phydev->pause =0 ; phydev->asym_pause =0 ; -- 2.7.0
Signature · 1 line
Florian
Quoted 11 lines · Florian Fainelli
Quoted 6 lines · Weidong Wang
When tested the PHY SGMII Loopback,:
1.set the LOOPBACK bit,
2.set the autoneg toAUTONEG_DISABLE, it calls thegenphy_setup_forcedwhich will clear the bit.So just keep the LOOPBACK bit while setup forced mode.
Humm, it makes sense why we want this one, but maybe we want other bits to be preserved too, like
MII_ISOLATEfor instance?
I will add the MII_ISOLATE as well.
Quoted 3 lines
Or maybe we should have a separate way to put the PHY into loopback mode which is deterministic and takes care of forcing the link at the same time?
I test with the loopback mode, and the link status is undeterminable.
Quoted 24 lines
Quoted 22 lines
Signed-off-by Weidong Wang <[email protected]>--- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/phy/phy_device.c +2
-1@@ -1124,7 +1124,9 @@ static int genphy_config_advert(struct phy_device *phydev)int genphy_setup_forced (struct phy_device *phydev) {int ctl =0 ; +int val =phy_read (phydev,MII_BMCR ); + ctl |= val &BMCR_LOOPBACK ; phydev->pause =0 ; phydev->asym_pause =0 ; -- 2.7.0
PATCH 1/1 phy: make some bits preserved while setup forced mode
In reply to Weidong WangWhen tested the PHY SGMII Loopback:
1.set the LOOPBACK bit,
2.set the autoneg to AUTONEG_DISABLE, it calls the genphy_setup_forced which will clear the bit.
The BMCR_LOOPBACK bit should be preserved.
As Florian pointed out that other bits should be preserved too. So I make the BMCR_ISOLATE and BMCR_PDOWN as well.
---
the patch is evoluted from "phy: keep the BCMR_LOOPBACK bit while setup forced mode".
--- drivers/net/phy/phy_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy_device.c +2 -1
@@ -818,8 +818,9 @@ static int genphy_config_advert(struct phy_device *phydev)*/ int genphy_setup_forced (struct phy_device *phydev) { -int ctl =0 ; +int ctl =phy_read (phydev,MII_BMCR ); + ctl &=BMCR_LOOPBACK |BMCR_ISOLATE |BMCR_PDOWN ; phydev->pause =0 ; phydev->asym_pause =0 ;
Signature · 1 line
2.7.0
Re: [PATCH net-next] phy: make some bits preserved while setup forced mode
From: Weidong Wang <[email protected]>
Date: Thu, 14 Apr 2016 15:43:52 +0800
Quoted 11 lines
When tested the PHY SGMII Loopback:
1.set the LOOPBACK bit,
2.set the autoneg toAUTONEG_DISABLE, it calls thegenphy_setup_forcedwhich will clear the bit.The
BMCR_LOOPBACKbit should be preserved.As Florian pointed out that other bits should be preserved too. So I make the
BMCR_ISOLATEandBMCR_PDOWNas well.Signed-off-by Weidong Wang <[email protected]>
Applied, thank you.