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:39:49 EST


On Mon, Nov 26, 2018 at 12:37:49PM +0530, 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.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx>
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xxxxxxxxxx>
> Signed-off-by: Harini Katakam <harinik@xxxxxxxxxx>
> ---
> v2 changes:
> Use readx_poll_timeout
>
> Changes form RFC:
> Cleaned up timeout implementation and moved it to a helper.
>
> drivers/net/ethernet/cadence/macb.h | 3 +++
> drivers/net/ethernet/cadence/macb_main.c | 33 ++++++++++++++++++++++++++------
> 2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 3d45f4c..df7bee1 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -714,6 +714,9 @@
> __v; \
> })
>
> +#define MACB_IDLE_MASK (1 << MACB_IDLE_OFFSET)

I think you could use the MACB_BIT() macro here.

But otherwise,

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew