[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200114112425.19967-1-m.grzeschik@pengutronix.de>
Date: Tue, 14 Jan 2020 12:24:25 +0100
From: Michael Grzeschik <m.grzeschik@...gutronix.de>
To: netdev@...r.kernel.org
Cc: andrew@...n.ch, f.fainelli@...il.com, hkallweit1@...il.com,
kernel@...gutronix.de
Subject: [PATCH] net: phy: dp83867: Set FORCE_LINK_GOOD do default after reset
According to the Datasheet this bit should be 0 (Normal operation) in
default. With the FORCE_LINK_GOOD bit set, it is not possible to get a
link. This patch sets FORCE_LINK_GOOD to the default value after
resetting the phy.
Signed-off-by: Michael Grzeschik <m.grzeschik@...gutronix.de>
---
drivers/net/phy/dp83867.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index adda0d0eab800..60a09fabf41d1 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -99,6 +99,7 @@
#define DP83867_PHYCR_TX_FIFO_DEPTH_MASK GENMASK(15, 14)
#define DP83867_PHYCR_RX_FIFO_DEPTH_MASK GENMASK(13, 12)
#define DP83867_PHYCR_RESERVED_MASK BIT(11)
+#define DP83867_PHYCR_FORCE_LINK_GOOD BIT(10)
/* RGMIIDCTL bits */
#define DP83867_RGMII_TX_CLK_DELAY_MAX 0xf
@@ -627,7 +628,7 @@ static int dp83867_config_init(struct phy_device *phydev)
static int dp83867_phy_reset(struct phy_device *phydev)
{
- int err;
+ int val, err;
err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
if (err < 0)
@@ -635,6 +636,16 @@ static int dp83867_phy_reset(struct phy_device *phydev)
usleep_range(10, 20);
+ /* After reset FORCE_LINK_GOOD bit is set. Although the
+ * default value should be unset. Disable FORCE_LINK_GOOD
+ * for the phy to work properly.
+ */
+ val = phy_read(phydev, MII_DP83867_PHYCTRL);
+ if (val & DP83867_PHYCR_FORCE_LINK_GOOD) {
+ val &= ~(DP83867_PHYCR_FORCE_LINK_GOOD);
+ phy_write(phydev, MII_DP83867_PHYCTRL, val);
+ }
+
return 0;
}
--
2.25.0.rc1
Powered by blists - more mailing lists