Skip to content

Commit 749f6f6

Browse files
grygoriySdavem330
authored andcommitted
net: phy: dp83867: w/a for fld detect threshold bootstrapping issue
When the DP83867 PHY is strapped to enable Fast Link Drop (FLD) feature STRAP_STS2.STRAP_ FLD (reg 0x006F bit 10), the Energy Lost Threshold for FLD Energy Lost Mode FLD_THR_CFG.ENERGY_LOST_FLD_THR (reg 0x002e bits 2:0) will be defaulted to 0x2. This may cause the phy link to be unstable. The new DP83867 DM recommends to always restore ENERGY_LOST_FLD_THR to 0x1. Hence, restore default value of FLD_THR_CFG.ENERGY_LOST_FLD_THR to 0x1 when FLD is enabled by bootstrapping as recommended by DM. Signed-off-by: Grygorii Strashko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9de9aa4 commit 749f6f6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

drivers/net/phy/dp83867.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
#define DP83867_CTRL 0x1f
2929

3030
/* Extended Registers */
31-
#define DP83867_CFG4 0x0031
31+
#define DP83867_FLD_THR_CFG 0x002e
32+
#define DP83867_CFG4 0x0031
3233
#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6))
3334
#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5)
3435
#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5)
@@ -91,6 +92,7 @@
9192
#define DP83867_STRAP_STS2_CLK_SKEW_RX_MASK GENMASK(2, 0)
9293
#define DP83867_STRAP_STS2_CLK_SKEW_RX_SHIFT 0
9394
#define DP83867_STRAP_STS2_CLK_SKEW_NONE BIT(2)
95+
#define DP83867_STRAP_STS2_STRAP_FLD BIT(10)
9496

9597
/* PHY CTRL bits */
9698
#define DP83867_PHYCR_TX_FIFO_DEPTH_SHIFT 14
@@ -125,6 +127,9 @@
125127
/* CFG4 bits */
126128
#define DP83867_CFG4_PORT_MIRROR_EN BIT(0)
127129

130+
/* FLD_THR_CFG */
131+
#define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7
132+
128133
enum {
129134
DP83867_PORT_MIRROING_KEEP,
130135
DP83867_PORT_MIRROING_EN,
@@ -476,6 +481,20 @@ static int dp83867_config_init(struct phy_device *phydev)
476481
phy_clear_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4,
477482
BIT(7));
478483

484+
bs = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_STRAP_STS2);
485+
if (bs & DP83867_STRAP_STS2_STRAP_FLD) {
486+
/* When using strap to enable FLD, the ENERGY_LOST_FLD_THR will
487+
* be set to 0x2. This may causes the PHY link to be unstable -
488+
* the default value 0x1 need to be restored.
489+
*/
490+
ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
491+
DP83867_FLD_THR_CFG,
492+
DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK,
493+
0x1);
494+
if (ret)
495+
return ret;
496+
}
497+
479498
if (phy_interface_is_rgmii(phydev) ||
480499
phydev->interface == PHY_INTERFACE_MODE_SGMII) {
481500
val = phy_read(phydev, MII_DP83867_PHYCTRL);

0 commit comments

Comments
 (0)