2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -3528,11 +3528,18 @@ static void rt2800_config_channel(struct
|
2012-11-20 07:19:08 +00:00
|
|
|
/*
|
|
|
|
* Change BBP settings
|
|
|
|
*/
|
|
|
|
+
|
|
|
|
if (rt2x00_rt(rt2x00dev, RT3352)) {
|
2014-04-23 07:52:37 +00:00
|
|
|
+ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
|
|
|
|
+ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
|
|
|
|
+ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
|
|
|
|
+
|
2012-11-20 07:19:08 +00:00
|
|
|
rt2800_bbp_write(rt2x00dev, 27, 0x0);
|
|
|
|
rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
|
|
|
|
rt2800_bbp_write(rt2x00dev, 27, 0x20);
|
|
|
|
rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
|
|
|
|
+ rt2800_bbp_write(rt2x00dev, 86, 0x38);
|
|
|
|
+ rt2800_bbp_write(rt2x00dev, 83, 0x6a);
|
2013-08-27 10:44:06 +00:00
|
|
|
} else if (rt2x00_rt(rt2x00dev, RT3593)) {
|
|
|
|
if (rf->channel > 14) {
|
|
|
|
/* Disable CCK Packet detection on 5GHz */
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -6594,6 +6601,12 @@ static void rt2800_init_rfcsr_3290(struc
|
2013-01-09 12:45:28 +00:00
|
|
|
|
|
|
|
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
|
|
|
|
{
|
|
|
|
+ int tx0_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX0,
|
|
|
|
+ &rt2x00dev->cap_flags);
|
|
|
|
+ int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1,
|
|
|
|
+ &rt2x00dev->cap_flags);
|
|
|
|
+ u8 rfcsr;
|
|
|
|
+
|
2013-06-15 20:14:06 +00:00
|
|
|
rt2800_rf_init_calibration(rt2x00dev, 30);
|
|
|
|
|
2013-01-09 12:45:28 +00:00
|
|
|
rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -6629,15 +6642,30 @@ static void rt2800_init_rfcsr_3352(struc
|
2013-01-09 12:45:28 +00:00
|
|
|
rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 34, 0x01);
|
|
|
|
+ rfcsr = 0x01;
|
|
|
|
+ if (!tx0_int_pa)
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1);
|
|
|
|
+ if (!tx1_int_pa)
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1);
|
2013-06-15 20:14:06 +00:00
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 34, rfcsr);
|
2013-01-09 12:45:28 +00:00
|
|
|
rt2800_rfcsr_write(rt2x00dev, 35, 0x03);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 36, 0xbd);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 37, 0x3c);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 38, 0x5f);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 39, 0xc5);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 40, 0x33);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 41, 0x5b);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
|
|
|
|
+ rfcsr = 0x52;
|
|
|
|
+ if (tx0_int_pa) {
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR41_BIT1, 1);
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR41_BIT4, 1);
|
|
|
|
+ }
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 41, rfcsr);
|
|
|
|
+ rfcsr = 0x52;
|
|
|
|
+ if (tx1_int_pa) {
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1);
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1);
|
|
|
|
+ }
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 42, rfcsr);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -6645,15 +6673,20 @@ static void rt2800_init_rfcsr_3352(struc
|
2013-01-09 12:45:28 +00:00
|
|
|
rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 50, 0x2d);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 51, 0x7f);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 52, 0x00);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 53, 0x52);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 54, 0x1b);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 55, 0x7f);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 56, 0x00);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 57, 0x52);
|
|
|
|
- rt2800_rfcsr_write(rt2x00dev, 58, 0x1b);
|
|
|
|
+ rfcsr = 0x2d;
|
|
|
|
+ if (!tx0_int_pa)
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1);
|
|
|
|
+ if (!tx1_int_pa)
|
|
|
|
+ rt2x00_set_field8(&rfcsr, RFCSR50_TX1_EXT_PA, 1);
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 50, rfcsr);
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 51, (tx0_int_pa ? 0x7f : 0x52));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 52, (tx0_int_pa ? 0x00 : 0xc0));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 53, (tx0_int_pa ? 0x52 : 0xd2));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 54, (tx0_int_pa ? 0x1b : 0xc0));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 55, (tx1_int_pa ? 0x7f : 0x52));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 56, (tx1_int_pa ? 0x00 : 0xc0));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 57, (tx0_int_pa ? 0x52 : 0x49));
|
|
|
|
+ rt2800_rfcsr_write(rt2x00dev, 58, (tx1_int_pa ? 0x1b : 0xc0));
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
|
|
|
|
rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -7674,6 +7707,7 @@ static int rt2800_init_eeprom(struct rt2
|
2013-06-15 20:14:06 +00:00
|
|
|
* RT53xx: defined in "EEPROM_CHIP_ID" field
|
|
|
|
*/
|
|
|
|
if (rt2x00_rt(rt2x00dev, RT3290) ||
|
|
|
|
+ rt2x00_rt(rt2x00dev, RT3352) ||
|
|
|
|
rt2x00_rt(rt2x00dev, RT5390) ||
|
|
|
|
rt2x00_rt(rt2x00dev, RT5392))
|
2013-08-27 10:44:06 +00:00
|
|
|
rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -7769,7 +7803,8 @@ static int rt2800_init_eeprom(struct rt2
|
2012-11-20 07:19:08 +00:00
|
|
|
/*
|
|
|
|
* Detect if this device has Bluetooth co-existence.
|
|
|
|
*/
|
|
|
|
- if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_BT_COEXIST))
|
|
|
|
+ if (!rt2x00_rt(rt2x00dev, RT3352) &&
|
|
|
|
+ rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_BT_COEXIST))
|
|
|
|
__set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
|
|
|
|
|
|
|
|
/*
|
2015-07-06 16:26:34 +00:00
|
|
|
@@ -7798,6 +7833,22 @@ static int rt2800_init_eeprom(struct rt2
|
2012-11-20 07:19:08 +00:00
|
|
|
EIRP_MAX_TX_POWER_LIMIT)
|
|
|
|
__set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Detect if device uses internal or external PA
|
|
|
|
+ */
|
2013-08-27 10:44:06 +00:00
|
|
|
+ rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
|
2012-11-20 07:19:08 +00:00
|
|
|
+
|
|
|
|
+ if (rt2x00_rt(rt2x00dev, RT3352)) {
|
|
|
|
+ if (!rt2x00_get_field16(eeprom,
|
|
|
|
+ EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
|
|
|
|
+ __set_bit(CAPABILITY_INTERNAL_PA_TX0,
|
|
|
|
+ &rt2x00dev->cap_flags);
|
|
|
|
+ if (!rt2x00_get_field16(eeprom,
|
|
|
|
+ EEPROM_NIC_CONF1_EXTERNAL_TX1_PA_3352))
|
|
|
|
+ __set_bit(CAPABILITY_INTERNAL_PA_TX1,
|
|
|
|
+ &rt2x00dev->cap_flags);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
|
2014-09-27 20:51:43 +00:00
|
|
|
@@ -2335,6 +2335,12 @@ struct mac_iveiv_entry {
|
2013-08-27 10:44:06 +00:00
|
|
|
#define RFCSR36_RF_BS FIELD8(0x80)
|
2012-11-20 07:19:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
+ * RFCSR 34:
|
|
|
|
+ */
|
|
|
|
+#define RFCSR34_TX0_EXT_PA FIELD8(0x04)
|
|
|
|
+#define RFCSR34_TX1_EXT_PA FIELD8(0x08)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* RFCSR 38:
|
|
|
|
*/
|
|
|
|
#define RFCSR38_RX_LO1_EN FIELD8(0x20)
|
2014-09-27 20:51:43 +00:00
|
|
|
@@ -2346,6 +2352,18 @@ struct mac_iveiv_entry {
|
2012-11-20 07:19:08 +00:00
|
|
|
#define RFCSR39_RX_LO2_EN FIELD8(0x80)
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * RFCSR 41:
|
|
|
|
+ */
|
|
|
|
+#define RFCSR41_BIT1 FIELD8(0x01)
|
|
|
|
+#define RFCSR41_BIT4 FIELD8(0x08)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * RFCSR 42:
|
|
|
|
+ */
|
|
|
|
+#define RFCSR42_BIT1 FIELD8(0x01)
|
|
|
|
+#define RFCSR42_BIT4 FIELD8(0x08)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* RFCSR 49:
|
|
|
|
*/
|
|
|
|
#define RFCSR49_TX FIELD8(0x3f)
|
2014-09-27 20:51:43 +00:00
|
|
|
@@ -2358,6 +2376,8 @@ struct mac_iveiv_entry {
|
2012-11-20 07:19:08 +00:00
|
|
|
* RFCSR 50:
|
|
|
|
*/
|
|
|
|
#define RFCSR50_TX FIELD8(0x3f)
|
|
|
|
+#define RFCSR50_TX0_EXT_PA FIELD8(0x02)
|
|
|
|
+#define RFCSR50_TX1_EXT_PA FIELD8(0x10)
|
2013-04-26 10:52:03 +00:00
|
|
|
#define RFCSR50_EP FIELD8(0xc0)
|
2013-08-27 10:44:06 +00:00
|
|
|
/* bits for RT3593 */
|
|
|
|
#define RFCSR50_TX_LO1_EN FIELD8(0x20)
|
2014-09-27 20:51:43 +00:00
|
|
|
@@ -2505,6 +2525,8 @@ enum rt2800_eeprom_word {
|
2012-11-20 07:19:08 +00:00
|
|
|
* INTERNAL_TX_ALC: 0: disable, 1: enable
|
|
|
|
* BT_COEXIST: 0: disable, 1: enable
|
|
|
|
* DAC_TEST: 0: disable, 1: enable
|
|
|
|
+ * EXTERNAL_TX0_PA: 0: disable, 1: enable (only on RT3352)
|
|
|
|
+ * EXTERNAL_TX1_PA: 0: disable, 1: enable (only on RT3352)
|
|
|
|
*/
|
|
|
|
#define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001)
|
2013-11-12 22:11:33 +00:00
|
|
|
#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
|
2014-09-27 20:51:43 +00:00
|
|
|
@@ -2521,6 +2543,8 @@ enum rt2800_eeprom_word {
|
2013-11-12 22:11:33 +00:00
|
|
|
#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
|
2012-11-20 07:19:08 +00:00
|
|
|
#define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000)
|
|
|
|
#define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000)
|
|
|
|
+#define EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352 FIELD16(0x4000)
|
|
|
|
+#define EEPROM_NIC_CONF1_EXTERNAL_TX1_PA_3352 FIELD16(0x8000)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EEPROM frequency
|
2015-12-04 22:39:37 +00:00
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
|
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
|
2015-10-30 15:17:56 +00:00
|
|
|
@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
|
2012-11-20 07:19:08 +00:00
|
|
|
CAPABILITY_DOUBLE_ANTENNA,
|
|
|
|
CAPABILITY_BT_COEXIST,
|
|
|
|
CAPABILITY_VCO_RECALIBRATION,
|
|
|
|
+ CAPABILITY_INTERNAL_PA_TX0,
|
|
|
|
+ CAPABILITY_INTERNAL_PA_TX1,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|