[U-Boot] DM9161BMSR must be read twice ?

Andy Fleming afleming at gmail.com
Mon Sep 8 23:25:41 CEST 2008


On Tue, Sep 2, 2008 at 2:37 PM, Nícolas Carneiro Lebedenco
<nicolas.lebedenco at tasksistemas.com.br> wrote:
> Hi,
>
> I'm developing a custom board based on the AT91RM9200dk. In u-boot prompt,
> every time a enter a network command such as tftp or ping I get a message
> like this:
>
> "MAC: error during MII initialization"
>
> Although the command actually seems to work I was a little concerned.
> After taking a look at cpu/arm920t/at91rm9200/ether.c and
> cpu/arm920t/at91rm9200/dm9161.c I realized the problem was at
> the function UCHAR dm9161_GetLinkSpeed (AT91PS_EMAC p_mac) in dm9161.c.
> Apparently, the link status bit at BMSR register is indicating link down even
> when it's not.

This is part of the 802.3 standard for PHYs.  If the link status bit
is 1, it means the link is up.  However, when the link goes down, the
status bit will stay 0 until read.  This allows temporary link drops
to be detected.  In practice, few drivers bother to take advantage of
this.  So if the first read indicates the link is down, it is
necessary to read the status again.

Andy


More information about the U-Boot mailing list