* [PATCH] net: phy: dp83867: reset PHY on probe
@ 2024-05-07 13:39 Roland Hieber
2024-05-07 14:11 ` Oleksij Rempel
2024-05-13 9:27 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Roland Hieber @ 2024-05-07 13:39 UTC (permalink / raw)
To: barebox; +Cc: Roland Hieber, Oleksij Rempel
Some PHY variants set the DP83867_PHYCR_FORCE_LINK_GOOD bit by default,
which should be unset if we want to rely on autonegotiation. Port
dp83867_phy_reset() from Linux v6.9-rc7, which already does all
necessary things, and call it in dp83867_probe(). (Keep the functions in
the original order so that the diff stays clean.)
Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
drivers/net/phy/dp83867.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 5dc5bac12536..aefc65148926 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -362,6 +362,8 @@ 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;
@@ -370,6 +372,8 @@ static int dp83867_probe(struct phy_device *phydev)
phydev->priv = dp83867;
+ dp83867_phy_reset(phydev);
+
return dp83867_of_init(phydev);
}
@@ -563,6 +567,20 @@ static int dp83867_config_init(struct phy_device *phydev)
return 0;
}
+static int dp83867_phy_reset(struct phy_device *phydev)
+{
+ int 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);
+}
+
static struct phy_driver dp83867_driver[] = {
{
.phy_id = DP83867_PHY_ID,
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: dp83867: reset PHY on probe
2024-05-07 13:39 [PATCH] net: phy: dp83867: reset PHY on probe Roland Hieber
@ 2024-05-07 14:11 ` Oleksij Rempel
2024-05-13 9:27 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2024-05-07 14:11 UTC (permalink / raw)
To: Roland Hieber; +Cc: barebox
On Tue, May 07, 2024 at 03:39:52PM +0200, Roland Hieber wrote:
> Some PHY variants set the DP83867_PHYCR_FORCE_LINK_GOOD bit by default,
> which should be unset if we want to rely on autonegotiation. Port
> dp83867_phy_reset() from Linux v6.9-rc7, which already does all
> necessary things, and call it in dp83867_probe(). (Keep the functions in
> the original order so that the diff stays clean.)
>
> Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/dp83867.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> index 5dc5bac12536..aefc65148926 100644
> --- a/drivers/net/phy/dp83867.c
> +++ b/drivers/net/phy/dp83867.c
> @@ -362,6 +362,8 @@ 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;
> @@ -370,6 +372,8 @@ static int dp83867_probe(struct phy_device *phydev)
>
> phydev->priv = dp83867;
>
> + dp83867_phy_reset(phydev);
> +
> return dp83867_of_init(phydev);
> }
>
> @@ -563,6 +567,20 @@ static int dp83867_config_init(struct phy_device *phydev)
> return 0;
> }
>
> +static int dp83867_phy_reset(struct phy_device *phydev)
> +{
> + int 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);
> +}
> +
> static struct phy_driver dp83867_driver[] = {
> {
> .phy_id = DP83867_PHY_ID,
> --
> 2.39.2
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: dp83867: reset PHY on probe
2024-05-07 13:39 [PATCH] net: phy: dp83867: reset PHY on probe Roland Hieber
2024-05-07 14:11 ` Oleksij Rempel
@ 2024-05-13 9:27 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-13 9:27 UTC (permalink / raw)
To: barebox, Roland Hieber; +Cc: Oleksij Rempel
On Tue, 07 May 2024 15:39:52 +0200, Roland Hieber wrote:
> Some PHY variants set the DP83867_PHYCR_FORCE_LINK_GOOD bit by default,
> which should be unset if we want to rely on autonegotiation. Port
> dp83867_phy_reset() from Linux v6.9-rc7, which already does all
> necessary things, and call it in dp83867_probe(). (Keep the functions in
> the original order so that the diff stays clean.)
>
>
> [...]
Applied, thanks!
[1/1] net: phy: dp83867: reset PHY on probe
https://git.pengutronix.de/cgit/barebox/commit/?id=59a6b92960ff (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-13 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 13:39 [PATCH] net: phy: dp83867: reset PHY on probe Roland Hieber
2024-05-07 14:11 ` Oleksij Rempel
2024-05-13 9:27 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox