netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Schulz <alex@shark-linux.de>
To: netdev@vger.kernel.org
Cc: alex@shark-linux.de
Subject: Reading MAC Address from a CS89x0 without eeprom
Date: Thu, 08 Jan 2009 20:25:01 +0100	[thread overview]
Message-ID: <4966530D.3050103@shark-linux.de> (raw)

Hello,

on my machine, an ARM based board, there is a SUN-like openprom
firmware that initializes hardware using one global eeprom. It
also initializes the network chip (CS89x0) with a MAC Address. The
current Linux driver has the ability to read the address from the
chip but it only does it if it detects an eeprom attached to the
chip. There is no dedicated eeprom on my board. So I would like
to include something like the following possibility to read the mac
address from the chip anyway. I discussed this on the ARM devel
list and was redirected here, so I hope you can help me.

Thanks
   Alexander

diff -udpNr -x '*.cmd' -x '*.o'
linux-2.6.28-git6-org/drivers/net/cs89x0.c linux-2.6.28/drivers/net/cs89x0.c
--- linux-2.6.28-git6-org/drivers/net/cs89x0.c  2009-01-04
12:07:04.000000000 +0100
+++ linux-2.6.28/drivers/net/cs89x0.c   2009-01-08 17:17:32.000000000 +0100
@@ -670,8 +670,14 @@ cs89x0_probe1(struct net_device *dev, in
          } else
   #endif

+#ifndef CONFIG_CS89x0_NOEEPROM
+        /* On some systems the chip might be initialized by firmware
+         * even though it does not have an EEPROM.
+         * So let's read the config from the chip anyway. */
           if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) ==
-             (EEPROM_OK|EEPROM_PRESENT)) {
+             (EEPROM_OK|EEPROM_PRESENT))
+#endif
+              {
                  /* Load the MAC. */
                  for (i=0; i < ETH_ALEN/2; i++) {
                          unsigned int Addr;
diff -udpNr -x '*.cmd' -x '*.o'
linux-2.6.28-git6-org/drivers/net/Kconfig linux-2.6.28/drivers/net/Kconfig
--- linux-2.6.28-git6-org/drivers/net/Kconfig   2009-01-04
12:07:02.000000000 +0100
+++ linux-2.6.28/drivers/net/Kconfig    2009-01-08 17:22:32.000000000 +0100
@@ -1424,6 +1424,19 @@ config CS89x0_NONISA_IRQ
          depends on CS89x0 != n
          depends on MACH_IXDP2351 || ARCH_IXDP2X01 || ARCH_PNX010X ||
MACH_MX31ADS

+config CS89x0_NOEEPROM
+       bool "Always read MAC Address from the chip"
+       depends on CS89x0 != n
+       default y if ARCH_SHARK
+       ---help---
+         If you say Y here, the MAC address is read from the CS89x0
+         even if there is no EEPROM connected to it that could hold
+         the address. This is useful if the chip was previously
+         initialized by some firmware or bootloader that uses other
+         means to determine a unique MAC address like a global EEPROM
+         for many different hardware settings.
+
+
   config TC35815
          tristate "TOSHIBA TC35815 Ethernet support"
          depends on NET_PCI && PCI && MIPS

                 reply	other threads:[~2009-01-08 19:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4966530D.3050103@shark-linux.de \
    --to=alex@shark-linux.de \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).