Re: [PATCH net-next 2/3] net: mdio: Add Cortina CS7542 bus controller
From: Andrew Lunn
Date: Mon Nov 23 2026 - 14:41:13 EST
> +++ b/drivers/net/mdio/Kconfig
> @@ -291,3 +291,16 @@ config MDIO_BUS_MUX_MMIOREG
>
> endmenu
> endmenu
> +
> +config MDIO_CS75XX
> + tristate "Cortina Systems CS7542 MDIO controller"
This file is sorted by tristate string. So this goes between
Broadcom UniMAC MDIO bus controller
and
GPIO lib-based bitbanged MDIO buses
MDIO_CAVIUM is an odd ball. I suggest after it.
> + depends on OF_MDIO && HAS_IOMEM
> + help
> + Support Clause 22 PHY register access through the CS7542 MDIO
> + controller, retaining the prescaler configured by platform firmware.
> + Transactions use bounded polling and recover from late completion.
> + Device Tree describes the PHYs sharing this management bus.
> +
> + To compile this driver as a module, choose M here: the module
> + will be called mdio-cs75xx.
> +
> diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile
> index 048586746..2afa6066f 100644
> --- a/drivers/net/mdio/Makefile
> +++ b/drivers/net/mdio/Makefile
> @@ -35,3 +35,4 @@ obj-$(CONFIG_MDIO_BUS_MUX_MESON_G12A) += mdio-mux-meson-g12a.o
> obj-$(CONFIG_MDIO_BUS_MUX_MESON_GXL) += mdio-mux-meson-gxl.o
> obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) += mdio-mux-mmioreg.o
> obj-$(CONFIG_MDIO_BUS_MUX_MULTIPLEXER) += mdio-mux-multiplexer.o
> +obj-$(CONFIG_MDIO_CS75XX) += mdio-cs75xx.o
This file is also sorted.
> +struct cs75xx_mdio {
> + void __iomem *base;
> + struct mii_bus *bus;
> + bool pending;
This pending is odd.
> +static int cs75xx_mdio_wait(struct cs75xx_mdio *priv)
> +{
> + u32 val;
> + int ret;
> +
> + ret = readl_poll_timeout_atomic(priv->base + PER_MDIO_CTRL, val,
> + val & MDIO_CTRL_DONE, 1,
> + CS75XX_MDIO_TIMEOUT_US);
> + if (!ret) {
> + writel(MDIO_CTRL_DONE, priv->base + PER_MDIO_CTRL);
> + priv->pending = false;
> + }
Have you seen this fail?
MDIO busses are simple things, it is just a big shift register. They
pretty much don't fail, except if the clock is not ticking. Any
failure is generally fatal, and you can expect cascading failures, the
next operation is going to fail, and the one after that etc.
So i would throw away pending.
Andrew
---
pw-bot: cr