mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: Bryan Whitehead <bryan.whitehead@microchip.com>,
	David S Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Roelof Berg <rberg@berg-solutions.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] lan743x: correctly handle chips with internal PHY
Date: Sun, 8 Nov 2020 05:14:47 +0100	[thread overview]
Message-ID: <20201108041447.GZ933237@lunn.ch> (raw)
In-Reply-To: <20201106134324.20656-1-TheSven73@gmail.com>

On Fri, Nov 06, 2020 at 08:43:24AM -0500, Sven Van Asbroeck wrote:
> From: Sven Van Asbroeck <thesven73@gmail.com>
> 
> Commit 6f197fb63850 ("lan743x: Added fixed link and RGMII support")
> assumes that chips with an internal PHY will never have a devicetree
> entry. This is incorrect: even for these chips, a devicetree entry
> can be useful e.g. to pass the mac address from bootloader to chip:
> 
>     &pcie {
>             status = "okay";
> 
>             host@0 {
>                     reg = <0 0 0 0 0>;
> 
>                     #address-cells = <3>;
>                     #size-cells = <2>;
> 
>                     lan7430: ethernet@0 {
>                             /* LAN7430 with internal PHY */
>                             compatible = "microchip,lan743x";
>                             status = "okay";
>                             reg = <0 0 0 0 0>;
>                             /* filled in by bootloader */
>                             local-mac-address = [00 00 00 00 00 00];
>                     };
>             };
>     };
> 
> If a devicetree entry is present, the driver will not attach the chip
> to its internal phy, and the chip will be non-operational.
> 
> Fix by tweaking the phy connection algorithm:
> - first try to connect to a phy specified in the devicetree
>   (could be 'real' phy, or just a 'fixed-link')
> - if that doesn't succeed, try to connect to an internal phy, even
>   if the chip has a devnode
> 
> Tested on a LAN7430 with internal PHY. I cannot test a device using
> fixed-link, as I do not have access to one.
> 
> Fixes: 6f197fb63850 ("lan743x: Added fixed link and RGMII support")
> Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
> Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
> ---
> 
> v1 -> v2:
>     Andrew Lunn: keep patch minimal and correct, so keep open-coded version
>     of of_phy_get_and_connect().

Hi Sven

Why is it required to remove adapter->phy_mode? It is not clear to me
what this change has to do with not looking for an internal PHY.

> @@ -1063,6 +1065,7 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
>  
>  	phy_start(phydev);
>  	phy_start_aneg(phydev);
> +	phy_attached_info(phydev);

This also has nothing to do with the problem you are fixing. It is a
sensible thing to do, but it should be a separate patch, and target
net-next, since it is not a fix.

	  Andrew

  reply	other threads:[~2020-11-08  4:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 13:43 Sven Van Asbroeck
2020-11-08  4:14 ` Andrew Lunn [this message]
2020-11-08  7:43   ` Roelof Berg
2020-11-08 13:36     ` Sven Van Asbroeck
     [not found]       ` <91E6EF39-9562-4654-BC6C-96C23460870F@berg-solutions.de>
2020-11-09 17:59         ` Sven Van Asbroeck
2020-11-09 20:03           ` Roelof Berg
2020-11-08 13:21   ` Sven Van Asbroeck

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=20201108041447.GZ933237@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rberg@berg-solutions.de \
    --cc=thesven73@gmail.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

all inboxes | Powered by JetHome®