linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>
Cc: bcm43xx-dev@lists.berlios.de, "Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH 10/11] b43: N-PHY: implement chanspec setup
Date: Tue,  9 Feb 2010 21:04:42 +0100	[thread overview]
Message-ID: <1265745883-3392-11-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1265745883-3392-2-git-send-email-zajec5@gmail.com>

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/phy_n.c |   62 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 631e01f..19d4f11 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -3283,6 +3283,68 @@ int b43_phy_initn(struct b43_wldev *dev)
 	return 0;
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
+static void b43_nphy_chanspec_setup(struct b43_wldev *dev,
+				const struct b43_nphy_channeltab_entry *e,
+				struct b43_chanspec chanspec)
+{
+	struct b43_phy *phy = &dev->phy;
+	struct b43_phy_n *nphy = dev->phy.n;
+
+	u16 tmp;
+	u32 tmp32;
+
+	tmp = b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ;
+	if (chanspec.b_freq == 1 && tmp == 0) {
+		tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
+		b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);
+		b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000);
+		b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32);
+		b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
+	} else if (chanspec.b_freq == 1) {
+		b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
+		tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
+		b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);
+		b43_phy_mask(dev, B43_PHY_B_BBCFG, (u16)~0xC000);
+		b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32);
+	}
+
+	b43_chantab_phy_upload(dev, e);
+
+	tmp = chanspec.channel;
+	if (chanspec.b_freq == 1)
+		tmp |= 0x0100;
+	if (chanspec.b_width == 3)
+		tmp |= 0x0200;
+	b43_bmac_write_shm(dev, 0xA0, tmp);
+
+	if (nphy->radio_chanspec.channel == 14) {
+		b43_nphy_classifier(dev, 2, 0);
+		b43_phy_set(dev, B43_PHY_B_TEST, 0x0800);
+	} else {
+		b43_nphy_classifier(dev, 2, 2);
+		if (chanspec.b_freq == 2)
+			b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840);
+	}
+
+	if (nphy->txpwrctrl)
+		b43_nphy_tx_power_fix(dev);
+
+	if (dev->phy.rev < 3)
+		b43_nphy_adjust_lna_gain_table(dev);
+
+	b43_nphy_tx_lp_fbw(dev);
+
+	if (dev->phy.rev >= 3 && 0) {
+		/* TODO */
+	}
+
+	b43_phy_write(dev, B43_NPHY_NDATAT_DUP40, 0x3830);
+
+	if (phy->rev >= 3)
+		b43_nphy_spur_workaround(dev);
+}
+
 static int b43_nphy_op_allocate(struct b43_wldev *dev)
 {
 	struct b43_phy_n *nphy;
-- 
1.6.4.2


  parent reply	other threads:[~2010-02-09 20:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 20:04 [PATCH 01/11] b43: N-PHY: add some registers and structs definitions Rafał Miłecki
2010-02-09 20:04 ` [PATCH 02/11] b43: N-PHY: initialize super switch Rafał Miłecki
2010-02-09 20:04 ` [PATCH 03/11] b43: N-PHY: turn radio on/off (rfkill) Rafał Miłecki
2010-02-09 20:04 ` [PATCH 04/11] b43: N-PHY: update writing channel-specific radio registers Rafał Miłecki
2010-02-09 20:04 ` [PATCH 05/11] b43: N-PHY: update post init of 2055 radio Rafał Miłecki
2010-02-09 20:04 ` [PATCH 06/11] b43: N-PHY: switch to chanspec struct Rafał Miłecki
2010-02-09 20:04 ` [PATCH 07/11] b43: N-PHY: adjust gain table Rafał Miłecki
2010-02-09 20:04 ` [PATCH 08/11] b43: implement writing to MMIO shared memory Rafał Miłecki
2010-02-09 22:59   ` Michael Buesch
2010-02-27 11:09     ` Rafał Miłecki
2010-02-27 14:50       ` Michael Buesch
2010-02-09 20:04 ` [PATCH 09/11] b43: N-PHY: isloate 2055 radio setup Rafał Miłecki
2010-02-09 23:01   ` Michael Buesch
2010-02-09 20:04 ` Rafał Miłecki [this message]
2010-02-09 20:04 ` [PATCH 11/11] b43: N-PHY: switch to chanspec ops Rafał Miłecki
2010-02-09 20:23   ` Larry Finger
2010-02-09 23:02 ` [PATCH 01/11] b43: N-PHY: add some registers and structs definitions Michael Buesch
2010-02-15 19:30   ` John W. Linville
2010-02-19 16:12     ` Rafał Miłecki
2010-02-27 11:12   ` Rafał Miłecki
2010-02-27 14:51     ` Michael Buesch
2010-02-28  1:37       ` Rafał Miłecki
2010-02-28 11:46         ` Michael Buesch
2010-02-19 14:54 ` Johannes Berg
2010-02-19 15:49   ` Larry Finger
2010-02-19 16:23     ` Johannes Berg
2010-02-19 16:40       ` Larry Finger
2010-02-19 17:02         ` Johannes Berg
2010-02-19 17:06           ` Gábor Stefanik
2010-02-19 17:09             ` Johannes Berg
2010-02-19 18:21               ` Gábor Stefanik
2010-02-19 18:24                 ` Johannes Berg
2010-02-19 18:33                   ` Gábor Stefanik
2010-02-19 18:41                     ` Johannes Berg
2010-02-19 18:10           ` Larry Finger
2010-02-19 18:19             ` Johannes Berg

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=1265745883-3392-11-git-send-email-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).