Thread (14 messages) flat view 14 messages, 2 authors, 2022-06-15

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

From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-06-14 21:03:47
Also in: lkml

On Tue, Jun 14, 2022 at 04:04:22PM +0530, Raju Lakkaraju wrote:
quoted hunk ↗ jump to hunk
Add SGMII access read and write functions

Signed-off-by: Raju Lakkaraju <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help