Re: [PATCH net-next 3/5] net: lan743x: Add support to SGMII block access functions

From: Andrew Lunn
Date: Tue Jun 14 2022 - 17:03:47 EST


On Tue, Jun 14, 2022 at 04:04:22PM +0530, Raju Lakkaraju wrote:
> Add SGMII access read and write functions
>
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@xxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 69 +++++++++++++++++++
> drivers/net/ethernet/microchip/lan743x_main.h | 12 ++++
> 2 files changed, 81 insertions(+)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 6352cba19691..e496769efb54 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -909,6 +909,74 @@ static int lan743x_mdiobus_c45_write(struct mii_bus *bus,
> return ret;
> }
>
> +static int lan743x_sgmii_wait_till_not_busy(struct lan743x_adapter *adapter)
> +{
> + u32 data;
> + int ret;
> +
> + ret = readx_poll_timeout(LAN743X_CSR_READ_OP, SGMII_ACC, data,
> + !(data & SGMII_ACC_SGMII_BZY_), 100, 1000000);
> + if (unlikely(ret < 0))

unlikely() seems pointless here. You have just done a blocking poll,
so you don't care about high performance, this is not the fast path.

Andrew