]> git.hungrycats.org Git - linux/commitdiff
[TG3]: Reset GRC, if necessary, before DMA test.
authorGrant Grundler <grundler@parisc-linux.org>
Wed, 11 Feb 2004 02:42:16 +0000 (18:42 -0800)
committerDavid S. Miller <davem@nuts.davemloft.net>
Wed, 11 Feb 2004 02:42:16 +0000 (18:42 -0800)
With help from Michael Chan.

drivers/net/tg3.c

index 7dce45ddadcf0eca22d530337b66a81b620bdc39..da91d77ad51ea9c64881cdb27df0de1ab6c87cd3 100644 (file)
@@ -3420,7 +3420,10 @@ static int tg3_abort_hw(struct tg3 *tp)
        if (err)
                goto out;
 
-       memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
+       if (tp->hw_status)
+               memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
+       if (tp->hw_stats)
+               memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
 
 out:
        return err;
@@ -7750,6 +7753,18 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                goto err_out_iounmap;
        }
 
+       /*
+        * Reset chip in case UNDI or EFI driver did not shutdown
+        * DMA self test will enable WDMAC and we'll see (spurious)
+        * pending DMA on the PCI bus at that point.
+        */
+       if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
+           (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
+               pci_save_state(tp->pdev, tp->pci_cfg_state);
+               tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
+               tg3_halt(tp);
+       }
+
        err = tg3_test_dma(tp);
        if (err) {
                printk(KERN_ERR PFX "DMA engine test failed, aborting.\n");