netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: Russell King - ARM Linux admin <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Antoine Tenart <atenart@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: net: phy: Dealing with 88e1543 dual-port mode
Date: Fri, 20 Nov 2020 10:36:01 +0100	[thread overview]
Message-ID: <20201120103601.313a166b@bootlin.com> (raw)
In-Reply-To: <87eekoanvj.fsf@waldekranz.com>

Hi Tobias,

On Fri, 20 Nov 2020 01:11:12 +0100
Tobias Waldekranz <tobias@waldekranz.com> wrote:

>On Thu, Nov 19, 2020 at 23:16, Russell King - ARM Linux admin <linux@armlinux.org.uk> wrote:
>> On Thu, Nov 19, 2020 at 11:43:39PM +0100, Tobias Waldekranz wrote:  
>>> On Thu, Nov 19, 2020 at 16:24, Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:  
>>> > I don't think we have a way to distinguish from the DT if we are in
>>> > SGMII-to-Fibre or in SGMII-to-{Copper + Fibre}, since the description is
>>> > the same, we don't have any information in DT about wether or not the
>>> > PHY is wired to a Copper RJ45 port.
>>> >
>>> > Maybe we should have a way to indicate if a PHY is wired to a Copper
>>> > port in DT ?  
>>> 
>>> Do you mean something like:
>>> 
>>> SGMII->SGMII (Fibre):
>>> ethernet-phy@0 {
>>>    sfp = <&sfp0>;
>>> };
>>> 
>>> SGMII->MDI (Copper):
>>> ethernet-phy@0 {
>>>     mdi;
>>> };
>>> 
>>> SGMII->Auto Media Detect
>>> ethernet-phy@0 {
>>>     mdi;
>>>     sfp = <&sfp0>;
>>> };  
>>
>> This isn't something we could realistically do - think about how many
>> DT files are out there today which would not have this for an existing
>> PHY. The default has to be that today's DT descriptions continue to work
>> as-is, and that includes ones which already support copper and fibre
>> either with or without a sfp property.
>>
>> So, we can't draw any conclusion about whether the fiber interface is
>> wired from whether there is a sfp property or not.
>>
>> We also can't draw a conclusion about whether the copper side is wired
>> using a "mdi" property, or whether there is a "sfp" property or not.
>>
>> The only thing we could realistically do today is to introduce a
>> property like:
>>
>> 	mdi = "disabled" | "okay";
>>
>> to indicate whether the copper port can be used, and maybe something
>> similar for the fiber interface.  Maybe as you suggest, not "okay"
>> but specifying the number of connected pairs would be a good idea,
>> or maybe that should be a separate property?  
>
>Maybe you could have optional media nodes under the PHY instead, so that
>you don't involve the SFP property in the logic (SGMII can be connected
>to lots of things after all):
>
>    ethernet-phy@0 {
>        ...
>
>        sgmii {
>            status = "okay";
>            preferred;
>        };
>
>        mdi {
>           status = "okay";
>           pairs = <2>;
>        };
>    };

I like that approach too, and I agree that we do need to be very careful
with not breaking existing PHYs, where most of the time we assume that
a PHY simply has a 8P8C (RJ45) connector.

Maybe the term MDI is a bit misused here, my understanding was that MDI,
standing for "Media Dependent Interface" represents the media-side
interface in general, and not a particular technology such as
xxxBaseT/X/K or Copper of Fibre.

So maybe we could be a bit more generic, with something along these lines :

    ethernet-phy@0 {
        ...

        mdi {
            port@0 {
                media = "10baseT", "100baseT", "1000baseT";
                pairs = <1>;
	    };

            port@1 {
                media = "1000baseX", "10gbaseR"
            };
        };
    };

This would allow us to explicitely indicate which modes are supported
by each port.

And in absence of the mdi node, we indeed fallback to the usual behaviour.

>In the absence of any media declarations, you fall back to the driver's
>default behavior (keeping compatibility with older DTs). But you can
>still add support for more configurations if the information is
>available.

I also like the idea of having a way to express the "preferred" media,
although I wonder if that's something we want to include in DT or that
we would want to tweak at runtime, through ethtool for example.

What do you think ?

Thanks,

Maxime


  parent reply	other threads:[~2020-11-20  9:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 14:22 net: phy: Dealing with 88e1543 dual-port mode Maxime Chevallier
2020-11-19 14:55 ` Russell King - ARM Linux admin
2020-11-19 15:19   ` Russell King - ARM Linux admin
2020-11-19 15:24   ` Maxime Chevallier
2020-11-19 22:43     ` Tobias Waldekranz
2020-11-19 23:16       ` Russell King - ARM Linux admin
2020-11-20  0:11         ` Tobias Waldekranz
2020-11-20  0:40           ` Russell King - ARM Linux admin
2020-11-20  9:12             ` Tobias Waldekranz
2020-11-20  9:36           ` Maxime Chevallier [this message]
2020-11-20 10:25             ` Russell King - ARM Linux admin
2020-11-20 10:59               ` Tobias Waldekranz
2020-11-20 13:55               ` Andrew Lunn
2020-11-20 14:18                 ` Maxime Chevallier
2020-11-20  0:00       ` Andrew Lunn
2020-11-20  9:05         ` Tobias Waldekranz
2020-11-19 15:16 ` Andrew Lunn
2020-11-19 15:45   ` Maxime Chevallier

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=20201120103601.313a166b@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tobias@waldekranz.com \
    --cc=vivien.didelot@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;
as well as URLs for NNTP newsgroup(s).