Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Sep 2011 17:11:03 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r225593 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201109151711.p8FHB36g082552@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Sep 15 17:11:03 2011
New Revision: 225593
URL: http://svn.freebsd.org/changeset/base/225593

Log:
  Merge in beacon related fixes (mostly STA related) from HEAD.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
  user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416reg.h

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Thu Sep 15 15:54:37 2011	(r225592)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Thu Sep 15 17:11:03 2011	(r225593)
@@ -26,6 +26,7 @@
 #include "ar5416/ar5416phy.h"
 
 #define TU_TO_USEC(_tu)		((_tu) << 10)
+#define	ONE_EIGHTH_TU_TO_USEC(_tu8)	((_tu8) << 7)
 
 /*
  * Initialize all of the hardware registers used to
@@ -38,8 +39,8 @@ ar5416SetBeaconTimers(struct ath_hal *ah
 	uint32_t bperiod;
 
 	OS_REG_WRITE(ah, AR_NEXT_TBTT, TU_TO_USEC(bt->bt_nexttbtt));
-	OS_REG_WRITE(ah, AR_NEXT_DBA, TU_TO_USEC(bt->bt_nextdba) >> 3);
-	OS_REG_WRITE(ah, AR_NEXT_SWBA, TU_TO_USEC(bt->bt_nextswba) >> 3);
+	OS_REG_WRITE(ah, AR_NEXT_DBA, ONE_EIGHTH_TU_TO_USEC(bt->bt_nextdba));
+	OS_REG_WRITE(ah, AR_NEXT_SWBA, ONE_EIGHTH_TU_TO_USEC(bt->bt_nextswba));
 	OS_REG_WRITE(ah, AR_NEXT_NDP, TU_TO_USEC(bt->bt_nextatim));
 
 	bperiod = TU_TO_USEC(bt->bt_intval & HAL_BEACON_PERIOD);
@@ -144,7 +145,7 @@ ar5416SetStaBeaconTimers(struct ath_hal 
 	
 	/* NB: no cfp setting since h/w automatically takes care */
 
-	OS_REG_WRITE(ah, AR_NEXT_TBTT, bs->bs_nexttbtt);
+	OS_REG_WRITE(ah, AR_NEXT_TBTT, TU_TO_USEC(bs->bs_nexttbtt));
 
 	/*
 	 * Start the beacon timers by setting the BEACON register
@@ -221,15 +222,19 @@ ar5416SetStaBeaconTimers(struct ath_hal 
 	OS_REG_WRITE(ah, AR_NEXT_TIM, TU_TO_USEC(nextTbtt - SLEEP_SLOP));
 
 	/* cab timeout is now in 1/8 TU */
-	OS_REG_WRITE(ah, AR_SLEEP1,
+	OS_REG_WRITE(ah, AR5416_SLEEP1,
 		SM((CAB_TIMEOUT_VAL << 3), AR5416_SLEEP1_CAB_TIMEOUT)
-		| AR_SLEEP1_ASSUME_DTIM);
+		| AR5416_SLEEP1_ASSUME_DTIM);
+
+	/* XXX autosleep? Use min beacon timeout; check ath9k -adrian */
 	/* beacon timeout is now in 1/8 TU */
-	OS_REG_WRITE(ah, AR_SLEEP2,
+	OS_REG_WRITE(ah, AR5416_SLEEP2,
 		SM((BEACON_TIMEOUT_VAL << 3), AR5416_SLEEP2_BEACON_TIMEOUT));
 
-	OS_REG_WRITE(ah, AR_TIM_PERIOD, beaconintval);
-	OS_REG_WRITE(ah, AR_DTIM_PERIOD, dtimperiod);
+	/* TIM_PERIOD and DTIM_PERIOD are now in uS. */
+	OS_REG_WRITE(ah, AR_TIM_PERIOD, TU_TO_USEC(beaconintval));
+	OS_REG_WRITE(ah, AR_DTIM_PERIOD, TU_TO_USEC(dtimperiod));
+
 	OS_REG_SET_BIT(ah, AR_TIMER_MODE,
 	     AR_TIMER_MODE_TBTT | AR_TIMER_MODE_TIM | AR_TIMER_MODE_DTIM);
 	HALDEBUG(ah, HAL_DEBUG_BEACON, "%s: next DTIM %d\n",

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416reg.h	Thu Sep 15 15:54:37 2011	(r225592)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416reg.h	Thu Sep 15 17:11:03 2011	(r225593)
@@ -79,6 +79,13 @@
 #endif	/* AH_SUPPORT_AR9130 */
 
 #define	AR_RESET_TSF		0x8020
+
+/*
+ * AR_SLEEP1 / AR_SLEEP2 are in the same place as in
+ * AR5212, however the fields have changed.
+ */
+#define	AR5416_SLEEP1		0x80d4
+#define	AR5416_SLEEP2		0x80d8
 #define	AR_RXFIFO_CFG		0x8114
 #define	AR_PHY_ERR_1		0x812c
 #define	AR_PHY_ERR_MASK_1	0x8130	/* mask for AR_PHY_ERR_1 */
@@ -409,6 +416,7 @@
 #define	AR9271_AN_RF2G6_OFFS_S	20
 
 /* Sleep control */
+#define	AR5416_SLEEP1_ASSUME_DTIM	0x00080000
 #define	AR5416_SLEEP1_CAB_TIMEOUT	0xFFE00000	/* Cab timeout (TU) */
 #define	AR5416_SLEEP1_CAB_TIMEOUT_S	22
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109151711.p8FHB36g082552>