[netdrvr forcedeth] phy address scan range
authorAyaz Abdulla <aabdulla@nvidia.com>
Fri, 11 Nov 2005 13:31:11 +0000 (08:31 -0500)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 11 Nov 2005 13:31:11 +0000 (08:31 -0500)
Added phy address 0 to the phy scan.

Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
drivers/net/forcedeth.c

index 731d0d7b2f37bccf0e99d488be1149ff192661c0..525624fc03b47016c2d1f1586d49d92e83c4dbba 100644 (file)
@@ -99,6 +99,7 @@
  *     0.44: 20 Aug 2005: Add support for scatter gather and segmentation.
  *     0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check
  *     0.46: 20 Oct 2005: Add irq optimization modes.
+ *     0.47: 26 Oct 2005: Add phyaddr 0 in phy scan.
  *
  * Known bugs:
  * We suspect that on some hardware no TX done interrupts are generated.
  * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
  * superfluous timer interrupts from the nic.
  */
-#define FORCEDETH_VERSION              "0.46"
+#define FORCEDETH_VERSION              "0.47"
 #define DRV_NAME                       "forcedeth"
 
 #include <linux/module.h>
@@ -2557,16 +2558,17 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
        }
 
        /* find a suitable phy */
-       for (i = 1; i < 32; i++) {
+       for (i = 1; i <= 32; i++) {
                int id1, id2;
+               int phyaddr = i & 0x1F;
 
                spin_lock_irq(&np->lock);
-               id1 = mii_rw(dev, i, MII_PHYSID1, MII_READ);
+               id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ);
                spin_unlock_irq(&np->lock);
                if (id1 < 0 || id1 == 0xffff)
                        continue;
                spin_lock_irq(&np->lock);
-               id2 = mii_rw(dev, i, MII_PHYSID2, MII_READ);
+               id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ);
                spin_unlock_irq(&np->lock);
                if (id2 < 0 || id2 == 0xffff)
                        continue;
@@ -2574,23 +2576,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT;
                id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT;
                dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n",
-                               pci_name(pci_dev), id1, id2, i);
-               np->phyaddr = i;
+                       pci_name(pci_dev), id1, id2, phyaddr);
+               np->phyaddr = phyaddr;
                np->phy_oui = id1 | id2;
                break;
        }
-       if (i == 32) {
-               /* PHY in isolate mode? No phy attached and user wants to
-                * test loopback? Very odd, but can be correct.
-                */
+       if (i == 33) {
                printk(KERN_INFO "%s: open: Could not find a valid PHY.\n",
-                               pci_name(pci_dev));
-       }
-
-       if (i != 32) {
-               /* reset it */
-               phy_init(dev);
+                      pci_name(pci_dev));
+               goto out_freering;
        }
+       
+       /* reset it */
+       phy_init(dev);
 
        /* set default link speed settings */
        np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10;