From nobody Thu Aug 11 14:53:12 2022 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 4M3VD85339z4Y7pH; Thu, 11 Aug 2022 14:53: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 4M3VD83S6Tz3Sk5; Thu, 11 Aug 2022 14:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660229592; 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=fNBZec8CE5+5gujTio9D96Lt0Uks55Nj7TxgZaH1yao=; b=ffYzq09wxP8IizBY1PiUNaW05qNhxDJBXIGEXSEGpyle6WPAnGlVa+MtRiT9fRxe/s0Og7 ALhSfvjONQ/i6TShGLeS2tpE1rBi/2mWSlIJ7yBGreLBncijyynf/XOWlM0YlmKEHkuCDp XX2aZAQCCr+ZBUdrwCjXtwdQXgEWEid3dpEWMSk8u1dpkngbY8rq3pH1GtfGyGNK6zmO5Z ZZKDN2NNim3LDp5J6we2Bvjo0nH3QDPKivgDUCEwBVu+UL78nP6tA5NpM+6XSI9qVSgqfC xNn8qvzbIQRU+ns64mEJOBch3EGXKuDT735l7TRULvTTBD+RfrEE8WG43j2EdA== 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 4M3VD82Z92zvqj; Thu, 11 Aug 2022 14:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27BErCQH032377; Thu, 11 Aug 2022 14:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BErC7C032376; Thu, 11 Aug 2022 14:53:12 GMT (envelope-from git) Date: Thu, 11 Aug 2022 14:53:12 GMT Message-Id: <202208111453.27BErC7C032376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 74c406678245 - stable/12 - if_dwc: Add a function to enable/disable the mac tx/rx 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 74c406678245a68e4345eec57790feaa67533bad Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660229592; 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=fNBZec8CE5+5gujTio9D96Lt0Uks55Nj7TxgZaH1yao=; b=XKdVzHe9S1FK54N9tRqPvtBeyG/ASbbnfrGUxNIHeVYNZXbQ8TNbaS4NTiQlDLwjDV0tuD BPf2zrNtieZpsRD9J+gvQG0pQm2osz0/GtkVaHYjlmEHfl9AQe70GcTLr0Ys6ZDyr25vN1 iZnhZqVhHU0+FHOjwt1S4xIK6+mtK4sBFQyOwrTTYZbok8QwPqr3FH4vbRQf7pYpAk1ZNp ojTSacbk4F43vu5gCpegNSaY88Xp9dmTuKakwJJaw1iJzA1J32QSrv6o0youl8mqrS8xCO RdeyLLPvPFZKr1VyEIMUDwt8YzAMjMR5yGEdc7hin5f5nfCWuPaoepzZ+yVx4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660229592; a=rsa-sha256; cv=none; b=vckATzux/+kXRn1Vk2pCB4o4d2WJLmU7RR0lQoGcyImvSQIkqi4y6xKJ753Kc+aHJb/X+6 tnqXUVX4PetAEtwsyAlN2PqpLpObKV7G0tL4LD0wZpaqxlqu4cneVmgGbJpV/k+batDZ6a hDACnqVZrReGdgonA8OZD5Bf4U/9VXtMAcZ7YA0+Z4CJmEmmViQIVJvai1C8fF3gyvGESK FepYY/cr4+1ky8Q6vHgg/0uoq3bpnE848m7+PPYgRk3WByJkIrMIhwTLjOo5e/FARhKtvn vY3iefdsyHV/jBl0KpZYOxqcnz/s9JV2uo/3KC1v1jgfUmVi33NK4g2IGwDYAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=74c406678245a68e4345eec57790feaa67533bad commit 74c406678245a68e4345eec57790feaa67533bad Author: Emmanuel Vadot AuthorDate: 2020-11-20 11:27:43 +0000 Commit: Mitchell Horne CommitDate: 2022-08-11 14:52:02 +0000 if_dwc: Add a function to enable/disable the mac tx/rx No functional changes intended (cherry picked from commit f368f4b10924cb530e5ab2ada38bb2b08e193ea8) --- sys/dev/dwc/if_dwc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index e4270f7dd3de..74e5922ff828 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -212,6 +212,7 @@ static void dwc_rxfinish_locked(struct dwc_softc *sc); static void dwc_stop_locked(struct dwc_softc *sc); static void dwc_setup_rxfilter(struct dwc_softc *sc); static void dwc_setup_core(struct dwc_softc *sc); +static void dwc_enable_mac(struct dwc_softc *sc, bool enable); static void dwc_init_dma(struct dwc_softc *sc); static inline uint32_t @@ -483,6 +484,7 @@ dwc_init_locked(struct dwc_softc *sc) dwc_setup_rxfilter(sc); dwc_setup_core(sc); + dwc_enable_mac(sc, true); dwc_init_dma(sc); if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); @@ -778,10 +780,23 @@ dwc_setup_core(struct dwc_softc *sc) DWC_ASSERT_LOCKED(sc); - /* Enable transmitters */ + /* Enable core */ reg = READ4(sc, MAC_CONFIGURATION); reg |= (CONF_JD | CONF_ACS | CONF_BE); - reg |= (CONF_TE | CONF_RE); + WRITE4(sc, MAC_CONFIGURATION, reg); +} + +static void +dwc_enable_mac(struct dwc_softc *sc, bool enable) +{ + uint32_t reg; + + DWC_ASSERT_LOCKED(sc); + reg = READ4(sc, MAC_CONFIGURATION); + if (enable) + reg |= CONF_TE | CONF_RE; + else + reg &= ~(CONF_TE | CONF_RE); WRITE4(sc, MAC_CONFIGURATION, reg); }