Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Aug 2011 13:36:09 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225111 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201108231336.p7NDa9GL004761@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Tue Aug 23 13:36:09 2011
New Revision: 225111
URL: http://svn.freebsd.org/changeset/base/225111

Log:
  These timer registers are all 1uS in resolution in AR5416
  or later. Previous hardware had some as TU, some as 1/8th
  TU.
  
  * Modify AR_NEXT_DBA and AR_NEXT_SWBA to use a new macro,
    ONE_EIGHTH_TU_TO_USEC(), which converts the 1/8th TU
    fields to USEC. This is just cosmetic and matches the
    Atheros reference driver.
  
  * Fix AR_NEXT_TBTT, which is USEC, not TU.
  
  Submitted by:	paradyse@gmail.com
  Approved by:	re (kib, blanket)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Tue Aug 23 13:25:29 2011	(r225110)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c	Tue Aug 23 13:36:09 2011	(r225111)
@@ -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



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