2010-02-09 20:04:30

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

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

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 6a6ab0f..bd7c505 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -104,6 +104,7 @@
#define B43_MMIO_MACFILTER_CONTROL 0x420
#define B43_MMIO_MACFILTER_DATA 0x422
#define B43_MMIO_RCMTA_COUNT 0x43C
+#define B43_MMIO_PSM_PHY_HDR 0x492 /* programmable state machine */
#define B43_MMIO_RADIO_HWENABLED_LO 0x49A
#define B43_MMIO_GPIO_CONTROL 0x49C
#define B43_MMIO_GPIO_MASK 0x49E
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 403aad3..47d20dc 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -711,6 +711,8 @@
#define B43_NPHY_PAPD_EN1 B43_PHY_N(0x29B) /* PAPD Enable1 TBD */
#define B43_NPHY_EPS_TABLE_ADJ1 B43_PHY_N(0x29C) /* EPS Table Adj1 TBD */

+#define B43_PHY_B_BBCFG B43_PHY_N_BMODE(0x001) /* BB config */
+#define B43_PHY_B_TEST B43_PHY_N_BMODE(0x00A)


/* Broadcom 2055 radio registers */
@@ -924,6 +926,13 @@

struct b43_wldev;

+struct b43_chanspec {
+ u8 channel;
+ u8 sideband;
+ u8 b_width;
+ u8 b_freq;
+};
+
struct b43_phy_n_iq_comp {
s16 a0;
s16 b0;
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index 9c1c6ec..b23036f 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -4,6 +4,15 @@
#include <linux/types.h>


+struct b43_phy_n_sfo_cfg {
+ u16 phy_bw1a;
+ u16 phy_bw2;
+ u16 phy_bw3;
+ u16 phy_bw4;
+ u16 phy_bw5;
+ u16 phy_bw6;
+};
+
struct b43_nphy_channeltab_entry {
/* The channel number */
u8 channel;
--
1.6.4.2



2010-02-09 23:02:14

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
> +#define B43_MMIO_PSM_PHY_HDR 0x492 /* programmable state machine */

The comment doesn't make a lot of sense.
In case you don't know, the PSM is the part of the hardware
that executes the firmware.

--
Greetings, Michael.

2010-02-19 16:13:03

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

2010/2/15 John W. Linville <[email protected]>:
> On Wed, Feb 10, 2010 at 12:02:11AM +0100, Michael Buesch wrote:
>> On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
>> > +#define B43_MMIO_PSM_PHY_HDR               0x492   /* programmable state machine */
>>
>> The comment doesn't make a lot of sense.
>> In case you don't know, the PSM is the part of the hardware
>> that executes the firmware.
>
> Rafał,
>
> Are you going to repost this series and/or respond to Michael's
> comments?  I tried to apply some of the ones Michael didn't comment
> upon, but they seem to depend on the ones in question.

I got some exams recently and today I got one more for recrucation for
new studies level. Will fix patches this week.

--
Rafał

2010-02-09 20:04:48

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 02/11] b43: N-PHY: initialize super switch

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 795bb1e..2d8eda1 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -646,6 +646,41 @@ static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st)
clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
+static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
+{
+ if (dev->phy.rev >= 3) {
+ if (!init)
+ return;
+ if (0 /* FIXME */) {
+ b43_ntab_write(dev, B43_NTAB16(9, 2), 0x211);
+ b43_ntab_write(dev, B43_NTAB16(9, 3), 0x222);
+ b43_ntab_write(dev, B43_NTAB16(9, 8), 0x144);
+ b43_ntab_write(dev, B43_NTAB16(9, 12), 0x188);
+ }
+ } else {
+ b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0);
+ b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0);
+
+ ssb_chipco_gpio_control(&dev->dev->bus->chipco, 0xFC00,
+ 0xFC00);
+ b43_write32(dev, B43_MMIO_MACCTL,
+ b43_read32(dev, B43_MMIO_MACCTL) &
+ ~B43_MACCTL_GPOUTSMSK);
+ b43_write16(dev, B43_MMIO_GPIO_MASK,
+ b43_read16(dev, B43_MMIO_GPIO_MASK) | 0xFC00);
+ b43_write16(dev, B43_MMIO_GPIO_CONTROL,
+ b43_read16(dev, B43_MMIO_GPIO_CONTROL) & ~0xFC00);
+
+ if (init) {
+ b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8);
+ b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0x301);
+ b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8);
+ b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301);
+ }
+ }
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
{
@@ -3116,7 +3151,7 @@ int b43_phy_initn(struct b43_wldev *dev)
target = b43_nphy_get_tx_gains(dev);

if (nphy->antsel_type == 2)
- ;/*TODO NPHY Superswitch Init with argument 1*/
+ b43_nphy_superswitch_init(dev, true);
if (nphy->perical != 2) {
b43_nphy_rssi_cal(dev);
if (phy->rev >= 3) {
--
1.6.4.2


2010-02-19 14:54:55

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

Out of curiosity, how far along is this stuff in general?

I have a rev 16 core, but right now I can't find the right firmware
(yes, I should be able to dig it out, but maybe you know off-hand?)

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-09 20:05:51

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 11/11] b43: N-PHY: switch to chanspec ops

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 19d4f11..49256bf 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -72,6 +72,7 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
u16 value, u8 core, bool off);
static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
u16 value, u8 core);
+static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel);

static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
{
@@ -172,31 +173,6 @@ static void b43_radio_2055_setup(struct b43_wldev *dev,
udelay(300);
}

-/* Tune the hardware to a new channel. */
-static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
-{
- const struct b43_nphy_channeltab_entry *tabent;
-
- tabent = b43_nphy_get_chantabent(dev, channel);
- if (!tabent)
- return -ESRCH;
-
- //FIXME enable/disable band select upper20 in RXCTL
- if (0 /*FIXME 5Ghz*/)
- b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
- else
- b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
- b43_radio_2055_setup(dev, tabent);
- if (0 /*FIXME 5Ghz*/)
- b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
- else
- b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
- b43_chantab_phy_upload(dev, tabent);
- b43_nphy_tx_power_fix(dev);
-
- return 0;
-}
-
static void b43_radio_init2055_pre(struct b43_wldev *dev)
{
b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
@@ -3345,6 +3321,67 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev,
b43_nphy_spur_workaround(dev);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
+static int b43_nphy_set_chanspec(struct b43_wldev *dev,
+ struct b43_chanspec chanspec)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+
+ const struct b43_nphy_channeltab_entry *tabent;
+
+ u8 tmp;
+ u8 channel = chanspec.channel;
+
+ if (dev->phy.rev >= 3) {
+ /* TODO */
+ }
+
+ nphy->radio_chanspec = chanspec;
+
+ if (chanspec.b_width != nphy->b_widht)
+ ; /* TODO: BMAC BW Set (chanspec.b_width) */
+
+ /* TODO: use defines */
+ if (chanspec.b_width == 3) {
+ if (chanspec.sideband == 2)
+ b43_phy_set(dev, B43_NPHY_RXCTL,
+ B43_NPHY_RXCTL_BSELU20);
+ else
+ b43_phy_mask(dev, B43_NPHY_RXCTL,
+ ~B43_NPHY_RXCTL_BSELU20);
+ }
+
+ if (dev->phy.rev >= 3) {
+ tmp = (chanspec.b_freq == 1) ? 4 : 0;
+ b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
+ /* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */
+ /* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */
+ } else {
+ tabent = b43_nphy_get_chantabent(dev, channel);
+ if (!tabent)
+ return -ESRCH;
+
+ tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050;
+ b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
+ b43_radio_2055_setup(dev, tabent);
+ b43_nphy_chanspec_setup(dev, tabent, chanspec);
+ }
+
+ return 0;
+}
+
+/* Tune the hardware to a new channel */
+static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+
+ struct b43_chanspec chanspec;
+ chanspec = nphy->radio_chanspec;
+ chanspec.channel = channel;
+
+ return b43_nphy_set_chanspec(dev, chanspec);
+}
+
static int b43_nphy_op_allocate(struct b43_wldev *dev)
{
struct b43_phy_n *nphy;
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index e7acae2..26d01fe 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -984,6 +984,7 @@ struct b43_phy_n {
u16 papd_epsilon_offset[2];
s32 preamble_override;
u32 bb_mult_save;
+ u8 b_widht;
struct b43_chanspec radio_chanspec;

bool gain_boost;
--
1.6.4.2


2010-02-09 20:05:34

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 09/11] b43: N-PHY: isloate 2055 radio setup

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 835d0da..631e01f 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -155,6 +155,23 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
//TODO
}

+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
+static void b43_radio_2055_setup(struct b43_wldev *dev,
+ const struct b43_nphy_channeltab_entry *e)
+{
+ B43_WARN_ON(dev->phy.rev >= 3);
+
+ b43_chantab_radio_upload(dev, e);
+ udelay(50);
+ b43_radio_write(dev, B2055_VCO_CAL10, 5);
+ b43_radio_write(dev, B2055_VCO_CAL10, 45);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_VCO_CAL10, 65);
+ udelay(300);
+}
+
/* Tune the hardware to a new channel. */
static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
{
@@ -169,12 +186,7 @@ static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
else
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
- b43_chantab_radio_upload(dev, tabent);
- udelay(50);
- b43_radio_write16(dev, B2055_VCO_CAL10, 5);
- b43_radio_write16(dev, B2055_VCO_CAL10, 45);
- b43_radio_write16(dev, B2055_VCO_CAL10, 65);
- udelay(300);
+ b43_radio_2055_setup(dev, tabent);
if (0 /*FIXME 5Ghz*/)
b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
else
--
1.6.4.2


2010-02-27 11:12:25

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

2010/2/10 Michael Buesch <[email protected]>:
> On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
>> +#define B43_MMIO_PSM_PHY_HDR         0x492   /* programmable state machine */
>
> The comment doesn't make a lot of sense.
> In case you don't know, the PSM is the part of the hardware
> that executes the firmware.

Well, guess you're right. It was me hearing for the first time "PSM"
so decided to write it. Guess it's pretty obvious for every device
driver developer :)

--
Rafał

2010-02-19 18:38:36

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, Feb 19, 2010 at 7:24 PM, Johannes Berg
<[email protected]> wrote:
> On Fri, 2010-02-19 at 19:21 +0100, G?bor Stefanik wrote:
>
>> >> Hmm... rev8 SPROM in an N-PHY?
>> >> Or is this a "low-cost" N-PHY with actual N support disabled
>> (similar
>> >> to Ralink RT2070)?
>> >
>> > I have no idea what you mean by "low-cost" N PHY ... this should be
>> a
>> > 2x2 device.
>
>> I thought it was a device that was based on the N-PHY design, but
>> without support for any 802.11n features.
>
> FWIW, aside from the discussion about SPROM formats which Larry
> clarified, there's no such thing.
>
> IMHO a manufacturer would have to be immensely stupid to build an N-PHY
> design based (!) chip that doesn't at least support MCS rates 0 through
> 7, i.e. 1x1 11n operation.

Well, check Atheros and Ralink for an example. Usually, such chips
aren't "built" on purpose, rather, they have 802.11n support disabled
due to having been found defective (but usable in 802.11g mode) during
manufacturing.

>
> johannes
>



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

2010-02-09 23:01:03

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 09/11] b43: N-PHY: isloate 2055 radio setup

On Tuesday 09 February 2010 21:04:41 Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> drivers/net/wireless/b43/phy_n.c | 24 ++++++++++++++++++------
> 1 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
> index 835d0da..631e01f 100644
> --- a/drivers/net/wireless/b43/phy_n.c
> +++ b/drivers/net/wireless/b43/phy_n.c
> @@ -155,6 +155,23 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
> //TODO
> }
>
> +
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
> +static void b43_radio_2055_setup(struct b43_wldev *dev,
> + const struct b43_nphy_channeltab_entry *e)
> +{
> + B43_WARN_ON(dev->phy.rev >= 3);
> +
> + b43_chantab_radio_upload(dev, e);
> + udelay(50);
> + b43_radio_write(dev, B2055_VCO_CAL10, 5);
> + b43_radio_write(dev, B2055_VCO_CAL10, 45);
> + if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
> + b43_read32(dev, B43_MMIO_MACCTL);

Just read MACCTL unconditionally. It obviously is just used for bus posting.
We usually also add a comment.

b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */

--
Greetings, Michael.

2010-02-09 22:59:28

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 08/11] b43: implement writing to MMIO shared memory

On Tuesday 09 February 2010 21:04:40 Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> drivers/net/wireless/b43/phy_common.c | 11 +++++++++++
> drivers/net/wireless/b43/phy_common.h | 2 ++
> 2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
> index 8f7d7ef..0b0f9df 100644
> --- a/drivers/net/wireless/b43/phy_common.c
> +++ b/drivers/net/wireless/b43/phy_common.c
> @@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)
>
> return ret;
> }
> +
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
> +void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
> +{
> + b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x00010000 | (offset >> 2));
> + b43_read32(dev, B43_MMIO_SHM_CONTROL);
> + if (offset & 2)
> + b43_write16(dev, 0x165, value);
> + else
> + b43_write16(dev, B43_MMIO_SHM_DATA, value);
> +}

I'd like to put a biiiig questionmark on this.
We already have SHM access. Your function does exactly the same, except that it
accesses the bullshit register h165.

--
Greetings, Michael.

2010-02-28 11:46:24

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Sunday 28 February 2010 02:37:21 Rafał Miłecki wrote:
> W dniu 27 lutego 2010 15:51 użytkownik Michael Buesch <[email protected]> napisał:
> > On Saturday 27 February 2010 12:12:23 Rafał Miłecki wrote:
> >> 2010/2/10 Michael Buesch <[email protected]>:
> >> > On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
> >> >> +#define B43_MMIO_PSM_PHY_HDR         0x492   /* programmable state machine */
> >> >
> >> > The comment doesn't make a lot of sense.
> >> > In case you don't know, the PSM is the part of the hardware
> >> > that executes the firmware.
> >>
> >> Well, guess you're right. It was me hearing for the first time "PSM"
> >> so decided to write it. Guess it's pretty obvious for every device
> >> driver developer :)
> >>
> >
> > Well, what I wanted to say is that it's more important to explain
> > what PHY_HDR means. Something like /* PSM PHY header */ ?
>
> Sure, explaining HDR sounds great, but do you actually know it's
> header? Personally I have no idea, so I am not sure if you know that
> with nice probability of being right, or are you just guessing? :)

Well, I assumed you could deduce the meaning from the code. If not, it's
better to leave it without a comment. I don't know for sure what this means.
But declaring the definition as "Programmable State Machine" is also
wrong. So let's simply leave it without a comment.


--
Greetings, Michael.

2010-02-19 16:40:47

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On 02/19/2010 10:23 AM, Johannes Berg wrote:
>
> Right. I was also wondering if it is showing signs of life yet? Mine has
> device version that also needs minor SSB adjustments still.

Thanks for the update on the link. I pulled it out of a previous E-mail rather
than using Google to find it again.

Rafał is taking exams now, but said in one of our last communications that he
was finishing up some radio code. After that, he expected some signs of life.

What PHY revision do you have? Between 2 and 3 there were a lot of changes
including a new radio version. Rafał has a 2, thus he has been concentrating on
that one.

Do you have any log messages on the SSB adjustments?

Larry

2010-02-19 18:10:18

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On 02/19/2010 11:02 AM, Johannes Berg wrote:
> On Fri, 2010-02-19 at 10:40 -0600, Larry Finger wrote:
>
>> Rafał is taking exams now, but said in one of our last communications
>> that he
>> was finishing up some radio code. After that, he expected some signs
>> of life.
>
> Neat.
>
>> What PHY revision do you have? Between 2 and 3 there were a lot of
>> changes
>> including a new radio version. Rafał has a 2, thus he has been
>> concentrating on
>> that one.
>>
>> Do you have any log messages on the SSB adjustments?
>
> [ 5.861375] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x17, vendor 0x4243)
> [ 5.861390] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x10, vendor 0x4243)
> [ 5.861402] ssb: Core 2 found: PCI-E (cc 0x820, rev 0x0B, vendor 0x4243)
> [ 5.861414] ssb: Core 3 found: PCI (cc 0x804, rev 0x0E, vendor 0x4243)
> [ 5.861427] ssb: Core 4 found: USB 2.0 Device (cc 0x81A, rev 0x05, vendor 0x4243)
> [ 5.861439] ssb: Core 5 found: UNKNOWN (cc 0x8FF, rev 0x00, vendor 0x4243)
> [ 5.861452] ssb: Core 6 found: Internal Memory (cc 0x80E, rev 0x03, vendor 0x4243)
> [ 5.900494] ssb: Found rev 2 PMU (capabilities 0x04583002)
> [ 5.900500] ssb: ERROR: PLL init unknown for device 4322
> [ 5.900844] ssb: ERROR: PMU resource config unknown for device 4322
> [ 5.909764] ssb: SPROM revision 8 detected.
> ...
> [ 6.378717] b43-phy0: Broadcom 4322 WLAN found (core revision 16)
> [ 6.482611] b43-phy0 debug: Found PHY: Analog 8, Type 4, Revision 4
> [ 6.482638] b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2056, Revision 3

I just submitted a patch for the errors above that I've had here for a long time.

A Rev 8 SPROM has all the entities found in Rev 4 plus some additions. If R4 can
support an mimo N PHY, R8 certainly can.

Larry


2010-02-09 20:05:01

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 04/11] b43: N-PHY: update writing channel-specific radio registers

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index dd81e8a..ebb9632 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -90,28 +90,38 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
static void b43_chantab_radio_upload(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry *e)
{
- b43_radio_write16(dev, B2055_PLL_REF, e->radio_pll_ref);
- b43_radio_write16(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
- b43_radio_write16(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1);
- b43_radio_write16(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail);
- b43_radio_write16(dev, B2055_VCO_CAL1, e->radio_vco_cal1);
- b43_radio_write16(dev, B2055_VCO_CAL2, e->radio_vco_cal2);
- b43_radio_write16(dev, B2055_PLL_LFC1, e->radio_pll_lfc1);
- b43_radio_write16(dev, B2055_PLL_LFR1, e->radio_pll_lfr1);
- b43_radio_write16(dev, B2055_PLL_LFC2, e->radio_pll_lfc2);
- b43_radio_write16(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf);
- b43_radio_write16(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1);
- b43_radio_write16(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2);
- b43_radio_write16(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune);
- b43_radio_write16(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune);
- b43_radio_write16(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1);
- b43_radio_write16(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn);
- b43_radio_write16(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim);
- b43_radio_write16(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune);
- b43_radio_write16(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune);
- b43_radio_write16(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1);
- b43_radio_write16(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn);
- b43_radio_write16(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
+ b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref);
+ b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
+ b43_radio_write(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1);
+ b43_radio_write(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_VCO_CAL1, e->radio_vco_cal1);
+ b43_radio_write(dev, B2055_VCO_CAL2, e->radio_vco_cal2);
+ b43_radio_write(dev, B2055_PLL_LFC1, e->radio_pll_lfc1);
+ b43_radio_write(dev, B2055_PLL_LFR1, e->radio_pll_lfr1);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_PLL_LFC2, e->radio_pll_lfc2);
+ b43_radio_write(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf);
+ b43_radio_write(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1);
+ b43_radio_write(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune);
+ b43_radio_write(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune);
+ b43_radio_write(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1);
+ b43_radio_write(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim);
+ b43_radio_write(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune);
+ b43_radio_write(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune);
+ b43_radio_write(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1);
+ if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+ b43_read32(dev, B43_MMIO_MACCTL);
+ b43_radio_write(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn);
+ b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
}

static void b43_chantab_phy_upload(struct b43_wldev *dev,
--
1.6.4.2


2010-02-19 18:24:18

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 19:21 +0100, Gábor Stefanik wrote:

> >> Hmm... rev8 SPROM in an N-PHY?
> >> Or is this a "low-cost" N-PHY with actual N support disabled
> (similar
> >> to Ralink RT2070)?
> >
> > I have no idea what you mean by "low-cost" N PHY ... this should be
> a
> > 2x2 device.

> I thought it was a device that was based on the N-PHY design, but
> without support for any 802.11n features.

FWIW, aside from the discussion about SPROM formats which Larry
clarified, there's no such thing.

IMHO a manufacturer would have to be immensely stupid to build an N-PHY
design based (!) chip that doesn't at least support MCS rates 0 through
7, i.e. 1x1 11n operation.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-09 20:05:25

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 08/11] b43: implement writing to MMIO shared memory

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_common.c | 11 +++++++++++
drivers/net/wireless/b43/phy_common.h | 2 ++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 8f7d7ef..0b0f9df 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)

return ret;
}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
+void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
+{
+ b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x00010000 | (offset >> 2));
+ b43_read32(dev, B43_MMIO_SHM_CONTROL);
+ if (offset & 2)
+ b43_write16(dev, 0x165, value);
+ else
+ b43_write16(dev, B43_MMIO_SHM_DATA, value);
+}
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index bd480b4..484d4d7 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -429,4 +429,6 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on);

struct b43_c32 b43_cordic(int theta);

+void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value);
+
#endif /* LINUX_B43_PHY_COMMON_H_ */
--
1.6.4.2


2010-02-27 11:09:31

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 08/11] b43: implement writing to MMIO shared memory

2010/2/9 Michael Buesch <[email protected]>:
> On Tuesday 09 February 2010 21:04:40 Rafał Miłecki wrote:
>> Signed-off-by: Rafał Miłecki <[email protected]>
>> ---
>>  drivers/net/wireless/b43/phy_common.c |   11 +++++++++++
>>  drivers/net/wireless/b43/phy_common.h |    2 ++
>>  2 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
>> index 8f7d7ef..0b0f9df 100644
>> --- a/drivers/net/wireless/b43/phy_common.c
>> +++ b/drivers/net/wireless/b43/phy_common.c
>> @@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)
>>
>>       return ret;
>>  }
>> +
>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
>> +void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
>> +{
>> +     b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x00010000 | (offset >> 2));
>> +     b43_read32(dev, B43_MMIO_SHM_CONTROL);
>> +     if (offset & 2)
>> +             b43_write16(dev, 0x165, value);
>> +     else
>> +             b43_write16(dev, B43_MMIO_SHM_DATA, value);
>> +}
>
> I'd like to put a biiiig questionmark on this.
> We already have SHM access. Your function does exactly the same, except that it
> accesses the bullshit register h165.

Yeah, that 0x165 is really crappy. Let's hope it really should be
0x166 (B43_MMIO_SHM_DATA_UNALIGNED).

Do you think we should add dummy-read to b43_shm_control_word as
BmacWriteShm does? Currently we do not perform that.

--
Rafał

2010-02-19 18:41:14

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 19:33 +0100, Gábor Stefanik wrote:

> > IMHO a manufacturer would have to be immensely stupid to build an
> N-PHY
> > design based (!) chip that doesn't at least support MCS rates 0
> through
> > 7, i.e. 1x1 11n operation.
>
> Well, check Atheros and Ralink for an example. Usually, such chips
> aren't "built" on purpose, rather, they have 802.11n support disabled
> due to having been found defective (but usable in 802.11g mode) during
> manufacturing.

That ... doesn't really make sense either. But we can leave it at that,
I don't care much :)

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-09 20:05:53

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 10/11] b43: N-PHY: implement chanspec setup

Signed-off-by: Rafał Miłecki <[email protected]>
---
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


2010-02-19 18:22:12

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, Feb 19, 2010 at 6:09 PM, Johannes Berg
<[email protected]> wrote:
> On Fri, 2010-02-19 at 18:06 +0100, G?bor Stefanik wrote:
>
>> > [ ? ?5.909764] ssb: SPROM revision 8 detected.
>>
>> Hmm... rev8 SPROM in an N-PHY?
>> Or is this a "low-cost" N-PHY with actual N support disabled (similar
>> to Ralink RT2070)?
>
> I have no idea what you mean by "low-cost" N PHY ... this should be a
> 2x2 device.
>
> johannes
>

I thought it was a device that was based on the N-PHY design, but
without support for any 802.11n features. But if rev8 is really a
superset or rev4 (though I seem to remember that it only has space for
a single TX/RX chain), then it can easily be a real 802.11n device.

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

2010-02-09 20:05:07

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 05/11] b43: N-PHY: update post init of 2055 radio

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index ebb9632..2f45817 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -183,49 +183,58 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev)

static void b43_radio_init2055_post(struct b43_wldev *dev)
{
+ struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = &(dev->dev->bus->sprom);
struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo);
int i;
u16 val;
+ bool workaround = false;
+
+ if (sprom->revision < 4)
+ workaround = (binfo->vendor != PCI_VENDOR_ID_BROADCOM ||
+ binfo->type != 0x46D ||
+ binfo->rev < 0x41);
+ else
+ workaround = ((sprom->boardflags_hi & B43_BFH_NOPA) == 0);

b43_radio_mask(dev, B2055_MASTER1, 0xFFF3);
- msleep(1);
- if ((sprom->revision != 4) ||
- !(sprom->boardflags_hi & B43_BFH_RSSIINV)) {
- if ((binfo->vendor != PCI_VENDOR_ID_BROADCOM) ||
- (binfo->type != 0x46D) ||
- (binfo->rev < 0x41)) {
- b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
- b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
- msleep(1);
- }
+ if (workaround) {
+ b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
+ b43_radio_mask(dev, B2055_C2_RX_BB_REG, 0x7F);
}
- b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0x3F, 0x2C);
- msleep(1);
- b43_radio_write16(dev, B2055_CAL_MISC, 0x3C);
- msleep(1);
+ b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0xFFC0, 0x2C);
+ b43_radio_write(dev, B2055_CAL_MISC, 0x3C);
b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE);
- msleep(1);
b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80);
- msleep(1);
b43_radio_set(dev, B2055_CAL_MISC, 0x1);
msleep(1);
b43_radio_set(dev, B2055_CAL_MISC, 0x40);
- msleep(1);
- for (i = 0; i < 100; i++) {
- val = b43_radio_read16(dev, B2055_CAL_COUT2);
- if (val & 0x80)
+ for (i = 0; i < 200; i++) {
+ val = b43_radio_read(dev, B2055_CAL_COUT2);
+ if (val & 0x80) {
+ i = 0;
break;
+ }
udelay(10);
}
- msleep(1);
+ if (i)
+ b43err(dev->wl, "radio post init timeout\n");
b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
- msleep(1);
nphy_channel_switch(dev, dev->phy.channel);
- b43_radio_write16(dev, B2055_C1_RX_BB_LPF, 0x9);
- b43_radio_write16(dev, B2055_C2_RX_BB_LPF, 0x9);
- b43_radio_write16(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
- b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
+ b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9);
+ b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9);
+ b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
+ b43_radio_write(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
+ b43_radio_maskset(dev, B2055_C1_LNA_GAINBST, 0xFFF8, 0x6);
+ b43_radio_maskset(dev, B2055_C2_LNA_GAINBST, 0xFFF8, 0x6);
+ if (!nphy->gain_boost) {
+ b43_radio_set(dev, B2055_C1_RX_RFSPC1, 0x2);
+ b43_radio_set(dev, B2055_C2_RX_RFSPC1, 0x2);
+ } else {
+ b43_radio_mask(dev, B2055_C1_RX_RFSPC1, 0xFFFD);
+ b43_radio_mask(dev, B2055_C2_RX_RFSPC1, 0xFFFD);
+ }
+ udelay(2);
}

/*
--
1.6.4.2


2010-02-19 17:06:25

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, Feb 19, 2010 at 6:02 PM, Johannes Berg
<[email protected]> wrote:
> On Fri, 2010-02-19 at 10:40 -0600, Larry Finger wrote:
>
>> Rafał is taking exams now, but said in one of our last communications
>> that he
>> was finishing up some radio code. After that, he expected some signs
>> of life.
>
> Neat.
>
>> What PHY revision do you have? Between 2 and 3 there were a lot of
>> changes
>> including a new radio version. Rafał has a 2, thus he has been
>> concentrating on
>> that one.
>>
>> Do you have any log messages on the SSB adjustments?
>
> [    5.861375] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x17, vendor 0x4243)
> [    5.861390] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x10, vendor 0x4243)
> [    5.861402] ssb: Core 2 found: PCI-E (cc 0x820, rev 0x0B, vendor 0x4243)
> [    5.861414] ssb: Core 3 found: PCI (cc 0x804, rev 0x0E, vendor 0x4243)
> [    5.861427] ssb: Core 4 found: USB 2.0 Device (cc 0x81A, rev 0x05, vendor 0x4243)
> [    5.861439] ssb: Core 5 found: UNKNOWN (cc 0x8FF, rev 0x00, vendor 0x4243)
> [    5.861452] ssb: Core 6 found: Internal Memory (cc 0x80E, rev 0x03, vendor 0x4243)
> [    5.900494] ssb: Found rev 2 PMU (capabilities 0x04583002)
> [    5.900500] ssb: ERROR: PLL init unknown for device 4322
> [    5.900844] ssb: ERROR: PMU resource config unknown for device 4322
> [    5.909764] ssb: SPROM revision 8 detected.

Hmm... rev8 SPROM in an N-PHY?
Or is this a "low-cost" N-PHY with actual N support disabled (similar
to Ralink RT2070)?

> ...
> [    6.378717] b43-phy0: Broadcom 4322 WLAN found (core revision 16)
> [    6.482611] b43-phy0 debug: Found PHY: Analog 8, Type 4, Revision 4
> [    6.482638] b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2056, Revision 3
>
>
>
> johannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



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

2010-02-09 20:05:19

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 07/11] b43: N-PHY: adjust gain table

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 4ff09b8..835d0da 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -837,6 +837,62 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
b43_nphy_stay_in_carrier_search(dev, 0);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
+static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+
+ u8 i;
+ s16 tmp;
+ u16 data[4];
+ s16 gain[2];
+ u16 minmax[2];
+ u16 lna_gain[4] = { -2, 10, 19, 25 };
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_in_carrier_search(dev, 1);
+
+ if (nphy->gain_boost) {
+ if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+ gain[0] = 6;
+ gain[1] = 6;
+ } else {
+ tmp = 40370 - 315 * nphy->radio_chanspec.channel;
+ gain[0] = ((tmp >> 13) + ((tmp >> 12) & 1));
+ tmp = 23242 - 224 * nphy->radio_chanspec.channel;
+ gain[1] = ((tmp >> 13) + ((tmp >> 12) & 1));
+ }
+ } else {
+ gain[0] = 0;
+ gain[1] = 0;
+ }
+
+ for (i = 0; i < 2; i++) {
+ if (nphy->elna_gain_config) {
+ data[0] = 19 + gain[i];
+ data[1] = 25 + gain[i];
+ data[2] = 25 + gain[i];
+ data[3] = 25 + gain[i];
+ } else {
+ data[0] = lna_gain[0] + gain[i];
+ data[1] = lna_gain[1] + gain[i];
+ data[2] = lna_gain[2] + gain[i];
+ data[3] = lna_gain[3] + gain[i];
+ }
+ b43_ntab_write_bulk(dev, B43_NTAB16(10, 8), 4, data);
+
+ minmax[i] = 23 + gain[i];
+ }
+
+ b43_phy_maskset(dev, B43_NPHY_C1_MINMAX_GAIN, ~B43_NPHY_C1_MINGAIN,
+ minmax[0] << B43_NPHY_C1_MINGAIN_SHIFT);
+ b43_phy_maskset(dev, B43_NPHY_C2_MINMAX_GAIN, ~B43_NPHY_C2_MINGAIN,
+ minmax[1] << B43_NPHY_C2_MINGAIN_SHIFT);
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_in_carrier_search(dev, 0);
+}
+
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
{
@@ -921,7 +977,7 @@ static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_TABLE_DATALO,
(code << 8 | 0x7C));

- /* TODO: b43_nphy_adjust_lna_gain_table(dev); */
+ b43_nphy_adjust_lna_gain_table(dev);

if (nphy->elna_gain_config) {
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0808);
--
1.6.4.2


2010-02-15 19:45:40

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Wed, Feb 10, 2010 at 12:02:11AM +0100, Michael Buesch wrote:
> On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
> > +#define B43_MMIO_PSM_PHY_HDR 0x492 /* programmable state machine */
>
> The comment doesn't make a lot of sense.
> In case you don't know, the PSM is the part of the hardware
> that executes the firmware.

Rafał,

Are you going to repost this series and/or respond to Michael's
comments? I tried to apply some of the ones Michael didn't comment
upon, but they seem to depend on the ones in question.

Thanks,

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

2010-02-09 20:04:54

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 03/11] b43: N-PHY: turn radio on/off (rfkill)

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2d8eda1..dd81e8a 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -218,7 +218,10 @@ static void b43_radio_init2055_post(struct b43_wldev *dev)
b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
}

-/* Initialize a Broadcom 2055 N-radio */
+/*
+ * Initialize a Broadcom 2055 N-radio
+ * http://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
+ */
static void b43_radio_init2055(struct b43_wldev *dev)
{
b43_radio_init2055_pre(dev);
@@ -229,17 +232,6 @@ static void b43_radio_init2055(struct b43_wldev *dev)
b43_radio_init2055_post(dev);
}

-void b43_nphy_radio_turn_on(struct b43_wldev *dev)
-{
- b43_radio_init2055(dev);
-}
-
-void b43_nphy_radio_turn_off(struct b43_wldev *dev)
-{
- b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
- ~B43_NPHY_RFCTL_CMD_EN);
-}
-
/*
* Upload the N-PHY tables.
* http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables
@@ -3277,9 +3269,41 @@ static void b43_nphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value)
b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value);
}

+/* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
bool blocked)
-{//TODO
+{
+ if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED)
+ b43err(dev->wl, "MAC not suspended\n");
+
+ if (blocked) {
+ b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+ ~B43_NPHY_RFCTL_CMD_CHIP0PU);
+ if (dev->phy.rev >= 3) {
+ b43_radio_mask(dev, 0x09, ~0x2);
+
+ b43_radio_write(dev, 0x204D, 0);
+ b43_radio_write(dev, 0x2053, 0);
+ b43_radio_write(dev, 0x2058, 0);
+ b43_radio_write(dev, 0x205E, 0);
+ b43_radio_mask(dev, 0x2062, ~0xF0);
+ b43_radio_write(dev, 0x2064, 0);
+
+ b43_radio_write(dev, 0x304D, 0);
+ b43_radio_write(dev, 0x3053, 0);
+ b43_radio_write(dev, 0x3058, 0);
+ b43_radio_write(dev, 0x305E, 0);
+ b43_radio_mask(dev, 0x3062, ~0xF0);
+ b43_radio_write(dev, 0x3064, 0);
+ }
+ } else {
+ if (dev->phy.rev >= 3) {
+ /* TODO: b43_radio_init2056(dev); */
+ /* TODO: PHY Set Channel Spec (dev, radio_chanspec) */
+ } else {
+ b43_radio_init2055(dev);
+ }
+ }
}

static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
--
1.6.4.2


2010-02-09 20:23:14

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 11/11] b43: N-PHY: switch to chanspec ops

On 02/09/2010 02:04 PM, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> drivers/net/wireless/b43/phy_n.c | 87 +++++++++++++++++++++++++++-----------
> drivers/net/wireless/b43/phy_n.h | 1 +
> 2 files changed, 63 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
> index 19d4f11..49256bf 100644
> --- a/drivers/net/wireless/b43/phy_n.c
> +++ b/drivers/net/wireless/b43/phy_n.c
> @@ -72,6 +72,7 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
> u16 value, u8 core, bool off);
> static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
> u16 value, u8 core);
> +static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel);
>
> static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
> {
> @@ -172,31 +173,6 @@ static void b43_radio_2055_setup(struct b43_wldev *dev,
> udelay(300);
> }
>
> -/* Tune the hardware to a new channel. */
> -static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
> -{
> - const struct b43_nphy_channeltab_entry *tabent;
> -
> - tabent = b43_nphy_get_chantabent(dev, channel);
> - if (!tabent)
> - return -ESRCH;
> -
> - //FIXME enable/disable band select upper20 in RXCTL
> - if (0 /*FIXME 5Ghz*/)
> - b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
> - else
> - b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
> - b43_radio_2055_setup(dev, tabent);
> - if (0 /*FIXME 5Ghz*/)
> - b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
> - else
> - b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
> - b43_chantab_phy_upload(dev, tabent);
> - b43_nphy_tx_power_fix(dev);
> -
> - return 0;
> -}
> -
> static void b43_radio_init2055_pre(struct b43_wldev *dev)
> {
> b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
> @@ -3345,6 +3321,67 @@ static void b43_nphy_chanspec_setup(struct b43_wldev *dev,
> b43_nphy_spur_workaround(dev);
> }
>
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
> +static int b43_nphy_set_chanspec(struct b43_wldev *dev,
> + struct b43_chanspec chanspec)
> +{
> + struct b43_phy_n *nphy = dev->phy.n;
> +
> + const struct b43_nphy_channeltab_entry *tabent;
> +
> + u8 tmp;
> + u8 channel = chanspec.channel;
> +
> + if (dev->phy.rev >= 3) {
> + /* TODO */
> + }
> +
> + nphy->radio_chanspec = chanspec;
> +
> + if (chanspec.b_width != nphy->b_widht)
> + ; /* TODO: BMAC BW Set (chanspec.b_width) */
> +
> + /* TODO: use defines */
> + if (chanspec.b_width == 3) {
> + if (chanspec.sideband == 2)
> + b43_phy_set(dev, B43_NPHY_RXCTL,
> + B43_NPHY_RXCTL_BSELU20);
> + else
> + b43_phy_mask(dev, B43_NPHY_RXCTL,
> + ~B43_NPHY_RXCTL_BSELU20);
> + }
> +
> + if (dev->phy.rev >= 3) {
> + tmp = (chanspec.b_freq == 1) ? 4 : 0;
> + b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
> + /* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */
> + /* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */
> + } else {
> + tabent = b43_nphy_get_chantabent(dev, channel);
> + if (!tabent)
> + return -ESRCH;
> +
> + tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050;
> + b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
> + b43_radio_2055_setup(dev, tabent);
> + b43_nphy_chanspec_setup(dev, tabent, chanspec);
> + }
> +
> + return 0;
> +}
> +
> +/* Tune the hardware to a new channel */
> +static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
> +{
> + struct b43_phy_n *nphy = dev->phy.n;
> +
> + struct b43_chanspec chanspec;
> + chanspec = nphy->radio_chanspec;
> + chanspec.channel = channel;
> +
> + return b43_nphy_set_chanspec(dev, chanspec);
> +}
> +
> static int b43_nphy_op_allocate(struct b43_wldev *dev)
> {
> struct b43_phy_n *nphy;
> diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
> index e7acae2..26d01fe 100644
> --- a/drivers/net/wireless/b43/phy_n.h
> +++ b/drivers/net/wireless/b43/phy_n.h
> @@ -984,6 +984,7 @@ struct b43_phy_n {
> u16 papd_epsilon_offset[2];
> s32 preamble_override;
> u32 bb_mult_save;
> + u8 b_widht;

Typo here?

> struct b43_chanspec radio_chanspec;
>
> bool gain_boost;


2010-02-28 01:37:22

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

W dniu 27 lutego 2010 15:51 użytkownik Michael Buesch <[email protected]> napisał:
> On Saturday 27 February 2010 12:12:23 Rafał Miłecki wrote:
>> 2010/2/10 Michael Buesch <[email protected]>:
>> > On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
>> >> +#define B43_MMIO_PSM_PHY_HDR         0x492   /* programmable state machine */
>> >
>> > The comment doesn't make a lot of sense.
>> > In case you don't know, the PSM is the part of the hardware
>> > that executes the firmware.
>>
>> Well, guess you're right. It was me hearing for the first time "PSM"
>> so decided to write it. Guess it's pretty obvious for every device
>> driver developer :)
>>
>
> Well, what I wanted to say is that it's more important to explain
> what PHY_HDR means. Something like /* PSM PHY header */ ?

Sure, explaining HDR sounds great, but do you actually know it's
header? Personally I have no idea, so I am not sure if you know that
with nice probability of being right, or are you just guessing? :)


--
Rafał

2010-02-19 18:19:25

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 12:10 -0600, Larry Finger wrote:

> > [ 5.900494] ssb: Found rev 2 PMU (capabilities 0x04583002)
> > [ 5.900500] ssb: ERROR: PLL init unknown for device 4322
> > [ 5.900844] ssb: ERROR: PMU resource config unknown for device 4322

> I just submitted a patch for the errors above that I've had here for a
> long time.

I saw, thanks.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-27 14:51:30

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Saturday 27 February 2010 12:12:23 Rafał Miłecki wrote:
> 2010/2/10 Michael Buesch <[email protected]>:
> > On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
> >> +#define B43_MMIO_PSM_PHY_HDR         0x492   /* programmable state machine */
> >
> > The comment doesn't make a lot of sense.
> > In case you don't know, the PSM is the part of the hardware
> > that executes the firmware.
>
> Well, guess you're right. It was me hearing for the first time "PSM"
> so decided to write it. Guess it's pretty obvious for every device
> driver developer :)
>

Well, what I wanted to say is that it's more important to explain
what PHY_HDR means. Something like /* PSM PHY header */ ?

--
Greetings, Michael.

2010-02-19 16:23:32

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 09:49 -0600, Larry Finger wrote:
> On 02/19/2010 08:54 AM, Johannes Berg wrote:
> > Out of curiosity, how far along is this stuff in general?
> >
> > I have a rev 16 core, but right now I can't find the right firmware
> > (yes, I should be able to dig it out, but maybe you know off-hand?)
>
> I got my latest firmware (version 508.1107 (2009-06-26 19:16:02))
> from:
>
> http://www.linksysbycisco.com/gpl/wrt610n_v2.00.00.05_us.tar.gz

Thanks.
The link seems to be
http://downloads.linksysbycisco.com/downloads/gplcode/wrt610n_v2.00.00.05_us.tgz

now.

> From my firmware directory, I see ucode16 firmware for LP N and SSLPN
> PHYs. From your question to Rafał, yours must be an N PHY.

Right. I was also wondering if it is showing signs of life yet? Mine has
device version that also needs minor SSB adjustments still.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-19 15:49:54

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On 02/19/2010 08:54 AM, Johannes Berg wrote:
> Out of curiosity, how far along is this stuff in general?
>
> I have a rev 16 core, but right now I can't find the right firmware
> (yes, I should be able to dig it out, but maybe you know off-hand?)

I got my latest firmware (version 508.1107 (2009-06-26 19:16:02)) from:

http://www.linksysbycisco.com/gpl/wrt610n_v2.00.00.05_us.tar.gz

The binaries are in directory wrt610n_v2.00.00.05_us/release/src/wl/linux/. I
used Daniel Lenski's script named b43_fwcutter.py to extract the firmware from
wl_apsta.o. Included are ucode_2w20 - Rev 20 802.11 cores have an SSLPN PHY.

>From my firmware directory, I see ucode16 firmware for LP N and SSLPN PHYs. From
your question to Rafał, yours must be an N PHY.

Larry

2010-02-09 20:05:13

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 06/11] b43: N-PHY: switch to chanspec struct

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 45 +++++++++++++++++++++++++------------
drivers/net/wireless/b43/phy_n.h | 11 +++++----
2 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2f45817..4ff09b8 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -73,6 +73,21 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
u16 value, u8 core);

+static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
+{
+ return !chanspec->channel && !chanspec->sideband &&
+ !chanspec->b_width && !chanspec->b_freq;
+}
+
+static inline bool b43_eq_chanspecs(struct b43_chanspec *chanspec1,
+ struct b43_chanspec *chanspec2)
+{
+ return (chanspec1->channel == chanspec2->channel &&
+ chanspec1->sideband == chanspec2->sideband &&
+ chanspec1->b_width == chanspec2->b_width &&
+ chanspec1->b_freq == chanspec2->b_freq);
+}
+
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
{//TODO
}
@@ -768,7 +783,7 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
{
struct b43_phy_n *nphy = dev->phy.n;

- unsigned int channel;
+ u8 channel = nphy->radio_chanspec.channel;
int tone[2] = { 57, 58 };
u32 noise[2] = { 0x3FF, 0x3FF };

@@ -777,8 +792,6 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
if (nphy->hang_avoid)
b43_nphy_stay_in_carrier_search(dev, 1);

- /* FIXME: channel = radio_chanspec */
-
if (nphy->gband_spurwar_en) {
/* TODO: N PHY Adjust Analog Pfbw (7) */
if (channel == 11 && dev->phy.is_40mhz)
@@ -2015,12 +2028,12 @@ static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev)
u16 *rssical_phy_regs = NULL;

if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
- if (!nphy->rssical_chanspec_2G)
+ if (b43_empty_chanspec(&nphy->rssical_chanspec_2G))
return;
rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G;
rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G;
} else {
- if (!nphy->rssical_chanspec_5G)
+ if (b43_empty_chanspec(&nphy->rssical_chanspec_5G))
return;
rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G;
rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G;
@@ -2440,7 +2453,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev)

struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
u16 *txcal_radio_regs = NULL;
- u8 *iqcal_chanspec;
+ struct b43_chanspec *iqcal_chanspec;
u16 *table = NULL;

if (nphy->hang_avoid)
@@ -2496,12 +2509,12 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;

if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
- if (nphy->iqcal_chanspec_2G == 0)
+ if (b43_empty_chanspec(&nphy->iqcal_chanspec_2G))
return;
table = nphy->cal_cache.txcal_coeffs_2G;
loft = &nphy->cal_cache.txcal_coeffs_2G[5];
} else {
- if (nphy->iqcal_chanspec_5G == 0)
+ if (b43_empty_chanspec(&nphy->iqcal_chanspec_5G))
return;
table = nphy->cal_cache.txcal_coeffs_5G;
loft = &nphy->cal_cache.txcal_coeffs_5G[5];
@@ -2746,8 +2759,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
nphy->txiqlocal_bestc);
nphy->txiqlocal_coeffsvalid = true;
- /* TODO: Set nphy->txiqlocal_chanspec to
- the current channel */
+ nphy->txiqlocal_chanspec = nphy->radio_chanspec;
} else {
length = 11;
if (dev->phy.rev < 3)
@@ -2782,7 +2794,8 @@ static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev)
u16 buffer[7];
bool equal = true;

- if (!nphy->txiqlocal_coeffsvalid || 1 /* FIXME */)
+ if (!nphy->txiqlocal_coeffsvalid ||
+ b43_eq_chanspecs(&nphy->txiqlocal_chanspec, &nphy->radio_chanspec))
return;

b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer);
@@ -3137,9 +3150,11 @@ int b43_phy_initn(struct b43_wldev *dev)
do_rssi_cal = false;
if (phy->rev >= 3) {
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
- do_rssi_cal = (nphy->rssical_chanspec_2G == 0);
+ do_rssi_cal =
+ b43_empty_chanspec(&nphy->rssical_chanspec_2G);
else
- do_rssi_cal = (nphy->rssical_chanspec_5G == 0);
+ do_rssi_cal =
+ b43_empty_chanspec(&nphy->rssical_chanspec_5G);

if (do_rssi_cal)
b43_nphy_rssi_cal(dev);
@@ -3151,9 +3166,9 @@ int b43_phy_initn(struct b43_wldev *dev)

if (!((nphy->measure_hold & 0x6) != 0)) {
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
- do_cal = (nphy->iqcal_chanspec_2G == 0);
+ do_cal = b43_empty_chanspec(&nphy->iqcal_chanspec_2G);
else
- do_cal = (nphy->iqcal_chanspec_5G == 0);
+ do_cal = b43_empty_chanspec(&nphy->iqcal_chanspec_5G);

if (nphy->mute)
do_cal = false;
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 47d20dc..e7acae2 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -984,7 +984,7 @@ struct b43_phy_n {
u16 papd_epsilon_offset[2];
s32 preamble_override;
u32 bb_mult_save;
- u16 radio_chanspec;
+ struct b43_chanspec radio_chanspec;

bool gain_boost;
bool elna_gain_config;
@@ -1000,6 +1000,7 @@ struct b43_phy_n {
u16 txiqlocal_bestc[11];
bool txiqlocal_coeffsvalid;
struct b43_phy_n_txpwrindex txpwrindex[2];
+ struct b43_chanspec txiqlocal_chanspec;

u8 txrx_chain;
u16 tx_rx_cal_phy_saveregs[11];
@@ -1015,12 +1016,12 @@ struct b43_phy_n {
bool gband_spurwar_en;

bool ipa2g_on;
- u8 iqcal_chanspec_2G;
- u8 rssical_chanspec_2G;
+ struct b43_chanspec iqcal_chanspec_2G;
+ struct b43_chanspec rssical_chanspec_2G;

bool ipa5g_on;
- u8 iqcal_chanspec_5G;
- u8 rssical_chanspec_5G;
+ struct b43_chanspec iqcal_chanspec_5G;
+ struct b43_chanspec rssical_chanspec_5G;

struct b43_phy_n_rssical_cache rssical_cache;
struct b43_phy_n_cal_cache cal_cache;
--
1.6.4.2


2010-02-19 17:09:23

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 18:06 +0100, Gábor Stefanik wrote:

> > [ 5.909764] ssb: SPROM revision 8 detected.
>
> Hmm... rev8 SPROM in an N-PHY?
> Or is this a "low-cost" N-PHY with actual N support disabled (similar
> to Ralink RT2070)?

I have no idea what you mean by "low-cost" N PHY ... this should be a
2x2 device.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2010-02-19 17:02:58

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

On Fri, 2010-02-19 at 10:40 -0600, Larry Finger wrote:

> Rafał is taking exams now, but said in one of our last communications
> that he
> was finishing up some radio code. After that, he expected some signs
> of life.

Neat.

> What PHY revision do you have? Between 2 and 3 there were a lot of
> changes
> including a new radio version. Rafał has a 2, thus he has been
> concentrating on
> that one.
>
> Do you have any log messages on the SSB adjustments?

[ 5.861375] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x17, vendor 0x4243)
[ 5.861390] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x10, vendor 0x4243)
[ 5.861402] ssb: Core 2 found: PCI-E (cc 0x820, rev 0x0B, vendor 0x4243)
[ 5.861414] ssb: Core 3 found: PCI (cc 0x804, rev 0x0E, vendor 0x4243)
[ 5.861427] ssb: Core 4 found: USB 2.0 Device (cc 0x81A, rev 0x05, vendor 0x4243)
[ 5.861439] ssb: Core 5 found: UNKNOWN (cc 0x8FF, rev 0x00, vendor 0x4243)
[ 5.861452] ssb: Core 6 found: Internal Memory (cc 0x80E, rev 0x03, vendor 0x4243)
[ 5.900494] ssb: Found rev 2 PMU (capabilities 0x04583002)
[ 5.900500] ssb: ERROR: PLL init unknown for device 4322
[ 5.900844] ssb: ERROR: PMU resource config unknown for device 4322
[ 5.909764] ssb: SPROM revision 8 detected.
...
[ 6.378717] b43-phy0: Broadcom 4322 WLAN found (core revision 16)
[ 6.482611] b43-phy0 debug: Found PHY: Analog 8, Type 4, Revision 4
[ 6.482638] b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2056, Revision 3



johannes


2010-02-27 14:50:24

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 08/11] b43: implement writing to MMIO shared memory

On Saturday 27 February 2010 12:09:30 Rafał Miłecki wrote:
> 2010/2/9 Michael Buesch <[email protected]>:
> > On Tuesday 09 February 2010 21:04:40 Rafał Miłecki wrote:
> >> Signed-off-by: Rafał Miłecki <[email protected]>
> >> ---
> >>  drivers/net/wireless/b43/phy_common.c |   11 +++++++++++
> >>  drivers/net/wireless/b43/phy_common.h |    2 ++
> >>  2 files changed, 13 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
> >> index 8f7d7ef..0b0f9df 100644
> >> --- a/drivers/net/wireless/b43/phy_common.c
> >> +++ b/drivers/net/wireless/b43/phy_common.c
> >> @@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)
> >>
> >>       return ret;
> >>  }
> >> +
> >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
> >> +void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
> >> +{
> >> +     b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x00010000 | (offset >> 2));
> >> +     b43_read32(dev, B43_MMIO_SHM_CONTROL);
> >> +     if (offset & 2)
> >> +             b43_write16(dev, 0x165, value);
> >> +     else
> >> +             b43_write16(dev, B43_MMIO_SHM_DATA, value);
> >> +}
> >
> > I'd like to put a biiiig questionmark on this.
> > We already have SHM access. Your function does exactly the same, except that it
> > accesses the bullshit register h165.
>
> Yeah, that 0x165 is really crappy. Let's hope it really should be
> 0x166 (B43_MMIO_SHM_DATA_UNALIGNED).
>
> Do you think we should add dummy-read to b43_shm_control_word as
> BmacWriteShm does? Currently we do not perform that.

That doesn't hurt.
It probably won't help much either, as the whole driver depends on implicit write posting.
But I don't care whether you add it or not.

--
Greetings, Michael.