ath9k_hw: move the RF claim stuff to AR9002 hardware family
[safe/jmp/linux-2.6] / drivers / net / tulip / eeprom.c
index 206918b..93f4e83 100644 (file)
@@ -1,7 +1,6 @@
 /*
        drivers/net/tulip/eeprom.c
 
-       Maintained by Valerie Henson <val_henson@linux.intel.com>
        Copyright 2000,2001  The Linux Kernel Team
        Written/copyright 1994-2001 by Donald Becker.
 
@@ -9,9 +8,8 @@
        of the GNU General Public License, incorporated herein by reference.
 
        Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
-       for more information on this driver, or visit the project
-       Web page at http://sourceforge.net/projects/tulip/
-
+       for more information on this driver.
+       Please submit bug reports to http://bugzilla.kernel.org/.
 */
 
 #include <linux/pci.h>
@@ -163,36 +161,35 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
                if (ee_data[0] == 0xff) {
                        if (last_mediatable) {
                                controller_index++;
-                               printk(KERN_INFO "%s:  Controller %d of multiport board.\n",
-                                          dev->name, controller_index);
+                               dev_info(&dev->dev,
+                                        "Controller %d of multiport board\n",
+                                        controller_index);
                                tp->mtable = last_mediatable;
                                ee_data = last_ee_data;
                                goto subsequent_board;
                        } else
-                               printk(KERN_INFO "%s:  Missing EEPROM, this interface may "
-                                          "not work correctly!\n",
-                          dev->name);
+                               dev_info(&dev->dev,
+                                        "Missing EEPROM, this interface may not work correctly!\n");
                        return;
                }
          /* Do a fix-up based on the vendor half of the station address prefix. */
          for (i = 0; eeprom_fixups[i].name; i++) {
-               if (dev->dev_addr[0] == eeprom_fixups[i].addr0
-                       &&  dev->dev_addr[1] == eeprom_fixups[i].addr1
-                       &&  dev->dev_addr[2] == eeprom_fixups[i].addr2) {
-                 if (dev->dev_addr[2] == 0xE8  &&  ee_data[0x1a] == 0x55)
+                 if (dev->dev_addr[0] == eeprom_fixups[i].addr0 &&
+                     dev->dev_addr[1] == eeprom_fixups[i].addr1 &&
+                     dev->dev_addr[2] == eeprom_fixups[i].addr2) {
+                 if (dev->dev_addr[2] == 0xE8 && ee_data[0x1a] == 0x55)
                          i++;                  /* An Accton EN1207, not an outlaw Maxtech. */
                  memcpy(ee_data + 26, eeprom_fixups[i].newtable,
                                 sizeof(eeprom_fixups[i].newtable));
-                 printk(KERN_INFO "%s: Old format EEPROM on '%s' board.  Using"
-                                " substitute media control info.\n",
-                                dev->name, eeprom_fixups[i].name);
+                 dev_info(&dev->dev,
+                          "Old format EEPROM on '%s' board.  Using substitute media control info\n",
+                          eeprom_fixups[i].name);
                  break;
                }
          }
          if (eeprom_fixups[i].name == NULL) { /* No fixup found. */
-                 printk(KERN_INFO "%s: Old style EEPROM with no media selection "
-                                "information.\n",
-                          dev->name);
+                 dev_info(&dev->dev,
+                          "Old style EEPROM with no media selection information\n");
                return;
          }
        }
@@ -220,7 +217,8 @@ subsequent_board:
                /* there is no phy information, don't even try to build mtable */
                if (count == 0) {
                        if (tulip_debug > 0)
-                               printk(KERN_WARNING "%s: no phy info, aborting mtable build\n", dev->name);
+                               dev_warn(&dev->dev,
+                                        "no phy info, aborting mtable build\n");
                        return;
                }
 
@@ -236,8 +234,8 @@ subsequent_board:
                mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0;
                mtable->csr15dir = mtable->csr15val = 0;
 
-               printk(KERN_INFO "%s:  EEPROM default media type %s.\n", dev->name,
-                          media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]);
+               dev_info(&dev->dev, "EEPROM default media type %s\n",
+                        media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]);
                for (i = 0; i < count; i++) {
                        struct medialeaf *leaf = &mtable->mleaf[i];
 
@@ -300,16 +298,17 @@ subsequent_board:
                        }
                        if (tulip_debug > 1  &&  leaf->media == 11) {
                                unsigned char *bp = leaf->leafdata;
-                               printk(KERN_INFO "%s:  MII interface PHY %d, setup/reset "
-                                          "sequences %d/%d long, capabilities %2.2x %2.2x.\n",
-                                          dev->name, bp[0], bp[1], bp[2 + bp[1]*2],
-                                          bp[5 + bp[2 + bp[1]*2]*2], bp[4 + bp[2 + bp[1]*2]*2]);
+                               dev_info(&dev->dev,
+                                        "MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n",
+                                        bp[0], bp[1], bp[2 + bp[1]*2],
+                                        bp[5 + bp[2 + bp[1]*2]*2],
+                                        bp[4 + bp[2 + bp[1]*2]*2]);
                        }
-                       printk(KERN_INFO "%s:  Index #%d - Media %s (#%d) described "
-                                  "by a %s (%d) block.\n",
-                                  dev->name, i, medianame[leaf->media & 15], leaf->media,
-                                  leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
-                                  leaf->type);
+                       dev_info(&dev->dev,
+                                "Index #%d - Media %s (#%d) described by a %s (%d) block\n",
+                                i, medianame[leaf->media & 15], leaf->media,
+                                leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
+                                leaf->type);
                }
                if (new_advertise)
                        tp->sym_advertise = new_advertise;
@@ -339,10 +338,16 @@ int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_l
 {
        int i;
        unsigned retval = 0;
-       struct tulip_private *tp = dev->priv;
+       struct tulip_private *tp = netdev_priv(dev);
        void __iomem *ee_addr = tp->base_addr + CSR9;
        int read_cmd = location | (EE_READ_CMD << addr_len);
 
+       /* If location is past the end of what we can address, don't
+        * read some other location (ie truncate). Just return zero.
+        */
+       if (location > (1 << addr_len) - 1)
+               return 0;
+
        iowrite32(EE_ENB & ~EE_CS, ee_addr);
        iowrite32(EE_ENB, ee_addr);