Skip to contentSkip to conversation

sh_eth: call of_mdiobus_register() to register phys

PATCH Ben Dooks 1 participant 1 message Feb 18, 2014 SuperH

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw
Quoted 40 lines · Ben Dooks
Quoted 39 lines · Sergei Shtylyov

Hello.

Quoted 9 lines · Ben Dooks

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.

--
v2:
- allocate mdio->irq array at init time

Did this also fix something?

Quoted 23 lines

- set devdata after succesful mdio registration

---
  drivers/net/ethernet/renesas/sh_eth.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +1 -0
index 06970ac..1244509 100644
@@ -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;
      }
 
Quoted 6 lines
Quoted 6 lines

drivers/net/ethernet/renesas/sh_eth.c static int sh_mdio_init(struct net_device · line 2646

Quoted 4 lines
drivers/net/ethernet/renesas/sh_eth.c +4 -0
+    if (ndev->dev.parent->of_node) {
+        ret = of_mdiobus_register(mdp->mii_bus,
+                      ndev->dev.parent->of_node);
+        if (ret != 0) {

Why not just (ret)?

Because of years of people complaining that an integer is not a boolean. I'll change that in the next version of the patch.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius