netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jacky Chou <jacky_chou@aspeedtech.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, u.kleine-koenig@baylibre.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Russell King (Oracle)" <linux@armlinux.org.uk>
Subject: Re: [net-next v3] net: ftgmac100: refactor getting phy device handle
Date: Thu, 24 Oct 2024 09:57:48 +0100	[thread overview]
Message-ID: <20241024085748.GH402847@kernel.org> (raw)
In-Reply-To: <20241022084214.1261174-1-jacky_chou@aspeedtech.com>

+ Russell

On Tue, Oct 22, 2024 at 04:42:14PM +0800, Jacky Chou wrote:
> Consolidate the handling of dedicated PHY and fixed-link phy by taking
> advantage of logic in of_phy_get_and_connect() which handles both of
> these cases, rather than open coding the same logic in ftgmac100_probe().
> 
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> ---
> v2:
>   - enable mac asym pause support for fixed-link PHY
>   - remove fixes information
> v3:
>   - Adjust the commit message

Thanks for the updates.

Probably this should also be reviewed by Andrew or Russell (CCed).
But it looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

> ---
>  drivers/net/ethernet/faraday/ftgmac100.c | 28 +++++-------------------
>  1 file changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 10c1a2f11000..17ec35e75a65 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1918,35 +1918,17 @@ static int ftgmac100_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "Connecting PHY failed\n");
>  			goto err_phy_connect;
>  		}
> -	} else if (np && of_phy_is_fixed_link(np)) {
> -		struct phy_device *phy;
> -
> -		err = of_phy_register_fixed_link(np);
> -		if (err) {
> -			dev_err(&pdev->dev, "Failed to register fixed PHY\n");
> -			goto err_phy_connect;
> -		}
> -
> -		phy = of_phy_get_and_connect(priv->netdev, np,
> -					     &ftgmac100_adjust_link);
> -		if (!phy) {
> -			dev_err(&pdev->dev, "Failed to connect to fixed PHY\n");
> -			of_phy_deregister_fixed_link(np);
> -			err = -EINVAL;
> -			goto err_phy_connect;
> -		}
> -
> -		/* Display what we found */
> -		phy_attached_info(phy);
> -	} else if (np && of_get_property(np, "phy-handle", NULL)) {
> +	} else if (np && (of_phy_is_fixed_link(np) ||
> +			  of_get_property(np, "phy-handle", NULL))) {
>  		struct phy_device *phy;
>  
>  		/* Support "mdio"/"phy" child nodes for ast2400/2500 with
>  		 * an embedded MDIO controller. Automatically scan the DTS for
>  		 * available PHYs and register them.
>  		 */
> -		if (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
> -		    of_device_is_compatible(np, "aspeed,ast2500-mac")) {
> +		if (of_get_property(np, "phy-handle", NULL) &&
> +		    (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
> +		     of_device_is_compatible(np, "aspeed,ast2500-mac"))) {
>  			err = ftgmac100_setup_mdio(netdev);
>  			if (err)
>  				goto err_setup_mdio;
> -- 
> 2.25.1
> 
> 

  reply	other threads:[~2024-10-24  8:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  8:42 [net-next v3] net: ftgmac100: refactor getting phy device handle Jacky Chou
2024-10-24  8:57 ` Simon Horman [this message]
2024-10-24 19:42 ` Andrew Lunn
2024-10-29 22:50 ` patchwork-bot+netdevbpf

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=20241024085748.GH402847@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacky_chou@aspeedtech.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=u.kleine-koenig@baylibre.com \
    /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;
as well as URLs for NNTP newsgroup(s).