fsl_pq_mdio: Use proper address translation
Subsystems (2)
PATCH 1/1 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.
---
On Thu, Mar 19, 2009 at 03:57:10AM -0500, Kumar Gala wrote:
[...]
Quoted 12 lines
Quoted 11 lines
This is for 2.6.30 since we don't use ranges = <> yet.
David, I believe Kumar would like to pick this patch into his tree along with a patch set that adds "ranges = <>" properties to the device tree... So would you mind if we take it via powerpc.git?
Thanks,
drivers/net/gianfar_mii.c | 10 +++++++--- drivers/net/ucc_geth_mii.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-)
Quoted 7 lines
Andy merged these in net-next to just have
drivers/net/fsl_pq_mdio.c.My suggestion is to update the patch against -next and have David put it into net-next.
(I'll deal w/the .dts updates in powerpc.git and cherry pick commits out of net-next into my testing branching)
OK.
David, I guess it's yours now. :-)
Thanks.
drivers/net/fsl_pq_mdio.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/fsl_pq_mdio.c +7 -3
@@ -194,11 +194,15 @@ static int *create_irq_map(struct device_node *np)void fsl_pq_mdio_bus_name (char *name,struct device_node *np) { -const u32 *reg; +const u32 *addr; +u64 taddr =OF_BAD_ADDR ; - reg =of_get_property (np,"reg" ,NULL ); + addr =of_get_address (np,0 ,NULL ,NULL ); +if (addr) + taddr =of_translate_address (np, addr); -snprintf (name,MII_BUS_ID_SIZE ,"%s@%x" , np->name, reg ? *reg :0 ); +snprintf (name,MII_BUS_ID_SIZE ,"%s@%llx" , np->name, + (unsigned long long )taddr); }/* Scan the bus in reverse, looking for an empty spot */
Signature · 1 line
1.5.6.5
Quoted 29 lines · Anton Vorontsov
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: 20000000TASK = cf81fbd0[1] 'swapper' THREAD:
cf82e000
GPR00:c00cb6b8cf82fcc0cf81fbd00000003b00000e42ffffffff 0000400000000e42
GPR08:c03cb0fcc03bfbdc00000e42c03cac50220440221006a2bc0ffcb00000000000
GPR16:0ffc04b00ffc5a40000000000ffc79a80f7863a800000004 00000000 00000000
GPR24:c033a6a8d1014520cf85e840cf82fd08cf87cf2ccf82fcd8cf85dea8ffffffef NIP [c00cb6b8]sysfs_add_one+0x4c/0x54
LR [c00cb6b8]sysfs_add_one+0x4c/0x54Call 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
Quoted 7 lines
...
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 <[email protected]>---
David, I'm expecting you to pick this up and put it into net-next.
thanks
- k
David Miller
maintainerFrom: Kumar Gala <[email protected]>
Date: Mon, 23 Mar 2009 11:49:07 -0500
Quoted 3 lines
Acked-by Kumar Gala <[email protected]>David, I'm expecting you to pick this up and put it into net-next.
Done, thanks.