All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Andy Chiu <andy.chiu@sifive.com>
Cc: davem@davemloft.net, kuba@kernel.org, michal.simek@xilinx.com,
	linux@armlinux.org.uk, robert.hancock@calian.co,
	netdev@vger.kernel.org, Greentime Hu <greentime.hu@sifive.com>
Subject: Re: [PATCH] net: axiemac: use a phandle to reference pcs_phy
Date: Wed, 16 Mar 2022 13:45:41 +0100	[thread overview]
Message-ID: <YjHb9bYloSvnIiTo@lunn.ch> (raw)
In-Reply-To: <20220316075953.61398-1-andy.chiu@sifive.com>

On Wed, Mar 16, 2022 at 03:59:53PM +0800, Andy Chiu wrote:
> The `of_mdio_find_device()` would get a reference to `mdio_device` by
> a given device tree node. Thus, getting a reference to the internal
> PCS/PMA PHY by `lp->phy_node` is incorrect since "phy-handle" in the DT
> sould point to the external PHY. This incorrect use of "phy-hanlde"
> would cause a problem when the driver called `phylink_of_phy_connect()`,
> where it would use "phy-handle" in the DT to connect the external PHY.
> To fix it, we could add a phandle, "pcs-phy", in the DT so that it would
> point to the internal PHY. And the driver would get the correct address
> of PCS/PHY.
> 
> Fixes: 1a02556086fc (net: axienet: Properly handle PCS/PMA PHY for 1000BaseX mode)
> Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
> Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 6fd5157f0a6d..293189aab4e6 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2073,12 +2073,15 @@ static int axienet_probe(struct platform_device *pdev)
>  	}
>  	if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII ||
>  	    lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) {
> -		if (!lp->phy_node) {
> -			dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n");
> +		np = of_parse_phandle(pdev->dev.of_node, "pcs-phy", 0);

Other drivers call this pcs-handle. Please be consistent with them.

You also should update the binding document with this new property.

	Andrew

  reply	other threads:[~2022-03-16 12:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  7:59 [PATCH] net: axiemac: use a phandle to reference pcs_phy Andy Chiu
2022-03-16 12:45 ` Andrew Lunn [this message]
2022-03-16 20:04 ` Jakub Kicinski
2022-03-16 21:14 ` Robert Hancock
2022-03-17  9:10   ` Andy Chiu

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=YjHb9bYloSvnIiTo@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andy.chiu@sifive.com \
    --cc=davem@davemloft.net \
    --cc=greentime.hu@sifive.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=robert.hancock@calian.co \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.