public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Martin Eriksson <nitrax@giron.wox.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: via-rhine and MMIO
Date: Tue, 30 Oct 2001 04:12:07 -0500	[thread overview]
Message-ID: <3BDE6EE7.EC006474@mandrakesoft.com> (raw)
In-Reply-To: <04b801c1607a$947dbef0$0201a8c0@HOMER>

Martin Eriksson wrote:
> (drivers/net/via-rhine.c)
> ...
> /* Reload the station address from the EEPROM. */
> writeb(0x20, ioaddr + MACRegEEcsr);
> /* Typically 2 cycles to reload. */
> for (i = 0; i < 150; i++)
>     if (! (readb(ioaddr + MACRegEEcsr) & 0x20))
>         break;
> ...
> 
> If I run this code when I'm using MMIO, I get a hardware adress of
> "ff:ff:ff:ff:ff:ff" instead of the right one (and everything craps up). But
> when I comment out this part all is fine. So what's it needed for anyway?

On init all NIC drivers should get the MAC address from the NIC's
EEPROM, and store it in dev->dev_addr[].

If the MAC address is changed by the user in Windows, or in a previous
driver invocation, you want to change it back to the default.  Obtaining
the address from EEPROM is the only way to do this on most cards.  Since
the via-rhine apparently doesn't support this directly, it does the next
best thing:  kick the h/w to reload the EEPROM into chip registers, and
then read the MAC address from the chip registers.

WRT the above code, you should add a check to see if '150' is enough of
a wait.  MMIO is faster and would affect that loop.  Maybe you want to
schedule_timeout before reading MACRegEEcsr to delay a little bit.


-- 
Jeff Garzik      | Only so many songs can be sung
Building 1024    | with two lips, two lungs, and one tongue.
MandrakeSoft     |         - nomeansno


  parent reply	other threads:[~2001-10-30  9:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-29 13:06 via-rhine and MMIO Martin Eriksson
2001-10-29 18:13 ` Urban Widmark
2001-10-29 20:11   ` Martin Eriksson
2001-10-29 21:22     ` Urban Widmark
2001-10-29 21:36   ` Experimental via-rhine.c, mmio enabled Martin Eriksson
2001-10-30  9:12 ` Jeff Garzik [this message]
2001-11-03 15:55   ` [patch] Re: via-rhine and MMIO Urban Widmark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BDE6EE7.EC006474@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nitrax@giron.wox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox