From c9607cc01de44e26cef9088cde644467d9c1eb5c Mon Sep 17 00:00:00 2001 From: Grant Grundler Date: Tue, 10 Feb 2004 18:42:16 -0800 Subject: [PATCH] [TG3]: Reset GRC, if necessary, before DMA test. With help from Michael Chan. --- drivers/net/tg3.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7dce45ddadcf0..da91d77ad51ea 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -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"); -- 2.53.0