aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2800.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c59
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c13
9 files changed, 83 insertions, 45 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5063e01410e5..6a6cd7142e31 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1488,8 +1488,10 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1488 spec->channels_info = info; 1488 spec->channels_info = info;
1489 1489
1490 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1490 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1491 for (i = 0; i < 14; i++) 1491 for (i = 0; i < 14; i++) {
1492 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1492 info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER);
1493 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1494 }
1493 1495
1494 return 0; 1496 return 0;
1495} 1497}
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index c2a555d5376b..ec3e8b329a67 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1802,12 +1802,16 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1802 spec->channels_info = info; 1802 spec->channels_info = info;
1803 1803
1804 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1804 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1805 for (i = 0; i < 14; i++) 1805 for (i = 0; i < 14; i++) {
1806 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1806 info[i].max_power = MAX_TXPOWER;
1807 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1808 }
1807 1809
1808 if (spec->num_channels > 14) { 1810 if (spec->num_channels > 14) {
1809 for (i = 14; i < spec->num_channels; i++) 1811 for (i = 14; i < spec->num_channels; i++) {
1810 info[i].tx_power1 = DEFAULT_TXPOWER; 1812 info[i].max_power = MAX_TXPOWER;
1813 info[i].default_power1 = DEFAULT_TXPOWER;
1814 }
1811 } 1815 }
1812 1816
1813 return 0; 1817 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index cdaf93f48263..ed4de3f02d40 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1705,12 +1705,16 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1705 spec->channels_info = info; 1705 spec->channels_info = info;
1706 1706
1707 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); 1707 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1708 for (i = 0; i < 14; i++) 1708 for (i = 0; i < 14; i++) {
1709 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 1709 info[i].max_power = MAX_TXPOWER;
1710 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1711 }
1710 1712
1711 if (spec->num_channels > 14) { 1713 if (spec->num_channels > 14) {
1712 for (i = 14; i < spec->num_channels; i++) 1714 for (i = 14; i < spec->num_channels; i++) {
1713 info[i].tx_power1 = DEFAULT_TXPOWER; 1715 info[i].max_power = MAX_TXPOWER;
1716 info[i].default_power1 = DEFAULT_TXPOWER;
1717 }
1714 } 1718 }
1715 1719
1716 return 0; 1720 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index ed4ebcdde7c9..616b71a4ad1f 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -1841,6 +1841,13 @@ struct mac_iveiv_entry {
1841#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) 1841#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)
1842 1842
1843/* 1843/*
1844 * EEPROM Maximum TX power values
1845 */
1846#define EEPROM_MAX_TX_POWER 0x0027
1847#define EEPROM_MAX_TX_POWER_24GHZ FIELD16(0x00ff)
1848#define EEPROM_MAX_TX_POWER_5GHZ FIELD16(0xff00)
1849
1850/*
1844 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. 1851 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power.
1845 * This is delta in 40MHZ. 1852 * This is delta in 40MHZ.
1846 * VALUE: Tx Power dalta value (MAX=4) 1853 * VALUE: Tx Power dalta value (MAX=4)
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
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index c21af38cc5af..6b2b92bfbc6b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -212,8 +212,9 @@ struct channel_info {
212 unsigned int flags; 212 unsigned int flags;
213#define GEOGRAPHY_ALLOWED 0x00000001 213#define GEOGRAPHY_ALLOWED 0x00000001
214 214
215 short tx_power1; 215 short max_power;
216 short tx_power2; 216 short default_power1;
217 short default_power2;
217}; 218};
218 219
219/* 220/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 585e8166f22a..19f86ce13df5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -710,7 +710,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
710 for (i = 0; i < spec->num_channels; i++) { 710 for (i = 0; i < spec->num_channels; i++) {
711 rt2x00lib_channel(&channels[i], 711 rt2x00lib_channel(&channels[i],
712 spec->channels[i].channel, 712 spec->channels[i].channel,
713 spec->channels_info[i].tx_power1, i); 713 spec->channels_info[i].max_power, i);
714 } 714 }
715 715
716 /* 716 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e539c6cb636f..73d6382663b4 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2661,13 +2661,17 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2661 spec->channels_info = info; 2661 spec->channels_info = info;
2662 2662
2663 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); 2663 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START);
2664 for (i = 0; i < 14; i++) 2664 for (i = 0; i < 14; i++) {
2665 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2665 info[i].max_power = MAX_TXPOWER;
2666 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2667 }
2666 2668
2667 if (spec->num_channels > 14) { 2669 if (spec->num_channels > 14) {
2668 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); 2670 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
2669 for (i = 14; i < spec->num_channels; i++) 2671 for (i = 14; i < spec->num_channels; i++) {
2670 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2672 info[i].max_power = MAX_TXPOWER;
2673 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2674 }
2671 } 2675 }
2672 2676
2673 return 0; 2677 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index aa9de18fd410..c457d65f81a7 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2091,13 +2091,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2091 spec->channels_info = info; 2091 spec->channels_info = info;
2092 2092
2093 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); 2093 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START);
2094 for (i = 0; i < 14; i++) 2094 for (i = 0; i < 14; i++) {
2095 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2095 info[i].max_power = MAX_TXPOWER;
2096 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2097 }
2096 2098
2097 if (spec->num_channels > 14) { 2099 if (spec->num_channels > 14) {
2098 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); 2100 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
2099 for (i = 14; i < spec->num_channels; i++) 2101 for (i = 14; i < spec->num_channels; i++) {
2100 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); 2102 info[i].max_power = MAX_TXPOWER;
2103 info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
2104 }
2101 } 2105 }
2102 2106
2103 return 0; 2107 return 0;
@@ -2391,6 +2395,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2391 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, 2395 { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
2392 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, 2396 { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
2393 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, 2397 { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) },
2398 { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) },
2394 /* Qcom */ 2399 /* Qcom */
2395 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, 2400 { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) },
2396 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, 2401 { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) },