mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-05 05:24:20 +00:00
439ac8104b
Import patches from upstream to sync 19.07 with master: 9f3e3323e996 rt2x00: allow to specify watchdog interval 2034afe4db4a rt2800: add helpers for reading dma done index 759c5b599cf4 rt2800: initial watchdog implementation 09db3b000619 rt2800: add pre_reset_hw callback 710e6cc1595e rt2800: do not nullify initialization vector data e403fa31ed71 rt2x00: add restart hw 0f47aeeada2a rt2800: do not enable watchdog by default 41a531ffa4c5 rt2x00usb: fix rx queue hang 3b902fa811cf rt2x00usb: remove unnecessary rx flag checks 1dc244064c47 rt2x00: no need to check return value of debugfs_create functions 706f0182b1ad rt2800usb: Add new rt2800usb device PLANEX GW-USMicroN 95844124385e rt2x00: clear IV's on start to fix AP mode regression 567a9b766b47 rt2x00: do not set IEEE80211_TX_STAT_AMPDU_NO_BACK on tx status 14d5e14c8a6c rt2x00: clear up IV's on key removal 13fa451568ab Revert "rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band" --pending-- rt2800: remove errornous duplicate condition Signed-off-by: Daniel Golle <daniel@makrotopia.org>
108 lines
3.9 KiB
Diff
108 lines
3.9 KiB
Diff
From 9782a7f7488443568fa4d6088b73c9aff7eb8510 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Golle <daniel@makrotopia.org>
|
|
Date: Wed, 19 Apr 2017 16:14:53 +0200
|
|
Subject: [PATCH] rt2x00: add support for external PA on MT7620
|
|
To: Stanislaw Gruszka <sgruszka@redhat.com>
|
|
Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
|
|
linux-wireless@vger.kernel.org,
|
|
Kalle Valo <kvalo@codeaurora.org>
|
|
Content-Type: text/plain; charset="UTF-8"
|
|
Content-Transfer-Encoding: quoted-printable
|
|
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
Signed-off-by: Tomislav Po=C5=BEega <pozega.tomislav@gmail.com>
|
|
[pozega.tomislav@gmail.com: use chanreg and dccal helpers.]
|
|
|
|
---
|
|
drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 +
|
|
drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 70 +++++++++++++++++++++++++-
|
|
2 files changed, 70 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
|
|
@@ -2750,6 +2750,7 @@ enum rt2800_eeprom_word {
|
|
#define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f)
|
|
#define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0)
|
|
#define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600)
|
|
+#define EEPROM_NIC_CONF2_EXTERNAL_PA FIELD16(0xc000)
|
|
|
|
/*
|
|
* EEPROM LNA
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
|
|
@@ -4370,6 +4370,45 @@ static void rt2800_config_channel(struct
|
|
rt2800_iq_calibrate(rt2x00dev, rf->channel);
|
|
}
|
|
|
|
+ if (rt2x00_rt(rt2x00dev, RT6352)) {
|
|
+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0,
|
|
+ &rt2x00dev->cap_flags)) {
|
|
+ rt2x00_warn(rt2x00dev, "Using incomplete support for " \
|
|
+ "external PA\n");
|
|
+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
|
|
+ reg |= 0x00000101;
|
|
+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
|
|
+
|
|
+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
|
|
+ reg |= 0x00000101;
|
|
+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
|
|
+
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
|
|
+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
|
|
+ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
|
|
+
|
|
+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
|
|
+ 0x36303636);
|
|
+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN,
|
|
+ 0x6C6C6B6C);
|
|
+ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
|
|
+ 0x6C6C6B6C);
|
|
+ }
|
|
+ }
|
|
+
|
|
bbp = rt2800_bbp_read(rt2x00dev, 4);
|
|
rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
|
|
rt2800_bbp_write(rt2x00dev, 4, bbp);
|
|
@@ -9571,7 +9610,8 @@ static int rt2800_init_eeprom(struct rt2
|
|
*/
|
|
eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
|
|
|
|
- if (rt2x00_rt(rt2x00dev, RT3352)) {
|
|
+ if (rt2x00_rt(rt2x00dev, RT3352) ||
|
|
+ rt2x00_rt(rt2x00dev, RT6352)) {
|
|
if (rt2x00_get_field16(eeprom,
|
|
EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352))
|
|
__set_bit(CAPABILITY_EXTERNAL_PA_TX0,
|
|
@@ -9582,6 +9622,18 @@ static int rt2800_init_eeprom(struct rt2
|
|
&rt2x00dev->cap_flags);
|
|
}
|
|
|
|
+ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2);
|
|
+
|
|
+ if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) {
|
|
+ if (rt2x00_get_field16(eeprom,
|
|
+ EEPROM_NIC_CONF2_EXTERNAL_PA)) {
|
|
+ __set_bit(CAPABILITY_EXTERNAL_PA_TX0,
|
|
+ &rt2x00dev->cap_flags);
|
|
+ __set_bit(CAPABILITY_EXTERNAL_PA_TX1,
|
|
+ &rt2x00dev->cap_flags);
|
|
+ }
|
|
+ }
|
|
+
|
|
return 0;
|
|
}
|
|
|