mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
lantiq: etop: pass devicetree node to phy driver
Use of_mdiobus_register() to pass the ethernet phy node to the phy drivers. This is needed for the at8030 phy driver which needs to know the GPIO which is connected to the ar8030 reset pin. This driver expects a child in gsw/etop node named "mdio-bus", which has the ethernet phys defined: &gsw { phy-mode = "rmii"; phy-handle = <&phy0>; mtd-mac-address = <&ath9k_cal 0xa91>; mtd-mac-address-increment = <(-2)>; mdio-bus { #address-cells = <1>; #size-cells = <0>; reg = <0>; phy0: ethernet-phy@0 { reg = <0>; reset-gpios = <&gpio 34 GPIO_ACTIVE_LOW>; }; }; }; Fallback to mdiobus_register() if no mdio-bus child node exists. This way we don't need to touch all xway dts files, for which we don't know the actual address on the mdio bus. Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
This commit is contained in:
parent
4c42887286
commit
f2f7802148
@ -0,0 +1,37 @@
|
||||
--- a/drivers/net/ethernet/lantiq_etop.c
|
||||
+++ b/drivers/net/ethernet/lantiq_etop.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
|
||||
#include <asm/checksum.h>
|
||||
|
||||
@@ -567,7 +568,8 @@ static int
|
||||
ltq_etop_mdio_init(struct net_device *dev)
|
||||
{
|
||||
struct ltq_etop_priv *priv = netdev_priv(dev);
|
||||
- int err;
|
||||
+ struct device_node *mdio_np = NULL;
|
||||
+ int err, ret;
|
||||
|
||||
priv->mii_bus = mdiobus_alloc();
|
||||
if (!priv->mii_bus) {
|
||||
@@ -587,7 +589,15 @@ ltq_etop_mdio_init(struct net_device *de
|
||||
priv->mii_bus->name = "ltq_mii";
|
||||
snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
|
||||
priv->pdev->name, priv->pdev->id);
|
||||
- if (mdiobus_register(priv->mii_bus)) {
|
||||
+
|
||||
+ mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus");
|
||||
+
|
||||
+ if (mdio_np)
|
||||
+ ret = of_mdiobus_register(priv->mii_bus, mdio_np);
|
||||
+ else
|
||||
+ ret = mdiobus_register(priv->mii_bus);
|
||||
+
|
||||
+ if (ret) {
|
||||
err = -ENXIO;
|
||||
goto err_out_free_mdiobus;
|
||||
}
|
Loading…
Reference in New Issue
Block a user