netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Allocation of MDIO bus numbers when fixed MDIO bus is enabled?
@ 2011-12-29 16:09 Florian Fainelli
  2011-12-29 19:10 ` Anton Vorontsov
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2011-12-29 16:09 UTC (permalink / raw)
  To: afleming, netdev, Anton Vorontsov

Hello Andy,

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.

Thanks.
--
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Allocation of MDIO bus numbers when fixed MDIO bus is enabled?
  2011-12-29 16:09 Allocation of MDIO bus numbers when fixed MDIO bus is enabled? Florian Fainelli
@ 2011-12-29 19:10 ` Anton Vorontsov
  2011-12-30  3:52   ` Andy Fleming
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Vorontsov @ 2011-12-29 19:10 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: afleming, netdev

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".

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Allocation of MDIO bus numbers when fixed MDIO bus is enabled?
  2011-12-29 19:10 ` Anton Vorontsov
@ 2011-12-30  3:52   ` Andy Fleming
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Fleming @ 2011-12-30  3:52 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: Florian Fainelli, netdev


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-30  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 16:09 Allocation of MDIO bus numbers when fixed MDIO bus is enabled? Florian Fainelli
2011-12-29 19:10 ` Anton Vorontsov
2011-12-30  3:52   ` Andy Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).