summaryrefslogtreecommitdiff
path: root/package/madwifi/patches/375-atim_tsf_update.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-07-31 18:59:25 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-07-31 18:59:25 +0000
commit709eae54e465fc9c482ccd97142a29b4c4e09686 (patch)
treeecfbfa5eddf04d331e443e334f18295053b1c8e5 /package/madwifi/patches/375-atim_tsf_update.patch
parentd6d5c715b937690586b3618a8365a10d81c867cc (diff)
downloadmtk-20170518-709eae54e465fc9c482ccd97142a29b4c4e09686.zip
mtk-20170518-709eae54e465fc9c482ccd97142a29b4c4e09686.tar.gz
mtk-20170518-709eae54e465fc9c482ccd97142a29b4c4e09686.tar.bz2
madwifi: add some beacon setup/update related fixes (based on Bruno Randolf's patchset)
SVN-Revision: 12049
Diffstat (limited to 'package/madwifi/patches/375-atim_tsf_update.patch')
-rw-r--r--package/madwifi/patches/375-atim_tsf_update.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/package/madwifi/patches/375-atim_tsf_update.patch b/package/madwifi/patches/375-atim_tsf_update.patch
new file mode 100644
index 0000000..bbe380e
--- /dev/null
+++ b/package/madwifi/patches/375-atim_tsf_update.patch
@@ -0,0 +1,59 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2785,6 +2785,44 @@
+ return 1;
+ }
+
++/* Fix up the ATIM window after TSF resync */
++static int
++ath_hw_check_atim(struct ath_softc *sc, int window)
++{
++#define AR5K_TIMER0_5210 0x802c /* Next beacon time register */
++#define AR5K_TIMER0_5211 0x8028
++#define AR5K_TIMER3_5210 0x8038 /* End of ATIM window time register */
++#define AR5K_TIMER3_5211 0x8034
++ struct ath_hal *ah = sc->sc_ah;
++ unsigned int nbtt, atim;
++ int dev = ar_device(sc->devid);
++
++ switch(dev) {
++ case 5210:
++ nbtt = OS_REG_READ(ah, AR5K_TIMER0_5210);
++ atim = OS_REG_READ(ah, AR5K_TIMER3_5210);
++ if (atim - nbtt != window) {
++ OS_REG_WRITE(ah, AR5K_TIMER3_5210, nbtt + window );
++ return atim - nbtt;
++ }
++ break;
++ case 5211:
++ case 5212:
++ nbtt = OS_REG_READ(ah, AR5K_TIMER0_5211);
++ atim = OS_REG_READ(ah, AR5K_TIMER3_5211);
++ if (atim - nbtt != window) {
++ OS_REG_WRITE(ah, AR5K_TIMER3_5211, nbtt + window );
++ return atim - nbtt;
++ }
++ break;
++ /* NB: 5416+ doesn't do ATIM in hw */
++ default:
++ break;
++ }
++ return 0;
++}
++
++
+ /*
+ * Reset the hardware w/o losing operational state. This is
+ * basically a more efficient way of doing ath_stop, ath_init,
+@@ -6391,6 +6429,11 @@
+ DPRINTF(sc, ATH_DEBUG_BEACON,
+ "Updated beacon timers\n");
+ }
++ if ((sc->sc_opmode == IEEE80211_M_IBSS) &&
++ IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
++ ath_hw_check_atim(sc, 1)) {
++ DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
++ }
+ /* NB: Fall Through */
+ case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
+ if (vap->iv_opmode == IEEE80211_M_IBSS &&