All pastes #41117 Raw Edit

Something

public text v1 · immutable
#41117 ·published 2006-02-11 08:09 UTC
rendered paste body
 -38,6 +38,8 @@   
        Miiadr          = 0x71,         /* MII Address */
        Miidata         = 0x72,         /* MII Data */
        Eecsr           = 0x74,         /* EEPROM Control and Status */
+       Misccr  = 0x81,         /* Misc. Control */
+       Stickyhw        = 0x83,         /* Sticky hardware config */
 };                 
                    
 enum {                                 /* Rcr */
@@ -174,10 +176,13 @@
        Eck             = 0x04,         /* Clock */
        Ecs             = 0x08,         /* Chip Select */
        Dpm             = 0x10,         /* Direct Program Mode Enable */
-       Autold          = 0x20,         /* Dynamic Reload */
+       Autold  = 0x20,         /* Dynamic Reload */
        Embp            = 0x40,         /* Embedded Program Enable */
        Eepr            = 0x80,         /* Programmed */
 };                 
+enum{                                  /* Misccr */
+       Forcereset = 0x40,
+};                 
 /*                 
  * Ring descriptor. The space allocated for each
@@ -840,7 +845,13 @@
        /*          
         * Soft reset the controller.
         */         
-       csr16w(ctlr, Cr, Sfrst);
+                   
+       /* Handle new revisions' reset brain damage */
+       if(ctlr->pcidev->rid >= 0x40){
+               print("vt6102: found evil revision\n");
+               csr8w(ctlr, Misccr, Forcereset);
+       }           
+       else csr16w(ctlr, Cr, Sfrst);
        for(timeo = 0; timeo < 10000; timeo++){
                if(!(csr16r(ctlr, Cr) & Sfrst))
                        break;
@@ -861,6 +872,10 @@
        if(vt6102detach(ctlr) < 0)
                return -1;
                    
+       /* Wake up */
+       if(ctlr->pcidev->rid >= 0x40)
+               csr8w(ctlr, Stickyhw, csr8r(ctlr, Stickyhw) & 0xfc);
+                   

        /*          
         * Load the MAC address into the PAR[01]
         * registers.
@@ -1019,5 +1034,4 @@
 ethervt6102link(void)
 {                  
        addethercard("vt6102", vt6102pnp);
-       addethercard("rhine", vt6102pnp);
 }