OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/drivers/net/ethernet/lantiq_etop.c |
2 | +++ b/drivers/net/ethernet/lantiq_etop.c |
||
3 | @@ -40,6 +40,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 | |||
9 | #include <asm/checksum.h> |
||
10 | |||
11 | @@ -567,7 +568,8 @@ static int |
||
12 | ltq_etop_mdio_init(struct net_device *dev) |
||
13 | { |
||
14 | struct ltq_etop_priv *priv = netdev_priv(dev); |
||
15 | - int err; |
||
16 | + struct device_node *mdio_np = NULL; |
||
17 | + int err, ret; |
||
18 | |||
19 | priv->mii_bus = mdiobus_alloc(); |
||
20 | if (!priv->mii_bus) { |
||
21 | @@ -587,7 +589,15 @@ ltq_etop_mdio_init(struct net_device *de |
||
22 | priv->mii_bus->name = "ltq_mii"; |
||
23 | snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", |
||
24 | priv->pdev->name, priv->pdev->id); |
||
25 | - if (mdiobus_register(priv->mii_bus)) { |
||
26 | + |
||
27 | + mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus"); |
||
28 | + |
||
29 | + if (mdio_np) |
||
30 | + ret = of_mdiobus_register(priv->mii_bus, mdio_np); |
||
31 | + else |
||
32 | + ret = mdiobus_register(priv->mii_bus); |
||
33 | + |
||
34 | + if (ret) { |
||
35 | err = -ENXIO; |
||
36 | goto err_out_free_mdiobus; |
||
37 | } |