Add support for Generic PHY in macb
PATCH 1/1 Add support for Generic PHY in macb
Hi,
Quoted 14 lines
Quoted 3 lines · On Fri, 22 Feb 2008 12:41:17 +0100 michael wrote:
Add support for Generic PHY in macb.
Signed-off-by michaelWhat's a "generic PHY"?
hskinnemoen at dhcp-252-066:~/git/u-boot/master$ grep -r
GENERIC_PHYinclude/configs
hskinnemoen at dhcp-252-066:~/git/u-boot/master$
Quoted 8 lines
Review
Quoted 7 lines
if (phy_id == 0xffff) {(quoted diff) +4
-0+#if defined (CONFIG_GENERIC_PHY) + printf("%s: Using the Generic PHY\n", netdev->name); +#else printf("%s: No PHY present\n", netdev->name); return 0; +#endif
When I read to my id u-boot report 0xffff and fail, but the device works pretty well skipping this testing. If I remember linux report the same issue.
I test it on my board and it works well.
Regards 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 3 lines · On Fri, 22 Feb 2008 12:27:48 +0000 (GMT) Michael Trimarchi…
When I read to my id u-boot report
0xffffand fail, but the device works pretty well skipping this testing. If I remember linux report the same issue.
Is the MII address of your PHY set correctly?
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
So I think the CONFIG_GENERIC_PHY name is misleading -- the test is generic enough as is. CONFIG_BROKEN_PHY would be better, if there's really no way to get your PHY to behave.
But note that if MDIO communication isn't working, autonegotiation won't work, and the speed and duplex settings will most likely be wrong. So I don't think simply #ifdefing out that sanity check is really going to solve any problems.
Haavard
PATCH 1/1 Add support for Generic PHY in macb
Hi
Quoted 14 lines · Haavard Skinnemoen
Quoted 4 lines · On Fri, 22 Feb 2008 12:27:48 +0000 (GMT) Michael Trimarchi…
When I read to my id u-boot report
0xffffand fail, but the device works pretty well skipping this testing. If I remember linux report the same issue.Is the MII address of your PHY set correctly?
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
Quoted 10 lines
So I think the
CONFIG_GENERIC_PHYname is misleading -- the test is generic enough as is.CONFIG_BROKEN_PHYwould be better, if there's really no way to get your PHY to behave.But note that if MDIO communication isn't working, autonegotiation won't work, and the speed and duplex settings will most likely be wrong. So I don't think simply #ifdefing out that sanity check is really going to solve any problems.
Yes I know but this is the situation:
- dm9161a
- at91sam9260
When I try to read at phy id it reports 0xffff and linux too. I suppose that can be related to a broken phy. But seems to be broken on this read. I think that you have more experience, do you have an idea?
Regards Michael
PATCH 1/1 Add support for Generic PHY in macb
Quoted 7 lines · On Fri, 22 Feb 2008 15:05:52 +0100 michael <[email protected]> wrote:
- dm9161a
- at91sam9260When I try to read at phy id it reports
0xffffand linux too. I suppose that can be related to a broken phy. But seems to be broken on this read. I think that you have more experience, do you have an idea?
According to the data sheet, a read from PHYID1 should return 0x0181 on this particular PHY. So the PHY seems sane enough, but something is not working as it should.
There can be several reasons why the PHY doesn't respond:
* The board code specifies the wrong PHY address. If this is the case, the PHY will simply not respond to anything.
* The board code has not set up the MDIO and MDC I/O pins for use by the MACB. If so, the CPU won't toggle these lines as it should, and it will probably just see floating signals on the input.
* The MDIO and/or MDC lines aren't connected to the PHY. If so, there's really nothing to do about it except modify the driver to use fixed settings instead of asking the PHY about the current speed/duplex settings.
* The PHYAD[4:0] pins on the PHY aren't strapped correctly. The state of these pins is latched on powerup and determine the PHY address. A combination of pull-ups and pull-downs must be used to specify a particular address. IIRC address 0 is special, so you probably shouldn't pull all of them down.
Or it could be something else. Hard to say for sure without seeing the board code and schematics.
I think that if the macb driver only ever sees 0xffff returned from the PHY it will probably still work, but it will always run at 100 Mbps full-duplex. So while your patch appears to work, I suspect it will fail if you plug your device into a switch or hub that doesn't do 100 Mbps full-duplex.
Haavard
PATCH 1/1 Add support for Generic PHY in macb
In reply to Haavard SkinnemoenQuoted 3 lines · Haavard Skinnemoen
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
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.
Quoted 4 lines
So I think the
CONFIG_GENERIC_PHYname is misleading -- the test is generic enough as is.CONFIG_BROKEN_PHYwould be better, if there's really no way to get your PHY to behave.
Right. Or CONFIG_PHY_NO_MDIO or something like that. This is in the direction of CONFIG_MII_ETHSWITCH which is used eg. by AcTux-2 for this purpose.
Quoted 5 lines
But note that if MDIO communication isn't working, autonegotiation won't work, and the speed and duplex settings will most likely be wrong. So I don't think simply #ifdefing out that sanity check is really going to solve any problems.
The chip may do autonegotiation by default, however, the MAC driver still needs to know about the negotiated speed/duplex, so unless there is some board-specific way to read those (eg. by GPIO pins), only one speed/duplex will work and all other modes will be broken. This is different from the case with the hardwired ethernet switch - in case of the switch, we know that the MII port is always running at 100Mbps, full-duplex.
cu
Michael
PATCH 1/1 Add support for Generic PHY in macb
Quoted 6 lines · On Fri, 22 Feb 2008 16:05:34 +0100 Michael Schwingen…
Quoted 3 lines · Haavard Skinnemoen
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
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.
Quoted 7 lines
Quoted 4 lines
So I think the
CONFIG_GENERIC_PHYname is misleading -- the test is generic enough as is.CONFIG_BROKEN_PHYwould be better, if there's really no way to get your PHY to behave.Right. Or
CONFIG_PHY_NO_MDIOor something like that. This is in the direction ofCONFIG_MII_ETHSWITCHwhich is used eg. by AcTux-2 for this purpose.
I think U-Boot needs a common PHY layer like Linux has. IIRC someone suggested the same thing some time ago. There's no point going around adding the same special-case code to every ethernet driver in the tree...
Quoted 5 lines
Quoted 5 lines
But note that if MDIO communication isn't working, autonegotiation won't work, and the speed and duplex settings will most likely be wrong. So I don't think simply #ifdefing out that sanity check is really going to solve any problems.
Quoted 7 lines
The chip may do autonegotiation by default, however, the MAC driver still needs to know about the negotiated speed/duplex, so unless there is some board-specific way to read those (eg. by GPIO pins), only one speed/duplex will work and all other modes will be broken. This is different from the case with the hardwired ethernet switch - in case of the switch, we know that the MII port is always running at 100Mbps, full-duplex.
Hmm...most switches support autonegotiation don't they? If not, what happens if you plug in in an old computer with a 10Mbps ethernet board?
But I guess we need something equivalent to CONFIG_FIXED_PHY in Linux...
Haavard
PATCH 1/1 Add support for Generic PHY in macb
Quoted 3 lines · Haavard Skinnemoen
Right. We might need to add support for such PHYs, but just disabling the sanity check is far from enough.
Agreed - in the case of a single MII-connected TP PHY, we really need working MDIO (or some replacement). For special cases (100BaseF fiber, which is always fixed speed and duplex), some equivalent to Linux' fixed phy handling would be needed.
Quoted 9 lines
Quoted 8 lines
The chip may do autonegotiation by default, however, the MAC driver still needs to know about the negotiated speed/duplex, so unless there is some board-specific way to read those (eg. by GPIO pins), only one speed/duplex will work and all other modes will be broken. This is different from the case with the hardwired ethernet switch - in case of the switch, we know that the MII port is always running at 100Mbps, full-duplex.
Quoted 3 lines
Hmm...most switches support autonegotiation don't they? If not, what happens if you plug in in an old computer with a 10Mbps ethernet board?
The switches support autonegotiation on the TP ports. The internal MII port which connects them to the CPU/MAC is usually run at fixed 100Mbps full-duplex.
If the switch has MDIO, you can quary the status of the external PHYs - however, from the point of the MAC driver, that is useless, you need to assume that the MII link is always up, since there is no autonegotiation on the MII bus.
Older switches (I have worked with the Marvell M88E6050) do not even have MDIO - the MII runs fixed, and the TP ports can either autonegotiate, or can be set to fixed 10/100/halfduplex operation using strapping pins.
cu
Michael
PATCH 1/1 Add support for Generic PHY in macb
In reply to Haavard SkinnemoenQuoted 31 lines · Haavard Skinnemoen
Quoted 9 lines · On Fri, 22 Feb 2008 16:05:34 +0100 Michael Schwingen…
Quoted 4 lines · Haavard Skinnemoen
All MII-capable PHYs should have a working PHYSID1 register. If it doesn't, something is broken.
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.
Quoted 9 lines
Quoted 5 lines
So I think the
CONFIG_GENERIC_PHYname is misleading -- the test is generic enough as is.CONFIG_BROKEN_PHYwould be better, if there's really no way to get your PHY to behave.Right. Or
CONFIG_PHY_NO_MDIOor something like that. This is in the direction ofCONFIG_MII_ETHSWITCHwhich is used eg. by AcTux-2 for this purpose.
Quoted 6 lines
I think U-Boot needs a common PHY layer like Linux has. IIRC someone suggested the same thing some time ago. There's no point going around adding the same special-case code to every ethernet driver in the tree...
Yeah, that's me. I'm working on porting the Linux PHY driver over, but have had next to no time in the past few months (had to find a new job etc...) I hope to seriously get back into it in the next few days, with a goal of the next U-boot release for an initial spin.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
But note that if MDIO communication isn't working, autonegotiation won't work, and the speed and duplex settings will most likely be wrong. So I don't think simply #ifdefing out that sanity check is really going to solve any problems.
Quoted 8 lines
The chip may do autonegotiation by default, however, the MAC driver still needs to know about the negotiated speed/duplex, so unless there is some board-specific way to read those (eg. by GPIO pins), only one speed/duplex will work and all other modes will be broken. This is different from the case with the hardwired ethernet switch - in case of the switch, we know that the MII port is always running at 100Mbps, full-duplex.
Quoted 4 lines
Hmm...most switches support autonegotiation don't they? If not, what happens if you plug in in an old computer with a 10Mbps ethernet board?
Some do and some don't. Typically when you connect to a switch via RvMII the data rate is set by strap pins or over the control plane, which can be MDIO, SPI, or whatever.
Quoted 3 lines
But I guess we need something equivalent to
CONFIG_FIXED_PHYin Linux...
Yeah
Quoted 12 lines
Haavard
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users