mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Roland Hieber <rhi@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] net: phy: dp83867: reset PHY on probe
Date: Tue, 7 May 2024 16:11:51 +0200	[thread overview]
Message-ID: <Zjo2p5lZd6W6d-Lh@pengutronix.de> (raw)
In-Reply-To: <20240507133952.3716733-1-rhi@pengutronix.de>

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 |



  reply	other threads:[~2024-05-07 14:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 13:39 Roland Hieber
2024-05-07 14:11 ` Oleksij Rempel [this message]
2024-05-13  9:27 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zjo2p5lZd6W6d-Lh@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=rhi@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox