[U-Boot-Users] [PATCH] Add support for Generic PHY in macb
Andy Fleming
afleming at gmail.com
Sun Feb 24 19:24:10 CET 2008
On Sun, Feb 24, 2008 at 7:30 AM, <trimarchi at gandalf.sssup.it> wrote:
> Hi
>
> Quoting Michael Schwingen <rincewind at discworld.dascon.de>:
> > If yes, you simply need to define the right PHY address in your board
> > config, and it should work without the loop.
> >
> ... if I understand the physical address is latched during power on and
> if the logic is not good maybe it can be latched a different addresss in
> different session. I like somenthing that permits at software
> developer to easy
> search for the physical address.
That's not a very good solution. If the logic is bad, that's an
actual hardware bug. If you can't guarantee the PHY will have the
intended address, then if you have more than one PHY, you'll have no
way of knowing which one is connected to which ethernet controller.
Also, if they can end up at arbitrary addresses, you can get an
address conflict, and then you're hosed. In other words, you might be
ok with doing such a workaround during bringup, but it's not a
guaranteed workaround for a production system. Get your hardware
designer to not screw up the address latching
And, speaking from experience, you can run into a large number of
problems with trying to search for the PHY:
* There's no ordering requirement. I've seen boards where they put
the PHYs for my four controllers at 17, 1, 2, 3
* If you have multiple *types* of controller on the same bus, even if
you have the right internal order, you now need to guarantee that the
drivers are initialized in the right order. For example, I have a
processor that has two tsec-style controllers and two ucc_geth-style
controllers. They share the same MDIO bus, so the order could be
tsec, tsec, ucc, ucc. Or it could be ucc, ucc, tsec, tsec. I forget
which one it actually is, but the important thing is that whichever
way it is, the other way is perfectly reasonable. Any scanning
algorithm that would work one way (assuming you had some way of
telling other drivers that you were using the PHYs you found) would
fail the other way.
* The number of PHYs may not be one-to-one for the controllers. For
instance, I have a board with 4 ethernet controllers. It has the
option of using either the 4 normal PHYs, or 4 SGMII PHYs. Which ones
they use are selected by a switch. However, all eight PHYs are on the
bus. If I scanned, I would find the normal PHYs first, and that would
be wrong if I'm in SGMII mode.
In short (I know, too late), there is not a reliable way to determine
the address of a controller's PHY dynamically. There are a number of
instances where it works, but there's no requirement on the hardware
designers to allow any such scheme to work in the future. To me, this
means the PHY address must be knowable ahead of time.
Andy
More information about the U-Boot
mailing list