git: 9c3faa7da860 - main - dwc: Configure the AXI request limits and mixed burst of the QoS core
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 13:55:51 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=9c3faa7da8600e9b1215b5b298cfda9df8627c34
commit 9c3faa7da8600e9b1215b5b298cfda9df8627c34
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-10-20 15:01:29 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-20 13:55:26 +0000
dwc: Configure the AXI request limits and mixed burst of the QoS core
dma4_init() wrote the system bus mode register with only the burst length
and enhanced address bits, which left the maximum number of outstanding AXI
requests at its reset value of one and did not honour mixed burst. The
receive DMA could not keep up and dropped frames in the FIFO while the CPU
was mostly idle.
Parse the snps,axi-config node of the device tree (the maximum number of
outstanding read and write requests) with the other snps properties, and
program the limits, the hardware fields hold the limit minus one. Set the
mixed burst bit when snps,mixed-burst is present, as the eqos driver does.
Differential Revision: https://reviews.freebsd.org/D60918
---
sys/dev/dwc/dwc4_dma.c | 9 +++++++++
sys/dev/dwc/dwc4_dma.h | 4 ++++
sys/dev/dwc/if_dwc.c | 16 ++++++++++++++++
sys/dev/dwc/if_dwcvar.h | 2 ++
4 files changed, 31 insertions(+)
diff --git a/sys/dev/dwc/dwc4_dma.c b/sys/dev/dwc/dwc4_dma.c
index 4c796c5a8688..58e8b009e08e 100644
--- a/sys/dev/dwc/dwc4_dma.c
+++ b/sys/dev/dwc/dwc4_dma.c
@@ -644,6 +644,11 @@ dma4_init(struct dwc_softc *sc)
reg |= DMASBMR_BLEN8;
reg |= DMASBMR_BLEN16;
reg |= DMASBMR_EAME;
+ /* The hardware fields hold the limits minus one. */
+ reg |= ((sc->axi_rd_osr_lmt - 1) << DMASBMR_RD_OSR_LMT_S) &
+ DMASBMR_RD_OSR_LMT_M;
+ reg |= ((sc->axi_wr_osr_lmt - 1) << DMASBMR_WR_OSR_LMT_S) &
+ DMASBMR_WR_OSR_LMT_M;
WRITE4(sc, ETH_DMASBMR, reg);
reg = READ4(sc, ETH_DMASBMR);
@@ -651,6 +656,10 @@ dma4_init(struct dwc_softc *sc)
reg |= DMASBMR_FB;
else
reg &= ~DMASBMR_FB;
+ if (sc->mixed_burst)
+ reg |= DMASBMR_MB;
+ else
+ reg &= ~DMASBMR_MB;
if (sc->aal)
reg |= DMASBMR_AAL;
else
diff --git a/sys/dev/dwc/dwc4_dma.h b/sys/dev/dwc/dwc4_dma.h
index 97d060eb77f1..83239b13be55 100644
--- a/sys/dev/dwc/dwc4_dma.h
+++ b/sys/dev/dwc/dwc4_dma.h
@@ -29,7 +29,11 @@
#define ETH_DMAMR 0x1000
#define DMAMR_SWR (1 << 0) /* Software Reset */
#define ETH_DMASBMR 0x1004
+#define DMASBMR_WR_OSR_LMT_S 24 /* AXI Maximum Write Outstanding Req Limit */
+#define DMASBMR_WR_OSR_LMT_M (0xf << DMASBMR_WR_OSR_LMT_S)
#define DMASBMR_RD_OSR_LMT_S 16 /* AXI Maximum Read Outstanding Req Limit */
+#define DMASBMR_RD_OSR_LMT_M (0xf << DMASBMR_RD_OSR_LMT_S)
+#define DMASBMR_MB (1 << 14) /* Mixed Burst */
#define DMASBMR_AAL (1 << 12) /* Address-Aligned Beats */
#define DMASBMR_EAME (1 << 11) /* Enhanced Address Mode Enable */
#define DMASBMR_BLEN16 (1 << 3) /* Fixed Burst Length */
diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index 78216a5d14f6..82af47220ccf 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -549,6 +549,8 @@ dwc_attach(device_t dev)
if_t ifp;
int error;
uint32_t pbl;
+ phandle_t axi;
+ pcell_t xref;
sc = device_get_softc(dev);
sc->dev = dev;
@@ -586,6 +588,20 @@ dwc_attach(device_t dev)
if (OF_hasprop(sc->node, "snps,aal"))
sc->aal = true;
+ /* Maximum number of outstanding AXI requests. */
+ sc->axi_rd_osr_lmt = 1;
+ sc->axi_wr_osr_lmt = 1;
+ if (OF_getencprop(sc->node, "snps,axi-config", &xref,
+ sizeof(xref)) > 0) {
+ axi = OF_node_from_xref(xref);
+ OF_getencprop(axi, "snps,rd_osr_lmt", &sc->axi_rd_osr_lmt,
+ sizeof(uint32_t));
+ OF_getencprop(axi, "snps,wr_osr_lmt", &sc->axi_wr_osr_lmt,
+ sizeof(uint32_t));
+ }
+ sc->axi_rd_osr_lmt = MIN(MAX(sc->axi_rd_osr_lmt, 1), 16);
+ sc->axi_wr_osr_lmt = MIN(MAX(sc->axi_wr_osr_lmt, 1), 16);
+
error = clk_set_assigned(dev, ofw_bus_get_node(dev));
if (error != 0 && error != ENOENT) {
device_printf(dev, "clk_set_assigned failed\n");
diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h
index 7b21be7629a1..bfe7ca5ce29b 100644
--- a/sys/dev/dwc/if_dwcvar.h
+++ b/sys/dev/dwc/if_dwcvar.h
@@ -120,6 +120,8 @@ struct dwc_softc {
/* DMA config */
uint32_t txpbl; /* TX Burst lenght */
uint32_t rxpbl; /* RX Burst lenght */
+ uint32_t axi_rd_osr_lmt; /* AXI max outstanding reads */
+ uint32_t axi_wr_osr_lmt; /* AXI max outstanding writes */
bool nopblx8;
bool fixed_burst;
bool mixed_burst;