Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2012 09:58:21 +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: r231368 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201202100958.q1A9wLNd065511@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Feb 10 09:58:20 2012
New Revision: 231368
URL: http://svn.freebsd.org/changeset/base/231368

Log:
  Extend the HAL code to allow the RX and TX chainmask to be overridden
  by capabilities.
  
  Add an ar5416SetCapability() function, which contains logic to override
  the chainmask and update the relevant stream.
  
  This is designed to be called after the attach function, which presets
  the TX/RX chainmask and stream.
  
  TODO: check the chainmask against the hardware chainmask so non-existing
  chains aren't enabled.

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

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Fri Feb 10 09:55:18 2012	(r231367)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Fri Feb 10 09:58:20 2012	(r231368)
@@ -207,6 +207,9 @@ extern	HAL_STATUS ar5416SetQuiet(struct 
 	    uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag);
 extern	HAL_STATUS ar5416GetCapability(struct ath_hal *ah,
 	    HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t *result);
+extern	HAL_BOOL ar5416SetCapability(struct ath_hal *ah,
+	    HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t val,
+	    HAL_STATUS *status);
 extern	HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request,
 	    const void *args, uint32_t argsize,
 	    void **result, uint32_t *resultsize);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Fri Feb 10 09:55:18 2012	(r231367)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Fri Feb 10 09:58:20 2012	(r231368)
@@ -129,6 +129,7 @@ ar5416InitState(struct ath_hal_5416 *ahp
 
 	/* Misc Functions */
 	ah->ah_getCapability		= ar5416GetCapability;
+	ah->ah_setCapability		= ar5416SetCapability;
 	ah->ah_getDiagState		= ar5416GetDiagState;
 	ah->ah_setLedState		= ar5416SetLedState;
 	ah->ah_gpioCfgOutput		= ar5416GpioCfgOutput;
@@ -884,6 +885,7 @@ ar5416FillCapabilityInfo(struct ath_hal 
 	/* AR5416 may have 3 antennas but is a 2x2 stream device */
 	pCap->halTxStreams = 2;
 	pCap->halRxStreams = 2;
+
 	/*
 	 * If the TX or RX chainmask has less than 2 chains active,
 	 * mark it as a 1-stream device for the relevant stream.

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Fri Feb 10 09:55:18 2012	(r231367)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Fri Feb 10 09:58:20 2012	(r231368)
@@ -27,6 +27,8 @@
 #include "ar5416/ar5416reg.h"
 #include "ar5416/ar5416phy.h"
 
+#include "ah_eeprom_v14.h"	/* for owl_get_ntxchains() */
+
 /*
  * Return the wireless modes (a,b,g,n,t) supported by hardware.
  *
@@ -430,6 +432,33 @@ ar5416GetCapability(struct ath_hal *ah, 
 	return ar5212GetCapability(ah, type, capability, result);
 }
 
+HAL_BOOL
+ar5416SetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
+    u_int32_t capability, u_int32_t setting, HAL_STATUS *status)
+{
+	HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps;
+
+	switch (type) {
+	case HAL_CAP_RX_CHAINMASK:
+		pCap->halRxChainMask = setting;
+		if (owl_get_ntxchains(setting) > 2)
+			pCap->halRxStreams = 2;
+		else
+			pCap->halRxStreams = 1;
+		return HAL_OK;
+	case HAL_CAP_TX_CHAINMASK:
+		pCap->halTxChainMask = setting;
+		if (owl_get_ntxchains(setting) > 2)
+			pCap->halTxStreams = 2;
+		else
+			pCap->halTxStreams = 1;
+		return HAL_OK;
+	default:
+		break;
+	}
+	return ar5212SetCapability(ah, type, capability, setting, status);
+}
+
 static int ar5416DetectMacHang(struct ath_hal *ah);
 static int ar5416DetectBBHang(struct ath_hal *ah);
 



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