From 3d71d1d9a98f55659acbfb8434406636310cb54b Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 24 Apr 2017 01:38:07 +0200 Subject: [PATCH] mac80211: rt2x00: reorder patches and prepare for MT7620 external PA Import change to make external PA capability consistent with the vendor driver instead of having the logic inverted. While at it, apply patches in the same order as they got merged upstream. Signed-off-by: Daniel Golle --- ...se-external-PA-capability-flag-logic.patch | 128 ++++++++++++++++++ ...-fix-LNA-gain-assignment-for-MT7620.patch} | 0 ...O-calibration-after-programming-ALC.patch} | 0 ...ix-mt7620-vco-calibration-registers.patch} | 0 ...800-fix-mt7620-E2-channel-registers.patch} | 0 5 files changed, 128 insertions(+) create mode 100644 package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch rename package/kernel/mac80211/patches/{021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch => 020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/{021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch => 020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch} (100%) rename package/kernel/mac80211/patches/{021-03-rt2800-fix-mt7620-vco-calibration-registers.patch => 020-23-rt2800-fix-mt7620-vco-calibration-registers.patch} (100%) rename package/kernel/mac80211/patches/{021-04-rt2800-fix-mt7620-E2-channel-registers.patch => 020-24-rt2800-fix-mt7620-E2-channel-registers.patch} (100%) diff --git a/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch b/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch new file mode 100644 index 0000000000..35b1918fb8 --- /dev/null +++ b/package/kernel/mac80211/patches/020-20-rt2x00-reverse-external-PA-capability-flag-logic.patch @@ -0,0 +1,128 @@ +From 1f242a3de702d5a19c479685d35b050837122724 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Mon, 10 Apr 2017 15:29:45 +0200 +Subject: [PATCH] rt2x00: reverse external PA capability flag logic + +Consequently refer to external PA instead of inverting the logic and +use an internal PA capability flag which is a bit confusing. +Currently this is used for Rt3352 only, but MT7620A also allows for an +external PA which will be supported by a follow up patch. + +Signed-off-by: Daniel Golle +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 40 +++++++++++++------------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 +-- + 2 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +index 201b12ed90c6..ba06ac2d876d 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -7014,9 +7014,9 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev) + + static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) + { +- int tx0_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX0, ++ int tx0_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX0, + &rt2x00dev->cap_flags); +- int tx1_int_pa = test_bit(CAPABILITY_INTERNAL_PA_TX1, ++ int tx1_ext_pa = test_bit(CAPABILITY_EXTERNAL_PA_TX1, + &rt2x00dev->cap_flags); + u8 rfcsr; + +@@ -7056,9 +7056,9 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) + rt2800_rfcsr_write(rt2x00dev, 32, 0x80); + rt2800_rfcsr_write(rt2x00dev, 33, 0x00); + rfcsr = 0x01; +- if (!tx0_int_pa) ++ if (tx0_ext_pa) + rt2x00_set_field8(&rfcsr, RFCSR34_TX0_EXT_PA, 1); +- if (!tx1_int_pa) ++ if (tx1_ext_pa) + rt2x00_set_field8(&rfcsr, RFCSR34_TX1_EXT_PA, 1); + rt2800_rfcsr_write(rt2x00dev, 34, rfcsr); + rt2800_rfcsr_write(rt2x00dev, 35, 0x03); +@@ -7068,13 +7068,13 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) + rt2800_rfcsr_write(rt2x00dev, 39, 0xc5); + rt2800_rfcsr_write(rt2x00dev, 40, 0x33); + rfcsr = 0x52; +- if (tx0_int_pa) { ++ if (!tx0_ext_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) { ++ if (!tx1_ext_pa) { + rt2x00_set_field8(&rfcsr, RFCSR42_BIT1, 1); + rt2x00_set_field8(&rfcsr, RFCSR42_BIT4, 1); + } +@@ -7087,19 +7087,19 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) + rt2800_rfcsr_write(rt2x00dev, 48, 0x14); + rt2800_rfcsr_write(rt2x00dev, 49, 0x00); + rfcsr = 0x2d; +- if (!tx0_int_pa) ++ if (tx0_ext_pa) + rt2x00_set_field8(&rfcsr, RFCSR50_TX0_EXT_PA, 1); +- if (!tx1_int_pa) ++ if (tx1_ext_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, 51, (tx0_ext_pa ? 0x52 : 0x7f)); ++ rt2800_rfcsr_write(rt2x00dev, 52, (tx0_ext_pa ? 0xc0 : 0x00)); ++ rt2800_rfcsr_write(rt2x00dev, 53, (tx0_ext_pa ? 0xd2 : 0x52)); ++ rt2800_rfcsr_write(rt2x00dev, 54, (tx0_ext_pa ? 0xc0 : 0x1b)); ++ rt2800_rfcsr_write(rt2x00dev, 55, (tx1_ext_pa ? 0x52 : 0x7f)); ++ rt2800_rfcsr_write(rt2x00dev, 56, (tx1_ext_pa ? 0xc0 : 0x00)); ++ rt2800_rfcsr_write(rt2x00dev, 57, (tx0_ext_pa ? 0x49 : 0x52)); ++ rt2800_rfcsr_write(rt2x00dev, 58, (tx1_ext_pa ? 0xc0 : 0x1b)); + rt2800_rfcsr_write(rt2x00dev, 59, 0x00); + rt2800_rfcsr_write(rt2x00dev, 60, 0x00); + rt2800_rfcsr_write(rt2x00dev, 61, 0x00); +@@ -8782,13 +8782,13 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) + rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); + + if (rt2x00_rt(rt2x00dev, RT3352)) { +- if (!rt2x00_get_field16(eeprom, ++ if (rt2x00_get_field16(eeprom, + EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) +- __set_bit(CAPABILITY_INTERNAL_PA_TX0, ++ __set_bit(CAPABILITY_EXTERNAL_PA_TX0, + &rt2x00dev->cap_flags); +- if (!rt2x00_get_field16(eeprom, ++ if (rt2x00_get_field16(eeprom, + EEPROM_NIC_CONF1_EXTERNAL_TX1_PA_3352)) +- __set_bit(CAPABILITY_INTERNAL_PA_TX1, ++ __set_bit(CAPABILITY_EXTERNAL_PA_TX1, + &rt2x00dev->cap_flags); + } + +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +index 8fdd2f9726ee..1bc353eafe37 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -719,8 +719,8 @@ enum rt2x00_capability_flags { + CAPABILITY_DOUBLE_ANTENNA, + CAPABILITY_BT_COEXIST, + CAPABILITY_VCO_RECALIBRATION, +- CAPABILITY_INTERNAL_PA_TX0, +- CAPABILITY_INTERNAL_PA_TX1, ++ CAPABILITY_EXTERNAL_PA_TX0, ++ CAPABILITY_EXTERNAL_PA_TX1, + }; + + /* +-- +2.12.2 + diff --git a/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch b/package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch rename to package/kernel/mac80211/patches/020-21-rt2800-fix-LNA-gain-assignment-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch b/package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch similarity index 100% rename from package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch rename to package/kernel/mac80211/patches/020-22-rt2800-do-VCO-calibration-after-programming-ALC.patch diff --git a/package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch b/package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch similarity index 100% rename from package/kernel/mac80211/patches/021-03-rt2800-fix-mt7620-vco-calibration-registers.patch rename to package/kernel/mac80211/patches/020-23-rt2800-fix-mt7620-vco-calibration-registers.patch diff --git a/package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch b/package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch similarity index 100% rename from package/kernel/mac80211/patches/021-04-rt2800-fix-mt7620-E2-channel-registers.patch rename to package/kernel/mac80211/patches/020-24-rt2800-fix-mt7620-E2-channel-registers.patch -- 2.30.2