Skip to contentSkip to conversation

drivers: net: davinci_mdio: remove busy loop on wait user access

PATCH Superseded Max Uvarov 1 participant 2 messages Aug 10, 2017

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Max Uvarov

author
#0 lore raw

PATCH 1/2 drivers: net: davinci_mdio: remove busy loop on wait user access

Polling 14 mdio devices on single mdio bus eats 30% of 1Ghz cpu time due to busy loop in waiti(). Aadd small delay to relax cpu.

---
 drivers/net/ethernet/ti/davinci_mdio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/davinci_mdio.c +3 -1
index 33df340..611e7cc 100644
@@ -198,8 +198,10 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data)
 			return 0;
 
 		reg = __raw_readl(&regs->control);
-		if ((reg & CONTROL_IDLE) == 0)
+		if ((reg & CONTROL_IDLE) == 0) {
+			usleep_range(100, 200);
 			continue;
+		}
 
 		/*
 		 * An emac soft_reset may have clobbered the mdio controller's
Signature · 1 line
2.5.0
author
#1 lore raw

PATCH 2/2 drivers: net: davinci_mdio: print bus frequency

Frequency can be audjusted in DT it make sense to
print current used value on driver init.

---
 drivers/net/ethernet/ti/davinci_mdio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_mdio.c +4 -2
index 611e7cc..3c33f45 100644
@@ -159,8 +159,10 @@ static int davinci_mdio_reset(struct mii_bus *bus)
 
 	/* dump hardware version info */
 	ver = __raw_readl(&data->regs->version);
-	dev_info(data->dev, "davinci mdio revision %d.%d\n",
-		 (ver >> 8) & 0xff, ver & 0xff);
+	dev_info(data->dev,
+		 "davinci mdio revision %d.%d, bus freq %ld\n",
+		 (ver >> 8) & 0xff, ver & 0xff,
+		 data->pdata.bus_freq);
 
 	if (data->skip_scan)
 		goto done;
Signature · 1 line
2.5.0