mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Stefan Kerkmann <s.kerkmann@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH 3/3] net: phy: dp83867: sync dp83867_phy_rest
Date: Thu, 23 May 2024 16:49:43 +0200	[thread overview]
Message-ID: <71b844c5-3205-4f5e-be71-eab0d36984d9@pengutronix.de> (raw)
In-Reply-To: <20240523-feature-dp83867-soft-reset-v1-3-428d15168dfe@pengutronix.de>

On 23.05.24 16:40, Stefan Kerkmann wrote:
> 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.

Even if it doesn't matter for your original issue, the DP83867_DSP_FFE_CFG
configuration you import looks like a good thing to have.

> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@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,
>  	},
> 

-- 
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-23 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 14:40 [PATCH 0/3] net: phy: dp83867: sync dp83867_phy_reset Stefan Kerkmann
2024-05-23 14:40 ` [PATCH 1/3] net: phy: allow PHY drivers to implement their own software reset Stefan Kerkmann
2024-05-23 14:46   ` Ahmad Fatoum
2024-05-23 14:40 ` [PATCH 2/3] net: phy: document core PHY structures Stefan Kerkmann
2024-05-23 14:47   ` Ahmad Fatoum
2024-05-23 14:40 ` [PATCH 3/3] net: phy: dp83867: sync dp83867_phy_rest Stefan Kerkmann
2024-05-23 14:49   ` Ahmad Fatoum [this message]
2024-05-24  9:15 ` [PATCH 0/3] net: phy: dp83867: sync dp83867_phy_reset 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=71b844c5-3205-4f5e-be71-eab0d36984d9@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.kerkmann@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