2010-01-06 15:39:12

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls


From ec599007464bb8220c605af500b724797d54aba8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
Date: Wed, 6 Jan 2010 15:20:20 +0100
Subject: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index ceb429a..40d7b73 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -348,6 +348,63 @@ static void b43_nphy_reset_cca(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg & ~B43_NPHY_BBCFG_RSTCCA);
}

+static void b43_nphy_write_clip_detection(struct b43_wldev *dev, u16 *vals)
+{
+ b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, vals[0]);
+ b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, vals[1]);
+}
+
+static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *vals)
+{
+ vals[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
+ vals[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
+}
+
+static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
+{
+ u16 tmp;
+ bool suspended = false;
+
+ if (dev->dev->id.revision == 16 && dev->mac_suspended == 0) {
+ b43_mac_suspend(dev);
+ suspended = true;
+ }
+
+ tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
+ tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN |
+ B43_NPHY_CLASSCTL_WAITEDEN);
+ tmp &= ~mask;
+ tmp |= (val & mask);
+ b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
+
+ if (suspended)
+ b43_mac_enable(dev);
+
+ return tmp;
+}
+
+static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
+{
+ struct b43_phy *phy = &dev->phy;
+ struct b43_phy_n *nphy = phy->n;
+
+ if (enable) {
+ u16 clip[] = { 0xFFFF, 0xFFFF };
+ if (nphy->deaf_count++ == 0) {
+ nphy->classifier_state = b43_nphy_classifier(dev, 0, 0);
+ b43_nphy_classifier(dev, 0x7, 0);
+ b43_nphy_read_clip_detection(dev, nphy->clip_state);
+ b43_nphy_write_clip_detection(dev, clip);
+ }
+ b43_nphy_reset_cca(dev);
+ } else {
+ if (--nphy->deaf_count != 0) {
+ b43_nphy_classifier(dev, 0x7, nphy->classifier_state);
+ b43_nphy_write_clip_detection(dev, nphy->clip_state);
+ }
+ }
+}
+
enum b43_nphy_rf_sequence {
B43_RFSEQ_RX2TX,
B43_RFSEQ_TX2RX,
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index e5e402a..6ab07fc 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -932,6 +932,9 @@ struct b43_phy_n {
u32 deaf_count;
bool mute;

+ u16 classifier_state;
+ u16 clip_state[2];
+
u8 iqcal_chanspec_2G;
u8 rssical_chanspec_2G;

--
1.6.4.2


2010-01-06 15:45:04

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

Dnia 06-01-2010 o 16:40:32 Rafał Miłecki <[email protected]> napisał(a):

> b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

Attaching patch (only inline-posted before).

--
Rafał


Attachments:
0001-b43-N-PHY-implement-b43_nphy_stay_carrier_search-and.patch (2.86 kB)

2010-01-06 20:53:18

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
rename function. Thanks Michael!

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

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index ceb429a..5252c0f 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -348,6 +348,64 @@ static void b43_nphy_reset_cca(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg & ~B43_NPHY_BBCFG_RSTCCA);
}

+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
+static void b43_nphy_write_clip_detection(struct b43_wldev *dev, u16 *clip_st)
+{
+ b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, clip_st[0]);
+ b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, clip_st[1]);
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
+static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st)
+{
+ clip_st[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
+ clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
+static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
+{
+ u16 tmp;
+
+ if (dev->dev->id.revision == 16)
+ b43_mac_suspend(dev);
+
+ tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
+ tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN |
+ B43_NPHY_CLASSCTL_WAITEDEN);
+ tmp &= ~mask;
+ tmp |= (val & mask);
+ b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
+
+ if (dev->dev->id.revision == 16)
+ b43_mac_enable(dev);
+
+ return tmp;
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */
+static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, bool enable)
+{
+ struct b43_phy *phy = &dev->phy;
+ struct b43_phy_n *nphy = phy->n;
+
+ if (enable) {
+ u16 clip[] = { 0xFFFF, 0xFFFF };
+ if (nphy->deaf_count++ == 0) {
+ nphy->classifier_state = b43_nphy_classifier(dev, 0, 0);
+ b43_nphy_classifier(dev, 0x7, 0);
+ b43_nphy_read_clip_detection(dev, nphy->clip_state);
+ b43_nphy_write_clip_detection(dev, clip);
+ }
+ b43_nphy_reset_cca(dev);
+ } else {
+ if (--nphy->deaf_count == 0) {
+ b43_nphy_classifier(dev, 0x7, nphy->classifier_state);
+ b43_nphy_write_clip_detection(dev, nphy->clip_state);
+ }
+ }
+}
+
enum b43_nphy_rf_sequence {
B43_RFSEQ_RX2TX,
B43_RFSEQ_TX2RX,
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index e5e402a..6ab07fc 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -932,6 +932,9 @@ struct b43_phy_n {
u32 deaf_count;
bool mute;

+ u16 classifier_state;
+ u16 clip_state[2];
+
u8 iqcal_chanspec_2G;
u8 rssical_chanspec_2G;

--
1.6.4.2


2010-01-06 23:32:54

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

On Thu, Jan 7, 2010 at 12:12 AM, Rafa? Mi?ecki <[email protected]> wrote:
> W dniu 6 stycznia 2010 23:59 u?ytkownik Larry Finger
> <[email protected]> napisa?:
>> On 01/06/2010 04:49 PM, G?bor Stefanik wrote:
>>> 2010/1/6 Rafa? Mi?ecki <[email protected]>:
>>>> W dniu 6 stycznia 2010 23:35 u?ytkownik G?bor Stefanik
>>>> <[email protected]> napisa?:
>>>>> 2010/1/6 Rafa? Mi?ecki <[email protected]>:
>>>>>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>>>>> ? ?rename function. Thanks Michael!
>>>>>>
>>>>>> Signed-off-by: Rafa? Mi?ecki <[email protected]>
>>>>>> ---
>>>>>> ?drivers/net/wireless/b43/phy_n.c | ? 58
>>>>>> ++++++++++++++++++++++++++++++++++++++
>>>>>> ?drivers/net/wireless/b43/phy_n.h | ? ?3 ++
>>>>>> ?2 files changed, 61 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> <snip>
>>>>>
>>>>> Typo in title (it's vs. its)
>>>>
>>>> My gramma is far from perfect, thanks.
>>>
>>> I've yet to see a perfect grandmother... :-)
>>
>> My wife thinks she is perfect!
>
> What a one latter can change ;)
>
> --
> Rafa?
>

The the impotence of proofreading

Has this ever happened to you?

You work very very horde on a paper for English clash
And you still get a very glow raid on it (like a D or even a D=)
and all because you are the liverwurst spoiler in the whale wide word.
Yes, proofreading your peppers is a matter of the the utmost impotence.

Now, this is a problem that affects manly, manly students, all over the world.
I myself was such a bed spiller once upon a term
that my English torturer in my sophomoric year,
Mrs. Myth, she said that I would never get into a good colleague.
And that's all I wanted, that's all any kid wants at that age,
just to get into a good colleague!
And not just anal community colleague either,
because I am not the kind of guy who would be happy at just anal
community colleague.
I need to be challenged. Challenged, menstrually.
I needed a place that can offer me intellectual simulation.
So I know this probably makes me sound like a stereo,
but I really felt that I could get into an ivory legal colleague.
So if I did not improvement
then gone would be my dream of going to Harvard, Jail, or Prison
(you know, in Prison, New Jersey).

So I got myself a spell checker
and figured I was on Sleazy Street.

But there are several missed aches
that a spell chukker can't can't catch catch.
For instant, if you accidentally leave out word,
your spell checker won't put it in you.
And God for billing purposes only
you should have serial problems with Tori Spelling
your spell Chekhov might replace a word
with one you had absolutely no detention of using.
Because, I mean, what do you want it to douche? You know...
No, it only does what you tell it to douche.
You're the one who's sitting in front of the computer scream,
with your hand on the mouth going clit, clit, clit.
It just goes to show you how embargo
one careless little clit of the mouth can be.

Which reminds me of this one time during my Junior Mint.
The teacher took the paper that I have written on A Sale of Two Titties.
No, I'm cereal, I'm cereal.
She read it out loud in front of all of my assmates.
It was quite possibly one of the most humidifying experiences I've ever had,
being laughed at, like that, pubicly.

So do yourself a flavor and follow these two Pisces of advice:
One: There is no prostitute for careful editing of your own work. No
prostitute, whatsoever.
And three: When it comes to proofreading,
the red penis your friend.

Spank you!

(Credits go to Taylor Mali for this one.)

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

2010-01-06 22:59:25

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

On 01/06/2010 04:49 PM, G?bor Stefanik wrote:
> 2010/1/6 Rafa? Mi?ecki <[email protected]>:
>> W dniu 6 stycznia 2010 23:35 u?ytkownik G?bor Stefanik
>> <[email protected]> napisa?:
>>> 2010/1/6 Rafa? Mi?ecki <[email protected]>:
>>>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>>> rename function. Thanks Michael!
>>>>
>>>> Signed-off-by: Rafa? Mi?ecki <[email protected]>
>>>> ---
>>>> drivers/net/wireless/b43/phy_n.c | 58
>>>> ++++++++++++++++++++++++++++++++++++++
>>>> drivers/net/wireless/b43/phy_n.h | 3 ++
>>>> 2 files changed, 61 insertions(+), 0 deletions(-)
>>>>
>>>> <snip>
>>>
>>> Typo in title (it's vs. its)
>>
>> My gramma is far from perfect, thanks.
>
> I've yet to see a perfect grandmother... :-)

My wife thinks she is perfect!

Larry

2010-01-06 23:12:38

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

W dniu 6 stycznia 2010 23:59 użytkownik Larry Finger
<[email protected]> napisał:
> On 01/06/2010 04:49 PM, Gábor Stefanik wrote:
>> 2010/1/6 Rafał Miłecki <[email protected]>:
>>> W dniu 6 stycznia 2010 23:35 użytkownik Gábor Stefanik
>>> <[email protected]> napisał:
>>>> 2010/1/6 Rafał Miłecki <[email protected]>:
>>>>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>>>>    rename function. Thanks Michael!
>>>>>
>>>>> Signed-off-by: Rafał Miłecki <[email protected]>
>>>>> ---
>>>>>  drivers/net/wireless/b43/phy_n.c |   58
>>>>> ++++++++++++++++++++++++++++++++++++++
>>>>>  drivers/net/wireless/b43/phy_n.h |    3 ++
>>>>>  2 files changed, 61 insertions(+), 0 deletions(-)
>>>>>
>>>>> <snip>
>>>>
>>>> Typo in title (it's vs. its)
>>>
>>> My gramma is far from perfect, thanks.
>>
>> I've yet to see a perfect grandmother... :-)
>
> My wife thinks she is perfect!

What a one latter can change ;)

--
Rafał

2010-01-06 20:11:10

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

2010/1/6 Michael Buesch <[email protected]>:
> On Wednesday 06 January 2010 16:40:32 Rafał Miłecki wrote:
>> +static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
>> +{
>> +     struct b43_phy *phy = &dev->phy;
>> +     struct b43_phy_n *nphy = phy->n;
>> +
>> +     if (enable) {
>> +             u16 clip[] = { 0xFFFF, 0xFFFF };
>> +             if (nphy->deaf_count++ == 0) {
>> +                     nphy->classifier_state = b43_nphy_classifier(dev, 0, 0);
>> +                     b43_nphy_classifier(dev, 0x7, 0);
>> +                     b43_nphy_read_clip_detection(dev, nphy->clip_state);
>> +                     b43_nphy_write_clip_detection(dev, clip);
>> +             }
>> +             b43_nphy_reset_cca(dev);
>> +     } else {
>> +             if (--nphy->deaf_count != 0) {
>
> If this test logic correct? The following would make more sense to me:

Huuh, thanks for catching that! I believe you saved me from long
debugging in future.

--
Rafał

2010-01-06 16:36:37

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

On 01/06/2010 09:50 AM, Michael Buesch wrote:
> On Wednesday 06 January 2010 16:40:32 Rafał Miłecki wrote:
>> b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls
>
> Hm, The phrase "stay carrier earch" doesn't make a lot of sense to me.
> Is "stray carrier search" or something like that meant?
> Not that I care much, but I'm just wondering if this is just a typo.

"stay in carrier search"

>
>> +static void b43_nphy_write_clip_detection(struct b43_wldev *dev, u16 *vals)
>
> We know that these values are the clip thresholds, so use a better variable name, please.
>
>> +{
>> + b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, vals[0]);
>> + b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, vals[1]);
>> +}
>> +
>> +static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *vals)
>> +{
>> + vals[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
>> + vals[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
>> +}
>> +
>> +static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
>> +{
>> + u16 tmp;
>> + bool suspended = false;
>> +
>> + if (dev->dev->id.revision == 16 && dev->mac_suspended == 0) {
>
> Do not check for mac_suspended==0 here. b43_mac_suspended does this internally.
>
>> + b43_mac_suspend(dev);
>> + suspended = true;
>> + }
>> +
>> + tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
>> + tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN |
>> + B43_NPHY_CLASSCTL_WAITEDEN);
>> + tmp &= ~mask;
>> + tmp |= (val & mask);
>> + b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
>> +
>> + if (suspended)
>> + b43_mac_enable(dev);
>> +
>> + return tmp;
>> +}
>> +
>> +static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
>> +{
>> + struct b43_phy *phy = &dev->phy;
>> + struct b43_phy_n *nphy = phy->n;
>> +
>> + if (enable) {
>> + u16 clip[] = { 0xFFFF, 0xFFFF };
>> + if (nphy->deaf_count++ == 0) {
>> + nphy->classifier_state = b43_nphy_classifier(dev, 0, 0);
>> + b43_nphy_classifier(dev, 0x7, 0);
>> + b43_nphy_read_clip_detection(dev, nphy->clip_state);
>> + b43_nphy_write_clip_detection(dev, clip);
>> + }
>> + b43_nphy_reset_cca(dev);
>> + } else {
>> + if (--nphy->deaf_count != 0) {
>
> If this test logic correct? The following would make more sense to me:
>
> if (--nphy->deaf_count == 0) {

It should be == 0. Specs match Broadcom code.


Larry


2010-01-06 22:37:03

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

2010/1/6 Gábor Stefanik <[email protected]>:
> 2010/1/6 Rafał Miłecki <[email protected]>:
>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>    rename function. Thanks Michael!
>>
>> Signed-off-by: Rafał Miłecki <[email protected]>
>> ---
>>  drivers/net/wireless/b43/phy_n.c |   58
>> ++++++++++++++++++++++++++++++++++++++
>>  drivers/net/wireless/b43/phy_n.h |    3 ++
>>  2 files changed, 61 insertions(+), 0 deletions(-)
>>
>> <snip>
>
> Typo in title (it's vs. its)

Note that you don't need to resubmit for this, I posted this so the
committer (John AFAIK) will notice and fix it before committing.

--Gábor

>
>>
>> --
>> 1.6.4.2
>>
>> --
>> 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. :-)
>



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

2010-01-06 22:35:36

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

2010/1/6 Rafał Miłecki <[email protected]>:
> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>    rename function. Thanks Michael!
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
>  drivers/net/wireless/b43/phy_n.c |   58
> ++++++++++++++++++++++++++++++++++++++
>  drivers/net/wireless/b43/phy_n.h |    3 ++
>  2 files changed, 61 insertions(+), 0 deletions(-)
>
> <snip>

Typo in title (it's vs. its)

>
> --
> 1.6.4.2
>
> --
> 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-01-06 22:45:08

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

W dniu 6 stycznia 2010 23:35 użytkownik Gábor Stefanik
<[email protected]> napisał:
> 2010/1/6 Rafał Miłecki <[email protected]>:
>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>    rename function. Thanks Michael!
>>
>> Signed-off-by: Rafał Miłecki <[email protected]>
>> ---
>>  drivers/net/wireless/b43/phy_n.c |   58
>> ++++++++++++++++++++++++++++++++++++++
>>  drivers/net/wireless/b43/phy_n.h |    3 ++
>>  2 files changed, 61 insertions(+), 0 deletions(-)
>>
>> <snip>
>
> Typo in title (it's vs. its)

My gramma is far from perfect, thanks.

--
Rafał

2010-01-06 22:49:45

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_in_carrier_search and it's calls (V2)

2010/1/6 Rafa? Mi?ecki <[email protected]>:
> W dniu 6 stycznia 2010 23:35 u?ytkownik G?bor Stefanik
> <[email protected]> napisa?:
>> 2010/1/6 Rafa? Mi?ecki <[email protected]>:
>>> V2: fix typo in deaf_count counting, improve b43_mac_[sr] calls,
>>> ? ?rename function. Thanks Michael!
>>>
>>> Signed-off-by: Rafa? Mi?ecki <[email protected]>
>>> ---
>>> ?drivers/net/wireless/b43/phy_n.c | ? 58
>>> ++++++++++++++++++++++++++++++++++++++
>>> ?drivers/net/wireless/b43/phy_n.h | ? ?3 ++
>>> ?2 files changed, 61 insertions(+), 0 deletions(-)
>>>
>>> <snip>
>>
>> Typo in title (it's vs. its)
>
> My gramma is far from perfect, thanks.

I've yet to see a perfect grandmother... :-)

>
> --
> Rafa?
>



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

2010-01-06 15:50:58

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 1/5] b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

On Wednesday 06 January 2010 16:40:32 Rafał Miłecki wrote:
> b43: N-PHY: implement b43_nphy_stay_carrier_search and it's calls

Hm, The phrase "stay carrier earch" doesn't make a lot of sense to me.
Is "stray carrier search" or something like that meant?
Not that I care much, but I'm just wondering if this is just a typo.

> +static void b43_nphy_write_clip_detection(struct b43_wldev *dev, u16 *vals)

We know that these values are the clip thresholds, so use a better variable name, please.

> +{
> + b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, vals[0]);
> + b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, vals[1]);
> +}
> +
> +static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *vals)
> +{
> + vals[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
> + vals[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
> +}
> +
> +static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
> +{
> + u16 tmp;
> + bool suspended = false;
> +
> + if (dev->dev->id.revision == 16 && dev->mac_suspended == 0) {

Do not check for mac_suspended==0 here. b43_mac_suspended does this internally.

> + b43_mac_suspend(dev);
> + suspended = true;
> + }
> +
> + tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
> + tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN |
> + B43_NPHY_CLASSCTL_WAITEDEN);
> + tmp &= ~mask;
> + tmp |= (val & mask);
> + b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
> +
> + if (suspended)
> + b43_mac_enable(dev);
> +
> + return tmp;
> +}
> +
> +static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
> +{
> + struct b43_phy *phy = &dev->phy;
> + struct b43_phy_n *nphy = phy->n;
> +
> + if (enable) {
> + u16 clip[] = { 0xFFFF, 0xFFFF };
> + if (nphy->deaf_count++ == 0) {
> + nphy->classifier_state = b43_nphy_classifier(dev, 0, 0);
> + b43_nphy_classifier(dev, 0x7, 0);
> + b43_nphy_read_clip_detection(dev, nphy->clip_state);
> + b43_nphy_write_clip_detection(dev, clip);
> + }
> + b43_nphy_reset_cca(dev);
> + } else {
> + if (--nphy->deaf_count != 0) {

If this test logic correct? The following would make more sense to me:

if (--nphy->deaf_count == 0) {

> + b43_nphy_classifier(dev, 0x7, nphy->classifier_state);
> + b43_nphy_write_clip_detection(dev, nphy->clip_state);
> + }
> + }
> +}
> +
> enum b43_nphy_rf_sequence {
> B43_RFSEQ_RX2TX,
> B43_RFSEQ_TX2RX,
> diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
> index e5e402a..6ab07fc 100644
> --- a/drivers/net/wireless/b43/phy_n.h
> +++ b/drivers/net/wireless/b43/phy_n.h
> @@ -932,6 +932,9 @@ struct b43_phy_n {
> u32 deaf_count;
> bool mute;
>
> + u16 classifier_state;
> + u16 clip_state[2];
> +
> u8 iqcal_chanspec_2G;
> u8 rssical_chanspec_2G;
>



--
Greetings, Michael.