2010-01-22 00:53:14

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 0/5] b43: more N-PHY stuff

John, I hope to have patch submission fixed, please let me know if there
is anything wrong still.

Rafał Miłecki (5):
b43: check band width
b43: N-PHY: implement overriding RF control
b43: N-PHY: add running samples
b43: N-PHY: add setting power amplifier filters
b43: N-PHY: add TX tone

drivers/net/wireless/b43/main.c | 6 +
drivers/net/wireless/b43/phy_common.h | 3 +
drivers/net/wireless/b43/phy_n.c | 253 ++++++++++++++++++++++++++++++--
drivers/net/wireless/b43/tables_nphy.c | 61 ++++++++
drivers/net/wireless/b43/tables_nphy.h | 22 +++
5 files changed, 330 insertions(+), 15 deletions(-)



2010-01-22 21:45:31

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Fri, Jan 22, 2010 at 01:53:11AM +0100, Rafał Miłecki wrote:
> John, I hope to have patch submission fixed, please let me know if there
> is anything wrong still.

This batch applied with no problems -- thanks, Rafał!

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-01-22 00:53:38

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 2/5] b43: N-PHY: implement overriding RF control

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 82 ++++++++++++++++++++++++++++++-
drivers/net/wireless/b43/tables_nphy.c | 37 ++++++++++++++
drivers/net/wireless/b43/tables_nphy.h | 21 ++++++++
3 files changed, 137 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2cdf32e..d3c9783 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -912,6 +912,82 @@ ok:
b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */
+static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
+ u16 value, u8 core, bool off)
+{
+ int i;
+ u8 index = fls(field);
+ u8 addr, en_addr, val_addr;
+ /* we expect only one bit set */
+ B43_WARN_ON(field & (~(1 << index)));
+
+ if (dev->phy.rev >= 3) {
+ const struct nphy_rf_control_override_rev3 *rf_ctrl;
+ for (i = 0; i < 2; i++) {
+ if (index == 0 || index == 16) {
+ b43err(dev->wl,
+ "Unsupported RF Ctrl Override call\n");
+ return;
+ }
+
+ rf_ctrl = &tbl_rf_control_override_rev3[index - 1];
+ en_addr = B43_PHY_N((i == 0) ?
+ rf_ctrl->en_addr0 : rf_ctrl->en_addr1);
+ val_addr = B43_PHY_N((i == 0) ?
+ rf_ctrl->val_addr0 : rf_ctrl->val_addr1);
+
+ if (off) {
+ b43_phy_mask(dev, en_addr, ~(field));
+ b43_phy_mask(dev, val_addr,
+ ~(rf_ctrl->val_mask));
+ } else {
+ if (core == 0 || ((1 << core) & i) != 0) {
+ b43_phy_set(dev, en_addr, field);
+ b43_phy_maskset(dev, val_addr,
+ ~(rf_ctrl->val_mask),
+ (value << rf_ctrl->val_shift));
+ }
+ }
+ }
+ } else {
+ const struct nphy_rf_control_override_rev2 *rf_ctrl;
+ if (off) {
+ b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~(field));
+ value = 0;
+ } else {
+ b43_phy_set(dev, B43_NPHY_RFCTL_OVER, field);
+ }
+
+ for (i = 0; i < 2; i++) {
+ if (index <= 1 || index == 16) {
+ b43err(dev->wl,
+ "Unsupported RF Ctrl Override call\n");
+ return;
+ }
+
+ if (index == 2 || index == 10 ||
+ (index >= 13 && index <= 15)) {
+ core = 1;
+ }
+
+ rf_ctrl = &tbl_rf_control_override_rev2[index - 2];
+ addr = B43_PHY_N((i == 0) ?
+ rf_ctrl->addr0 : rf_ctrl->addr1);
+
+ if ((core & (1 << i)) != 0)
+ b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask),
+ (value << rf_ctrl->shift));
+
+ b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1);
+ b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
+ B43_NPHY_RFCTL_CMD_START);
+ udelay(1);
+ b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, 0xFFFE);
+ }
+ }
+}
+
static void b43_nphy_bphy_init(struct b43_wldev *dev)
{
unsigned int i;
@@ -2075,8 +2151,8 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,

tmp[0] = ((cur_hpf2 << 8) | (cur_hpf1 << 4) |
(cur_lna << 2));
- /* TODO:Call N PHY RF Ctrl Override with 0x400, tmp[0],
- 3, 0 as arguments */
+ b43_nphy_rf_control_override(dev, 0x400, tmp[0], 3,
+ false);
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
b43_nphy_stop_playback(dev);

@@ -2124,7 +2200,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
break;
}

- /* TODO: Call N PHY RF Ctrl Override with 0x400, 0, 3, 1 as arguments*/
+ b43_nphy_rf_control_override(dev, 0x400, 0, 3, true);
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save);

diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index b8c9fc6..dd9687d 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -2883,6 +2883,43 @@ const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = {
0x9084, 0x9267, 0x9056, 0x9234
};

+/* addr0, addr1, bmask, shift */
+const struct nphy_rf_control_override_rev2 tbl_rf_control_override_rev2[] = {
+ { 0x78, 0x78, 0x0038, 3 }, /* for field == 0x0002 (fls == 2) */
+ { 0x7A, 0x7D, 0x0001, 0 }, /* for field == 0x0004 (fls == 3) */
+ { 0x7A, 0x7D, 0x0002, 1 }, /* for field == 0x0008 (fls == 4) */
+ { 0x7A, 0x7D, 0x0004, 2 }, /* for field == 0x0010 (fls == 5) */
+ { 0x7A, 0x7D, 0x0030, 4 }, /* for field == 0x0020 (fls == 6) */
+ { 0x7A, 0x7D, 0x00C0, 6 }, /* for field == 0x0040 (fls == 7) */
+ { 0x7A, 0x7D, 0x0100, 8 }, /* for field == 0x0080 (fls == 8) */
+ { 0x7A, 0x7D, 0x0200, 9 }, /* for field == 0x0100 (fls == 9) */
+ { 0x78, 0x78, 0x0004, 2 }, /* for field == 0x0200 (fls == 10) */
+ { 0x7B, 0x7E, 0x01FF, 0 }, /* for field == 0x0400 (fls == 11) */
+ { 0x7C, 0x7F, 0x01FF, 0 }, /* for field == 0x0800 (fls == 12) */
+ { 0x78, 0x78, 0x0100, 8 }, /* for field == 0x1000 (fls == 13) */
+ { 0x78, 0x78, 0x0200, 9 }, /* for field == 0x2000 (fls == 14) */
+ { 0x78, 0x78, 0xF000, 12 } /* for field == 0x4000 (fls == 15) */
+};
+
+/* val_mask, val_shift, en_addr0, val_addr0, en_addr1, val_addr1 */
+const struct nphy_rf_control_override_rev3 tbl_rf_control_override_rev3[] = {
+ { 0x8000, 15, 0xE5, 0xF9, 0xE6, 0xFB }, /* field == 0x0001 (fls 1) */
+ { 0x0001, 0, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0002 (fls 2) */
+ { 0x0002, 1, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0004 (fls 3) */
+ { 0x0004, 2, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0008 (fls 4) */
+ { 0x0016, 4, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0010 (fls 5) */
+ { 0x0020, 5, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0020 (fls 6) */
+ { 0x0040, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0040 (fls 7) */
+ { 0x0080, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0080 (fls 8) */
+ { 0x0100, 7, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0100 (fls 9) */
+ { 0x0007, 0, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0200 (fls 10) */
+ { 0x0070, 4, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0400 (fls 11) */
+ { 0xE000, 13, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0800 (fls 12) */
+ { 0xFFFF, 0, 0xE7, 0x7B, 0xEC, 0x7E }, /* field == 0x1000 (fls 13) */
+ { 0xFFFF, 0, 0xE7, 0x7C, 0xEC, 0x7F }, /* field == 0x2000 (fls 14) */
+ { 0x00C0, 6, 0xE7, 0xF9, 0xEC, 0xFB } /* field == 0x4000 (fls 15) */
+};
+
static inline void assert_ntab_array_sizes(void)
{
#undef check
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index 6bbef89..5d38172 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -51,6 +51,22 @@ struct nphy_txiqcal_ladder {
u8 g_env;
};

+struct nphy_rf_control_override_rev2 {
+ u8 addr0;
+ u8 addr1;
+ u16 bmask;
+ u8 shift;
+};
+
+struct nphy_rf_control_override_rev3 {
+ u16 val_mask;
+ u8 val_shift;
+ u8 en_addr0;
+ u8 val_addr0;
+ u8 en_addr1;
+ u8 val_addr1;
+};
+
/* Upload the default register value table.
* If "ghz5" is true, we upload the 5Ghz table. Otherwise the 2.4Ghz
* table is uploaded. If "ignore_uploadflag" is true, we upload any value
@@ -178,4 +194,9 @@ extern const u16 tbl_tx_iqlo_cal_cmds_recal[];
extern const u16 tbl_tx_iqlo_cal_cmds_fullcal[];
extern const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[];

+extern const struct nphy_rf_control_override_rev2
+ tbl_rf_control_override_rev2[];
+extern const struct nphy_rf_control_override_rev3
+ tbl_rf_control_override_rev3[];
+
#endif /* B43_TABLES_NPHY_H_ */
--
1.6.4.2


2010-01-22 15:01:59

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

2010/1/22 Rafał Miłecki <[email protected]>:
> John, I hope to have patch submission fixed, please let me know if there
> is anything wrong still.

Nope, it is still base64-encoded.

I personally use Thunderbird 2 for patch submission (had weird
problems with Thunderbird 3 beta - not sure about the final version).

>
> Rafał Miłecki (5):
>  b43: check band width
>  b43: N-PHY: implement overriding RF control
>  b43: N-PHY: add running samples
>  b43: N-PHY: add setting power amplifier filters
>  b43: N-PHY: add TX tone
>
>  drivers/net/wireless/b43/main.c        |    6 +
>  drivers/net/wireless/b43/phy_common.h  |    3 +
>  drivers/net/wireless/b43/phy_n.c       |  253 ++++++++++++++++++++++++++++++--
>  drivers/net/wireless/b43/tables_nphy.c |   61 ++++++++
>  drivers/net/wireless/b43/tables_nphy.h |   22 +++
>  5 files changed, 330 insertions(+), 15 deletions(-)
>
> _______________________________________________
> Bcm43xx-dev mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/bcm43xx-dev
>



--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2010-01-23 01:30:42

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Fri, Jan 22, 2010 at 11:33:40PM +0100, Michael Buesch wrote:

> So while we are at it, I'd really like to migrate away from the berlios list.
> It's really just annoying. Does somebody have a good reliable mailinglist service
> we could migrate to? Does vger offer lists to driver projects?

Probably -- I think davem is the person to ask? Infradead is probably
another option (dwmw2).

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-01-22 00:53:27

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 1/5] b43: check band width

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/main.c | 6 ++++++
drivers/net/wireless/b43/phy_common.h | 3 +++
drivers/net/wireless/b43/phy_n.c | 2 +-
3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9c5c7c9..a826e68 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3571,6 +3571,12 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
dev = wl->current_dev;
phy = &dev->phy;

+ if (conf_is_ht(conf))
+ phy->is_40mhz =
+ (conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf));
+ else
+ phy->is_40mhz = false;
+
b43_mac_suspend(dev);

if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index 9edd4e8..f635f9e 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -212,6 +212,9 @@ struct b43_phy {
bool supports_2ghz;
bool supports_5ghz;

+ /* HT info */
+ bool is_40mhz;
+
/* GMODE bit enabled? */
bool gmode;

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index e77f1f2..2cdf32e 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1787,7 +1787,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,

b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x8AA9);

- if (1 /* FIXME: the band width is 20 MHz */)
+ if (!dev->phy.is_40mhz)
freq = 2500;
else
freq = 5000;
--
1.6.4.2


2010-01-23 15:09:54

by Stefano Brivio

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Sat, 23 Jan 2010 12:33:00 +0100
Michael Buesch <[email protected]> wrote:

> On Saturday 23 January 2010 04:36:50 David Woodhouse wrote:
> >
> > Can you provide a list of existing subscribers?
>
> I think Stefano has access to our berlios mailman.

Last time I tried, I couldn't get berlios mailman to export the list of
subscribers properly. I'll try to get around this (probably, HTML
parsing is my best bet).


--
Ciao
Stefano

2010-01-22 22:33:44

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Friday 22 January 2010 22:59:26 Michael Buesch wrote:
> On Friday 22 January 2010 21:47:03 Rafał Miłecki wrote:
> > As you can see I've used git send-email for submission this time! I've
> > no idea what I did wrong that patch 1/5 was sent incorrectly. I just
> > generated patches with
> > git format-patch --cover-letter -o b43
> > , then modified 0000-...patch (ONLY this one) and finally sent all
> > patches from b43 directory.
>
> The mails may be re-encoded on intermediate mailservers.
> My server, for example, re-encodes all of your mails to base64.
> (or it may be the list-mailserver re-encoding the mails, because by server
> doesn't advertise the correct flags, I dunno...)
> I don't know why it does this, however. I'm still pretty sure that it's related
> to the characters in your name. Does anybody has an idea how to fix this? I'm using exim.
>

Oh, I just realize that these patches received via vger.kernel.org list are just fine.
It's just berlios' mailman which mangles the mails for me. Which is not surprising,
because berlios is a really really broken platform and its mailservers are even worse than that.

So I guess everything is fine now.

So while we are at it, I'd really like to migrate away from the berlios list.
It's really just annoying. Does somebody have a good reliable mailinglist service
we could migrate to? Does vger offer lists to driver projects?

--
Greetings, Michael.

2010-01-23 03:37:06

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Fri, 2010-01-22 at 20:16 -0500, John W. Linville wrote:
> On Fri, Jan 22, 2010 at 11:33:40PM +0100, Michael Buesch wrote:
>
> > So while we are at it, I'd really like to migrate away from the berlios list.
> > It's really just annoying. Does somebody have a good reliable mailinglist service
> > we could migrate to? Does vger offer lists to driver projects?
>
> Probably -- I think davem is the person to ask? Infradead is probably
> another option (dwmw2).

Yeah, pick one and either of us can set up a new list at the drop of a
hat. Strictly speaking I suspect it should be postmaster@vger rather
than just davem, but the effect is much the same most of the time.

Can you provide a list of existing subscribers?

--
David Woodhouse Open Source Technology Centre
[email protected] Intel Corporation


2010-01-22 21:59:32

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Friday 22 January 2010 21:47:03 Rafał Miłecki wrote:
> As you can see I've used git send-email for submission this time! I've
> no idea what I did wrong that patch 1/5 was sent incorrectly. I just
> generated patches with
> git format-patch --cover-letter -o b43
> , then modified 0000-...patch (ONLY this one) and finally sent all
> patches from b43 directory.

The mails may be re-encoded on intermediate mailservers.
My server, for example, re-encodes all of your mails to base64.
(or it may be the list-mailserver re-encoding the mails, because by server
doesn't advertise the correct flags, I dunno...)
I don't know why it does this, however. I'm still pretty sure that it's related
to the characters in your name. Does anybody has an idea how to fix this? I'm using exim.

--
Greetings, Michael.

2010-01-22 00:53:45

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 3/5] b43: N-PHY: add running samples

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 68 +++++++++++++++++++++++++++++++++++--
1 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index d3c9783..f5900f0 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -816,6 +816,66 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)
b43_nphy_stay_in_carrier_search(dev, 0);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
+static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
+ u16 wait, bool iqmode, bool dac_test)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+ int i;
+ u16 seq_mode;
+ u32 tmp;
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_in_carrier_search(dev, true);
+
+ if ((nphy->bb_mult_save & 0x80000000) == 0) {
+ tmp = b43_ntab_read(dev, B43_NTAB16(15, 87));
+ nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000;
+ }
+
+ if (!dev->phy.is_40mhz)
+ tmp = 0x6464;
+ else
+ tmp = 0x4747;
+ b43_ntab_write(dev, B43_NTAB16(15, 87), tmp);
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_in_carrier_search(dev, false);
+
+ b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1));
+
+ if (loops != 0xFFFF)
+ b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, (loops - 1));
+ else
+ b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, loops);
+
+ b43_phy_write(dev, B43_NPHY_SAMP_WAITCNT, wait);
+
+ seq_mode = b43_phy_read(dev, B43_NPHY_RFSEQMODE);
+
+ b43_phy_set(dev, B43_NPHY_RFSEQMODE, B43_NPHY_RFSEQMODE_CAOVER);
+ if (iqmode) {
+ b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF);
+ b43_phy_set(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x8000);
+ } else {
+ if (dac_test)
+ b43_phy_write(dev, B43_NPHY_SAMP_CMD, 5);
+ else
+ b43_phy_write(dev, B43_NPHY_SAMP_CMD, 1);
+ }
+ for (i = 0; i < 100; i++) {
+ if (b43_phy_read(dev, B43_NPHY_RFSEQST) & 1) {
+ i = 0;
+ break;
+ }
+ udelay(10);
+ }
+ if (i)
+ b43err(dev->wl, "run samples timeout\n");
+
+ b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode);
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
{
@@ -1869,8 +1929,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
freq = 5000;

if (nphy->mphase_cal_phase_id > 2)
- ;/* TODO: Call N PHY Run Samples with (band width * 8),
- 0xFFFF, 0, 1, 0 as arguments */
+ b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8,
+ 0xFFFF, 0, true, false);
else
;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments
and save result as error */
@@ -2162,8 +2222,8 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
as arguments and save result as ret */
playtone = false;
} else {
- /* TODO: Call N PHY Run Samples with 160,
- 0xFFFF, 0, 0, 0 as arguments */
+ b43_nphy_run_samples(dev, 160, 0xFFFF, 0,
+ false, false);
}

if (ret == 0) {
--
1.6.4.2


2010-01-22 00:53:51

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 4/5] b43: N-PHY: add setting power amplifier filters

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 41 ++++++++++++++++++++++++++++++-
drivers/net/wireless/b43/tables_nphy.c | 24 ++++++++++++++++++
drivers/net/wireless/b43/tables_nphy.h | 1 +
3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index f5900f0..97a44e4 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1628,6 +1628,43 @@ static void b43_nphy_update_tx_cal_ladder(struct b43_wldev *dev, u16 core)
}
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */
+static void b43_nphy_ext_pa_set_tx_dig_filters(struct b43_wldev *dev)
+{
+ int i;
+ for (i = 0; i < 15; i++)
+ b43_phy_write(dev, B43_PHY_N(0x2C5 + i),
+ tbl_tx_filter_coef_rev4[2][i]);
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */
+static void b43_nphy_int_pa_set_tx_dig_filters(struct b43_wldev *dev)
+{
+ int i, j;
+ /* B43_NPHY_TXF_20CO_S0A1, B43_NPHY_TXF_40CO_S0A1, unknown */
+ u16 offset[] = { 0x186, 0x195, 0x2C5 };
+
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 15; j++)
+ b43_phy_write(dev, B43_PHY_N(offset[i] + j),
+ tbl_tx_filter_coef_rev4[i][j]);
+
+ if (dev->phy.is_40mhz) {
+ for (j = 0; j < 15; j++)
+ b43_phy_write(dev, B43_PHY_N(offset[0] + j),
+ tbl_tx_filter_coef_rev4[3][j]);
+ } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+ for (j = 0; j < 15; j++)
+ b43_phy_write(dev, B43_PHY_N(offset[0] + j),
+ tbl_tx_filter_coef_rev4[5][j]);
+ }
+
+ if (dev->phy.channel == 14)
+ for (j = 0; j < 15; j++)
+ b43_phy_write(dev, B43_PHY_N(offset[0] + j),
+ tbl_tx_filter_coef_rev4[6][j]);
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
{
@@ -2371,9 +2408,9 @@ int b43_phy_initn(struct b43_wldev *dev)
b43_phy_set(dev, B43_NPHY_PAPD_EN1, 0x1);
b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ1, 0x007F,
nphy->papd_epsilon_offset[1] << 7);
- /* TODO N PHY IPA Set TX Dig Filters */
+ b43_nphy_int_pa_set_tx_dig_filters(dev);
} else if (phy->rev >= 5) {
- /* TODO N PHY Ext PA Set TX Dig Filters */
+ b43_nphy_ext_pa_set_tx_dig_filters(dev);
}

b43_nphy_workarounds(dev);
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index dd9687d..a00d509 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -2883,6 +2883,30 @@ const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = {
0x9084, 0x9267, 0x9056, 0x9234
};

+const s16 tbl_tx_filter_coef_rev4[7][15] = {
+ { -377, 137, -407, 208, -1527,
+ 956, 93, 186, 93, 230,
+ -44, 230, 20, -191, 201 },
+ { -77, 20, -98, 49, -93,
+ 60, 56, 111, 56, 26,
+ -5, 26, 34, -32, 34 },
+ { -360, 164, -376, 164, -1533,
+ 576, 308, -314, 308, 121,
+ -73, 121, 91, 124, 91 },
+ { -295, 200, -363, 142, -1391,
+ 826, 151, 301, 151, 151,
+ 301, 151, 602, -752, 602 },
+ { -92, 58, -96, 49, -104,
+ 44, 17, 35, 17, 12,
+ 25, 12, 13, 27, 13 },
+ { -375, 136, -399, 209, -1479,
+ 949, 130, 260, 130, 230,
+ -44, 230, 201, -191, 201 },
+ { 0xed9, 0xc8, 0xe95, 0x8e, 0xa91,
+ 0x33a, 0x97, 0x12d, 0x97, 0x97,
+ 0x12d, 0x97, 0x25a, 0xd10, 0x25a }
+};
+
/* addr0, addr1, bmask, shift */
const struct nphy_rf_control_override_rev2 tbl_rf_control_override_rev2[] = {
{ 0x78, 0x78, 0x0038, 3 }, /* for field == 0x0002 (fls == 2) */
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index 5d38172..9c1c6ec 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -193,6 +193,7 @@ extern const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[];
extern const u16 tbl_tx_iqlo_cal_cmds_recal[];
extern const u16 tbl_tx_iqlo_cal_cmds_fullcal[];
extern const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[];
+extern const s16 tbl_tx_filter_coef_rev4[7][15];

extern const struct nphy_rf_control_override_rev2
tbl_rf_control_override_rev2[];
--
1.6.4.2


2010-01-23 11:33:09

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On Saturday 23 January 2010 04:36:50 David Woodhouse wrote:
> On Fri, 2010-01-22 at 20:16 -0500, John W. Linville wrote:
> > On Fri, Jan 22, 2010 at 11:33:40PM +0100, Michael Buesch wrote:
> >
> > > So while we are at it, I'd really like to migrate away from the berlios list.
> > > It's really just annoying. Does somebody have a good reliable mailinglist service
> > > we could migrate to? Does vger offer lists to driver projects?
> >
> > Probably -- I think davem is the person to ask? Infradead is probably
> > another option (dwmw2).
>
> Yeah, pick one and either of us can set up a new list at the drop of a
> hat. Strictly speaking I suspect it should be postmaster@vger rather
> than just davem, but the effect is much the same most of the time.
>
> Can you provide a list of existing subscribers?

I think Stefano has access to our berlios mailman.

--
Greetings, Michael.

2010-01-22 15:21:24

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

On 01/22/2010 09:01 AM, Gábor Stefanik wrote:
> 2010/1/22 Rafał Miłecki <[email protected]>:
>> John, I hope to have patch submission fixed, please let me know if there
>> is anything wrong still.
>
> Nope, it is still base64-encoded.
>
> I personally use Thunderbird 2 for patch submission (had weird
> problems with Thunderbird 3 beta - not sure about the final version).

I am reading mail with Thunderbird 3.0beta4, and only patch 1/5 was
base64-encoded. The other 4 were fine.

For the record, the final version of TBird 3 cannot read my profile. I battled
with the devs for a while, but have now given up.

Larry


2010-01-22 20:52:50

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

W dniu 22 stycznia 2010 16:01 użytkownik Gábor Stefanik
<[email protected]> napisał:
> 2010/1/22 Rafał Miłecki <[email protected]>:
>> John, I hope to have patch submission fixed, please let me know if there
>> is anything wrong still.
>
> Nope, it is still base64-encoded.
>
> I personally use Thunderbird 2 for patch submission (had weird
> problems with Thunderbird 3 beta - not sure about the final version).

I start hating that :| I checked for headers and all messages seem to have same:


Return-path: <[email protected]>
Received: from localhost.localdomain (c3-107.icpnet.pl [62.21.3.107]) by
mx.google.com with ESMTPS id 16sm1347862ewy.14.2010.01.21.16.53.24
(version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Jan 2010 16:53:25 -0800 (PST)
From: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>
To: [email protected], "John W. Linville"
<[email protected]>
Cc: [email protected], =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?=
<[email protected]>
Subject: [PATCH 1/5] b43: check band width
Date: Fri, 22 Jan 2010 01:53:12 +0100
Message-ID: <[email protected]>
X-Mailer: git-send-email 1.6.4.2
In-Reply-To: <[email protected]>
References: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rafał Miłecki <[email protected]>


=====


Return-path: <[email protected]>
Received: from localhost.localdomain (c3-107.icpnet.pl [62.21.3.107]) by
mx.google.com with ESMTPS id 16sm1347862ewy.14.2010.01.21.16.53.12
(version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Jan 2010 16:53:12 -0800 (PST)
From: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>
To: [email protected], "John W. Linville"
<[email protected]>
Cc: [email protected], =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?=
<[email protected]>
Subject: [PATCH 0/5] b43: more N-PHY stuff
Date: Fri, 22 Jan 2010 01:53:11 +0100
Message-ID: <[email protected]>
X-Mailer: git-send-email 1.6.4.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

John, I hope to have patch submission fixed, please let me know if there
is anything wrong still.


=====


Return-path: <[email protected]>
Received: from localhost.localdomain (c3-107.icpnet.pl [62.21.3.107]) by
mx.google.com with ESMTPS id 16sm1347862ewy.14.2010.01.21.16.53.34
(version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Jan 2010 16:53:34 -0800 (PST)
From: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= <[email protected]>
To: [email protected], "John W. Linville"
<[email protected]>
Cc: [email protected], =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?=
<[email protected]>
Subject: [PATCH 2/5] b43: N-PHY: implement overriding RF control
Date: Fri, 22 Jan 2010 01:53:13 +0100
Message-ID: <[email protected]>
X-Mailer: git-send-email 1.6.4.2
In-Reply-To: <[email protected]>
References: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rafał Miłecki <[email protected]>


As you can see I've used git send-email for submission this time! I've
no idea what I did wrong that patch 1/5 was sent incorrectly. I just
generated patches with
git format-patch --cover-letter -o b43
, then modified 0000-...patch (ONLY this one) and finally sent all
patches from b43 directory.

--
Rafał

2010-01-23 15:28:15

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 0/5] b43: more N-PHY stuff

2010/1/23 Stefano Brivio <[email protected]>:
> On Sat, 23 Jan 2010 12:33:00 +0100
> Michael Buesch <[email protected]> wrote:
>
>> On Saturday 23 January 2010 04:36:50 David Woodhouse wrote:
>> >
>> > Can you provide a list of existing subscribers?
>>
>> I think Stefano has access to our berlios mailman.
>
> Last time I tried, I couldn't get berlios mailman to export the list of
> subscribers properly. I'll try to get around this (probably, HTML
> parsing is my best bet).

If you're busy, please send me this HTML/whatever list, I'll check
what I can do.


--
Rafał

2010-01-22 00:53:57

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 5/5] b43: N-PHY: add TX tone

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 60 ++++++++++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 97a44e4..a45a1f3 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -816,6 +816,43 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)
b43_nphy_stay_in_carrier_search(dev, 0);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
+static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
+ bool test)
+{
+ int i;
+ u16 bw, len, num, rot, angle;
+ /* TODO: *buffer; */
+
+ bw = (dev->phy.is_40mhz) ? 40 : 20;
+ len = bw << 3;
+
+ if (test) {
+ if (b43_phy_read(dev, B43_NPHY_BBCFG) & B43_NPHY_BBCFG_RSTRX)
+ bw = 82;
+ else
+ bw = 80;
+
+ if (dev->phy.is_40mhz)
+ bw <<= 1;
+
+ len = bw << 1;
+ }
+
+ /* TODO: buffer = kzalloc(len * sizeof(u32), GFP_KERNEL); */
+ num = len;
+ rot = (((freq * 36) / bw) << 16) / 100;
+ angle = 0;
+
+ for (i = 0; i < num; i++) {
+ /* TODO */
+ }
+
+ /* TODO: Call N PHY Load Sample Table with buffer, num as arguments */
+ /* TODO: kfree(buffer); */
+ return num;
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
u16 wait, bool iqmode, bool dac_test)
@@ -876,6 +913,20 @@ static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode);
}

+/*
+ * Transmits a known value for LO calibration
+ * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
+ */
+static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val,
+ bool iqmode, bool dac_test)
+{
+ u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test);
+ if (samp == 0)
+ return -1;
+ b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test);
+ return 0;
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
{
@@ -1969,8 +2020,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8,
0xFFFF, 0, true, false);
else
- ;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments
- and save result as error */
+ error = b43_nphy_tx_tone(dev, freq, 250, true, false);

if (error == 0) {
if (nphy->mphase_cal_phase_id > 2) {
@@ -2254,9 +2304,9 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
b43_nphy_stop_playback(dev);

if (playtone) {
- /* TODO: Call N PHY TX Tone with 4000,
- (nphy_rxcalparams & 0xffff), 0, 0
- as arguments and save result as ret */
+ ret = b43_nphy_tx_tone(dev, 4000,
+ (nphy->rxcalparams & 0xFFFF),
+ false, false);
playtone = false;
} else {
b43_nphy_run_samples(dev, 160, 0xFFFF, 0,
--
1.6.4.2