From 8643ea587a96f4db9aa43babf0bd678018fa4b38 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Mon, 29 Aug 2011 08:00:00 +0000
Subject: [PATCH] ath9k: minor fixes for the antenna control patch

SVN-Revision: 28109
---
 .../patches/582-ath9k_antdiv_comb_cb.patch    | 50 -------------------
 ....patch => 582-ath9k_antenna_control.patch} | 11 ++--
 2 files changed, 5 insertions(+), 56 deletions(-)
 delete mode 100644 package/mac80211/patches/582-ath9k_antdiv_comb_cb.patch
 rename package/mac80211/patches/{583-ath9k_antenna_control.patch => 582-ath9k_antenna_control.patch} (94%)

diff --git a/package/mac80211/patches/582-ath9k_antdiv_comb_cb.patch b/package/mac80211/patches/582-ath9k_antdiv_comb_cb.patch
deleted file mode 100644
index 92c8ea4b8b..0000000000
--- a/package/mac80211/patches/582-ath9k_antdiv_comb_cb.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/hw-ops.h
-+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
-@@ -121,13 +121,15 @@ static inline void ath9k_hw_set_clrdmask
- static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
- 		struct ath_hw_antcomb_conf *antconf)
- {
--	ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
-+	if (ath9k_hw_ops(ah)->antdiv_comb_conf_get)
-+		ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
- }
- 
- static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
- 		struct ath_hw_antcomb_conf *antconf)
- {
--	ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
-+	if (ath9k_hw_ops(ah)->antdiv_comb_conf_set)
-+		ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
- }
- 
- /* Private hardware call ops */
---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
-@@ -570,8 +570,10 @@ void ar9002_hw_attach_phy_ops(struct ath
- 	priv_ops->compute_pll_control = ar9002_hw_compute_pll_control;
- 	priv_ops->do_getnf = ar9002_hw_do_getnf;
- 
--	ops->antdiv_comb_conf_get = ar9002_hw_antdiv_comb_conf_get;
--	ops->antdiv_comb_conf_set = ar9002_hw_antdiv_comb_conf_set;
-+	if (AR_SREV_9285(ah)) {
-+		ops->antdiv_comb_conf_get = ar9002_hw_antdiv_comb_conf_get;
-+		ops->antdiv_comb_conf_set = ar9002_hw_antdiv_comb_conf_set;
-+	}
- 
- 	ar9002_hw_set_nf_limits(ah);
- }
---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
-@@ -1283,8 +1283,10 @@ void ar9003_hw_attach_phy_ops(struct ath
- 	priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs;
- 	priv_ops->set_radar_params = ar9003_hw_set_radar_params;
- 
--	ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
--	ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
-+	if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
-+		ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
-+		ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
-+	}
- 
- 	ar9003_hw_set_nf_limits(ah);
- 	ar9003_hw_set_radar_conf(ah);
diff --git a/package/mac80211/patches/583-ath9k_antenna_control.patch b/package/mac80211/patches/582-ath9k_antenna_control.patch
similarity index 94%
rename from package/mac80211/patches/583-ath9k_antenna_control.patch
rename to package/mac80211/patches/582-ath9k_antenna_control.patch
index a1caa8aaa9..ecd86808d7 100644
--- a/package/mac80211/patches/583-ath9k_antenna_control.patch
+++ b/package/mac80211/patches/582-ath9k_antenna_control.patch
@@ -24,7 +24,7 @@
  
  	hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
  		IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-@@ -692,6 +705,17 @@ void ath9k_set_hw_capab(struct ath_softc
+@@ -692,6 +705,16 @@ void ath9k_set_hw_capab(struct ath_softc
  	hw->sta_data_size = sizeof(struct ath_node);
  	hw->vif_data_size = sizeof(struct ath_vif);
  
@@ -32,9 +32,8 @@
 +	hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
 +
 +	/* single chain devices with rx diversity */
-+	if (ah->caps.max_rxchains == 1 &&
-+	    ath9k_hw_ops(ah)->antdiv_comb_conf_get)
-+		hw->wiphy->available_antennas_rx = 3;
++	if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
++		hw->wiphy->available_antennas_rx = BIT(0) | BIT(1);
 +
 +	sc->ant_rx = hw->wiphy->available_antennas_rx;
 +	sc->ant_tx = hw->wiphy->available_antennas_tx;
@@ -42,7 +41,7 @@
  #ifdef CONFIG_ATH9K_RATE_CONTROL
  	hw->rate_control_algorithm = "ath9k_rate_control";
  #endif
-@@ -703,12 +727,7 @@ void ath9k_set_hw_capab(struct ath_softc
+@@ -703,12 +726,7 @@ void ath9k_set_hw_capab(struct ath_softc
  		hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
  			&sc->sbands[IEEE80211_BAND_5GHZ];
  
@@ -62,7 +61,7 @@
  	struct ath_descdma txsdma;
  
  	struct ath_ant_comb ant_comb;
-+	u32 ant_tx, ant_rx;
++	u8 ant_tx, ant_rx;
  };
  
  void ath9k_tasklet(unsigned long data);
-- 
GitLab