Procházet zdrojové kódy

[sundance] Add reset completion check

Following the example of the Linux driver, we add a check and delay to
make sure that the NIC has finished resetting before the driver issues
any additional commands.

Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v0.9.7
Thomas Miletich před 15 roky
rodič
revize
afe59d4636
1 změnil soubory, kde provedl 16 přidání a 0 odebrání
  1. 16
    0
      src/drivers/net/sundance.c

+ 16
- 0
src/drivers/net/sundance.c Zobrazit soubor

@@ -691,6 +691,22 @@ static int sundance_probe ( struct nic *nic, struct pci_device *pci ) {
691 691
 	/* Reset the chip to erase previous misconfiguration */
692 692
 	DBG ( "ASIC Control is %#x\n", inl(BASE + ASICCtrl) );
693 693
 	outw(0x007f, BASE + ASICCtrl + 2);
694
+
695
+	/*
696
+	* wait for reset to complete
697
+	* this is heavily inspired by the linux sundance driver
698
+	* according to the linux driver it can take up to 1ms for the reset
699
+	* to complete
700
+	*/
701
+	i = 0;
702
+	while(inl(BASE + ASICCtrl) & (ResetBusy << 16)) {
703
+		if(i++ >= 10) {
704
+			DBG("sundance: NIC reset did not complete.\n");
705
+			break;
706
+		}
707
+		udelay(100);
708
+	}
709
+
694 710
 	DBG ( "ASIC Control is now %#x.\n", inl(BASE + ASICCtrl) );
695 711
 
696 712
 	sundance_reset(nic);

Načítá se…
Zrušit
Uložit