Re: [PATCH net-next 2/3] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity
From: Nicolai Buchwitz
Date: Sun Nov 15 2026 - 13:52:04 EST
On 13.11.2026 22:15, 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>
[...]
With what Andrew already asked:
Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
Thanks,
Nicolai