mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH v2 5/6] net: mdio-mux: Avoid probing multiplexed busses
Date: Mon,  4 Dec 2017 07:27:17 -0800	[thread overview]
Message-ID: <20171204152718.10674-6-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20171204152718.10674-1-andrew.smirnov@gmail.com>

Calling mdiobus_detect() for a bus that serves as a parent for a MDIO
bus multiplexer would result in parent bus being populated with
devices that are present on downstream bus that multiplexer happens to
be "pointing" at that moment. To avoid that introduce 'is_multiplexed'
flag to struct mii_bus and change mdiobus_detect to ignore busses for
which that flag is set.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/net/phy/mdio-mux.c | 1 +
 drivers/net/phy/mdio_bus.c | 3 +++
 include/linux/phy.h        | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 4e924e586..1f57d86c6 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -137,6 +137,7 @@ int mdio_mux_init(struct device_d *dev,
 		}
 	}
 
+	parent_bus->is_multiplexed = true;
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mdio_mux_init);
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6ae85692d..d209716a1 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -32,6 +32,9 @@ int mdiobus_detect(struct device_d *dev)
 	struct mii_bus *mii = to_mii_bus(dev);
 	int i, ret;
 
+	if (mii->is_multiplexed)
+		return 0;
+
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		struct phy_device *phydev;
 
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 809f06fb1..ac750f5c3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -100,6 +100,8 @@ struct mii_bus {
 	u32 phy_mask;
 
 	struct list_head list;
+
+	bool is_multiplexed;
 };
 #define to_mii_bus(d) container_of(d, struct mii_bus, dev)
 
-- 
2.14.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-12-04 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 15:27 [PATCH v2 0/6] MDIO bus multiplexer support Andrey Smirnov
2017-12-04 15:27 ` [PATCH v2 1/6] ARM: vybrid: zii: Make use of DT code from Linux kernel Andrey Smirnov
2017-12-04 15:27 ` [PATCH v2 2/6] mdio_bus: Port of_mdio_find_bus() " Andrey Smirnov
2017-12-04 15:27 ` [PATCH v2 3/6] net: phy: Port MDIO bus miltiplexer framework " Andrey Smirnov
2017-12-04 15:27 ` [PATCH v2 4/6] net: phy: Port GPIO controlled MDIO multiplexer driver Andrey Smirnov
2017-12-04 15:27 ` Andrey Smirnov [this message]
2017-12-04 15:27 ` [PATCH v2 6/6] zii_vf610_dev_defconfig: Select MDIO bus GPIO multiplexer Andrey Smirnov
2017-12-06 14:49 ` [PATCH v2 0/6] MDIO bus multiplexer support 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=20171204152718.10674-6-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --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