Browse Source

[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 16 years ago
parent
commit
afe59d4636
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      src/drivers/net/sundance.c

+ 16
- 0
src/drivers/net/sundance.c View File

691
 	/* Reset the chip to erase previous misconfiguration */
691
 	/* Reset the chip to erase previous misconfiguration */
692
 	DBG ( "ASIC Control is %#x\n", inl(BASE + ASICCtrl) );
692
 	DBG ( "ASIC Control is %#x\n", inl(BASE + ASICCtrl) );
693
 	outw(0x007f, BASE + ASICCtrl + 2);
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
 	DBG ( "ASIC Control is now %#x.\n", inl(BASE + ASICCtrl) );
710
 	DBG ( "ASIC Control is now %#x.\n", inl(BASE + ASICCtrl) );
695
 
711
 
696
 	sundance_reset(nic);
712
 	sundance_reset(nic);

Loading…
Cancel
Save