Subject: Re: net: phy: Dealing with 88e1543 dual-port mode

From: Tobias Waldekranz <[email-masked]>
Date: Fri, 20 Nov 2020 11:59:16 +0100

On Fri, Nov 20, 2020 at 10:25, Russell King - ARM Linux admin <[email-masked]> wrote:
> On Fri, Nov 20, 2020 at 10:36:01AM +0100, Maxime Chevallier wrote:
>> 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"
>>             };
>>         };
>>     };

Yeah that looks even better. Though "pairs" is redundant if you can
specify the list of supported link modes. I guess not specifying "media"
should mean "use all modes supported by the PHY". And if, for example,
media is set to 10-T+100-TX, that means that only two pairs will be
used.

> Don't forget that TP requires a minimum of two pairs. However, as
> Andrew pointed out, we already have max-speed which can be used to
> limit the speed below that which requires four pairs.

Maybe "max-speed" is how you solve this in the absense of explicit an
MDI declaration? Because in the multi-port case, the setting could be
different for the two ports, so you would source the information from
the "media" property instead.

> I have untested patches that allow the 88x3310 to be reconfigured
> between 10GBASE-R and 1000BASE-X depending on the SFP connected -
> untested because the I2C pull-ups on the Macchiatobin boards I have
> are way too strong and it results in SFP EEPROM corruption and/or
> failure to read the EEPROM.
>
>> 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.
>
> I think preferred media should be configurable through ethtool -
> which is preferred will be specific to the user's application.

Yeah I half-regretted putting that in there right after I hit "send" :)
It should definitely be configurable from ethtool.

> However, there may be scope for DT to be able to specify the default
> preferred media.

This is where I was coming from. The vendor could potentially have more
information on what the default should be. But I guess you could also
argue that there is value in having Linux behave the same across all
devices.