git: 74c406678245 - stable/12 - if_dwc: Add a function to enable/disable the mac tx/rx
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Aug 2022 14:53:12 UTC
The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=74c406678245a68e4345eec57790feaa67533bad commit 74c406678245a68e4345eec57790feaa67533bad Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2020-11-20 11:27:43 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> 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); }