Subject: Re: [PATCH RFC net-next] dt-bindings: ethernet-controller: document signal multiplexer

From: "Russell King (Oracle)" <[email-masked]>
Date: Wed, 7 Jul 2021 18:14:32 +0100

On Wed, Jul 07, 2021 at 01:22:24AM +0200, Marek Behún wrote:
> On Fri, 2 Jul 2021 02:55:54 +0200
> Andrew Lunn <[email-masked]> wrote:
> > On Thu, Jul 01, 2021 at 02:53:47AM +0200, Marek Behún wrote:
> > > There are devices where the MAC signals from the ethernet controller are
> > > not directly connected to an ethernet PHY or a SFP cage, but to a
> > > multiplexer, so that the device can switch between the endpoints.
> > > 
> > > For example on Turris Omnia the WAN controller is connected to a SerDes
> > > switch, which multiplexes the SerDes lanes between SFP cage and ethernet
> > > PHY, depending on whether a SFP module is present (MOD_DEF0 GPIO from
> > > the SFP cage).  
> > 
> > At the moment, i don't think phylink supports this. It does not have a
> > way to dynamically switch PHY. If the SFP disappears, you probably
> > want to configure the PHY, so that it is up, autoneg started,
> > etc. When the SFP reappears, the PHY needs to be configured down, the
> > SFP probably needs its TX GPIO line set active, etc. None of this
> > currently exists.
> 
> Of course this is not supported by phylink: it can't be, since we don't
> even have a binding description :) I am figuring out how to do correct
> binding while working on implementing this into phylink.

I have been thinking that we need phylink to separate the PHY pointer
that was probed by the network adapter and the PHY pointer for the SFP.
The reason being that currently, a network adapter can remove the SFP
PHY when it didn't create it - which is obviously not a good idea as it
doesn't own it.

The other reason is to do with this situation where we have separate
PHY and SFP paths. I'm not intending at this point to add support for
this, only to separate the two PHYs and have something like:

static struct phy_device *phylink_phy(struct phylink *pl)
{
	if (pl->sfp_phy)
		return pl->sfp_phydev;
	return pl->phydev;
}

and use that everywhere we want to get at pl->phydev in the independent
parts of the code. Those which want to get at a specific PHY will
continue using their appropriate pointers directly.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!