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: b43-dev@lists.infradead.org, "Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH 3/3] b43: LCN-PHY: switch analog
Date: Sun, 14 Aug 2011 23:27:30 +0200	[thread overview]
Message-ID: <1313357250-8292-3-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1313357250-8292-1-git-send-email-zajec5@gmail.com>

Analog is switched on right after reading PHY version:
 read16 0xfaafc3e0 -> 0xa801
 phy_read(0x043b) -> 0x0000
phy_write(0x043b) <- 0x0000
Switched off after after killing radio:
>>> Switch Radio(OFF) end
 phy_read(0x043c) -> 0x0000
phy_write(0x043c) <- 0x0007
 phy_read(0x043b) -> 0x0000
phy_write(0x043b) <- 0x0007

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
Again, MMIO hacks to find masks & sets.

Sets came from:
>>> analog(OFF) start
 phy_read(0x043c) -> 0x0000
phy_write(0x043c) <- 0x0007
 phy_read(0x043b) -> 0x0000
phy_write(0x043b) <- 0x0007
>>> analog(OFF) end

There is no masking for OFF:
>>> analog(OFF) start
 phy_read(0x043c) -> 0xffff
phy_write(0x043c) <- 0xffff
 phy_read(0x043b) -> 0xffff
phy_write(0x043b) <- 0xffff
>>> analog(OFF) end

Mask for ON came from
 phy_read(0x043b) -> 0xffff
phy_write(0x043b) <- 0xfff8
(there was not masking for ON).
---
 drivers/net/wireless/b43/phy_lcn.c |   12 +++++++++++-
 drivers/net/wireless/b43/phy_lcn.h |    2 ++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index 69a93b5..0fd72c1 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -81,6 +81,16 @@ static void b43_phy_lcn_op_software_rfkill(struct b43_wldev *dev,
 	}
 }
 
+static void b43_phy_lcn_op_switch_analog(struct b43_wldev *dev, bool on)
+{
+	if (on) {
+		b43_phy_mask(dev, B43_PHY_LCN_AFE_CTL1, ~0x7);
+	} else {
+		b43_phy_set(dev, B43_PHY_LCN_AFE_CTL2, 0x7);
+		b43_phy_set(dev, B43_PHY_LCN_AFE_CTL1, 0x7);
+	}
+}
+
 static unsigned int b43_phy_lcn_op_get_default_chan(struct b43_wldev *dev)
 {
 	if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
@@ -115,8 +125,8 @@ const struct b43_phy_operations b43_phyops_lcn = {
 	.radio_write		= b43_phy_lcn_op_radio_write,
 	*/
 	.software_rfkill	= b43_phy_lcn_op_software_rfkill,
-	/*
 	.switch_analog		= b43_phy_lcn_op_switch_analog,
+	/*
 	.switch_channel		= b43_phy_lcn_op_switch_channel,
 	*/
 	.get_default_chan	= b43_phy_lcn_op_get_default_chan,
diff --git a/drivers/net/wireless/b43/phy_lcn.h b/drivers/net/wireless/b43/phy_lcn.h
index 89f13b2..371e07d 100644
--- a/drivers/net/wireless/b43/phy_lcn.h
+++ b/drivers/net/wireless/b43/phy_lcn.h
@@ -4,6 +4,8 @@
 #include "phy_common.h"
 
 
+#define B43_PHY_LCN_AFE_CTL1			B43_PHY_OFDM(0x03B)
+#define B43_PHY_LCN_AFE_CTL2			B43_PHY_OFDM(0x03C)
 #define B43_PHY_LCN_RF_CTL1			B43_PHY_OFDM(0x04C)
 #define B43_PHY_LCN_RF_CTL2			B43_PHY_OFDM(0x04D)
 #define B43_PHY_LCN_RF_CTL3			B43_PHY_OFDM(0x0B0)
-- 
1.7.3.4


      parent reply	other threads:[~2011-08-14 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 21:27 [PATCH 1/3] b43: LCN-PHY: add very basic PHY ops Rafał Miłecki
2011-08-14 21:27 ` [PATCH 2/3] b43: LCN-PHY: implement disabling radio Rafał Miłecki
2011-08-14 23:24   ` Gábor Stefanik
2011-08-15  8:14     ` Rafał Miłecki
2011-08-15 13:18     ` David Woodhouse
2011-08-26 19:30       ` Henry Ptasinski
2011-08-14 21:27 ` Rafał Miłecki [this message]

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=1313357250-8292-3-git-send-email-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=b43-dev@lists.infradead.org \
    --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).