Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227711
b: refs/heads/master
c: 1945886
h: refs/heads/master
i:
  227709: 2a150bd
  227707: e034764
  227703: 1d58775
  227695: b89f007
  227679: dc5d5bd
  227647: 0ad2732
  227583: c9211b4
v: v3
  • Loading branch information
David Daney authored and Grant Likely committed Dec 24, 2010
1 parent 5649c58 commit 589d8b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 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: 0131d8973c8b9bd9d40fee8fae24eab24821efdb
refs/heads/master: 194588604765ac803f98fb9d19a36f6b835f4620
26 changes: 17 additions & 9 deletions trunk/drivers/of/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,35 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)

/* Loop over the child nodes and register a phy_device for each one */
for_each_child_of_node(np, child) {
const __be32 *addr;
const __be32 *paddr;
u32 addr;
int len;

/* A PHY must have a reg property in the range [0-31] */
addr = of_get_property(child, "reg", &len);
if (!addr || len < sizeof(*addr) || *addr >= 32 || *addr < 0) {
paddr = of_get_property(child, "reg", &len);
if (!paddr || len < sizeof(*paddr)) {
dev_err(&mdio->dev, "%s has invalid PHY address\n",
child->full_name);
continue;
}

addr = be32_to_cpup(paddr);
if (addr >= 32) {
dev_err(&mdio->dev, "%s PHY address %i is too large\n",
child->full_name, addr);
continue;
}

if (mdio->irq) {
mdio->irq[*addr] = irq_of_parse_and_map(child, 0);
if (!mdio->irq[*addr])
mdio->irq[*addr] = PHY_POLL;
mdio->irq[addr] = irq_of_parse_and_map(child, 0);
if (!mdio->irq[addr])
mdio->irq[addr] = PHY_POLL;
}

phy = get_phy_device(mdio, be32_to_cpup(addr));
phy = get_phy_device(mdio, addr);
if (!phy || IS_ERR(phy)) {
dev_err(&mdio->dev, "error probing PHY at address %i\n",
*addr);
addr);
continue;
}
phy_scan_fixups(phy);
Expand All @@ -91,7 +99,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
}

dev_dbg(&mdio->dev, "registered phy %s at address %i\n",
child->name, *addr);
child->name, addr);
}

return 0;
Expand Down

0 comments on commit 589d8b2

Please sign in to comment.