0701-NET-lantiq-etop-of-mido.patch 989 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --- a/drivers/net/ethernet/lantiq_etop.c
  2. +++ b/drivers/net/ethernet/lantiq_etop.c
  3. @@ -30,6 +30,7 @@
  4. #include <linux/of_net.h>
  5. #include <linux/of_irq.h>
  6. #include <linux/of_platform.h>
  7. +#include <linux/of_mdio.h>
  8. #include <asm/checksum.h>
  9. @@ -553,7 +554,8 @@ static int
  10. ltq_etop_mdio_init(struct net_device *dev)
  11. {
  12. struct ltq_etop_priv *priv = netdev_priv(dev);
  13. - int err;
  14. + struct device_node *mdio_np = NULL;
  15. + int err, ret;
  16. priv->mii_bus = mdiobus_alloc();
  17. if (!priv->mii_bus) {
  18. @@ -573,7 +575,15 @@ ltq_etop_mdio_init(struct net_device *de
  19. priv->mii_bus->name = "ltq_mii";
  20. snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
  21. priv->pdev->name, priv->pdev->id);
  22. - if (mdiobus_register(priv->mii_bus)) {
  23. +
  24. + mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus");
  25. +
  26. + if (mdio_np)
  27. + ret = of_mdiobus_register(priv->mii_bus, mdio_np);
  28. + else
  29. + ret = mdiobus_register(priv->mii_bus);
  30. +
  31. + if (ret) {
  32. err = -ENXIO;
  33. goto err_out_free_mdiobus;
  34. }