git: 5d88a52be44a - main - dwc: Move dma engine configuration to dwc1000_dma.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Oct 2023 15:35:11 UTC
The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa commit 5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2023-10-04 16:19:26 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2023-10-05 15:34:40 +0000 dwc: Move dma engine configuration to dwc1000_dma.c No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 14 ++++++++++++++ sys/dev/dwc/if_dwc.c | 37 +++++++++---------------------------- sys/dev/dwc/if_dwcvar.h | 8 ++++++++ 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index 25916404bb63..16b2b2a3241d 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -632,6 +632,20 @@ dma1000_init(struct dwc_softc *sc) int nidx; int idx; + reg = BUS_MODE_USP; + if (!sc->nopblx8) + reg |= BUS_MODE_EIGHTXPBL; + reg |= (sc->txpbl << BUS_MODE_PBL_SHIFT); + reg |= (sc->rxpbl << BUS_MODE_RPBL_SHIFT); + if (sc->fixed_burst) + reg |= BUS_MODE_FIXEDBURST; + if (sc->mixed_burst) + reg |= BUS_MODE_MIXEDBURST; + if (sc->aal) + reg |= BUS_MODE_AAL; + + WRITE4(sc, BUS_MODE, reg); + /* * DMA must be stop while changing descriptor list addresses. */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index a3ce32c95cb9..0e18d57a4c23 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -498,12 +498,7 @@ dwc_attach(device_t dev) struct dwc_softc *sc; if_t ifp; int error; - uint32_t reg; - uint32_t txpbl, rxpbl, pbl; - bool nopblx8 = false; - bool fixed_burst = false; - bool mixed_burst = false; - bool aal = false; + uint32_t pbl; sc = device_get_softc(dev); sc->dev = dev; @@ -534,18 +529,18 @@ dwc_attach(device_t dev) if (OF_getencprop(sc->node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) pbl = BUS_MODE_DEFAULT_PBL; - if (OF_getencprop(sc->node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) - txpbl = pbl; - if (OF_getencprop(sc->node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) - rxpbl = pbl; + if (OF_getencprop(sc->node, "snps,txpbl", &sc->txpbl, sizeof(uint32_t)) <= 0) + sc->txpbl = pbl; + if (OF_getencprop(sc->node, "snps,rxpbl", &sc->rxpbl, sizeof(uint32_t)) <= 0) + sc->rxpbl = pbl; if (OF_hasprop(sc->node, "snps,no-pbl-x8") == 1) - nopblx8 = true; + sc->nopblx8 = true; if (OF_hasprop(sc->node, "snps,fixed-burst") == 1) - fixed_burst = true; + sc->fixed_burst = true; if (OF_hasprop(sc->node, "snps,mixed-burst") == 1) - mixed_burst = true; + sc->mixed_burst = true; if (OF_hasprop(sc->node, "snps,aal") == 1) - aal = true; + sc->aal = true; error = clk_set_assigned(dev, ofw_bus_get_node(dev)); if (error != 0) { @@ -585,20 +580,6 @@ dwc_attach(device_t dev) return (error); } - 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; - if (mixed_burst) - reg |= BUS_MODE_MIXEDBURST; - if (aal) - reg |= BUS_MODE_AAL; - - WRITE4(sc, BUS_MODE, reg); - if (dma1000_init(sc)) { bus_release_resources(dev, dwc_spec, sc->res); return (ENXIO); diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 8a4b941297d0..2481b5c220bf 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -81,6 +81,14 @@ struct dwc_softc { hwreset_t rst_stmmaceth; hwreset_t rst_ahb; + /* DMA config */ + uint32_t txpbl; /* TX Burst lenght */ + uint32_t rxpbl; /* RX Burst lenght */ + bool nopblx8; + bool fixed_burst; + bool mixed_burst; + bool aal; + /* RX */ bus_dma_tag_t rxdesc_tag; bus_dmamap_t rxdesc_map;