diff mbox series

[net-next,v3,2/5] net/fsl: store mdiobus fwnode

Message ID 20200708173435.16256-3-calvin.johnson@oss.nxp.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net-next,v3,1/5] Documentation: ACPI: DSD: Document MDIO PHY | expand

Commit Message

Calvin Johnson July 8, 2020, 5:34 p.m. UTC
Store fwnode for mdiobus in the bus structure so that it can
later be retrieved and used whenever mdiobus fwnode information
is required.

Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
---

Changes in v3: None
Changes in v2: None

 drivers/net/ethernet/freescale/xgmac_mdio.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andrew Lunn July 8, 2020, 6:55 p.m. UTC | #1
On Wed, Jul 08, 2020 at 11:04:32PM +0530, Calvin Johnson wrote:
> Store fwnode for mdiobus in the bus structure so that it can
> later be retrieved and used whenever mdiobus fwnode information
> is required.
> 
> Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/net/ethernet/freescale/xgmac_mdio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
> index 98be51d8b08c..8189c86d5a44 100644
> --- a/drivers/net/ethernet/freescale/xgmac_mdio.c
> +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
> @@ -269,6 +269,8 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
>  	bus->write = xgmac_mdio_write;
>  	bus->parent = &pdev->dev;
>  	bus->probe_capabilities = MDIOBUS_C22_C45;
> +	if (pdev->dev.fwnode)
> +		bus->dev.fwnode = pdev->dev.fwnode;

This is pretty fundamental to making this work. In the device tree
world, this is setup by of_mdiobus_register(). Maybe we need an
fwnode_mdiobus_register(), just to ensure the next device wanting to
do ACPI does not forget this?

   Andrew
Andy Shevchenko July 8, 2020, 7:38 p.m. UTC | #2
On Wed, Jul 8, 2020 at 8:35 PM Calvin Johnson
<calvin.johnson@oss.nxp.com> wrote:
>
> Store fwnode for mdiobus in the bus structure so that it can
> later be retrieved and used whenever mdiobus fwnode information
> is required.

...

> +       if (pdev->dev.fwnode)

But do you need this check?

> +               bus->dev.fwnode = pdev->dev.fwnode;

Shouldn't be rather something like dev_fwnode().
And maybe set_primary_fwnode()? I'm not sure about the latter, though.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index 98be51d8b08c..8189c86d5a44 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -269,6 +269,8 @@  static int xgmac_mdio_probe(struct platform_device *pdev)
 	bus->write = xgmac_mdio_write;
 	bus->parent = &pdev->dev;
 	bus->probe_capabilities = MDIOBUS_C22_C45;
+	if (pdev->dev.fwnode)
+		bus->dev.fwnode = pdev->dev.fwnode;
 	snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res->start);
 
 	/* Set the PHY base address */