Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix a bug that the NVRAM lock timeout occured on...



details:   https://anonhg.NetBSD.org/src/rev/65533855818d
branches:  trunk
changeset: 785840:65533855818d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 02 12:27:02 2013 +0000

description:
Fix a bug that the NVRAM lock timeout occured on sparc64 onboard bge.
Tested by martin.
- Don't acquire NVRAM lock if no EEPROM(or NVRAM?).
- Reset NVRAM before bge_reset(). It's required to acquire NVRAM lock in
  bge_reset().

diffstat:

 sys/dev/pci/if_bge.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 1a81041a582b -r 65533855818d sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Tue Apr 02 10:12:22 2013 +0000
+++ b/sys/dev/pci/if_bge.c      Tue Apr 02 12:27:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.231 2013/04/02 10:12:22 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.232 2013/04/02 12:27:02 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.231 2013/04/02 10:12:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.232 2013/04/02 12:27:02 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -3539,6 +3539,15 @@
                }
        }
 
+       /*
+        * Reset NVRAM before bge_reset(). It's required to acquire NVRAM
+        * lock in bge_reset().
+        */
+       CSR_WRITE_4(sc, BGE_EE_ADDR,
+           BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
+       delay(1000);
+       BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
+
        bge_stop_fw(sc);
        bge_sig_pre_reset(sc, BGE_RESET_START);
        if (bge_reset(sc))
@@ -3890,7 +3899,8 @@
        } else
                write_op = bge_writereg_ind;
 
-       if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5700 &&
+       if ((sc->bge_flags & BGE_NO_EEPROM) == 0 &&
+           BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5700 &&
            BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5701) {
                CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1);
                for (i = 0; i < 8000; i++) {



Home | Main Index | Thread Index | Old Index