* [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup
@ 2010-01-17 12:03 Rafał Miłecki
2010-01-17 16:37 ` Gábor Stefanik
0 siblings, 1 reply; 5+ messages in thread
From: Rafał Miłecki @ 2010-01-17 12:03 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org, John W. Linville
Cc: bcm43xx-dev@lists.berlios.de
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/phy_n.c | 112 +++++++++++++++++++++++++++++++++++++-
1 files changed, 110 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 4a1853b..34dd4a2 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1505,6 +1505,114 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
return target;
}
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
+static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
+{
+ u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
+
+ if (dev->phy.rev >= 3) {
+ b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[0]);
+ b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]);
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]);
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[3]);
+ b43_phy_write(dev, B43_NPHY_BBCFG, regs[4]);
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
+ width 16, and data from regs[5] */
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 19,
+ width 16, and data from regs[6] */
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[7]);
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[8]);
+ b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]);
+ b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]);
+ b43_nphy_reset_cca(dev);
+ } else {
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, regs[0]);
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, regs[1]);
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]);
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
+ width 16, and data from regs[3] */
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 18,
+ width 16, and data from regs[4] */
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[5]);
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[6]);
+ }
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
+static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
+{
+ u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
+ u16 tmp;
+
+ regs[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
+ regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
+ if (dev->phy.rev >= 3) {
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0xF0FF, 0x0A00);
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0xF0FF, 0x0A00);
+
+ tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1);
+ regs[2] = tmp;
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, tmp | 0x0600);
+
+ tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
+ regs[3] = tmp;
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x0600);
+
+ regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG);
+ b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX);
+
+ /* TODO: Read an N PHY Table with ID 8, length 1, offset 3,
+ width 16, and data pointing to tmp */
+ regs[5] = tmp;
+
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
+ width 16, and data 0 */
+ /* TODO: Read an N PHY Table with ID 8, length 1, offset 19,
+ width 16, and data pointing to tmp */
+ regs[6] = tmp;
+
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 19,
+ width 16, and data 0 */
+ regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
+ regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
+
+ /* TODO: Call N PHY RF Ctrl Intc Override with 2, 1, 3 */
+ /* TODO: Call N PHY RF Ctrl Intc Override with 1, 2, 1 */
+ /* TODO: Call N PHY RF Ctrl Intc Override with 1, 8, 2 */
+
+ regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0);
+ regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1);
+ b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001);
+ b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001);
+ } else {
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, 0xA000);
+ b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, 0xA000);
+ tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
+ regs[2] = tmp;
+ b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000);
+ /* TODO: Read an N PHY Table with ID 8, length 1, offset 2,
+ width 16, and data pointing to tmp */
+ regs[3] = tmp;
+ tmp |= 0x2000;
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
+ width 16, and data pointer tmp */
+ /* TODO: Read an N PHY Table with ID 8, length 1, offset 18,
+ width 16, and data pointer tmp */
+ regs[4] = tmp;
+ tmp |= 0x2000;
+ /* TODO: Write an N PHY Table with ID 8, length 1, offset 18,
+ width 16, and data pointer tmp */
+ regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
+ regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
+ if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+ tmp = 0x0180;
+ else
+ tmp = 0x0120;
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, tmp);
+ b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, tmp);
+ }
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
static void b43_nphy_restore_cal(struct b43_wldev *dev)
{
@@ -1617,7 +1725,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
width 16, and data pointer gain */
b43_nphy_tx_cal_radio_setup(dev);
- /* TODO: Call N PHY TX Cal PHY Setup */
+ b43_nphy_tx_cal_phy_setup(dev);
phy6or5x = dev->phy.rev >= 6 ||
(dev->phy.rev == 5 && nphy->ipa2g_on &&
@@ -1788,7 +1896,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0);
}
- /* TODO: Call N PHY TX Cal PHY Cleanup */
+ b43_nphy_tx_cal_phy_cleanup(dev);
/* TODO: Write an N PHY Table with ID 7, length 2, offset 0x110,
width 16, and data from save */
--
1.6.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup
2010-01-17 12:03 [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup Rafał Miłecki
@ 2010-01-17 16:37 ` Gábor Stefanik
2010-01-17 16:41 ` Michael Buesch
0 siblings, 1 reply; 5+ messages in thread
From: Gábor Stefanik @ 2010-01-17 16:37 UTC (permalink / raw)
To: Rafał Miłecki
Cc: linux-wireless@vger.kernel.org, John W. Linville,
bcm43xx-dev@lists.berlios.de
2010/1/17 Rafał Miłecki <zajec5@gmail.com>:
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> drivers/net/wireless/b43/phy_n.c | 112
> +++++++++++++++++++++++++++++++++++++-
> 1 files changed, 110 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_n.c
> b/drivers/net/wireless/b43/phy_n.c
> index 4a1853b..34dd4a2 100644
> --- a/drivers/net/wireless/b43/phy_n.c
> +++ b/drivers/net/wireless/b43/phy_n.c
> @@ -1505,6 +1505,114 @@ static struct nphy_txgains
> b43_nphy_get_tx_gains(struct b43_wldev *dev)
> return target;
> }
>
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
> +static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
> +{
> + u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
> +
> + if (dev->phy.rev >= 3) {
> + b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[0]);
> + b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]);
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]);
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[3]);
> + b43_phy_write(dev, B43_NPHY_BBCFG, regs[4]);
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
> + width 16, and data from regs[5] */
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset
> 19,
While you are at it, why aren't you programming these table writes?
The table handling functions are AFAIK already in place...
> + width 16, and data from regs[6] */
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[7]);
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[8]);
> + b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]);
> + b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]);
> + b43_nphy_reset_cca(dev);
> + } else {
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, regs[0]);
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, regs[1]);
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]);
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
> + width 16, and data from regs[3] */
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset
> 18,
> + width 16, and data from regs[4] */
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[5]);
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[6]);
> + }
> +}
> +
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
> +static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
> +{
> + u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
> + u16 tmp;
> +
> + regs[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
> + regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
> + if (dev->phy.rev >= 3) {
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0xF0FF, 0x0A00);
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0xF0FF, 0x0A00);
> +
> + tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1);
> + regs[2] = tmp;
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, tmp | 0x0600);
> +
> + tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
> + regs[3] = tmp;
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x0600);
> +
> + regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG);
> + b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX);
> +
> + /* TODO: Read an N PHY Table with ID 8, length 1, offset 3,
> + width 16, and data pointing to tmp */
> + regs[5] = tmp;
> +
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
> + width 16, and data 0 */
> + /* TODO: Read an N PHY Table with ID 8, length 1, offset 19,
> + width 16, and data pointing to tmp */
> + regs[6] = tmp;
> +
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset
> 19,
> + width 16, and data 0 */
> + regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
> + regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
> +
> + /* TODO: Call N PHY RF Ctrl Intc Override with 2, 1, 3 */
> + /* TODO: Call N PHY RF Ctrl Intc Override with 1, 2, 1 */
> + /* TODO: Call N PHY RF Ctrl Intc Override with 1, 8, 2 */
> +
> + regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0);
> + regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1);
> + b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001);
> + b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001);
> + } else {
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, 0xA000);
> + b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, 0xA000);
> + tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
> + regs[2] = tmp;
> + b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000);
> + /* TODO: Read an N PHY Table with ID 8, length 1, offset 2,
> + width 16, and data pointing to tmp */
> + regs[3] = tmp;
> + tmp |= 0x2000;
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
> + width 16, and data pointer tmp */
> + /* TODO: Read an N PHY Table with ID 8, length 1, offset 18,
> + width 16, and data pointer tmp */
> + regs[4] = tmp;
> + tmp |= 0x2000;
> + /* TODO: Write an N PHY Table with ID 8, length 1, offset
> 18,
> + width 16, and data pointer tmp */
> + regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
> + regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
> + if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
> + tmp = 0x0180;
> + else
> + tmp = 0x0120;
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, tmp);
> + b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, tmp);
> + }
> +}
> +
> /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
> static void b43_nphy_restore_cal(struct b43_wldev *dev)
> {
> @@ -1617,7 +1725,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev
> *dev,
> width 16, and data pointer gain */
>
> b43_nphy_tx_cal_radio_setup(dev);
> - /* TODO: Call N PHY TX Cal PHY Setup */
> + b43_nphy_tx_cal_phy_setup(dev);
>
> phy6or5x = dev->phy.rev >= 6 ||
> (dev->phy.rev == 5 && nphy->ipa2g_on &&
> @@ -1788,7 +1896,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev
> *dev,
> b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0);
> }
>
> - /* TODO: Call N PHY TX Cal PHY Cleanup */
> + b43_nphy_tx_cal_phy_cleanup(dev);
> /* TODO: Write an N PHY Table with ID 7, length 2, offset 0x110,
> width 16, and data from save */
>
> --
> 1.6.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup
2010-01-17 16:37 ` Gábor Stefanik
@ 2010-01-17 16:41 ` Michael Buesch
2010-01-17 16:44 ` Gábor Stefanik
0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2010-01-17 16:41 UTC (permalink / raw)
To: bcm43xx-dev
Cc: Gábor Stefanik, Rafał Miłecki,
linux-wireless@vger.kernel.org
On Sunday 17 January 2010 17:37:29 Gábor Stefanik wrote:
> While you are at it, why aren't you programming these table writes?
> The table handling functions are AFAIK already in place...
Because we like small patches.
Please do _not_ increase the patchsize.
--
Greetings, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup
2010-01-17 16:41 ` Michael Buesch
@ 2010-01-17 16:44 ` Gábor Stefanik
2010-01-17 16:48 ` Rafał Miłecki
0 siblings, 1 reply; 5+ messages in thread
From: Gábor Stefanik @ 2010-01-17 16:44 UTC (permalink / raw)
To: Michael Buesch
Cc: bcm43xx-dev, Rafał Miłecki,
linux-wireless@vger.kernel.org
On Sun, Jan 17, 2010 at 5:41 PM, Michael Buesch <mb@bu3sch.de> wrote:
> On Sunday 17 January 2010 17:37:29 Gábor Stefanik wrote:
>> While you are at it, why aren't you programming these table writes?
>> The table handling functions are AFAIK already in place...
>
> Because we like small patches.
> Please do _not_ increase the patchsize.
They do not increase patch size - table reads/writes are one-line (in
fact, they are shorter than the placeholder comments in place of
them).
>
> --
> Greetings, Michael.
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup
2010-01-17 16:44 ` Gábor Stefanik
@ 2010-01-17 16:48 ` Rafał Miłecki
0 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2010-01-17 16:48 UTC (permalink / raw)
To: Gábor Stefanik
Cc: Michael Buesch, bcm43xx-dev, linux-wireless@vger.kernel.org
2010/1/17 Gábor Stefanik <netrolller.3d@gmail.com>:
> On Sun, Jan 17, 2010 at 5:41 PM, Michael Buesch <mb@bu3sch.de> wrote:
>> On Sunday 17 January 2010 17:37:29 Gábor Stefanik wrote:
>>> While you are at it, why aren't you programming these table writes?
>>> The table handling functions are AFAIK already in place...
>>
>> Because we like small patches.
>> Please do _not_ increase the patchsize.
>
> They do not increase patch size - table reads/writes are one-line (in
> fact, they are shorter than the placeholder comments in place of
> them).
Well, I just started implementing code without understanding of
tables... and got stick in implementing functions. There are some
"crazy" IDs, offsets and it's not only writing but also some
mysterious table reading... You know, it just sounds scary ;)
I'll have to finally read specs/existing code for tables, understand
it and implement.
--
Rafał
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-17 16:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 12:03 [PATCH 2/7] b43: N-PHY: implement TX PHY cleanup and setup Rafał Miłecki
2010-01-17 16:37 ` Gábor Stefanik
2010-01-17 16:41 ` Michael Buesch
2010-01-17 16:44 ` Gábor Stefanik
2010-01-17 16:48 ` Rafał Miłecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox