Re: [PATCH net-next 2/3] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity

From: Andrew Lunn

Date: Fri Nov 13 2026 - 17:01:03 EST


On Fri, Nov 13, 2026 at 01:15:53PM -0800, Florian Fainelli wrote:
> The current polling code unconditionally waits 30us, which was sized for
> a ~25us Clause 22 transaction, and then polls MDIO_CMD with a sleep of up
> to 2ms between samples.
>
> Adding Clause 45 support means that every access becomes two back to back
> transactions (an ADDR cycle followed by a READ/WRITE cycle), so a fixed
> delay sized for a single C22 transaction is no longer meaningful, and a
> sleep of up to 2ms between samples can add significant latency to each
> access when the transaction has not completed at the first sample.
>
> Instead, poll the MDIO_START_BUSY bit every microsecond so that the
> completion is noticed as soon as it happens, regardless of the type of
> transaction. This turns the wait into a busy wait, which is bounded by a
> timeout reduced from 100ms to 1ms: a 64 bit MDIO frame takes about 33us at
> the lowest MDIO clock the driver can program from a 250MHz reference clock,
> so even a two frame C45 access completes well within that.
>
> Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
> Co-developed-by: Carlos Soto <carlos.soto@xxxxxxxxxxxx>
> Signed-off-by: Carlos Soto <carlos.soto@xxxxxxxxxxxx>

Nitpick: Since you are submitting it, your Signed-off-by: should come
last.

Apart from that, please add my Reviewed-by: Andrew Lunn
<andrew@xxxxxxx>

Andrew