aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
diff options
context:
space:
mode:
authorRobert Hancock <hancock@sedsystems.ca>2019-06-06 16:28:07 -0600
committerDavid S. Miller <davem@davemloft.net>2019-06-06 16:24:29 -0700
commit88a972d74ea9172a156cdffb6bb30fbb4b1e27c6 (patch)
treeeab4d24bd02ec011337ee153d0bc4092347b42fd /drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
parentnet: axienet: Use standard IO accessors (diff)
downloadlinux-dev-88a972d74ea9172a156cdffb6bb30fbb4b1e27c6.tar.xz
linux-dev-88a972d74ea9172a156cdffb6bb30fbb4b1e27c6.zip
net: axienet: fix MDIO bus naming
The MDIO bus for this driver was being named using the result of of_address_to_resource on a node which may not have any resource on it, but the return value of that call was not checked so it was using some random value in the bus name. Change to name the MDIO bus based on the resource start of the actual Ethernet register block. Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c')
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index 704babdbc8a2..665ae1d16f1e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -127,7 +127,7 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
int ret;
u32 clk_div, host_clock;
struct mii_bus *bus;
- struct resource res;
+ struct device_node *mdio_node;
struct device_node *np1;
/* clk_div can be calculated by deriving it from the equation:
@@ -199,10 +199,9 @@ issue:
if (!bus)
return -ENOMEM;
- np1 = of_get_parent(lp->phy_node);
- of_address_to_resource(np1, 0, &res);
- snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
- (unsigned long long) res.start);
+ mdio_node = of_get_parent(lp->phy_node);
+ snprintf(bus->id, MII_BUS_ID_SIZE, "axienet-%.8llx",
+ (unsigned long long)lp->regs_start);
bus->priv = lp;
bus->name = "Xilinx Axi Ethernet MDIO";
@@ -211,7 +210,7 @@ issue:
bus->parent = lp->dev;
lp->mii_bus = bus;
- ret = of_mdiobus_register(bus, np1);
+ ret = of_mdiobus_register(bus, mdio_node);
if (ret) {
mdiobus_free(bus);
lp->mii_bus = NULL;