aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/ti/davinci_mdio.c')
-rw-r--r--drivers/net/ethernet/ti/davinci_mdio.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index c47f0dbcebb..7b10a322a29 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -37,6 +37,7 @@
37#include <linux/pm_runtime.h> 37#include <linux/pm_runtime.h>
38#include <linux/davinci_emac.h> 38#include <linux/davinci_emac.h>
39#include <linux/of.h> 39#include <linux/of.h>
40#include <linux/of_mdio.h>
40#include <linux/of_device.h> 41#include <linux/of_device.h>
41 42
42/* 43/*
@@ -143,6 +144,10 @@ static int davinci_mdio_reset(struct mii_bus *bus)
143 dev_info(data->dev, "davinci mdio revision %d.%d\n", 144 dev_info(data->dev, "davinci mdio revision %d.%d\n",
144 (ver >> 8) & 0xff, ver & 0xff); 145 (ver >> 8) & 0xff, ver & 0xff);
145 146
147 /* OF explicitly registers phy devices without a bus scan */
148 if (data->dev->of_node)
149 return 0;
150
146 /* get phy mask from the alive register */ 151 /* get phy mask from the alive register */
147 phy_mask = __raw_readl(&data->regs->alive); 152 phy_mask = __raw_readl(&data->regs->alive);
148 if (phy_mask) { 153 if (phy_mask) {
@@ -313,6 +318,7 @@ static int davinci_mdio_probe_dt(struct mdio_platform_data *data,
313static int davinci_mdio_probe(struct platform_device *pdev) 318static int davinci_mdio_probe(struct platform_device *pdev)
314{ 319{
315 struct mdio_platform_data *pdata = pdev->dev.platform_data; 320 struct mdio_platform_data *pdata = pdev->dev.platform_data;
321 struct device_node *node = pdev->dev.of_node;
316 struct device *dev = &pdev->dev; 322 struct device *dev = &pdev->dev;
317 struct davinci_mdio_data *data; 323 struct davinci_mdio_data *data;
318 struct resource *res; 324 struct resource *res;
@@ -346,9 +352,9 @@ static int davinci_mdio_probe(struct platform_device *pdev)
346 data->bus->reset = davinci_mdio_reset, 352 data->bus->reset = davinci_mdio_reset,
347 data->bus->parent = dev; 353 data->bus->parent = dev;
348 data->bus->priv = data; 354 data->bus->priv = data;
355 data->dev = dev;
349 356
350 pm_runtime_enable(&pdev->dev); 357 pm_runtime_enable(&pdev->dev);
351 pm_runtime_get_sync(&pdev->dev);
352 data->clk = clk_get(&pdev->dev, "fck"); 358 data->clk = clk_get(&pdev->dev, "fck");
353 if (IS_ERR(data->clk)) { 359 if (IS_ERR(data->clk)) {
354 dev_err(dev, "failed to get device clock\n"); 360 dev_err(dev, "failed to get device clock\n");
@@ -357,8 +363,9 @@ static int davinci_mdio_probe(struct platform_device *pdev)
357 goto bail_out; 363 goto bail_out;
358 } 364 }
359 365
366 clk_prepare(data->clk);
367 pm_runtime_get_sync(&pdev->dev);
360 dev_set_drvdata(dev, data); 368 dev_set_drvdata(dev, data);
361 data->dev = dev;
362 spin_lock_init(&data->lock); 369 spin_lock_init(&data->lock);
363 370
364 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 371 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -384,7 +391,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
384 } 391 }
385 392
386 /* register the mii bus */ 393 /* register the mii bus */
387 ret = mdiobus_register(data->bus); 394 ret = of_mdiobus_register(data->bus, node);
388 if (ret) 395 if (ret)
389 goto bail_out; 396 goto bail_out;
390 397