From: Stanislaw Gruszka <sgruszka@redhat.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com,
Stanislaw Gruszka <sgruszka@redhat.com>
Subject: [PATCH 4/4] rt2800: radio 3xxxx: channel switch RX/TX calibration fixes
Date: Mon, 30 Jan 2012 16:17:59 +0100 [thread overview]
Message-ID: <1327936679-12576-4-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1327936679-12576-1-git-send-email-sgruszka@redhat.com>
Synchronize code with Ralink driver:
2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO
Based on functions:
RT30xx_ChipSwitchChannel
RT33xx_ChipSwitchChannel
NICInitRT3370RFRegisters
and defines from:
include/chip/rt33xx.h
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/rt2x00/rt2800.h | 8 ++++++++
drivers/net/wireless/rt2x00/rt2800lib.c | 19 ++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index abf2ae5..c92fb2e 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -1872,6 +1872,13 @@ struct mac_iveiv_entry {
#define RFCSR23_FREQ_OFFSET FIELD8(0x7f)
/*
+ * RFCSR 24:
+ */
+#define RFCSR24_TX_AGC_FC FIELD8(0x1f)
+#define RFCSR24_TX_H20M FIELD8(0x20)
+#define RFCSR24_TX_CALIB FIELD8(0x7f)
+
+/*
* RFCSR 27:
*/
#define RFCSR27_R1 FIELD8(0x03)
@@ -1892,6 +1899,7 @@ struct mac_iveiv_entry {
*/
#define RFCSR31_RX_AGC_FC FIELD8(0x1f)
#define RFCSR31_RX_H20M FIELD8(0x20)
+#define RFCSR31_RX_CALIB FIELD8(0x7f)
/*
* RFCSR 38:
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b5dcc48..13d83ab 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1646,7 +1646,7 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
struct rf_channel *rf,
struct channel_info *info)
{
- u8 rfcsr;
+ u8 rfcsr, calib_tx, calib_rx;
rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1);
@@ -1711,8 +1711,21 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
- rt2800_rfcsr_write(rt2x00dev, 24,
- rt2x00dev->calibration[conf_is_ht40(conf)]);
+ if (rt2x00_rt(rt2x00dev, RT3390)) {
+ calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f;
+ calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f;
+ } else {
+ calib_tx = rt2x00dev->calibration[conf_is_ht40(conf)];
+ calib_rx = rt2x00dev->calibration[conf_is_ht40(conf)];
+ }
+
+ rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR24_TX_CALIB, calib_tx);
+ rt2800_rfcsr_write(rt2x00dev, 24, rfcsr);
+
+ rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr);
+ rt2x00_set_field8(&rfcsr, RFCSR31_RX_CALIB, calib_rx);
+ rt2800_rfcsr_write(rt2x00dev, 31, rfcsr);
rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr);
rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
--
1.7.1
next prev parent reply other threads:[~2012-01-30 15:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 15:17 [PATCH 1/4] rt2800: radio 3xxx: reprogram only lower bits of RF_R3 Stanislaw Gruszka
2012-01-30 15:17 ` [PATCH 2/4] rt2800: radio 3xxx: program RF_R1 during channel switch Stanislaw Gruszka
2012-01-30 22:06 ` [rt2x00-users] " Gertjan van Wingerde
2012-01-31 8:14 ` Stanislaw Gruszka
2012-01-31 17:00 ` Gertjan van Wingerde
2012-02-01 15:21 ` Stanislaw Gruszka
2012-01-30 15:17 ` [PATCH 3/4] rt2800: radio 3xxx: add channel switch calibration routines Stanislaw Gruszka
2012-02-01 10:30 ` Helmut Schaa
2012-01-30 15:17 ` Stanislaw Gruszka [this message]
2012-01-30 22:12 ` [rt2x00-users] [PATCH 4/4] rt2800: radio 3xxxx: channel switch RX/TX calibration fixes Gertjan van Wingerde
2012-02-01 15:17 ` [PATCH 5/4] rt2800: document RF_R03 register bits [7:4] Stanislaw Gruszka
2012-02-01 17:00 ` Helmut Schaa
2012-02-01 19:11 ` [rt2x00-users] " Gertjan van Wingerde
2012-02-01 10:27 ` [PATCH 1/4] rt2800: radio 3xxx: reprogram only lower bits of RF_R3 Helmut Schaa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1327936679-12576-4-git-send-email-sgruszka@redhat.com \
--to=sgruszka@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=users@rt2x00.serialmonkey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).