[PATCH 1/3] net: davinci_mdio: drop phy_mask detection
Sascha Hauer
s.hauer at pengutronix.de
Wed Nov 13 00:29:27 PST 2024
The davinci_mdio driver tries to autodetect connected phys using the
controllers internal state engine that seems to periodically scan for
phys. It then sets phy_mask according to the phys found. This doesn't
work on a beagleplay board because the timeout is too short.
This phy detection mechanism is an optimization only, which in the best
case saves some time needed to scan the bus for phys later on. Normally
the phys are described in the device tree, in this case the bus isn't
scanned for devices anyway, so instead of adjusting the timeout we can
drop the whole thing altogether.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/net/davinci_mdio.c | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/drivers/net/davinci_mdio.c b/drivers/net/davinci_mdio.c
index c5cd28fba4..fad14e92ea 100644
--- a/drivers/net/davinci_mdio.c
+++ b/drivers/net/davinci_mdio.c
@@ -110,8 +110,6 @@ static int cpsw_mdio_probe(struct device *dev)
{
struct resource *iores;
struct cpsw_mdio_priv *priv;
- uint64_t start;
- uint32_t phy_mask;
int ret;
priv = xzalloc(sizeof(*priv));
@@ -137,33 +135,6 @@ static int cpsw_mdio_probe(struct device *dev)
*/
writel(0xff | CONTROL_ENABLE, &priv->mdio_regs->control);
- /*
- * wait for scan logic to settle:
- * the scan time consists of (a) a large fixed component, and (b) a
- * small component that varies with the mii bus frequency. These
- * were estimated using measurements at 1.1 and 2.2 MHz on tnetv107x
- * silicon. Since the effect of (b) was found to be largely
- * negligible, we keep things simple here.
- */
- udelay(2000);
-
- start = get_time_ns();
- while (1) {
- phy_mask = readl(&priv->mdio_regs->alive);
- if (phy_mask) {
- dev_info(dev, "detected phy mask 0x%x\n", phy_mask);
- phy_mask = ~phy_mask;
- break;
- }
- if (is_timeout(start, 256 * MSECOND)) {
- dev_err(dev, "no live phy, scanning all\n");
- phy_mask = 0;
- break;
- }
- }
-
- priv->miibus.phy_mask = phy_mask;
-
ret = mdiobus_register(&priv->miibus);
if (ret)
return ret;
--
2.39.5
More information about the barebox
mailing list