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.
This commit is contained in:
parent
5321a88409
commit
5e38d9e483
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367940
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user