From nobody Thu Oct 05 15:35:11 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S1bGm17XVz4vncg; Thu, 5 Oct 2023 15:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGm045qz4dn9; Thu, 5 Oct 2023 15:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i3+8R8M/aN1UMQrr37msZDIKRYJnVeD4xTpD5Wm0+/4=; b=noUGRhAqveNnQa6oNY6ZxQjzAI7mfVCrFDXWRbI5g/9AtSr4e2ThzR4mXYhWrdKQo+n8JV dfhWqrpP3cPsa4a1jn2PecUrTMnziWeV+33MSzOeJILdx3ZEnv6kOa6XZXnzHjA/bDUUUz CiuAdVwDleUi1Pe6HO00sBm+t+XYXw2azNjrfddWVOJkGPc2CHkZE/aDe5zbfMShCJ6vh8 YYcVIaf44HVUbZ1b1IEFjPw02j8sXwuVPo6kk8BCmacY7tp+qETtu2kNR3bFezdScN9swk npia/cLgNteESYW56HugZ0y76nieO4RUMbIJHQSnTSjv1YjHIT65fBZy7VX0Tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520112; a=rsa-sha256; cv=none; b=illOik56hgssX/itRE7JqVq3jzIp6NAzL2qtWvkivP6YGv1+EorMP1SmwzDR9ev5EqKqAa y97INn7ttZPSGIZ+F70SrvESwIcXVmT+BiUjp5Nmc3vOu3JlXg7vBmbe9gpvEFLHu95wuo kiIy7QUj6SrpcLJNe2tvrx6aNMjsB4l9fZHeOcR6MRHn3AcbTQMaH4+8OPFTfVWurQProi 8FIBqysRdyMa5kpRCyzSlfCSKLjFCLu020Nr240LUvgKC5bc8ZH3YMhdzMBEwS+KuKdLIW U2m4c1POTPY+VBjmF+QOGVZ+MHVg/Eiz01wJ77WZ9B7sMWqepgWlLadJetZn5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i3+8R8M/aN1UMQrr37msZDIKRYJnVeD4xTpD5Wm0+/4=; b=P2Ou+9ZCJ2xsOvu7rd5teik9JzgK9R9AytP9o+wrveJyri+Kmjadn68Gc0fnbL5CEQsluM NFBFk+xpYcMWMEDd0LbboVFq3oAHMnqcANgNJWMalDzNrBFbPitaF6XsqC/yXatsB5PSXt Oq4ebHRR+h7VlG3TQx+TLhxJ0BZegew3aTworXhfBeZuQRUghiNgCiy+UbnYzYoXmA61fh iSzS2eaxKWOMHVIQmMbKJq5MuKPVkLOXvXWEaXN86r5TeCdIefju86MbSqUXNs393rjr6c v0WYX6Snh4AKceN/qmiJW0ooFvsf6F5zQLg0YarNgUJ4FDMeoJyI7Jyj/Zlvsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S1bGl5xnmz1Q70; Thu, 5 Oct 2023 15:35:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZB9Q012946; Thu, 5 Oct 2023 15:35:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZB05012943; Thu, 5 Oct 2023 15:35:11 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:11 GMT Message-Id: <202310051535.395FZB05012943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5d88a52be44a - main - dwc: Move dma engine configuration to dwc1000_dma.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa commit 5d88a52be44a98e2b49db7ead317b2d0b2ef9eaa Author: Emmanuel Vadot AuthorDate: 2023-10-04 16:19:26 +0000 Commit: Emmanuel Vadot 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;