[PATCH] net: phy: dp83867: reset PHY on probe
Oleksij Rempel
o.rempel at pengutronix.de
Tue May 7 07:11:51 PDT 2024
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 at pengutronix.de>
> Signed-off-by: Roland Hieber <rhi at pengutronix.de>
Reviewed-by: Oleksij Rempel <o.rempel at 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 |
More information about the barebox
mailing list