aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fsl_pq_mdio.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-03-19 02:48:08 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-23 18:37:09 -0400
commit18f27383d9bdcb985cc39599e99917bdad101a60 (patch)
treee171d633e8f0f2454779e06d2bcfb7485c38e88d /drivers/net/fsl_pq_mdio.c
parent3e303dc1215714308e21a45e2c0fa6f701ad0eb4 (diff)
fsl_pq_mdio: Use proper address translation
Currently the driver just read "reg" property for constructing MDIO bus IDs, but this won't work when we'll start using "ranges = <>" in the device tree, so this will pop up: Freescale PowerQUICC MII Bus: probed sysfs: duplicate filename 'mdio@520' can not be created ------------[ cut here ]------------ Badness at c00cb6b8 [verbose debug info unavailable] NIP: c00cb6b8 LR: c00cb6b8 CTR: c001271c REGS: cf82fc10 TRAP: 0700 Not tainted (2.6.29-rc7-03702-g7ccd10f) MSR: 00029032 <EE,ME,CE,IR,DR> CR: 42044022 XER: 20000000 TASK = cf81fbd0[1] 'swapper' THREAD: cf82e000 GPR00: c00cb6b8 cf82fcc0 cf81fbd0 0000003b 00000e42 ffffffff 00004000 00000e42 GPR08: c03cb0fc c03bfbdc 00000e42 c03cac50 22044022 1006a2bc 0ffcb000 00000000 GPR16: 0ffc04b0 0ffc5a40 00000000 0ffc79a8 0f7863a8 00000004 00000000 00000000 GPR24: c033a6a8 d1014520 cf85e840 cf82fd08 cf87cf2c cf82fcd8 cf85dea8 ffffffef NIP [c00cb6b8] sysfs_add_one+0x4c/0x54 LR [c00cb6b8] sysfs_add_one+0x4c/0x54 Call Trace: [cf82fcc0] [c00cb6b8] sysfs_add_one+0x4c/0x54 (unreliable) [cf82fcd0] [c00cbc18] create_dir+0x58/0xc0 [cf82fd00] [c00cbcc0] sysfs_create_dir+0x40/0x70 [cf82fd20] [c0159388] create_dir+0x28/0x78 [cf82fd30] [c0159824] kobject_add_internal+0x98/0x13c [cf82fd50] [c0159e98] kobject_add+0x60/0x98 [cf82fd80] [c018a480] device_add+0x98/0x2ac [cf82fda0] [c01a2380] mdiobus_register+0xbc/0x1c0 [cf82fdc0] [c019f31c] fsl_pq_mdio_probe+0x284/0x2a0 [cf82fe00] [c0223814] of_platform_device_probe+0x5c/0x84 ... This patch fixes the issue by translating the "reg" property to a full address, and thus avoids the duplicate names. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fsl_pq_mdio.c')
-rw-r--r--drivers/net/fsl_pq_mdio.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index 6be36b9bc31b..b3079a5a7f2b 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -194,11 +194,15 @@ static int *create_irq_map(struct device_node *np)
194 194
195void fsl_pq_mdio_bus_name(char *name, struct device_node *np) 195void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
196{ 196{
197 const u32 *reg; 197 const u32 *addr;
198 u64 taddr = OF_BAD_ADDR;
198 199
199 reg = of_get_property(np, "reg", NULL); 200 addr = of_get_address(np, 0, NULL, NULL);
201 if (addr)
202 taddr = of_translate_address(np, addr);
200 203
201 snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0); 204 snprintf(name, MII_BUS_ID_SIZE, "%s@%llx", np->name,
205 (unsigned long long)taddr);
202} 206}
203 207
204/* Scan the bus in reverse, looking for an empty spot */ 208/* Scan the bus in reverse, looking for an empty spot */