aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b66e0fd8f0fa..60039d3fe0a0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1120,27 +1120,27 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev,
1120 * double meaning, and we should set a 7DBm boost flag. 1120 * double meaning, and we should set a 7DBm boost flag.
1121 */ 1121 */
1122 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, 1122 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST,
1123 (info->tx_power1 >= 0)); 1123 (info->default_power1 >= 0));
1124 1124
1125 if (info->tx_power1 < 0) 1125 if (info->default_power1 < 0)
1126 info->tx_power1 += 7; 1126 info->default_power1 += 7;
1127 1127
1128 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, 1128 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A,
1129 TXPOWER_A_TO_DEV(info->tx_power1)); 1129 TXPOWER_A_TO_DEV(info->default_power1));
1130 1130
1131 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, 1131 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST,
1132 (info->tx_power2 >= 0)); 1132 (info->default_power2 >= 0));
1133 1133
1134 if (info->tx_power2 < 0) 1134 if (info->default_power2 < 0)
1135 info->tx_power2 += 7; 1135 info->default_power2 += 7;
1136 1136
1137 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, 1137 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A,
1138 TXPOWER_A_TO_DEV(info->tx_power2)); 1138 TXPOWER_A_TO_DEV(info->default_power2));
1139 } else { 1139 } else {
1140 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, 1140 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G,
1141 TXPOWER_G_TO_DEV(info->tx_power1)); 1141 TXPOWER_G_TO_DEV(info->default_power1));
1142 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, 1142 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G,
1143 TXPOWER_G_TO_DEV(info->tx_power2)); 1143 TXPOWER_G_TO_DEV(info->default_power2));
1144 } 1144 }
1145 1145
1146 rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); 1146 rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf));
@@ -1180,13 +1180,11 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1180 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); 1180 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr);
1181 1181
1182 rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); 1182 rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr);
1183 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, 1183 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1);
1184 TXPOWER_G_TO_DEV(info->tx_power1));
1185 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); 1184 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr);
1186 1185
1187 rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); 1186 rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr);
1188 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, 1187 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2);
1189 TXPOWER_G_TO_DEV(info->tx_power2));
1190 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); 1188 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr);
1191 1189
1192 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); 1190 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr);
@@ -2516,6 +2514,13 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
2516 default_lna_gain); 2514 default_lna_gain);
2517 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); 2515 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
2518 2516
2517 rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &word);
2518 if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_24GHZ) == 0xff)
2519 rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_24GHZ, MAX_G_TXPOWER);
2520 if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_5GHZ) == 0xff)
2521 rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_5GHZ, MAX_A_TXPOWER);
2522 rt2x00_eeprom_write(rt2x00dev, EEPROM_MAX_TX_POWER, word);
2523
2519 return 0; 2524 return 0;
2520} 2525}
2521EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); 2526EXPORT_SYMBOL_GPL(rt2800_validate_eeprom);
@@ -2755,9 +2760,10 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2755{ 2760{
2756 struct hw_mode_spec *spec = &rt2x00dev->spec; 2761 struct hw_mode_spec *spec = &rt2x00dev->spec;
2757 struct channel_info *info; 2762 struct channel_info *info;
2758 char *tx_power1; 2763 char *default_power1;
2759 char *tx_power2; 2764 char *default_power2;
2760 unsigned int i; 2765 unsigned int i;
2766 unsigned short max_power;
2761 u16 eeprom; 2767 u16 eeprom;
2762 2768
2763 /* 2769 /*
@@ -2871,21 +2877,26 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2871 2877
2872 spec->channels_info = info; 2878 spec->channels_info = info;
2873 2879
2874 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); 2880 rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &eeprom);
2875 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); 2881 max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_24GHZ);
2882 default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
2883 default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
2876 2884
2877 for (i = 0; i < 14; i++) { 2885 for (i = 0; i < 14; i++) {
2878 info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]); 2886 info[i].max_power = max_power;
2879 info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]); 2887 info[i].default_power1 = TXPOWER_G_FROM_DEV(default_power1[i]);
2888 info[i].default_power2 = TXPOWER_G_FROM_DEV(default_power2[i]);
2880 } 2889 }
2881 2890
2882 if (spec->num_channels > 14) { 2891 if (spec->num_channels > 14) {
2883 tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); 2892 max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_5GHZ);
2884 tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); 2893 default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
2894 default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
2885 2895
2886 for (i = 14; i < spec->num_channels; i++) { 2896 for (i = 14; i < spec->num_channels; i++) {
2887 info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]); 2897 info[i].max_power = max_power;
2888 info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]); 2898 info[i].default_power1 = TXPOWER_A_FROM_DEV(default_power1[i]);
2899 info[i].default_power2 = TXPOWER_A_FROM_DEV(default_power2[i]);
2889 } 2900 }
2890 } 2901 }
2891 2902