bge: Enable hardware fixes for BCM5704 B0 as recommended by datasheet.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 28 Jun 2012 06:18:21 +0000 (14:18 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 28 Jun 2012 06:58:30 +0000 (14:58 +0800)
Obtained-from: FreeBSD 204975

sys/dev/netif/bge/if_bge.c

index 1d0de2c..48e8797 100644 (file)
@@ -1210,6 +1210,7 @@ bge_chipinit(struct bge_softc *sc)
 {
        int i;
        uint32_t dma_rw_ctl;
+       uint16_t val;
 
        /* Set endian type before we access any non-PCI registers. */
        pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4);
@@ -1229,6 +1230,17 @@ bge_chipinit(struct bge_softc *sc)
            i < BGE_STATUS_BLOCK_END + 1; i += sizeof(uint32_t))
                BGE_MEMWIN_WRITE(sc, i, 0);
 
+       if (sc->bge_chiprev == BGE_CHIPREV_5704_BX) {
+               /*
+                * Fix data corruption caused by non-qword write with WB.
+                * Fix master abort in PCI mode.
+                * Fix PCI latency timer.
+                */
+               val = pci_read_config(sc->bge_dev, BGE_PCI_MSI_DATA + 2, 2);
+               val |= (1 << 10) | (1 << 12) | (1 << 13);
+               pci_write_config(sc->bge_dev, BGE_PCI_MSI_DATA + 2, val, 2);
+       }
+
        /* Set up the PCI DMA control register. */
        if (sc->bge_flags & BGE_FLAG_PCIE) {
                /* PCI Express */