aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c7
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c32
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c33
4 files changed, 46 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index eace74dac00e..cf16318a0a17 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1286,6 +1286,7 @@ u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
1286int ath5k_hw_phy_disable(struct ath5k_hw *ah); 1286int ath5k_hw_phy_disable(struct ath5k_hw *ah);
1287/* Antenna control */ 1287/* Antenna control */
1288void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode); 1288void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode);
1289void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode);
1289/* TX power setup */ 1290/* TX power setup */
1290int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, 1291int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
1291 u8 ee_mode, u8 txpower); 1292 u8 ee_mode, u8 txpower);
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index c58503c3d0d1..41817a294945 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -425,6 +425,13 @@ static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
425 "AR5K_PHY_FAST_ANT_DIV_EN\t%d\n", 425 "AR5K_PHY_FAST_ANT_DIV_EN\t%d\n",
426 (v & AR5K_PHY_FAST_ANT_DIV_EN) != 0); 426 (v & AR5K_PHY_FAST_ANT_DIV_EN) != 0);
427 427
428 v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_0);
429 len += snprintf(buf+len, sizeof(buf)-len,
430 "\nAR5K_PHY_ANT_SWITCH_TABLE_0\t0x%08x\n", v);
431 v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_1);
432 len += snprintf(buf+len, sizeof(buf)-len,
433 "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v);
434
428 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 435 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
429} 436}
430 437
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 0f3b9beca2c1..73c4fcd142bb 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1781,6 +1781,37 @@ ath5k_hw_set_fast_div(struct ath5k_hw *ah, u8 ee_mode, bool enable)
1781 } 1781 }
1782} 1782}
1783 1783
1784void
1785ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode)
1786{
1787 u8 ant0, ant1;
1788
1789 /*
1790 * In case a fixed antenna was set as default
1791 * use the same switch table twice.
1792 */
1793 if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_A)
1794 ant0 = ant1 = AR5K_ANT_SWTABLE_A;
1795 else if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_B)
1796 ant0 = ant1 = AR5K_ANT_SWTABLE_B;
1797 else {
1798 ant0 = AR5K_ANT_SWTABLE_A;
1799 ant1 = AR5K_ANT_SWTABLE_B;
1800 }
1801
1802 /* Set antenna idle switch table */
1803 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL,
1804 AR5K_PHY_ANT_CTL_SWTABLE_IDLE,
1805 (ah->ah_ant_ctl[ee_mode][AR5K_ANT_CTL] |
1806 AR5K_PHY_ANT_CTL_TXRX_EN));
1807
1808 /* Set antenna switch tables */
1809 ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant0],
1810 AR5K_PHY_ANT_SWITCH_TABLE_0);
1811 ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant1],
1812 AR5K_PHY_ANT_SWITCH_TABLE_1);
1813}
1814
1784/* 1815/*
1785 * Set antenna operating mode 1816 * Set antenna operating mode
1786 */ 1817 */
@@ -1900,6 +1931,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
1900 if (sta_id1) 1931 if (sta_id1)
1901 AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, sta_id1); 1932 AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, sta_id1);
1902 1933
1934 ath5k_hw_set_antenna_switch(ah, ee_mode);
1903 /* Note: set diversity before default antenna 1935 /* Note: set diversity before default antenna
1904 * because it won't work correctly */ 1936 * because it won't work correctly */
1905 ath5k_hw_set_fast_div(ah, ee_mode, fast_div); 1937 ath5k_hw_set_fast_div(ah, ee_mode, fast_div);
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index c17c84e93561..d561f7cb56cb 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -729,7 +729,7 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
729} 729}
730 730
731static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, 731static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
732 struct ieee80211_channel *channel, u8 *ant, u8 ee_mode) 732 struct ieee80211_channel *channel, u8 ee_mode)
733{ 733{
734 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 734 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
735 s16 cck_ofdm_pwr_delta; 735 s16 cck_ofdm_pwr_delta;
@@ -763,17 +763,9 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
763 ee->ee_cck_ofdm_gain_delta; 763 ee->ee_cck_ofdm_gain_delta;
764 } 764 }
765 765
766 /* Set antenna idle switch table */ 766 /* XXX: necessary here? is called from ath5k_hw_set_antenna_mode()
767 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL, 767 * too */
768 AR5K_PHY_ANT_CTL_SWTABLE_IDLE, 768 ath5k_hw_set_antenna_switch(ah, ee_mode);
769 (ah->ah_ant_ctl[ee_mode][0] |
770 AR5K_PHY_ANT_CTL_TXRX_EN));
771
772 /* Set antenna switch tables */
773 ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant[0]],
774 AR5K_PHY_ANT_SWITCH_TABLE_0);
775 ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant[1]],
776 AR5K_PHY_ANT_SWITCH_TABLE_1);
777 769
778 /* Noise floor threshold */ 770 /* Noise floor threshold */
779 ath5k_hw_reg_write(ah, 771 ath5k_hw_reg_write(ah,
@@ -887,7 +879,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
887 struct ath_common *common = ath5k_hw_common(ah); 879 struct ath_common *common = ath5k_hw_common(ah);
888 u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo; 880 u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;
889 u32 phy_tst1; 881 u32 phy_tst1;
890 u8 mode, freq, ee_mode, ant[2]; 882 u8 mode, freq, ee_mode;
891 int i, ret; 883 int i, ret;
892 884
893 s_ant = 0; 885 s_ant = 0;
@@ -1110,21 +1102,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1110 AR5K_TXCFG_B_MODE); 1102 AR5K_TXCFG_B_MODE);
1111 } 1103 }
1112 1104
1113 /*
1114 * In case a fixed antenna was set as default
1115 * use the same switch table twice.
1116 */
1117 if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_A)
1118 ant[0] = ant[1] = AR5K_ANT_SWTABLE_A;
1119 else if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_B)
1120 ant[0] = ant[1] = AR5K_ANT_SWTABLE_B;
1121 else {
1122 ant[0] = AR5K_ANT_SWTABLE_A;
1123 ant[1] = AR5K_ANT_SWTABLE_B;
1124 }
1125
1126 /* Commit values from EEPROM */ 1105 /* Commit values from EEPROM */
1127 ath5k_hw_commit_eeprom_settings(ah, channel, ant, ee_mode); 1106 ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode);
1128 1107
1129 } else { 1108 } else {
1130 /* 1109 /*