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 1/3] net: phy: allow PHY drivers to implement their own software reset
Date: Thu, 23 May 2024 16:46:33 +0200	[thread overview]
Message-ID: <590b3485-8464-40b1-9fc5-a21c87906aa9@pengutronix.de> (raw)
In-Reply-To: <20240523-feature-dp83867-soft-reset-v1-1-428d15168dfe@pengutronix.de>

On 23.05.24 16:40, Stefan Kerkmann wrote:
> This is a port of linux commit 9df81dd7583d14862d0cfb673a941b261f3b2112
> ("net: phy: allow PHY drivers to implement their own software reset")
> which implements the ability for phy drivers to implement the own
> non-standard software reset sequence.
> 
> A side effect is that fixups will now applied always even if
> .config_init is undefined. This shouldn't be possible to happen though,
> because phy_driver_register will populate the member with
> genphy_config_init in that case, so the member should never be NULL.
> 
> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  drivers/net/phy/phy.c | 16 ++++++++++++++--
>  include/linux/phy.h   |  5 +++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index abd78b2c80..a83f183302 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -1108,14 +1108,26 @@ int phy_init_hw(struct phy_device *phydev)
>  	struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
>  	int ret;
>  
> -	if (!phydrv || !phydrv->config_init)
> +	if (!phydrv)
>  		return 0;
>  
> +	if (phydrv->soft_reset) {
> +		ret = phydrv->soft_reset(phydev);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
>  	ret = phy_scan_fixups(phydev);
>  	if (ret < 0)
>  		return ret;
>  
> -	return phydrv->config_init(phydev);
> +	if (phydrv->config_init) {
> +		ret = phydrv->config_init(phydev);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
> +	return 0;
>  }
>  
>  static struct phy_driver genphy_driver = {
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 7da4f94e0e..a6b96a5984 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -275,6 +275,11 @@ struct phy_driver {
>  	const void *driver_data;
>  	bool is_phy;
>  
> +	/**
> +	 * @soft_reset: Called to issue a PHY software reset
> +	 */
> +	int (*soft_reset)(struct phy_device *phydev);
> +
>  	/*
>  	 * Called to initialize the PHY,
>  	 * including after a reset
> 

-- 
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:47 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 [this message]
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
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=590b3485-8464-40b1-9fc5-a21c87906aa9@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