Re: [PATCH net-next v2 4/4] net: dsa: soce: Add basic support for SoC-e switch IP cores

From: Vasilij Strassheim

Date: Tue Sep 15 2026 - 07:15:42 EST


On Thu, 2026-09-10 at 14:18 +0200, Andrew Lunn wrote:
> > 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 */
>
> These comments are probably wrong, as i suggested in my previous
> reply. There is no reason that port 0 PHY could not be on bus 10000.
>

That's right. I will remove the misleading comments.

> I've no idea if it will work, but maybe try:
>
> >         reg = <0x203 0x1>;
> >         mux-mask = <0x1f>;
>
> and then you get better bus numbers?

Although mdio-mux-mmioreg might work, I have realized that it is not
suitable here.

According to the switch documentation, the bus selector occupies bits
26:16 of the MDIO control register, while bit 0 is the transaction
start/busy bit. A partial write might trigger an operation before the
other fields have been updated.

Also accessing this register without checking the controller state
could interfere with an active or failed transaction and introduce
races (as noted by Netdev-Sashiko).

I will therefore add a dedicated MDIO mux driver. It will preserve the
other register fields and reject bus changes while the controller is
busy. Based on the current documentation, it will support selector
values representable by bits 26:16. These values identify hardware MDIO
interfaces, not switch ports.

So, in the next version, there will be a total of 3 new small drivers.

>
>     Andrew

Thanks,
Vasilij