From 160caba341e2737dc657c33f44c1c0d7d41b2e8a Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Fri, 6 Nov 2015 11:29:24 +0000 Subject: [PATCH] urtwn(4): simplify urtwn_tsf_sync_enable(). - Drop TSF initialization; device can discover it without our help. - Do not touch R92C_BCN_CTRL_EN_BCN bit in STA mode. - Add 'static' keyword for function definition. Tested with RTL8188EU, STA mode. Reviewed by: kevlo Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D3801 --- sys/dev/usb/wlan/if_urtwn.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c index 0cd1cf342a50..9bc8911be95b 100644 --- a/sys/dev/usb/wlan/if_urtwn.c +++ b/sys/dev/usb/wlan/if_urtwn.c @@ -1473,32 +1473,11 @@ urtwn_ra_init(struct urtwn_softc *sc) return (0); } -void +static void urtwn_tsf_sync_enable(struct urtwn_softc *sc) { - struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - struct ieee80211_node *ni = vap->iv_bss; - - uint64_t tsf; - - /* Enable TSF synchronization. */ urtwn_write_1(sc, R92C_BCN_CTRL, urtwn_read_1(sc, R92C_BCN_CTRL) & ~R92C_BCN_CTRL_DIS_TSF_UDT0); - - urtwn_write_1(sc, R92C_BCN_CTRL, - urtwn_read_1(sc, R92C_BCN_CTRL) & ~R92C_BCN_CTRL_EN_BCN); - - /* Set initial TSF. */ - memcpy(&tsf, ni->ni_tstamp.data, 8); - tsf = le64toh(tsf); - tsf = tsf - (tsf % (vap->iv_bss->ni_intval * IEEE80211_DUR_TU)); - tsf -= IEEE80211_DUR_TU; - urtwn_write_4(sc, R92C_TSFTR + 0, tsf); - urtwn_write_4(sc, R92C_TSFTR + 4, tsf >> 32); - - urtwn_write_1(sc, R92C_BCN_CTRL, - urtwn_read_1(sc, R92C_BCN_CTRL) | R92C_BCN_CTRL_EN_BCN); } static void