All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PATCH v2] sh_eth: call of_mdiobus_register() to register phys
@ 2014-02-17 16:57 Ben Dooks
  2014-02-17 20:09 ` Sergei Shtylyov
  2014-02-18  8:23 ` Ben Dooks
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2014-02-17 16:57 UTC (permalink / raw)
  To: linux-sh

If the sh_eth device is registered using OF, then the driver
should call of_mdiobus_register() to register any PHYs connected
to the system.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

--
v2:
	- allocate mdio->irq array at init time
	- set devdata after succesful mdio registration
---
 drivers/net/ethernet/renesas/sh_eth.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 06970ac..1244509 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -40,6 +40,7 @@
 #include <linux/if_vlan.h>
 #include <linux/clk.h>
 #include <linux/sh_eth.h>
+#include <linux/of_mdio.h>
 
 #include "sh_eth.h"
 
@@ -2638,6 +2639,18 @@ static int sh_mdio_init(struct net_device *ndev, int id,
 		goto out_free_bus;
 	}
 
+	if (ndev->dev.parent->of_node) {
+		ret = of_mdiobus_register(mdp->mii_bus,
+					  ndev->dev.parent->of_node);
+		if (ret != 0) {
+			dev_err(&ndev->dev, "of_mdiobus_register() failed\n");
+			goto out_free_bus;
+		}
+
+		dev_set_drvdata(&ndev->dev, mdp->mii_bus);
+		return 0;
+	}
+
 	for (i = 0; i < PHY_MAX_ADDR; i++)
 		mdp->mii_bus->irq[i] = PHY_POLL;
 	if (pd->phy_irq > 0)
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-18  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-17 16:57 [PATCH] [PATCH v2] sh_eth: call of_mdiobus_register() to register phys Ben Dooks
2014-02-17 20:09 ` Sergei Shtylyov
2014-02-18  8:23 ` Ben Dooks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.