Re: [PATCH v12 4/4] net: dsa: add basic initial driver for MxL862xx switches

From: Daniel Golle

Date: Mon Feb 02 2026 - 13:13:11 EST


On Mon, Feb 02, 2026 at 12:23:26PM +0200, Vladimir Oltean wrote:
> On Sun, Feb 01, 2026 at 02:25:13AM +0000, Daniel Golle wrote:
> > +static int mxl862xx_setup_mdio(struct dsa_switch *ds)
> > +{
> > + struct mxl862xx_priv *priv = ds->priv;
> > + struct device *dev = ds->dev;
> > + struct device_node *mdio_np;
> > + struct mii_bus *bus;
> > + int ret;
> > +
> > + bus = devm_mdiobus_alloc(dev);
> > + if (!bus)
> > + return -ENOMEM;
> > +
> > + bus->priv = priv;
> > + ds->user_mii_bus = bus;
> > + bus->name = KBUILD_MODNAME "-mii";
> > + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(dev));
> > + bus->read_c45 = mxl862xx_phy_read_c45_mii_bus;
> > + bus->write_c45 = mxl862xx_phy_write_c45_mii_bus;
> > + bus->read = mxl862xx_phy_read_mii_bus;
> > + bus->write = mxl862xx_phy_write_mii_bus;
> > + bus->parent = dev;
> > + bus->phy_mask = ~ds->phys_mii_mask;
> > +
> > + mdio_np = of_get_child_by_name(dev->of_node, "mdio");
> > + if (!mdio_np)
> > + return -ENODEV;
>
> As per the dt-bindings patch, the "mdio" child node is not required.
> But here it is.

Now that ports are counted from 0, and 0 being the microcontroller, the
port number no longer matches the PHY ID, so I suppose I got to change
the dt-bindigns as that kinda makes the mdio node mandatory for anything
to work.

>
> All user ports are given a valid non-NULL dp->cpu_dp pointer. I strongly
> oppose introducing FUD in the code. If there are valid reasons behind
> this I'm all ears, but there aren't.
>

Looking at other drivers I thought that, and regret not having challenged the
AI commenting on this...