Re: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
From: Jisheng Zhang
Date: Tue Nov 17 2026 - 11:15:34 EST
On Tue, Nov 17, 2026 at 03:59:30PM +0100, Andrew Lunn wrote:
> On Tue, Nov 17, 2026 at 10:13:58PM +0800, Jisheng Zhang wrote:
> > On Tue, Nov 17, 2026 at 02:24:16PM +0100, Andrew Lunn wrote:
> > > On Tue, Nov 17, 2026 at 01:06:19PM +0800, Jisheng Zhang wrote:
> > > > On Mon, Nov 16, 2026 at 04:06:25PM +0100, Andrew Lunn wrote:
> > > > > On Mon, Nov 16, 2026 at 09:54:35PM +0800, Jisheng Zhang wrote:
> > > > > > Assume we have the following implementation:
> > > > > > ----------
> > > > > > |mmio reg|
> > > > > > ----------
> > > > > > |
> > > > > > -------- | -------
> > > > > > | MAC0 |--MDIO-----| PHY |
> > > > > > -------- | | -------
> > > > > > | |
> > > > > > -------- | | -------
> > > > > > | MAC1 |-- ----| PHY |
> > > > > > -------- -------
> > > > > >
> > > > > > Both MAC0 and MAC1 have MDIO bus masters, and tie together to
> > > > > > a single set of clock and data lines, which go to some PHYs. While
> > > > > > there's a mmio reg to control which MAC mdio master can operate
> > > > > > the single mdio clock and data lines, so only one MAC can operate
> > > > > > the mdio clock and data lines.
> > > > >
> > > > > How does this differ from pinmux?
> > > > >
> > > >
> > > > in my case, the two MAC MDIO bus masters share the same MDC and MDIO
> > > > pins.
> > >
> > > That does not answer my question. How is this different to pinmux?
> >
> > Let me explain the HW in details:
> > The pad have their own pinmux configuation, which selects the MDC/MDIO
> > fucntion instead of GPIO or another perif function. That pad
> > configuration stays MDC/MDIO, I.E unchanged.
> >
> > The register discussed here is a separate selector between the two
> > MACs' MDIO controllers. With the pads already configured for MDC/MDIO,
> > it choose whether MAC0 or MAC1 drives the MDC and MDIO.
> >
> > So the proposed demux controls this internal selector and serializes
> > selection plus the complete MDIO transaction across both MDIO
> > controllers.
> >
> > Would you prefer model the selector as pinctrl states, with an MDIO
> > demux selecting the appropriate state under a shared lock before each
> > transaction?
>
> Each transaction?
>
> Are you proposing to use both MDIO bus master? Why? To the outside
> world, it is one MDIO bus, so you only need one active MDIO bus
Yep, both MDIO bus masters. I wanted to let each MAC uses its own
MDIO rather than disturbe another MAC for dual MACs case.
But now it looks like a over-designed solution.
> master. All the PHYs are then on that one bus.
>
> I would let the DT pinctrl node connect one MDIO bus master to the
> outside world, and that is all you need.
What about coping with the selector in sl2610 stmmac glue layer? I.E
use the presence of the mdio child node to identify the provider.
For dual MACs case:
ðernet0 {
phy-phandle = <&phy0>;
};
ðernet1 {
phy-phandle = <&phy1>;
mdio {
...
phy0: ethernet-phy@1 {
reg = <1>;
...
};
phy1: ethernet-phy@2 {
reg = <2>;
...
};
};
};
For single MAC case, it should be as simple as coding the selector
to let itself act as the provider.
This way looks simpler than modeling it as pinctrl. what do you think?