[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <A4772B50-0705-49EE-AE6D-BCF546C426A7@freescale.com>
Date: Thu, 29 Dec 2011 21:52:26 -0600
From: Andy Fleming <afleming@...escale.com>
To: Anton Vorontsov <anton.vorontsov@...aro.org>
CC: Florian Fainelli <florian@...nwrt.org>, <netdev@...r.kernel.org>
Subject: Re: Allocation of MDIO bus numbers when fixed MDIO bus is enabled?
On Dec 29, 2011, at 1:10 PM, Anton Vorontsov wrote:
> Hello,
>
> On Thu, Dec 29, 2011 at 05:09:44PM +0100, Florian Fainelli wrote:
>> An user of the r6040 driver has enabled support for the Fixed MDIO
>> bus, so when the r6040 registers with its first instance, it will
>> also try to register a MDIO bus with id 0, and this fails.
>>
>> What's the proper solution to fixing this kind of issue? The same
>> user proposed to use the pci slot and function as an id for
>> registering the MDIO bus, which will work for PCI devices, but not
>> for platform_devices for instance.
>
> AFAIR, MDIO bus id doesn't have to be numeric, so you can change it
> to parent's dev_name(). I.e. something like
>
> snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "%s-mdio", dev_name(dev));
>
> So, the resulting PHYs would have IDs something like "dev-mdio:1".
Yeah, there's a long-standing issue from when the "fixed" bus was created. I wasn't really involved in the architecture, and the arbitrary "0" bus stuck around. I think renaming it is not as trivial as it sounds, in that the bus id is hard-coded in a number of places. However, I would eagerly endorse any solution that was less hard-coded. You would have to change all of the fixed-phy clients. At the very least, it should be called "fixed-0", or something.
However, the issue is that the r6040's bus registration is being just as bad a citizen as the fixed bus registration. Please change it to have a sensible bus name. You can craft whatever name you like. Make it something that follows a convention that shouldn't ever conflict with anything else, while also being trivially deducible from available information (so the ethernet driver can find the right bus for the right instance). The names are global for the whole system.
Andy
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists