Re: [PATCH net-next v2 4/4] net: dsa: soce: Add basic support for SoC-e switch IP cores
From: Vasilij Strassheim
Date: Wed Sep 09 2026 - 16:27:10 EST
On Tue, 2026-09-08 at 21:20 +0200, Andrew Lunn wrote:
> > > What is the MDIO master?
> >
> > It refers to the switch-integrated MDIO controller: one shared set of
> > MMIO transaction registers serving multiple selectable MDIO buses. The
> > switch documentation calls it an MDIO bridge. I will rename "master" to
> > "controller".
>
> In Linux, we have the concept of MDIO muxes. You have one true MDIO
> bus master, and then logic gates to connect it to many MDIO
> busses. Generally, the MDIO data line has a set of analogue switches
> to mux it to one of the many MDIO busses.
>
> Having only one true MDIO bus master means you cannot do transactions
> in parallel.
That's true. I had already considered using an MDIO mux for v2, but
decided to retain the existing implementation while addressing the other
feedback first.
> It seems like this is how this hardware works. The question is, should
> we model it this way. Take a look at mdio-mux-mmioreg.c. Maybe the
> MDIO bus driver can be placed into drivers/net/mdio, and a
> mdio-mux-mmioreg stacked on top of it to provide the per port MDIO
> busses. That will make the locking simpler, and remove a lot of code.
>
For the next revision, I will try to implement this model. The MDIO
controller will become a standalone driver under mdio and register a
single parent mii_bus. A generic mdio-mux-mmioreg instance will then
provide the per-port child buses. Something like this:
ethernet-switch@xy {
/* ... */
mdio_parent: mdio@204 {
compatible = "soce,swip-mdio-23-02";
reg = <0x204 0xc>, <0x200 0x4>;
reg-names = "data", "control";
};
mdio-mux@200 {
compatible = "mdio-mux-mmioreg", "mdio-mux";
reg = <0x200 0x4>;
mux-mask = <0x1f0000>;
mdio-parent-bus = <&mdio_parent>;
#address-cells = <1>;
#size-cells = <0>;
mdio@0 {
reg = <0>;
/* PHYs connected to port 0 */
};
mdio@10000 {
reg = <0x10000>;
/* PHYs connected to port 1 */
};
};
/* ethernet-ports ... */
};
This requires a separate binding and compatible string for the MDIO
controller. I currently have soce,swip-mdio.yaml and the
register-layout-specific soce,swip-mdio-23-02 in mind, although I still
need to consider the naming.
> Andrew
Thanks,
Vasilij