[PATCH 3/3] net: phy: dp83867: sync dp83867_phy_rest
Stefan Kerkmann
s.kerkmann at pengutronix.de
Thu May 23 07:40:30 PDT 2024
This is a port of the `dp83867_phy_reset` function at the state of linux
commit a129b41fe0a8b4da828c46b10f5244ca07a3fec3 ("Revert "net: phy:
dp83867: perform soft reset and retain established link"). Which
performs a reset before starting the initial configuration.
It is a refactoring of commit 095cd32961aab64cfe72941ce43d99876852e12b
("net: phy: dp83867: reset PHY on probe") which already ported parts of
the function, but diverted from the upstream implementation.
Signed-off-by: Stefan Kerkmann <s.kerkmann at pengutronix.de>
---
drivers/net/phy/dp83867.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index aefc651489..3c9a8e6355 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -362,8 +362,6 @@ static int dp83867_of_init(struct phy_device *phydev)
return 0;
}
-static int dp83867_phy_reset(struct phy_device *phydev); /* see below */
-
static int dp83867_probe(struct phy_device *phydev)
{
struct dp83867_private *dp83867;
@@ -372,8 +370,6 @@ static int dp83867_probe(struct phy_device *phydev)
phydev->priv = dp83867;
- dp83867_phy_reset(phydev);
-
return dp83867_of_init(phydev);
}
@@ -571,14 +567,33 @@ static int dp83867_phy_reset(struct phy_device *phydev)
{
int err;
+ err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
+ if (err < 0)
+ return err;
+
+ udelay(20);
+
+ err = phy_modify(phydev, MII_DP83867_PHYCTRL,
+ DP83867_PHYCR_FORCE_LINK_GOOD, 0);
+ if (err < 0)
+ return err;
+
+ /* Configure the DSP Feedforward Equalizer Configuration register to
+ * improve short cable (< 1 meter) performance. This will not affect
+ * long cable performance.
+ */
+ err = phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_DSP_FFE_CFG,
+ 0x0e81);
+ if (err < 0)
+ return err;
+
err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART);
if (err < 0)
return err;
udelay(20);
- return phy_modify(phydev, MII_DP83867_PHYCTRL,
- DP83867_PHYCR_FORCE_LINK_GOOD, 0);
+ return 0;
}
static struct phy_driver dp83867_driver[] = {
@@ -590,6 +605,7 @@ static struct phy_driver dp83867_driver[] = {
.probe = dp83867_probe,
.config_init = dp83867_config_init,
+ .soft_reset = dp83867_phy_reset,
.read_status = dp83867_read_status,
},
--
2.39.2
More information about the barebox
mailing list