Add support for Generic PHY in macb
PATCH 1/1 Add support for Generic PHY in macb
Hi
----- Messaggio originale -----
Quoted 13 lines
Da: Haavard Skinnemoen <[email protected]>
A: Michael Schwingen <[email protected]>
Cc: Michael Trimarchi <[email protected]>; u-boot-users at lists.sourceforge.net
Inviato: Venerd? 22 febbraio 2008, 16:34:03
Oggetto: Re: [U-Boot-Users] [PATCH] Add support for Generic PHY in macbQuoted 4 lines · On Fri, 22 Feb 2008 16:05:34 +0100 Michael Schwingen wrote:
Quoted 3 lines · Haavard Skinnemoen
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
Quoted 9 lines
Quoted 2 lines
It depends - I am not sure if there are PHYs which simply do not implement MDIO, but at least for ethernet switches, such chips do exist.
Right. We might need to add support for such PHYs, but just disabling the sanity check is far from enough.
In any case, the dm9161a PHY in question does implement MDIO, so it really should work without any modifications.
Maybe we can add the for cycle like in linux to check the phy addr?
Michael
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html
PATCH 1/1 Add support for Generic PHY in macb
Quoted 4 lines · On Fri, 22 Feb 2008 16:02:13 +0000 (GMT) Michael Trimarchi…
Quoted 3 lines
In any case, the dm9161a PHY in question does implement MDIO, so it really should work without any modifications.
Maybe we can add the for cycle like in linux to check the phy addr?
Yes, we could do that. But it comes with its own share of problems -- some boards have a too weak pull-up (or none at all) on the MDIO line, so the probing code sometimes thinks it has found a whole bunch of PHYs...
Haavard
PATCH 1/1 Add support for Generic PHY in macb
Quoted 5 lines · Haavard Skinnemoen
Yes, we could do that. But it comes with its own share of problems -- some boards have a too weak pull-up (or none at all) on the MDIO line, so the probing code sometimes thinks it has found a whole bunch of PHYs...
And you have to know which PHY belongs to which MII port - for example, the IXP420 has two MII busses, but only one shared MDIO, so PHY addresses can not be autodetected - you need some kind of board-specific table/code that defines the mapping between PHY addresses and MII busses. Which is basically what we have now, in the form of CONFIG_PHY*_ADDR ;-)
cu
Michael
PATCH 1/1 Add support for Generic PHY in macb
In reply to Haavard SkinnemoenHi,
Quoted 8 lines · Haavard Skinnemoen
Quoted 4 lines · On Fri, 22 Feb 2008 16:02:13 +0000 (GMT) Michael Trimarchi…
Quoted 4 lines
In any case, the dm9161a PHY in question does implement MDIO, so it really should work without any modifications.
Quoted 8 lines
Quoted 2 lines
Maybe we can add the for cycle like in linux to check the phy addr?
Yes, we could do that. But it comes with its own share of problems -- some boards have a too weak pull-up (or none at all) on the MDIO line, so the probing code sometimes thinks it has found a whole bunch of PHYs...
I add the cycle only for testing and works, now I will take a look to the mii layer in the u-boot and maybe find a better and clean solution if I have spare time.
Regards Michael
PATCH 1/1 Add support for Generic PHY in macb
Quoted 4 lines · michael
I add the cycle only for testing and works, now I will take a look to the mii layer in the u-boot and maybe find a better and clean solution if I have spare time.
Did I get that right - you added a loop to check all PHY addresses,and now it works on your board?
If yes, you simply need to define the right PHY address in your board config, and it should work without the loop.
cu
Michael
PATCH 1/1 Add support for Generic PHY in macb
Hi
Quoting Michael Schwingen <[email protected]>:
Quoted 8 lines
Quoted 4 lines · michael
I add the cycle only for testing and works, now I will take a look to the mii layer in the u-boot and maybe find a better and clean solution if I have spare time.
Did I get that right - you added a loop to check all PHY addresses,and now it works on your board?
Yes
Quoted 3 lines
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.
Regards Michael
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
PATCH 1/1 Add support for Generic PHY in macb
Quoted 5 lines · trimarchi at gandalf.sssup.it
... 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.
The "mii info" command (without a PHY address as parameter) does exactly what you need:
=> mii info
PHY 0x10: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x11: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x12: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x13: OUI = 0x5043, Model = 0x08, Rev = 0x07, 100baseT, FDX PHY 0x14: OUI = 0x5043, Model = 0x08, Rev = 0x07, 10baseT, HDX PHY 0x15: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX PHY 0x16: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX PHY 0x17: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX PHY 0x18: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x19: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x1A: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x1B: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x1C: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x1D: OUI = 0x0001, Model = 0x20, Rev = 0x02, 10baseT, HDX PHY 0x1E: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX PHY 0x1F: OUI = 0x0000, Model = 0x00, Rev = 0x00, 10baseT, HDX
Now which of these should the autodetect code pick? (hint: 0x13 is wrong, even if it is the only one that shows a 100Mbps link). Also, this really is a board with working MDIO, with correct pullups, so no "ghost" PHYs in the list.
cu
Michael
PATCH 1/1 Add support for Generic PHY in macb
Quoting Michael Schwingen <[email protected]>:
Quoted 27 lines
Quoted 5 lines · trimarchi at gandalf.sssup.it
... 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.The "mii info" command (without a PHY address as parameter) does exactly what you need:
=> mii info
PHY0x10: OUI =0x5043, Model =0x08, Rev =0x07, 10baseT, HDX PHY0x11: OUI =0x5043, Model =0x08, Rev =0x07, 10baseT, HDX PHY0x12: OUI =0x5043, Model =0x08, Rev =0x07, 10baseT, HDX PHY0x13: OUI =0x5043, Model =0x08, Rev =0x07, 100baseT, FDX PHY0x14: OUI =0x5043, Model =0x08, Rev =0x07, 10baseT, HDX PHY0x15: OUI =0x0000, Model =0x00, Rev =0x00, 10baseT, HDX PHY0x16: OUI =0x0000, Model =0x00, Rev =0x00, 10baseT, HDX PHY0x17: OUI =0x0000, Model =0x00, Rev =0x00, 10baseT, HDX PHY0x18: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x19: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x1A: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x1B: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x1C: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x1D: OUI =0x0001, Model =0x20, Rev =0x02, 10baseT, HDX PHY0x1E: OUI =0x0000, Model =0x00, Rev =0x00, 10baseT, HDX PHY0x1F: OUI =0x0000, Model =0x00, Rev =0x00, 10baseT, HDX
Quoted 4 lines
Now which of these should the autodetect code pick? (hint:
0x13is wrong, even if it is the only one that shows a 100Mbps link). Also, this really is a board with working MDIO, with correct pullups, so no "ghost" PHYs in the list.
Ok, thanks
Regards Michael
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
PATCH 1/1 Add support for Generic PHY in macb
In reply to trimarchi at gandalf.sssup.itQuoted 11 lines · On Sun, Feb 24, 2008 at 7:30 AM, <[email protected]> wrote:
Hi
Quoting Michael Schwingen <[email protected]>:
Quoted 3 lines
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