patch-2.2.0-pre8 linux/drivers/net/acenic.c

Next file: linux/drivers/net/eepro100.c
Previous file: linux/drivers/net/Space.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre7/linux/drivers/net/acenic.c linux/drivers/net/acenic.c
@@ -121,7 +121,6 @@
  * TODO:
  *
  * - Add multicast support.
- * - The Tigon II firmware fails to run in some PCs.
  * - NIC dump support.
  * - More tuning parameters.
  */
@@ -133,15 +132,16 @@
 static int max_tx_desc[8] = {0, };
 static int max_rx_desc[8] = {0, };
 
-static const char *version = "acenic.c: v0.22 01/07/99  Jes Sorensen (Jes.Sorensen@cern.ch)\n";
+static const char *version = "acenic.c: v0.24 01/13/99  Jes Sorensen (Jes.Sorensen@cern.ch)\n";
 
 static struct device *root_dev = NULL;
 
 static int ace_load_firmware(struct device *dev);
 
+static int probed __initdata = 0;
+
 __initfunc(int acenic_probe (struct device *dev))
 {
-	static int i = 0;
 	int boards_found = 0;
 	int version_disp;
 	struct ace_private *ap;
@@ -154,6 +154,10 @@
 #endif
 	struct pci_dev *pdev = NULL;
 
+	if (probed)
+		return -ENODEV;
+	probed ++;
+
 	if (!pci_present())		/* is PCI support present? */
 		return -ENODEV;
 
@@ -183,8 +187,6 @@
 		ap->pdev = pdev;
 		ap->vendor = pdev->vendor;
 
-		pci_set_master(pdev);
-
 		dev->irq = pdev->irq;
 #ifdef __SMP__
 		spin_lock_init(&ap->lock);
@@ -221,6 +223,8 @@
 					      pci_latency);
 		}
 
+		pci_set_master(pdev);
+
 		switch(ap->vendor){
 		case PCI_VENDOR_ID_ALTEON:
 			sprintf(ap->name, "AceNIC Gigabit Ethernet");
@@ -246,7 +250,8 @@
 						      0x4000);
 		if (!ap->regs){
 			printk(KERN_ERR "%s:  Unable to map I/O register, "
-			       "AceNIC %i will be disabled.\n", dev->name, i);
+			       "AceNIC %i will be disabled.\n",
+			       dev->name, boards_found);
 			break;
 		}
 
@@ -401,13 +406,6 @@
 			  ((CLR_INT | WORD_SWAP) << 24));
 #endif
 
-#ifdef __LITTLE_ENDIAN
-	regs->ModeStat = ACE_BYTE_SWAP_DATA | ACE_WARN | ACE_FATAL
-			| ACE_WORD_SWAP;
-#else
-#error "this driver doesn't run on big-endian machines yet!"
-#endif
-
 	/*
 	 * Stop the NIC CPU and clear pending interrupts
 	 */
@@ -438,6 +436,20 @@
 		       tig_ver);
 		return -ENODEV;
 	}
+
+	/*
+	 * ModeStat _must_ be set after the SRAM settings as this change
+	 * seems to corrupt the ModeStat and possible other registers.
+	 * The SRAM settings survive resets and setting it to the same
+	 * value a second time works as well. This is what caused the
+	 * `Firmware not running' problem on the Tigon II.
+	 */
+#ifdef __LITTLE_ENDIAN
+	regs->ModeStat = ACE_BYTE_SWAP_DATA | ACE_WARN | ACE_FATAL
+			| ACE_WORD_SWAP;
+#else
+#error "this driver doesn't run on big-endian machines yet!"
+#endif
 
 	mac1 = 0;
 	for(i = 0; i < 4; i++){

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov