Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jul 2011 13:34:57 +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: r224517 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201107301334.p6UDYvZG002084@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Jul 30 13:34:57 2011
New Revision: 224517
URL: http://svn.freebsd.org/changeset/base/224517

Log:
  Fix AR5416 radar parameter initialisation.
  
  * I messed up the order of parameter true/false; oops!
  * AR_PHY_RADAR_1 was being written at the wrong place, and was writing
    potential garbage to the hardware.
  
  Approved by:	re (kib)

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

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Sat Jul 30 13:33:05 2011	(r224516)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Sat Jul 30 13:34:57 2011	(r224517)
@@ -670,26 +670,27 @@ ar5416EnableDfs(struct ath_hal *ah, HAL_
 
 	OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA);
 
-	if (pe->pe_usefir128 == 0)
-		OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
-	else if (pe->pe_usefir128 == 1)
+	if (pe->pe_usefir128 == 1)
 		OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
+	else if (pe->pe_usefir128 == 0)
+		OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
 
-	if (pe->pe_enmaxrssi == 0)
+	if (pe->pe_enmaxrssi == 1)
 		OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI);
-	else if (pe->pe_enmaxrssi == 1)
+	else if (pe->pe_enmaxrssi == 0)
 		OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI);
 
-	if (pe->pe_blockradar == 0)
+	if (pe->pe_blockradar == 1)
 		OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK);
-	else if (pe->pe_blockradar == 1)
+	else if (pe->pe_blockradar == 0)
 		OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK);
 
 	if (pe->pe_maxlen != HAL_PHYERR_PARAM_NOVAL) {
+		val = OS_REG_READ(ah, AR_PHY_RADAR_1);
 		val &= ~AR_PHY_RADAR_1_MAXLEN;
 		val |= SM(pe->pe_maxlen, AR_PHY_RADAR_1_MAXLEN);
+		OS_REG_WRITE(ah, AR_PHY_RADAR_1, val);
 	}
-	OS_REG_WRITE(ah, AR_PHY_RADAR_1, val);
 
 	/*
 	 * Enable HT/40 if the upper layer asks;



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