From: "Arend van Spriel" <arend@broadcom.com>
To: linux-wireless <linux-wireless@vger.kernel.org>
Cc: "Arend van Spriel" <arend@broadcom.com>,
"Jonas Gorski" <jogo@openwrt.org>,
"David Herrmann" <dh.herrmann@gmail.com>,
"Maximilian Engelhardt" <maxi@daemonizer.de>,
"David Costa" <david@zarel.net>
Subject: [RFT V2 13/13] brcmsmac: add support for BCM4313 iPA variant
Date: Tue, 13 Aug 2013 22:03:40 +0200 [thread overview]
Message-ID: <1376424220-10765-14-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1376424220-10765-1-git-send-email-arend@broadcom.com>
This patch completes the changes needed for supporting the
iPA variant cards of the BCM4313 wireless chipset.
Cc: Jonas Gorski <jogo@openwrt.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Maximilian Engelhardt <maxi@daemonizer.de>
Cc: David Costa <david@zarel.net>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
.../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 71 ++++++++++++++------
1 file changed, 51 insertions(+), 20 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 6e6bc28..4ba5d62 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1826,6 +1826,17 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
write_radio_reg(pi, RADIO_2064_REG038, 3);
write_radio_reg(pi, RADIO_2064_REG091, 7);
}
+
+ if (!(pi->sh->boardflags & BFL_FEM)) {
+ u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc,
+ 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0};
+
+ write_radio_reg(pi, RADIO_2064_REG02A, 0xf);
+ write_radio_reg(pi, RADIO_2064_REG091, 0x3);
+ write_radio_reg(pi, RADIO_2064_REG038, 0x3);
+
+ write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]);
+ }
}
static int
@@ -2123,7 +2134,16 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
{
struct phytbl_info tab;
u32 rfseq, ind;
+ enum lcnphy_tssi_mode mode;
+ u8 tssi_sel;
+ if (pi->sh->boardflags & BFL_FEM) {
+ tssi_sel = 0x1;
+ mode = LCNPHY_TSSI_EXT;
+ } else {
+ tssi_sel = 0xe;
+ mode = LCNPHY_TSSI_POST_PA;
+ }
tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
tab.tbl_width = 32;
tab.tbl_ptr = &ind;
@@ -2144,7 +2164,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4);
- wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
+ wlc_lcnphy_set_tssi_mux(pi, mode);
mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14);
mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15);
@@ -2180,9 +2200,10 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0);
if (LCNREV_IS(pi->pubpi.phy_rev, 2)) {
- mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe);
+ mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel);
mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4);
} else {
+ mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1);
mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1);
mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3);
}
@@ -4358,8 +4379,11 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi,
tab.tbl_len = 1;
tab.tbl_ptr = &val;
+ /* fixed gm_gain value for iPA */
+ gm_gain = 15;
for (j = 0; j < 128; j++) {
- gm_gain = gain_table[j].gm;
+ if (pi->sh->boardflags & BFL_FEM)
+ gm_gain = gain_table[j].gm;
val = (((u32) pa_gain << 24) |
(gain_table[j].pad << 16) |
(gain_table[j].pga << 8) | gm_gain);
@@ -4570,7 +4594,10 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
write_phy_reg(pi, 0x4ea, 0x4688);
- mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
+ if (pi->sh->boardflags & BFL_FEM)
+ mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
+ else
+ mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0);
mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6);
@@ -4581,6 +4608,13 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
wlc_lcnphy_rcal(pi);
wlc_lcnphy_rc_cal(pi);
+
+ if (!(pi->sh->boardflags & BFL_FEM)) {
+ write_radio_reg(pi, RADIO_2064_REG032, 0x6f);
+ write_radio_reg(pi, RADIO_2064_REG033, 0x19);
+ write_radio_reg(pi, RADIO_2064_REG039, 0xe);
+ }
+
}
static void wlc_lcnphy_radio_init(struct brcms_phy *pi)
@@ -4611,22 +4645,20 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
wlc_lcnphy_write_table(pi, &tab);
}
- tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
- tab.tbl_width = 16;
- tab.tbl_ptr = &val;
- tab.tbl_len = 1;
-
- val = 114;
- tab.tbl_offset = 0;
- wlc_lcnphy_write_table(pi, &tab);
+ if (!(pi->sh->boardflags & BFL_FEM)) {
+ tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
+ tab.tbl_width = 16;
+ tab.tbl_ptr = &val;
+ tab.tbl_len = 1;
- val = 130;
- tab.tbl_offset = 1;
- wlc_lcnphy_write_table(pi, &tab);
+ val = 150;
+ tab.tbl_offset = 0;
+ wlc_lcnphy_write_table(pi, &tab);
- val = 6;
- tab.tbl_offset = 8;
- wlc_lcnphy_write_table(pi, &tab);
+ val = 220;
+ tab.tbl_offset = 1;
+ wlc_lcnphy_write_table(pi, &tab);
+ }
if (CHSPEC_IS2G(pi->radio_chanspec)) {
if (pi->sh->boardflags & BFL_FEM)
@@ -5059,8 +5091,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
if (!wlc_phy_txpwr_srom_read_lcnphy(pi))
return false;
- if ((pi->sh->boardflags & BFL_FEM) &&
- (LCNREV_IS(pi->pubpi.phy_rev, 1))) {
+ if (LCNREV_IS(pi->pubpi.phy_rev, 1)) {
if (pi_lcn->lcnphy_tempsense_option == 3) {
pi->hwpwrctrl = true;
pi->hwpwrctrl_capable = true;
--
1.7.10.4
next prev parent reply other threads:[~2013-08-13 20:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 20:03 [RFT 00/13] brcmsmac: bcm4313 iPA related patches Arend van Spriel
2013-08-13 20:03 ` [RFT V2 01/13] brcmsmac: cosmetic change in phy_lcn.c Arend van Spriel
2013-08-13 20:03 ` [RFT V2 02/13] brcmsmac: change pa_gain for bcm4313 iPA Arend van Spriel
2013-08-21 19:18 ` Hauke Mehrtens
2013-08-22 8:08 ` Arend van Spriel
2013-08-13 20:03 ` [RFT V2 03/13] brcmsmac: use ARRAY_SIZE in phytbl_lcn.c Arend van Spriel
2013-08-13 20:03 ` [RFT V2 04/13] brcmsmac: add switch control table for BCM4313 iPA BT-combo cards Arend van Spriel
2013-08-13 20:03 ` [RFT V2 05/13] brcmsmac: add debug info message providing phy and radio info Arend van Spriel
2013-08-13 20:03 ` [RFT V2 06/13] brcmsmac: update transmit gain table for lcn phy Arend van Spriel
2013-08-13 20:03 ` [RFT V2 07/13] brcmsmac: change lcnphy receive i/q calibration routine Arend van Spriel
2013-08-13 20:03 ` [RFT V2 08/13] brcmsmac: fix TSSI idle estimation Arend van Spriel
2013-08-13 20:03 ` [RFT V2 09/13] brcmsmac: avoid calling set_txpwr_by_index() twice Arend van Spriel
2013-08-13 20:03 ` [RFT V2 10/13] brcmsmac: rework switch control table init including iPA BT-combo Arend van Spriel
2013-08-13 20:03 ` [RFT V2 11/13] brcmsmac: correct phy registers for TSSI-based power control Arend van Spriel
2013-08-13 20:03 ` [RFT V2 12/13] brcmsmac: reinitialize TSSI power control upon channel switch Arend van Spriel
2013-08-13 20:03 ` Arend van Spriel [this message]
2013-08-13 20:09 ` [RFT 00/13] brcmsmac: bcm4313 iPA related patches David Herrmann
2013-08-13 20:46 ` Arend van Spriel
2013-08-14 10:33 ` David Herrmann
2013-08-14 18:16 ` Arend van Spriel
2013-08-21 16:17 ` Maximilian Engelhardt
2013-08-21 19:00 ` Arend van Spriel
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=1376424220-10765-14-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=david@zarel.net \
--cc=dh.herrmann@gmail.com \
--cc=jogo@openwrt.org \
--cc=linux-wireless@vger.kernel.org \
--cc=maxi@daemonizer.de \
/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).