Messages in this thread |  | | Date | Wed, 30 Sep 2020 18:27:31 +0200 | From | Andrew Lunn <> | Subject | Re: [net-next PATCH v1 7/7] net/fsl: Use _ADR ACPI object to register PHYs |
| |
Hi Calvin
> priv->has_a011043 = device_property_read_bool(&pdev->dev, > "fsl,erratum-a011043"); > - > - ret = of_mdiobus_register(bus, np); > - if (ret) { > - dev_err(&pdev->dev, "cannot register MDIO bus\n"); > + if (is_of_node(pdev->dev.fwnode)) { > + ret = of_mdiobus_register(bus, np); > + if (ret) { > + dev_err(&pdev->dev, "cannot register MDIO bus\n"); > + goto err_registration; > + } > + } else if (is_acpi_node(pdev->dev.fwnode)) { > + priv->is_little_endian = true; > + /* Mask out all PHYs from auto probing. */ > + bus->phy_mask = ~0; > + ret = mdiobus_register(bus); > + if (ret) { > + dev_err(&pdev->dev, "mdiobus register err(%d)\n", ret); > + return ret; > + } > + > + fwnode = pdev->dev.fwnode;
> + /* Loop over the child nodes and register a phy_device for each PHY */ > + fwnode_for_each_child_node(fwnode, child) { > + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(child), > + "_ADR", NULL, &addr); > + if (ACPI_FAILURE(status)) { > + pr_debug("_ADR returned %d\n", status); > + continue; > + } > + > + if (addr < 0 || addr >= PHY_MAX_ADDR) > + continue; > + > + ret = fwnode_mdiobus_register_phy(bus, child, addr); > + if (ret == -ENODEV) > + dev_err(&bus->dev, > + "MDIO device at address %lld is missing.\n", > + addr); > + }
Hi Calvin
This looping over the properties should be in the core, in the same way of_mdiobus_register() loops over the OF properties in the core. We don't want MDIO drivers doing this in their own way, with their own bugs.
Andrew
|  |