diff mbox series

net: ethernet: freescale: Add device "fwnode" while MDIO bus get registered

Message ID 1599738730-27080-1-git-send-email-vikas.singh@puresoftware.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: ethernet: freescale: Add device "fwnode" while MDIO bus get registered | expand

Commit Message

Vikas Singh Sept. 10, 2020, 11:52 a.m. UTC
For DT case, auto-probe of c45 devices with extended scanning in xgmac_mdio
works well but scanning and registration of these devices (PHY's) fails in
case of ACPI mainly because of MDIO bus "fwnode" is not set appropriately.
This patch is based on https://www.spinics.net/lists/netdev/msg662173.html

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

Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
 drivers/net/ethernet/freescale/xgmac_mdio.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andrew Lunn Sept. 10, 2020, 1:26 p.m. UTC | #1
On Thu, Sep 10, 2020 at 05:22:10PM +0530, Vikas Singh wrote:
> For DT case, auto-probe of c45 devices with extended scanning in xgmac_mdio
> works well but scanning and registration of these devices (PHY's) fails in
> case of ACPI mainly because of MDIO bus "fwnode" is not set appropriately.
> This patch is based on https://www.spinics.net/lists/netdev/msg662173.html
> 
> This change will update the "fwnode" while MDIO bus get registered and allow
> lookup for registered PHYs on MDIO bus from other drivers while probing.

Vikas

How are you describing the MDIO bus in ACPI? Do you have a proposed
standard document for submission to UEFI?

Sorry, had to ask. Networking and ACPI is not in a good place right
now, and it will need some standardization before things get better.

	 Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index 98be51d..8217d17 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -268,6 +268,10 @@  static int xgmac_mdio_probe(struct platform_device *pdev)
 	bus->read = xgmac_mdio_read;
 	bus->write = xgmac_mdio_write;
 	bus->parent = &pdev->dev;
+
+	if (!is_of_node(pdev->dev.fwnode))
+		bus->dev.fwnode = bus->parent->fwnode;
+
 	bus->probe_capabilities = MDIOBUS_C22_C45;
 	snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res->start);