Re: [PATCH v2 1/4] net: macb: Check MDIO state before read/write and use timeouts

From: Andrew Lunn
Date: Mon Nov 26 2018 - 09:52:17 EST


On Mon, Nov 26, 2018 at 02:46:01PM +0000, Claudiu.Beznea@xxxxxxxxxxxxx wrote:
> Hi Harini,
>
> On 26.11.2018 09:07, Harini Katakam wrote:
> > From: Harini Katakam <harinik@xxxxxxxxxx>
> >
> > Replace the while loop in MDIO read/write functions with a timeout.
> > In addition, add a check for MDIO bus busy before initiating a new
> > operation as well to make sure there is no ongoing MDIO operation.
>
> Is this MDIO bus busy check necessary? The caller of
> macb_mdio_read/macb_mdio_write locks the mdio bus mutex before calling it
> (e.g. mdiobus_read).

Hi Claudiu

It depends on the implementation. A write operation you could just
launch, but not wait for it to complete, allowing you to do other
stuff while the hardware is busy. For the next operation you then do
need to check the previous operation has completed.

I've not checked it is actually implemented this way.

Andrew