Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 368604
b: refs/heads/master
c: 7111b71
h: refs/heads/master
v: v3
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Mar 22, 2013
1 parent e1db460 commit 1793f62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 43d6869037d6fa8f92a7a7e6df3b48147c8a3ef9
refs/heads/master: 7111b717a0e1c3edf492ffad34f030e323ca371c
22 changes: 15 additions & 7 deletions trunk/drivers/net/ethernet/marvell/mvmdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/phy.h>
#include <linux/of_address.h>
#include <linux/of_mdio.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/of_mdio.h>

#define MVMDIO_SMI_DATA_SHIFT 0
#define MVMDIO_SMI_PHY_ADDR_SHIFT 16
Expand Down Expand Up @@ -143,11 +143,17 @@ static int orion_mdio_reset(struct mii_bus *bus)

static int orion_mdio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct resource *r;
struct mii_bus *bus;
struct orion_mdio_dev *dev;
int i, ret;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
dev_err(&pdev->dev, "No SMI register address given\n");
return -ENODEV;
}

bus = mdiobus_alloc_size(sizeof(struct orion_mdio_dev));
if (!bus) {
dev_err(&pdev->dev, "Cannot allocate MDIO bus\n");
Expand All @@ -172,20 +178,22 @@ static int orion_mdio_probe(struct platform_device *pdev)
bus->irq[i] = PHY_POLL;

dev = bus->priv;
dev->smireg = of_iomap(pdev->dev.of_node, 0);
dev->smireg = devm_ioremap(&pdev->dev, r->start, resource_size(r));
if (!dev->smireg) {
dev_err(&pdev->dev, "No SMI register address given in DT\n");
dev_err(&pdev->dev, "Unable to remap SMI register\n");
kfree(bus->irq);
mdiobus_free(bus);
return -ENODEV;
}

mutex_init(&dev->lock);

ret = of_mdiobus_register(bus, np);
if (pdev->dev.of_node)
ret = of_mdiobus_register(bus, pdev->dev.of_node);
else
ret = mdiobus_register(bus);
if (ret < 0) {
dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
iounmap(dev->smireg);
kfree(bus->irq);
mdiobus_free(bus);
return ret;
Expand Down

0 comments on commit 1793f62

Please sign in to comment.