mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 1/3] net: davinci_mdio: drop phy_mask detection
Date: Wed, 13 Nov 2024 09:29:27 +0100	[thread overview]
Message-ID: <20241113-davinci-mdio-clk-fix-v1-1-6a98c9864bf6@pengutronix.de> (raw)
In-Reply-To: <20241113-davinci-mdio-clk-fix-v1-0-6a98c9864bf6@pengutronix.de>

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@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




  reply	other threads:[~2024-11-13  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13  8:29 [PATCH 0/3] davinci_mdio: clk fixes Sascha Hauer
2024-11-13  8:29 ` Sascha Hauer [this message]
2024-11-13  8:29 ` [PATCH 2/3] net: davinci_mdio: initialize priv->dev Sascha Hauer
2024-11-13  8:29 ` [PATCH 3/3] net: davinci_mdio: initialize divider from clk Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241113-davinci-mdio-clk-fix-v1-1-6a98c9864bf6@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox