Skip to contentSkip to conversation

net: Phy: Add PHY lookup support on MDIO bus in case of ACPI probe

PATCH In review Vikas Singh 3 participants 3 messages Jul 22, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Phy: Add PHY lookup support on MDIO bus in case of ACPI probe

Auto-probe of c45 devices with extended scanning in xgmac_mdio works well but fails to update device "fwnode" while registering PHYs on MDIO bus.
This patch is based on https://www.spinics.net/lists/netdev/msg662173.html

This change will update the "fwnode" while PHYs get registered and allow lookup for registered PHYs on MDIO bus from other drivers while probing.

---
 drivers/net/phy/mdio_bus.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +18 -1
index 46b3370..7275eff 100644
@@ -447,8 +447,25 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
 	struct device *dev = &mdiodev->dev;
 	struct device_node *child;
 
-	if (dev->of_node || !bus->dev.of_node)
+	if (dev->of_node || !bus->dev.of_node) {
+		/* Checking for acpi node, before returning */
+		struct fwnode_handle *fwnode;
+
+		/* Set the device firmware node to look for child nodes */
+		bus->dev.fwnode = bus->parent->fwnode;
+
+		device_for_each_child_node(&bus->dev, fwnode) {
+			int addr;
+
+			if (fwnode_property_read_u32(fwnode, "reg", &addr))
+				continue;
+			if (addr == mdiodev->addr) {
+				dev->fwnode = fwnode;
+				break;
+			}
+		}
 		return;
+	}
 
 	for_each_available_child_of_node(bus->dev.of_node, child) {
 		int addr;
Signature · 30 lines
2.7.4


-- 




*Disclaimer* -The information transmitted is intended solely for the 
individual
or entity to which it is addressed and may contain confidential 
and/or
privileged material. Any review, re-transmission, dissemination or 
other use of
or taking action in reliance upon this information by persons 
or entities other
than the intended recipient is prohibited. If you have 
received this email in
error please contact the sender and delete the 
material from any computer. In
such instances you are further prohibited 
from reproducing, disclosing,
distributing or taking any action in reliance 
on it.As a recipient of this email,
you are responsible for screening its 
contents and the contents of any
attachments for the presence of viruses. 
No liability is accepted for any
damages caused by any virus transmitted by 
this email.
maintainer
#1 lore raw
Quoted 8 lines

*Disclaimer* -The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer.

I.m going to partially ignore this request to delete your email...

This patch is dependent on

Calvin Johnson [net-next PATCH v7 0/6] ACPI support for dpaa2 MAC driver.

which is stuck in limbo waiting for an ACPI maintainer to ACK/NACK it. I've also had off list suggestions it should be NACKed. If it does get NACKed, it makes this patch pointless.

Andrew

maintainer
#2 lore raw
In reply to Vikas Singh

From: Vikas Singh <[email protected]>
Date: Wed, 22 Jul 2020 16:52:14 +0530

Quoted 14 lines

*Disclaimer* -The information transmitted is intended solely for the individual
or entity to which it is addressed and may contain confidential and/or
privileged material. Any review, re-transmission, dissemination or other use of
or taking action in reliance upon this information by persons or entities other
than the intended recipient is prohibited. If you have received this email in
error please contact the sender and delete the
material from any computer. In
such instances you are further prohibited
from reproducing, disclosing,

Quoted 8 lines

distributing or taking any action in reliance
on it.As a recipient of this email,
you are responsible for screening its
contents and the contents of any
attachments for the presence of viruses.
No liability is accepted for any
damages caused by any virus transmitted by
this email.

Postings with such disclaimers will be ignored.