[U-Boot] [PATCH] tsec: Wait for auto-negotiation to complete without link
Jerry Van Baren
gerald.vanbaren at ge.com
Fri Feb 6 20:30:22 CET 2009
Andy Fleming wrote:
> On Fri, Feb 6, 2009 at 7:32 AM, Jerry Van Baren <gerald.vanbaren at ge.com> wrote:
>> Peter Tyser wrote:
>
>>>> The problem is that you don't always know which interface you have
>>>> hooked up. So u-boot tries the one set in ethact, and then the next,
>>>> etc. With the old method, the penalty for being wrong was quite high.
>>>> I hadn't run into an issue with the link not being up. Why don't we
>>>> look up the spec, and find out the maximum time we'd have to wait for
>>>> that to happen. That way we get the best of both worlds. My sense is
>>>> that the link comes up fast, but autonegotiation potentially takes a
>>>> while.
>> 2 seconds minimum, it is written in the autonegotiation spec. If you add
>> the spec-required minimum times for each step of the dance, it is 2 seconds.
>> It could take longer, but I've never seen anything but 2 seconds.
>
> Could you point me at where in the spec it says this? I've been
> digging around in it, and found nothing concrete so far.
I've been sweating bullets just *knowing* someone was going to call me
on this. Oh man, I am ***SO*** lucky... I had to dig back to October
2002 to find it, but find it I did. :-) :-) :-)
My experience is that "The second case assumes that the far end link
partner fully supports Auto-Negotiation:" / "Min spec" time is what
occurs. I've never seen a PHY take anything other than bang-on 2
seconds (OK, 2.054 seconds).
IIRC, the "min spec" time is the minimum time a PHY is allowed to take
for autonegotiation. The "max spec" time is the maximum time the PHY is
allowed to take for autonegotiation. The PHY *has* everything it needs
to know by the "min spec" time, which is why all PHYs (that I've ever
used) take exactly 2 seconds for autonegotiation.
If you wanted to be safer than my semi-empirical 2 second number, 2.8
(round up to 3?) seconds is probably a good choice.
Note that the first case mentioned below is oddball in that the far end
doesn't support autonegotiation. In real life, you are probably screwed
in this case regardless of the time it takes for autonegotiation to fail.
I recall verifying the DP83840 calculations against chapter 28 of the
IEEE 802.3u and I *clearly* recall not wanting to go back there ever
again. If you doubt the numbers, *you* can go there. ;-)
Enjoy,
gvb
------------------------------------------------------------------
Worst case auto-negotiate times per IEEE.
------------------------------------------------------------------
Quote from National Instrument's DP83840A Datasheet:
==================================================================
3.9.6 Auto-Negotiation Complete Time
This section describes the amount of time required to complete an
Auto-Negotiation cycle for the 840A. These times are defined for two cases.
The first case assumes that the far end link partner does not support
Auto-Negotiation and is either a fixed 10M or 100M implementation.
Timer Min spec Max spec DP83840A
----- -------- -------- --------
Break link 1200ms 1500ms 1300ms
Autoneg wait 500ms 1000ms 750ms
Link fail inhibit 750ms 1000ms 800ms
------------------------------------------------------------------
Total 1700-2450ms 2500-3500ms 2050-2850ms
The second case assumes that the far end link partner fully
supports Auto-Negotiation:
Timer Min spec Max spec DP83840A
----- -------- -------- --------
Break link 1200ms 1500ms 1300ms
FLP bursts 104ms 312ms 200ms
Link fail inhibit 750ms 1000ms 800ms
------------------------------------------------------------------
Total 1304-2054ms 1812-2812ms 1500-2300ms
Refer to chapter 28 of the IEEE 802.3u standard for a full description
of the individual timers related to Auto-Negotiation.
==========================================================================
Notes:
* The minimum time in the "Total" lines is if "Link fail inhibit" is not
necessary. The maximum is the sum of all three times in the column.
* Assuming "Link fail inhibit" doesn't occur, the "Break link" dominates
the time required.
* Our experience is that the PHYs can be configured to start
auto-negotiating on application of power. This allows the
auto-negotiation to occur in parallel with the processor start up code.
This is helpful, but 2 seconds is still a long time.
* The FLP pulse width is 100nSec (10MHz fundamental frequency, probably
square edges).
More information about the U-Boot
mailing list