@@ -10,6 +10,8 @@
Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#include <linux/acpi.h>
+#include <linux/acpi_mdio.h>
#include <linux/gpio/consumer.h>
#include <linux/io.h>
#include <linux/iopoll.h>
@@ -445,6 +447,7 @@ int stmmac_mdio_register(struct net_device *ndev)
struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
struct device_node *mdio_node = priv->plat->mdio_node;
struct device *dev = ndev->dev.parent;
+ struct fwnode_handle *fwnode = dev->fwnode;
int addr, found, max_addr;
if (!mdio_bus_data)
@@ -488,7 +491,10 @@ int stmmac_mdio_register(struct net_device *ndev)
new_bus->phy_mask = mdio_bus_data->phy_mask;
new_bus->parent = priv->device;
- err = of_mdiobus_register(new_bus, mdio_node);
+ if (is_acpi_node(fwnode))
+ err = acpi_mdiobus_register(new_bus, fwnode);
+ else
+ err = of_mdiobus_register(new_bus, mdio_node);
if (err != 0) {
dev_err(dev, "Cannot register the MDIO bus\n");
goto bus_register_fail;
Child nodes of stmmac ACPI node may have additional properties that the PHY layer can use. To achieve that, use acpi_mdiobus_register() to find PHY nodes references via "phy-handle", so the properties of PHY nodes can be used by the PHY layer. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)