svn commit: r367940 - head/sys/dev/dwc
Emmanuel Vadot
manu at FreeBSD.org
Sun Nov 22 20:16:47 UTC 2020
Author: manu
Date: Sun Nov 22 20:16:46 2020
New Revision: 367940
URL: https://svnweb.freebsd.org/changeset/base/367940
Log:
if_dwc: Correctly configure the DMA engine based on the fdt properties
Do not hardcode what we setup for the DMA engine configuration but
lookup the fdt properties and configuring accordingly.
Use a default value of 8 for the burst dma length for both TX and
RX, this is what we used for TX before.
Modified:
head/sys/dev/dwc/if_dwc.c
head/sys/dev/dwc/if_dwc.h
Modified: head/sys/dev/dwc/if_dwc.c
==============================================================================
--- head/sys/dev/dwc/if_dwc.c Sun Nov 22 18:54:14 2020 (r367939)
+++ head/sys/dev/dwc/if_dwc.c Sun Nov 22 20:16:46 2020 (r367940)
@@ -1496,6 +1496,9 @@ dwc_attach(device_t dev)
uint32_t reg;
char *phy_mode;
phandle_t node;
+ uint32_t txpbl, rxpbl;
+ bool nopblx8 = false;
+ bool fixed_burst = false;
sc = device_get_softc(dev);
sc->dev = dev;
@@ -1513,6 +1516,15 @@ dwc_attach(device_t dev)
OF_prop_free(phy_mode);
}
+ if (OF_getencprop(node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0)
+ txpbl = 8;
+ if (OF_getencprop(node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0)
+ rxpbl = 8;
+ if (OF_hasprop(node, "snps,no-pbl-x8") == 1)
+ nopblx8 = true;
+ if (OF_hasprop(node, "snps,fixed-burst") == 1)
+ fixed_burst = true;
+
if (IF_DWC_INIT(dev) != 0)
return (ENXIO);
@@ -1550,12 +1562,13 @@ dwc_attach(device_t dev)
return (ENXIO);
}
- if (sc->mactype != DWC_GMAC_EXT_DESC) {
- reg = BUS_MODE_FIXEDBURST;
- reg |= (BUS_MODE_PRIORXTX_41 << BUS_MODE_PRIORXTX_SHIFT);
- } else
- reg = (BUS_MODE_EIGHTXPBL);
- reg |= (BUS_MODE_PBL_BEATS_8 << BUS_MODE_PBL_SHIFT);
+ reg = BUS_MODE_USP;
+ if (!nopblx8)
+ reg |= BUS_MODE_EIGHTXPBL;
+ reg |= (txpbl << BUS_MODE_PBL_SHIFT);
+ reg |= (rxpbl << BUS_MODE_RPBL_SHIFT);
+ if (fixed_burst)
+ reg |= BUS_MODE_FIXEDBURST;
WRITE4(sc, BUS_MODE, reg);
/*
Modified: head/sys/dev/dwc/if_dwc.h
==============================================================================
--- head/sys/dev/dwc/if_dwc.h Sun Nov 22 18:54:14 2020 (r367939)
+++ head/sys/dev/dwc/if_dwc.h Sun Nov 22 20:16:46 2020 (r367940)
@@ -220,6 +220,8 @@
/* DMA */
#define BUS_MODE 0x1000
#define BUS_MODE_EIGHTXPBL (1 << 24) /* Multiplies PBL by 8 */
+#define BUS_MODE_USP (1 << 23)
+#define BUS_MODE_RPBL_SHIFT 17 /* Single block transfer size */
#define BUS_MODE_FIXEDBURST (1 << 16)
#define BUS_MODE_PRIORXTX_SHIFT 14
#define BUS_MODE_PRIORXTX_41 3
More information about the svn-src-all
mailing list