Re: Congratulations

2009-08-26 Thread Larry Finger
Gábor Stefanik wrote:
> 2009/8/27 Larry Finger :
>> Gábor,
>>
>> Congratulations on your progress. With today's patches my BCM4312
>> 802.11b/g card with PCI ID 14e4:4315 works - I'm using it at the
>> moment. I'm using WPA2 encryption and have connected to APs on
>> channels 1 and 11. My logs are clean.
> 
> That's good to hear!
> 
>> As you noted, performance is a little weak, but I get transmits of
>> 9-11 Mb/s and receive rates up to 18 Mb/s - eminently usable.
> 
> What is your actual RX throughput? For me, it's usable up to 24Mb/s,
> but the actual throughput is limited to 1.2Mb/s.

That 18 Mb/s receive rate was observed data transfer from my server
that is wired to the router/AP and over the air to the BCM4312, just
as the 11 Mb/s was observed transfer from the BCM4312 to the server. I
have no idea what bit rate was set into the interface. Every time I
looked, it was at 1 Mb/s, but the throughput is better than that.

--snip--

>> For those of you with N PHYs, the RE of those devices will be my next
>> step.
> 
> My next step will be calibration. :-)
> 
> (However, calibration specs are still not complete - there are 2 wlc_*
> calls in PR41573. But that only matters for rev.0, and apparently all
> 4312s are rev.1.)

I missed those (obviously). Are there any other places in the LP PHY
that need work?

Larry

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: Congratulations

2009-08-26 Thread Gábor Stefanik
2009/8/27 Larry Finger :
> Gábor,
>
> Congratulations on your progress. With today's patches my BCM4312
> 802.11b/g card with PCI ID 14e4:4315 works - I'm using it at the
> moment. I'm using WPA2 encryption and have connected to APs on
> channels 1 and 11. My logs are clean.

That's good to hear!

>
> As you noted, performance is a little weak, but I get transmits of
> 9-11 Mb/s and receive rates up to 18 Mb/s - eminently usable.

What is your actual RX throughput? For me, it's usable up to 24Mb/s,
but the actual throughput is limited to 1.2Mb/s.

>
> I certainly hope that you get the patches approved so that these
> changes will be in the 2.6.32 kernel.

The patches are already in the tree, actually.

>
> Once again, congratulations to you, Michael, and the others members of
> the reverse engineering team. Seeing the device comes to life makes
> all those hours of staring at MIPS binary code seem very worthwhile.
>
> For those of you with N PHYs, the RE of those devices will be my next
> step.

My next step will be calibration. :-)

(However, calibration specs are still not complete - there are 2 wlc_*
calls in PR41573. But that only matters for rev.0, and apparently all
4312s are rev.1.)

>
> Larry
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Congratulations

2009-08-26 Thread Larry Finger
Gábor,

Congratulations on your progress. With today's patches my BCM4312
802.11b/g card with PCI ID 14e4:4315 works - I'm using it at the
moment. I'm using WPA2 encryption and have connected to APs on
channels 1 and 11. My logs are clean.

As you noted, performance is a little weak, but I get transmits of
9-11 Mb/s and receive rates up to 18 Mb/s - eminently usable.

I certainly hope that you get the patches approved so that these
changes will be in the 2.6.32 kernel.

Once again, congratulations to you, Michael, and the others members of
the reverse engineering team. Seeing the device comes to life makes
all those hours of staring at MIPS binary code seem very worthwhile.

For those of you with N PHYs, the RE of those devices will be my next
step.

Larry
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH v3] b43: LP-PHY: Revert to the original PHY register write routine

2009-08-26 Thread Gábor Stefanik
After some discussion on IRC about the PHY register write change,
I am not sure anymore if this is the right thing to do.

Signed-off-by: Gábor Stefanik 
---
v3: Use 16-bit writes.

 drivers/net/wireless/b43/phy_lp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 80f245c..a57c40d 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1496,7 +1496,8 @@ static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 
reg)
 
 static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value)
 {
-   b43_write32(dev, B43_MMIO_PHY_CONTROL, ((u32)value << 16) | reg);
+   b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
+   b43_write16(dev, B43_MMIO_PHY_DATA, value);
 }
 
 static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
-- 
1.5.6

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH v2] b43: LP-PHY: Revert to the original PHY register write routine

2009-08-26 Thread Gábor Stefanik
After some discussion on IRC about the PHY register write change,
I am not sure anymore if this is the right thing to do.

Signed-off-by: Gábor Stefanik 
---
v2: No more "From: root".

 drivers/net/wireless/b43/phy_lp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 80f245c..a57c40d 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1496,7 +1496,8 @@ static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 
reg)
 
 static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value)
 {
-   b43_write32(dev, B43_MMIO_PHY_CONTROL, ((u32)value << 16) | reg);
+   b43_write32(dev, B43_MMIO_PHY_CONTROL, reg);
+   b43_write32(dev, B43_MMIO_PHY_DATA, value);
 }
 
 static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
-- 
1.5.6

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: LP-PHY: Revert to the original PHY register write routine

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 23:38:48 Gábor Stefanik wrote:
> From: root 
> 
> After some discussion on IRC about the PHY register write change,
> I am not sure anymore if this is the right thing to do.
> 
> Signed-off-by: Gábor Stefanik 
> ---
>  drivers/net/wireless/b43/phy_lp.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_lp.c 
> b/drivers/net/wireless/b43/phy_lp.c
> index 80f245c..a57c40d 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -1496,7 +1496,8 @@ static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 
> reg)
>  
>  static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value)
>  {
> - b43_write32(dev, B43_MMIO_PHY_CONTROL, ((u32)value << 16) | reg);
> + b43_write32(dev, B43_MMIO_PHY_CONTROL, reg);
> + b43_write32(dev, B43_MMIO_PHY_DATA, value);

You just introduced a bug (need 16bit write).
As I said. I'm OK with it, if it works. Just submit it as separate patch in the 
future.

>  }
>  
>  static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,



-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: LP-PHY: Revert to the original PHY register write routine

2009-08-26 Thread Gábor Stefanik
2009/8/26 Gábor Stefanik :
> From: root 

The joys of an accidental "sudo git format-patch"... :-)

>
> After some discussion on IRC about the PHY register write change,
> I am not sure anymore if this is the right thing to do.
>
> Signed-off-by: Gábor Stefanik 
> ---
>  drivers/net/wireless/b43/phy_lp.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/phy_lp.c 
> b/drivers/net/wireless/b43/phy_lp.c
> index 80f245c..a57c40d 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -1496,7 +1496,8 @@ static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 
> reg)
>
>  static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value)
>  {
> -       b43_write32(dev, B43_MMIO_PHY_CONTROL, ((u32)value << 16) | reg);
> +       b43_write32(dev, B43_MMIO_PHY_CONTROL, reg);
> +       b43_write32(dev, B43_MMIO_PHY_DATA, value);
>  }
>
>  static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
> --
> 1.5.6
>
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH] b43: LP-PHY: Revert to the original PHY register write routine

2009-08-26 Thread Gábor Stefanik
From: root 

After some discussion on IRC about the PHY register write change,
I am not sure anymore if this is the right thing to do.

Signed-off-by: Gábor Stefanik 
---
 drivers/net/wireless/b43/phy_lp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 80f245c..a57c40d 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1496,7 +1496,8 @@ static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 
reg)
 
 static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value)
 {
-   b43_write32(dev, B43_MMIO_PHY_CONTROL, ((u32)value << 16) | reg);
+   b43_write32(dev, B43_MMIO_PHY_CONTROL, reg);
+   b43_write32(dev, B43_MMIO_PHY_DATA, value);
 }
 
 static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
-- 
1.5.6

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 22:54:03 John W. Linville wrote:
> On Wed, Aug 26, 2009 at 10:47:12PM +0200, Gábor Stefanik wrote:
> > 2009/8/26 Michael Buesch :
> > > And, everything in its own patch, please. I don't see a reason for
> > > patching unrelated things in one big patch.
> > 
> > Well, this patch is already in wireless-testing, so doing that would
> > now involve reverting this patch, applying a version without the
> > channel change, and applying the channel change - certainly more
> > confusing than the status quo.
> 
> But it is not in net-next-2.6.  Please submit the patches as Michael
> requested and I'll take care of the reorganization.

You can leave it as-is. But for the future please make sure to submit
independent things in independent patches so they can be discussed
and merged independently.

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread John W. Linville
On Wed, Aug 26, 2009 at 10:47:12PM +0200, Gábor Stefanik wrote:
> 2009/8/26 Michael Buesch :
> > And, everything in its own patch, please. I don't see a reason for
> > patching unrelated things in one big patch.
> 
> Well, this patch is already in wireless-testing, so doing that would
> now involve reverting this patch, applying a version without the
> channel change, and applying the channel change - certainly more
> confusing than the status quo.

But it is not in net-next-2.6.  Please submit the patches as Michael
requested and I'll take care of the reorganization.

John
-- 
John W. LinvilleSomeday the world will need a hero, and you
linvi...@tuxdriver.com  might be all we have.  Be ready.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 22:47:12 Gábor Stefanik wrote:
> 2009/8/26 Michael Buesch :
> > On Wednesday 26 August 2009 20:51:25 Gábor Stefanik wrote:
> >> -Fix a few nasty typos (b43_phy_* operations instead of b43_radio_*)
> >>  in the channel tune routines.
> >> -Fix some typos & spec errors found by MMIO tracing.
> >> -Optimize b43_phy_write & b43_phy_mask/set/maskset to use
> >>  only the minimal number of MMIO accesses. (Write is possible
> >>  using a single 32-bit MMIO write, while set/mask/maskset can
> >>  be done in 3 16-bit MMIOs).
> >
> > Why does it matter? PHY access is not done in any hotpath. So why
> > not prefer simple code over optimized code?
> 
> This is how the MIPS/hybrid driver does it, I simply updated the code
> for parity.

I think _if_ we do it (I'm not sure if it's worth it), we should certainly
do it in a completely separate patch.

> 
> >
> >> -Set the default channel back to 1, as the bug forcing us to use
> >>  channel 7 is now fixed.
> >
> > And, everything in its own patch, please. I don't see a reason for
> > patching unrelated things in one big patch.
> 
> Well, this patch is already in wireless-testing, so doing that would

When did I ack it?
Note that I _do_ have a life and I was not able to check mail for the past 9 
hours.
So please give me an ack latency of one day, at least.

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread Gábor Stefanik
2009/8/26 Michael Buesch :
> On Wednesday 26 August 2009 20:51:25 Gábor Stefanik wrote:
>> -Fix a few nasty typos (b43_phy_* operations instead of b43_radio_*)
>>  in the channel tune routines.
>> -Fix some typos & spec errors found by MMIO tracing.
>> -Optimize b43_phy_write & b43_phy_mask/set/maskset to use
>>  only the minimal number of MMIO accesses. (Write is possible
>>  using a single 32-bit MMIO write, while set/mask/maskset can
>>  be done in 3 16-bit MMIOs).
>
> Why does it matter? PHY access is not done in any hotpath. So why
> not prefer simple code over optimized code?

This is how the MIPS/hybrid driver does it, I simply updated the code
for parity.

>
>> -Set the default channel back to 1, as the bug forcing us to use
>>  channel 7 is now fixed.
>
> And, everything in its own patch, please. I don't see a reason for
> patching unrelated things in one big patch.

Well, this patch is already in wireless-testing, so doing that would
now involve reverting this patch, applying a version without the
channel change, and applying the channel change - certainly more
confusing than the status quo.

>
>>
>> With this, the device comes up, scans, associates, transmits,
>> receives, monitors and injects on all channels - in other words,
>> it's fully functional. Sensitivity and TX power are still sub-optimal,
>> due to the lack of calibration (that's next on my list).
>>
>> Signed-off-by: Gábor Stefanik 
>> ---
>>  drivers/net/wireless/b43/phy_common.c   |   27 +++--
>>  drivers/net/wireless/b43/phy_common.h   |    3 +
>>  drivers/net/wireless/b43/phy_lp.c       |   91 
>> +--
>>  drivers/net/wireless/b43/phy_lp.h       |    3 +
>>  drivers/net/wireless/b43/tables_lpphy.c |   79 +++
>>  5 files changed, 122 insertions(+), 81 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/phy_common.c 
>> b/drivers/net/wireless/b43/phy_common.c
>> index 51686ec..6e704be 100644
>> --- a/drivers/net/wireless/b43/phy_common.c
>> +++ b/drivers/net/wireless/b43/phy_common.c
>> @@ -249,20 +249,35 @@ void b43_phy_copy(struct b43_wldev *dev, u16 destreg, 
>> u16 srcreg)
>>
>>  void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
>>  {
>> -     b43_phy_write(dev, offset,
>> -                   b43_phy_read(dev, offset) & mask);
>> +     if (dev->phy.ops->phy_maskset) {
>> +             assert_mac_suspended(dev);
>> +             dev->phy.ops->phy_maskset(dev, offset, mask, 0);
>> +     } else {
>> +             b43_phy_write(dev, offset,
>> +                           b43_phy_read(dev, offset) & mask);
>> +     }
>>  }
>>
>>  void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set)
>>  {
>> -     b43_phy_write(dev, offset,
>> -                   b43_phy_read(dev, offset) | set);
>> +     if (dev->phy.ops->phy_maskset) {
>> +             assert_mac_suspended(dev);
>> +             dev->phy.ops->phy_maskset(dev, offset, 0x, set);
>> +     } else {
>> +             b43_phy_write(dev, offset,
>> +                           b43_phy_read(dev, offset) | set);
>> +     }
>>  }
>>
>>  void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
>>  {
>> -     b43_phy_write(dev, offset,
>> -                   (b43_phy_read(dev, offset) & mask) | set);
>> +     if (dev->phy.ops->phy_maskset) {
>> +             assert_mac_suspended(dev);
>> +             dev->phy.ops->phy_maskset(dev, offset, mask, set);
>> +     } else {
>> +             b43_phy_write(dev, offset,
>> +                           (b43_phy_read(dev, offset) & mask) | set);
>> +     }
>>  }
>>
>>  int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
>> diff --git a/drivers/net/wireless/b43/phy_common.h 
>> b/drivers/net/wireless/b43/phy_common.h
>> index 9f9f23c..b47a0f5 100644
>> --- a/drivers/net/wireless/b43/phy_common.h
>> +++ b/drivers/net/wireless/b43/phy_common.h
>> @@ -95,6 +95,8 @@ enum b43_txpwr_result {
>>   *                   Must not be NULL.
>>   * @phy_write:               Write to a PHY register.
>>   *                   Must not be NULL.
>> + * @phy_maskset:     Maskset a PHY register, taking shortcuts.
>> + *                   If it is NULL, a generic algorithm is used.
>>   * @radio_read:              Read from a Radio register.
>>   *                   Must not be NULL.
>>   * @radio_write:     Write to a Radio register.
>> @@ -154,6 +156,7 @@ struct b43_phy_operations {
>>       /* Register access */
>>       u16 (*phy_read)(struct b43_wldev *dev, u16 reg);
>>       void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value);
>> +     void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set);
>>       u16 (*radio_read)(struct b43_wldev *dev, u16 reg);
>>       void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value);
>>
>> diff --git a/drivers/net/wireless/b43/phy_lp.c 
>> b/drivers/net/wireless/b43/phy_lp.c
>> index 5306f2c..1a57d33 100644
>> --- a/drivers/net/wireless/b43/phy_lp.c
>> +++ b/drivers/net/wireless/b43/phy_lp.

Re: [PATCH] b43: Remove scary message from LP-PHY's Kconfig

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 21:48:52 Gábor Stefanik wrote:
> From: root Gábor Stefanik 
> 
> The most common LP-PHY device, BCM4312, is now fully functional.
> So, no need to say "probably won't work for you" anymore.
> It's also not "for debuggers and developers only", as it is
> perfectly usable for end-users now (at least for BCM4312).

Please also add
default y

> 
> Signed-off-by: Gábor Stefanik 
> ---
> This should only be applied once the "Qdiv roundup" and the "Fix and update"
> patches reach the tree, as those 2 patches are needed to make the BCM4312
> really work.
> 
>  drivers/net/wireless/b43/Kconfig |3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/Kconfig 
> b/drivers/net/wireless/b43/Kconfig
> index 87d10c8..1c0999b 100644
> --- a/drivers/net/wireless/b43/Kconfig
> +++ b/drivers/net/wireless/b43/Kconfig
> @@ -88,9 +88,6 @@ config B43_PHY_LP
> and embedded devices. It supports 802.11a/g
> (802.11a support is optional, and currently disabled).
>  
> -   This is heavily experimental, and probably will not work for you.
> -   Say N unless you want to help debug the driver.
> -
>  # This config option automatically enables b43 LEDS support,
>  # if it's possible.
>  config B43_LEDS



-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] ssb: Implement PMU LDO control and use it in b43

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 20:51:26 Gábor Stefanik wrote:
> Implement the "PMU LDO set voltage" and "PMU LDO PA ref enable"
> functions, and use them during LP-PHY baseband init in b43.
> 
> Signed-off-by: Gábor Stefanik 

ack

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread Michael Buesch
On Wednesday 26 August 2009 20:51:25 Gábor Stefanik wrote:
> -Fix a few nasty typos (b43_phy_* operations instead of b43_radio_*)
>  in the channel tune routines.
> -Fix some typos & spec errors found by MMIO tracing.
> -Optimize b43_phy_write & b43_phy_mask/set/maskset to use
>  only the minimal number of MMIO accesses. (Write is possible
>  using a single 32-bit MMIO write, while set/mask/maskset can
>  be done in 3 16-bit MMIOs).

Why does it matter? PHY access is not done in any hotpath. So why
not prefer simple code over optimized code? 

> -Set the default channel back to 1, as the bug forcing us to use
>  channel 7 is now fixed.

And, everything in its own patch, please. I don't see a reason for
patching unrelated things in one big patch.

> 
> With this, the device comes up, scans, associates, transmits,
> receives, monitors and injects on all channels - in other words,
> it's fully functional. Sensitivity and TX power are still sub-optimal,
> due to the lack of calibration (that's next on my list).
> 
> Signed-off-by: Gábor Stefanik 
> ---
>  drivers/net/wireless/b43/phy_common.c   |   27 +++--
>  drivers/net/wireless/b43/phy_common.h   |3 +
>  drivers/net/wireless/b43/phy_lp.c   |   91 
> +--
>  drivers/net/wireless/b43/phy_lp.h   |3 +
>  drivers/net/wireless/b43/tables_lpphy.c |   79 +++
>  5 files changed, 122 insertions(+), 81 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_common.c 
> b/drivers/net/wireless/b43/phy_common.c
> index 51686ec..6e704be 100644
> --- a/drivers/net/wireless/b43/phy_common.c
> +++ b/drivers/net/wireless/b43/phy_common.c
> @@ -249,20 +249,35 @@ void b43_phy_copy(struct b43_wldev *dev, u16 destreg, 
> u16 srcreg)
>  
>  void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
>  {
> - b43_phy_write(dev, offset,
> -   b43_phy_read(dev, offset) & mask);
> + if (dev->phy.ops->phy_maskset) {
> + assert_mac_suspended(dev);
> + dev->phy.ops->phy_maskset(dev, offset, mask, 0);
> + } else {
> + b43_phy_write(dev, offset,
> +   b43_phy_read(dev, offset) & mask);
> + }
>  }
>  
>  void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set)
>  {
> - b43_phy_write(dev, offset,
> -   b43_phy_read(dev, offset) | set);
> + if (dev->phy.ops->phy_maskset) {
> + assert_mac_suspended(dev);
> + dev->phy.ops->phy_maskset(dev, offset, 0x, set);
> + } else {
> + b43_phy_write(dev, offset,
> +   b43_phy_read(dev, offset) | set);
> + }
>  }
>  
>  void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
>  {
> - b43_phy_write(dev, offset,
> -   (b43_phy_read(dev, offset) & mask) | set);
> + if (dev->phy.ops->phy_maskset) {
> + assert_mac_suspended(dev);
> + dev->phy.ops->phy_maskset(dev, offset, mask, set);
> + } else {
> + b43_phy_write(dev, offset,
> +   (b43_phy_read(dev, offset) & mask) | set);
> + }
>  }
>  
>  int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
> diff --git a/drivers/net/wireless/b43/phy_common.h 
> b/drivers/net/wireless/b43/phy_common.h
> index 9f9f23c..b47a0f5 100644
> --- a/drivers/net/wireless/b43/phy_common.h
> +++ b/drivers/net/wireless/b43/phy_common.h
> @@ -95,6 +95,8 @@ enum b43_txpwr_result {
>   *   Must not be NULL.
>   * @phy_write:   Write to a PHY register.
>   *   Must not be NULL.
> + * @phy_maskset: Maskset a PHY register, taking shortcuts.
> + *   If it is NULL, a generic algorithm is used.
>   * @radio_read:  Read from a Radio register.
>   *   Must not be NULL.
>   * @radio_write: Write to a Radio register.
> @@ -154,6 +156,7 @@ struct b43_phy_operations {
>   /* Register access */
>   u16 (*phy_read)(struct b43_wldev *dev, u16 reg);
>   void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value);
> + void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set);
>   u16 (*radio_read)(struct b43_wldev *dev, u16 reg);
>   void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value);
>  
> diff --git a/drivers/net/wireless/b43/phy_lp.c 
> b/drivers/net/wireless/b43/phy_lp.c
> index 5306f2c..1a57d33 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -44,7 +44,7 @@ static inline u16 channel2freq_lp(u8 channel)
>  static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev)
>  {
>   if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
> - return 7; //FIXME temporary - channel 1 is broken
> + return 1;
>   return 36;
>  }
>  
> @@ -182,8 +182,8 @@ static void lpphy_adjust_gain_table(struct b43_wldev 
> *dev, u32 freq)
>   temp[1] = 

[PATCH] b43: Remove scary message from LP-PHY's Kconfig

2009-08-26 Thread Gábor Stefanik
From: root Gábor Stefanik 

The most common LP-PHY device, BCM4312, is now fully functional.
So, no need to say "probably won't work for you" anymore.
It's also not "for debuggers and developers only", as it is
perfectly usable for end-users now (at least for BCM4312).

Signed-off-by: Gábor Stefanik 
---
This should only be applied once the "Qdiv roundup" and the "Fix and update"
patches reach the tree, as those 2 patches are needed to make the BCM4312
really work.

 drivers/net/wireless/b43/Kconfig |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 87d10c8..1c0999b 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -88,9 +88,6 @@ config B43_PHY_LP
  and embedded devices. It supports 802.11a/g
  (802.11a support is optional, and currently disabled).
 
- This is heavily experimental, and probably will not work for you.
- Say N unless you want to help debug the driver.
-
 # This config option automatically enables b43 LEDS support,
 # if it's possible.
 config B43_LEDS
-- 
1.5.6

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH] b43: Fix and update LP-PHY code

2009-08-26 Thread Gábor Stefanik
-Fix a few nasty typos (b43_phy_* operations instead of b43_radio_*)
 in the channel tune routines.
-Fix some typos & spec errors found by MMIO tracing.
-Optimize b43_phy_write & b43_phy_mask/set/maskset to use
 only the minimal number of MMIO accesses. (Write is possible
 using a single 32-bit MMIO write, while set/mask/maskset can
 be done in 3 16-bit MMIOs).
-Set the default channel back to 1, as the bug forcing us to use
 channel 7 is now fixed.

With this, the device comes up, scans, associates, transmits,
receives, monitors and injects on all channels - in other words,
it's fully functional. Sensitivity and TX power are still sub-optimal,
due to the lack of calibration (that's next on my list).

Signed-off-by: Gábor Stefanik 
---
 drivers/net/wireless/b43/phy_common.c   |   27 +++--
 drivers/net/wireless/b43/phy_common.h   |3 +
 drivers/net/wireless/b43/phy_lp.c   |   91 +--
 drivers/net/wireless/b43/phy_lp.h   |3 +
 drivers/net/wireless/b43/tables_lpphy.c |   79 +++
 5 files changed, 122 insertions(+), 81 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index 51686ec..6e704be 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -249,20 +249,35 @@ void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 
srcreg)
 
 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
 {
-   b43_phy_write(dev, offset,
- b43_phy_read(dev, offset) & mask);
+   if (dev->phy.ops->phy_maskset) {
+   assert_mac_suspended(dev);
+   dev->phy.ops->phy_maskset(dev, offset, mask, 0);
+   } else {
+   b43_phy_write(dev, offset,
+ b43_phy_read(dev, offset) & mask);
+   }
 }
 
 void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set)
 {
-   b43_phy_write(dev, offset,
- b43_phy_read(dev, offset) | set);
+   if (dev->phy.ops->phy_maskset) {
+   assert_mac_suspended(dev);
+   dev->phy.ops->phy_maskset(dev, offset, 0x, set);
+   } else {
+   b43_phy_write(dev, offset,
+ b43_phy_read(dev, offset) | set);
+   }
 }
 
 void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
 {
-   b43_phy_write(dev, offset,
- (b43_phy_read(dev, offset) & mask) | set);
+   if (dev->phy.ops->phy_maskset) {
+   assert_mac_suspended(dev);
+   dev->phy.ops->phy_maskset(dev, offset, mask, set);
+   } else {
+   b43_phy_write(dev, offset,
+ (b43_phy_read(dev, offset) & mask) | set);
+   }
 }
 
 int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index 9f9f23c..b47a0f5 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -95,6 +95,8 @@ enum b43_txpwr_result {
  * Must not be NULL.
  * @phy_write: Write to a PHY register.
  * Must not be NULL.
+ * @phy_maskset:   Maskset a PHY register, taking shortcuts.
+ * If it is NULL, a generic algorithm is used.
  * @radio_read:Read from a Radio register.
  * Must not be NULL.
  * @radio_write:   Write to a Radio register.
@@ -154,6 +156,7 @@ struct b43_phy_operations {
/* Register access */
u16 (*phy_read)(struct b43_wldev *dev, u16 reg);
void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value);
+   void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set);
u16 (*radio_read)(struct b43_wldev *dev, u16 reg);
void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 5306f2c..1a57d33 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -44,7 +44,7 @@ static inline u16 channel2freq_lp(u8 channel)
 static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev)
 {
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
-   return 7; //FIXME temporary - channel 1 is broken
+   return 1;
return 36;
 }
 
@@ -182,8 +182,8 @@ static void lpphy_adjust_gain_table(struct b43_wldev *dev, 
u32 freq)
temp[1] = temp[0] + 0x1000;
temp[2] = temp[0] + 0x2000;
 
-   b43_lptab_write_bulk(dev, B43_LPTAB16(12, 0), 3, temp);
b43_lptab_write_bulk(dev, B43_LPTAB16(13, 0), 3, temp);
+   b43_lptab_write_bulk(dev, B43_LPTAB16(12, 0), 3, temp);
 }
 
 static void lpphy_table_init(struct b43_wldev *dev)
@@ -223,8 +223,8 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_maskset(dev, B43_LPPH

[PATCH] ssb: Implement PMU LDO control and use it in b43

2009-08-26 Thread Gábor Stefanik
Implement the "PMU LDO set voltage" and "PMU LDO PA ref enable"
functions, and use them during LP-PHY baseband init in b43.

Signed-off-by: Gábor Stefanik 
---
 drivers/net/wireless/b43/phy_lp.c |   10 +--
 drivers/ssb/driver_chipcommon_pmu.c   |   94 +
 include/linux/ssb/ssb_driver_chipcommon.h |   10 +++
 3 files changed, 107 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 1a57d33..80f245c 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -234,19 +234,15 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
if ((bus->sprom.boardflags_lo & B43_BFL_FEM) &&
   ((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
   (bus->sprom.boardflags_hi & B43_BFH_PAREF))) {
-   /* TODO:
-* Set the LDO voltage to 0x0028 - FIXME: What is this?
-* Call sb_pmu_set_ldo_voltage with 4 and the LDO voltage
-*  as arguments
-* Call sb_pmu_paref_ldo_enable with argument TRUE
-*/
+   ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28);
+   ssb_pmu_set_ldo_paref(&bus->chipco, true);
if (dev->phy.rev == 0) {
b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
0xFFCF, 0x0010);
}
b43_lptab_write(dev, B43_LPTAB16(11, 7), 60);
} else {
-   //TODO: Call ssb_pmu_paref_ldo_enable with argument FALSE
+   ssb_pmu_set_ldo_paref(&bus->chipco, false);
b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
0xFFCF, 0x0020);
b43_lptab_write(dev, B43_LPTAB16(11, 7), 100);
diff --git a/drivers/ssb/driver_chipcommon_pmu.c 
b/drivers/ssb/driver_chipcommon_pmu.c
index 4aaddee..64abd11 100644
--- a/drivers/ssb/driver_chipcommon_pmu.c
+++ b/drivers/ssb/driver_chipcommon_pmu.c
@@ -28,6 +28,21 @@ static void ssb_chipco_pll_write(struct ssb_chipcommon *cc,
chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, value);
 }
 
+static void ssb_chipco_regctl_maskset(struct ssb_chipcommon *cc,
+  u32 offset, u32 mask, u32 set)
+{
+   u32 value;
+
+   chipco_read32(cc, SSB_CHIPCO_REGCTL_ADDR);
+   chipco_write32(cc, SSB_CHIPCO_REGCTL_ADDR, offset);
+   chipco_read32(cc, SSB_CHIPCO_REGCTL_ADDR);
+   value = chipco_read32(cc, SSB_CHIPCO_REGCTL_DATA);
+   value &= mask;
+   value |= set;
+   chipco_write32(cc, SSB_CHIPCO_REGCTL_DATA, value);
+   chipco_read32(cc, SSB_CHIPCO_REGCTL_DATA);
+}
+
 struct pmu0_plltab_entry {
u16 freq;   /* Crystal frequency in kHz.*/
u8 xf;  /* Crystal frequency value for PMU control */
@@ -506,3 +521,82 @@ void ssb_pmu_init(struct ssb_chipcommon *cc)
ssb_pmu_pll_init(cc);
ssb_pmu_resources_init(cc);
 }
+
+void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc,
+enum ssb_pmu_ldo_volt_id id, u32 voltage)
+{
+   struct ssb_bus *bus = cc->dev->bus;
+   u32 addr, shift, mask;
+
+   switch (bus->chip_id) {
+   case 0x4328:
+   case 0x5354:
+   switch (id) {
+   case LDO_VOLT1:
+   addr = 2;
+   shift = 25;
+   mask = 0xF;
+   break;
+   case LDO_VOLT2:
+   addr = 3;
+   shift = 1;
+   mask = 0xF;
+   break;
+   case LDO_VOLT3:
+   addr = 3;
+   shift = 9;
+   mask = 0xF;
+   break;
+   case LDO_PAREF:
+   addr = 3;
+   shift = 17;
+   mask = 0x3F;
+   break;
+   default:
+   SSB_WARN_ON(1);
+   return;
+   }
+   break;
+   case 0x4312:
+   if (SSB_WARN_ON(id != LDO_PAREF))
+   return;
+   addr = 0;
+   shift = 21;
+   mask = 0x3F;
+   break;
+   default:
+   return;
+   }
+
+   ssb_chipco_regctl_maskset(cc, addr, ~(mask << shift),
+ (voltage & mask) << shift);
+}
+
+void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on)
+{
+   struct ssb_bus *bus = cc->dev->bus;
+   int ldo;
+
+   switch (bus->chip_id) {
+   case 0x4312:
+   ldo = SSB_PMURES_4312_PA_REF_LDO;
+   break;
+   case 0x4328:
+   ldo = SSB_PMURES_4328_PA_REF_LDO;
+   break;
+   case 0x5354:
+   ldo = SSB_PMURES_5354_PA_REF_LDO;
+   break;
+ 

[PATCH v2] b43: LP-PHY: Fix and simplify Qdiv roundup

2009-08-26 Thread Gábor Stefanik
The Qdiv roundup routine is essentially a fixed-point
division algorithm, using only integer math.
However, the version in the specs had a major error
that has been recently fixed (a missing quotient++).

Replace Qdiv roundup with a rewritten, simplified version.

Signed-off-by: Gábor Stefanik 
---
v2: Remove divide/modulo operations from the inner loop.

 drivers/net/wireless/b43/phy_lp.c |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 7e70c07..5306f2c 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1032,9 +1032,10 @@ static int lpphy_loopback(struct b43_wldev *dev)
return index;
 }
 
+/* Fixed-point division algorithm using only integer math. */
 static u32 lpphy_qdiv_roundup(u32 dividend, u32 divisor, u8 precision)
 {
-   u32 quotient, remainder, rbit, roundup, tmp;
+   u32 quotient, remainder;
 
if (divisor == 0)
return 0;
@@ -1042,20 +1043,16 @@ static u32 lpphy_qdiv_roundup(u32 dividend, u32 
divisor, u8 precision)
quotient = dividend / divisor;
remainder = dividend % divisor;
 
-   rbit = divisor & 0x1;
-   roundup = (divisor >> 1) + rbit;
-
-   while (precision != 0) {
-   tmp = remainder - roundup;
+   while (precision > 0) {
quotient <<= 1;
-   if (remainder >= roundup)
-   remainder = (tmp << 1) + rbit;
-   else
-   remainder <<= 1;
+   if (remainder << 1 >= divisor) {
+   quotient++;
+   remainder = (remainder << 1) - divisor;
+   }
precision--;
}
 
-   if (remainder >= roundup)
+   if (remainder << 1 >= divisor)
quotient++;
 
return quotient;
-- 
1.5.6

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev