[PATCH] b43: Add myself to module authors to LP-PHY file copyright notices

2009-08-28 Thread Gábor Stefanik
Also mark the LP-PHY driver 802.11a/g instead of 802.11g,
as LP-PHY is capable of both 2GHz and 5GHz operation.

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

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 5cc90a2..f2c5b2d 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -58,6 +58,7 @@ MODULE_DESCRIPTION(Broadcom B43 wireless driver);
 MODULE_AUTHOR(Martin Langer);
 MODULE_AUTHOR(Stefano Brivio);
 MODULE_AUTHOR(Michael Buesch);
+MODULE_AUTHOR(Gábor Stefanik);
 MODULE_LICENSE(GPL);
 
 MODULE_FIRMWARE(B43_SUPPORTED_FIRMWARE_ID);
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index fded6e5..5fff30a 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1,9 +1,10 @@
 /*
 
   Broadcom B43 wireless driver
-  IEEE 802.11g LP-PHY driver
+  IEEE 802.11a/g LP-PHY driver
 
   Copyright (c) 2008-2009 Michael Buesch m...@bu3sch.de
+  Copyright (c) 2009 Gábor Stefanik netrolller...@gmail.com
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/tables_lpphy.c 
b/drivers/net/wireless/b43/tables_lpphy.c
index 3464ac0..61027ee 100644
--- a/drivers/net/wireless/b43/tables_lpphy.c
+++ b/drivers/net/wireless/b43/tables_lpphy.c
@@ -1,9 +1,10 @@
 /*
 
   Broadcom B43 wireless driver
-  IEEE 802.11g LP-PHY and radio device data tables
+  IEEE 802.11a/g LP-PHY and radio device data tables
 
   Copyright (c) 2009 Michael Buesch m...@bu3sch.de
+  Copyright (c) 2009 Gábor Stefanik netrolller...@gmail.com
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-- 
1.6.2.4



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


[PATCH] b43: Fix typo in modparam_btcoex description

2009-08-28 Thread Gábor Stefanik
Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 1263f4b..f2c5b2d 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -91,7 +91,7 @@ MODULE_PARM_DESC(qos, Enable QOS support (default on));
 
 static int modparam_btcoex = 1;
 module_param_named(btcoex, modparam_btcoex, int, 0444);
-MODULE_PARM_DESC(btcoex, Enable Bluetooth coexistance (default on));
+MODULE_PARM_DESC(btcoex, Enable Bluetooth coexistence (default on));
 
 int b43_modparam_verbose = B43_VERBOSITY_DEFAULT;
 module_param_named(verbose, b43_modparam_verbose, int, 0644);
-- 
1.6.2.4



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


b43: LP-PHY: Fix TX gain tables

2009-08-28 Thread Gábor Stefanik
The rev1 2GHz and rev2 5GHz gain tables were incorrectly documented
on the specs originally. Update these gaintables to match the cor-
rected specs.

Signed-off-by: Gábor Stefanik netroller...@gmail.com
---
 drivers/net/wireless/b43/tables_lpphy.c |  306 +++---
 1 files changed, 153 insertions(+), 153 deletions(-)

diff --git a/drivers/net/wireless/b43/tables_lpphy.c 
b/drivers/net/wireless/b43/tables_lpphy.c
index b24521c..0312b31 100644
--- a/drivers/net/wireless/b43/tables_lpphy.c
+++ b/drivers/net/wireless/b43/tables_lpphy.c
@@ -1613,11 +1613,62 @@ static struct lpphy_tx_gain_table_entry 
lpphy_rev1_nopa_tx_gain_table[] = {
 };
 
 static struct lpphy_tx_gain_table_entry lpphy_rev1_2ghz_tx_gain_table[] = {
-   { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 85, },
-   { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 81, },
-   { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 78, },
-   { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 76, },
-   { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 74, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 90, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 88, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 85, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 83, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 81, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 78, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 76, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 74, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 59, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 59, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 59, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 59, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 72, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 70, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 68, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 66, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 64, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 62, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, },
+   { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 59, },
{ .gm = 4, .pga = 15, .pad = 9, .dac = 0

[PATCH] b43: LP-PHY: Fix TX gain tables

2009-08-28 Thread Gábor Stefanik
Just noticed that the [PATCH] tag is accidentally missing on this one
- I hope you can still apply it.

2009/8/28 Gábor Stefanik netrolller...@gmail.com:
 The rev1 2GHz and rev2 5GHz gain tables were incorrectly documented
 on the specs originally. Update these gaintables to match the cor-
 rected specs.

 Signed-off-by: Gábor Stefanik netroller...@gmail.com
 ---
 drivers/net/wireless/b43/tables_lpphy.c |  306
 +++---
 1 files changed, 153 insertions(+), 153 deletions(-)

 diff --git a/drivers/net/wireless/b43/tables_lpphy.c
 b/drivers/net/wireless/b43/tables_lpphy.c
 index b24521c..0312b31 100644
 --- a/drivers/net/wireless/b43/tables_lpphy.c
 +++ b/drivers/net/wireless/b43/tables_lpphy.c
 @@ -1613,11 +1613,62 @@ static struct lpphy_tx_gain_table_entry
 lpphy_rev1_nopa_tx_gain_table[] = {
 };

 static struct lpphy_tx_gain_table_entry lpphy_rev1_2ghz_tx_gain_table[] = {
 -       { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 85, },
 -       { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 81, },
 -       { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 78, },
 -       { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 76, },
 -       { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 74, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 90, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 88, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 85, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 83, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 81, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 78, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 76, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 74, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 62, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 60, },
 +       { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 59, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, },
 +       { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, },
 +       { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 59, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, },
 +       { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 59, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 62, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 60, },
 +       { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 59, },
 +       { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 72, },
 +       { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 70, },
 +       { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 68, },
 +       { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 66, },
 +       { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 64, },
 +       { .gm = 4, .pga = 15, .pad

[PATCH] b43: Enable LP-PHY support by default and remove Kconfig warning

2009-08-27 Thread 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 netrolller...@gmail.com
---
This replaces the remove scary message patch.

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

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 237b1aa..2af3b35 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
 -82,15 +82,13 @@ config B43_NPHY
 config B43_PHY_LP
bool Support for low-power (LP-PHY) devices (EXPERIMENTAL)
depends on B43  EXPERIMENTAL
+   default y
---help---
  Support for the LP-PHY.
  The LP-PHY is a low-power PHY built into some notebooks
  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.6.2.4

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


[PATCH v2] b43: Enable LP-PHY support by default and remove Kconfig warning

2009-08-27 Thread 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 netrolller...@gmail.com
---
This replaces the remove scary message patch.

V2: Fix pastebin damage.

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

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 237b1aa..2af3b35 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -82,15 +82,13 @@ config B43_NPHY
 config B43_PHY_LP
bool Support for low-power (LP-PHY) devices (EXPERIMENTAL)
depends on B43  EXPERIMENTAL
+   default y
---help---
  Support for the LP-PHY.
  The LP-PHY is a low-power PHY built into some notebooks
  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.6.2.4


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


[RFC/RFT] b43: Implement antenna diversity support for LP-PHY

2009-08-27 Thread Gábor Stefanik
Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
This intentionally deviates slightly from the spec (writing
the antenna ID in one pass instead of two) - please test if
this works. (I don't have the tools to test if it actually
selects the right antenna.)

The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

 drivers/net/wireless/b43/main.c   |3 ++-
 drivers/net/wireless/b43/phy_a.c  |2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +-
 drivers/net/wireless/b43/phy_g.c  |2 +-
 drivers/net/wireless/b43/phy_lp.c |   11 ++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
return B43_TXH_PHY_ANT2;
case B43_ANTENNA3:
return B43_TXH_PHY_ANT3;
-   case B43_ANTENNA_AUTO:
+   case B43_ANTENNA_AUTO0:
+   case B43_ANTENNA_AUTO1:
return B43_TXH_PHY_ANT01AUTO;
}
B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..a6a90df 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-   B43_ANTENNA0,   /* Antenna 0 */
-   B43_ANTENNA1,   /* Antenna 0 */
-   B43_ANTENNA_AUTO1,  /* Automatic, starting with antenna 1 */
-   B43_ANTENNA_AUTO0,  /* Automatic, starting with antenna 0 */
-   B43_ANTENNA2,
+   B43_ANTENNA0 = 0,   /* Antenna 0 */
+   B43_ANTENNA1 = 1,   /* Antenna 1 */
+   B43_ANTENNA_AUTO0 = 2,  /* Automatic, starting with antenna 0 */
+   B43_ANTENNA_AUTO1 = 3,  /* Automatic, starting with antenna 1 */
+   B43_ANTENNA2 = 4,
B43_ANTENNA3 = 8,
 
B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 837d952..457357a 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-   //TODO
+   int autodiv = ;
+
+   if (dev-phy.rev = 2)
+   return; // rev2+ doesn't support antenna diversity
+
+   if (B43_WARN_ON(antenna  B43_ANTENNA_AUTO1))
+   return;
+
+   /* NOTE: The spec breaks this up into 2 writes - please test */
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFC, antenna);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4



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


[PATCH] b43: Implement antenna diversity support for LP-PHY

2009-08-27 Thread Gábor Stefanik
The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
Note that according to recent spec changes, the A/G-PHY
antenna diversity routines also need to be updated.
However, I'm not lumping those changes into this patch
(this is for LP-PHY).

 drivers/net/wireless/b43/main.c   |3 ++-
 drivers/net/wireless/b43/phy_a.c  |2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +-
 drivers/net/wireless/b43/phy_g.c  |2 +-
 drivers/net/wireless/b43/phy_lp.c |   11 ++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
return B43_TXH_PHY_ANT2;
case B43_ANTENNA3:
return B43_TXH_PHY_ANT3;
-   case B43_ANTENNA_AUTO:
+   case B43_ANTENNA_AUTO0:
+   case B43_ANTENNA_AUTO1:
return B43_TXH_PHY_ANT01AUTO;
}
B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..28e3846 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-   B43_ANTENNA0,   /* Antenna 0 */
-   B43_ANTENNA1,   /* Antenna 0 */
-   B43_ANTENNA_AUTO1,  /* Automatic, starting with antenna 1 */
-   B43_ANTENNA_AUTO0,  /* Automatic, starting with antenna 0 */
-   B43_ANTENNA2,
+   B43_ANTENNA0 = 0,   /* Antenna 0 */
+   B43_ANTENNA1 = 1,   /* Antenna 1 */
+   B43_ANTENNA_AUTO0 = 2,  /* Automatic, starting with antenna 0 */
+   B43_ANTENNA_AUTO1 = 3,  /* Automatic, starting with antenna 1 */
+   B43_ANTENNA2 = 4,
B43_ANTENNA3 = 8,
 
B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 837d952..055c0f7 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-   //TODO
+   int autodiv = ;
+
+   if (dev-phy.rev = 2)
+   return; // rev2+ doesn't support antenna diversity
+
+   if (B43_WARN_ON(antenna  B43_ANTENNA_AUTO1))
+   return;
+
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna  0x2);
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna  0x1);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4



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


Re: [PATCH] b43: Implement antenna diversity support for LP-PHY

2009-08-27 Thread Gábor Stefanik
2009/8/27 Michael Buesch m...@bu3sch.de:
 On Thursday 27 August 2009 20:56:22 Gábor Stefanik wrote:
 The A/G-PHY changes are fallout fixes from the enum change,
 which in turn allows the LP-PHY code to be much simpler.
 The antenna_to_phyctl change is a fix for a potential
 existing bug that this patch may otherwise trigger.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 Note that according to recent spec changes, the A/G-PHY
 antenna diversity routines also need to be updated.
 However, I'm not lumping those changes into this patch
 (this is for LP-PHY).

  drivers/net/wireless/b43/main.c       |    3 ++-
  drivers/net/wireless/b43/phy_a.c      |    2 +-
  drivers/net/wireless/b43/phy_common.h |   10 +-
  drivers/net/wireless/b43/phy_g.c      |    2 +-
  drivers/net/wireless/b43/phy_lp.c     |   11 ++-
  5 files changed, 19 insertions(+), 9 deletions(-)

 diff --git a/drivers/net/wireless/b43/main.c 
 b/drivers/net/wireless/b43/main.c
 index 289e06c..3b038c9 100644
 --- a/drivers/net/wireless/b43/main.c
 +++ b/drivers/net/wireless/b43/main.c
 @@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
               return B43_TXH_PHY_ANT2;
       case B43_ANTENNA3:
               return B43_TXH_PHY_ANT3;
 -     case B43_ANTENNA_AUTO:
 +     case B43_ANTENNA_AUTO0:
 +     case B43_ANTENNA_AUTO1:
               return B43_TXH_PHY_ANT01AUTO;
       }
       B43_WARN_ON(1);
 diff --git a/drivers/net/wireless/b43/phy_a.c 
 b/drivers/net/wireless/b43/phy_a.c
 index 816e028..809ec97 100644
 --- a/drivers/net/wireless/b43/phy_a.c
 +++ b/drivers/net/wireless/b43/phy_a.c
 @@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev 
 *dev, int antenna)

       tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
       tmp = ~B43_PHY_BBANDCFG_RXANT;
 -     tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
 +     tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
            B43_PHY_BBANDCFG_RXANT_SHIFT;
       b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);

 diff --git a/drivers/net/wireless/b43/phy_common.h 
 b/drivers/net/wireless/b43/phy_common.h
 index b47a0f5..28e3846 100644
 --- a/drivers/net/wireless/b43/phy_common.h
 +++ b/drivers/net/wireless/b43/phy_common.h
 @@ -49,11 +49,11 @@ enum b43_interference_mitigation {

  /* Antenna identifiers */
  enum {
 -     B43_ANTENNA0,           /* Antenna 0 */
 -     B43_ANTENNA1,           /* Antenna 0 */
 -     B43_ANTENNA_AUTO1,      /* Automatic, starting with antenna 1 */
 -     B43_ANTENNA_AUTO0,      /* Automatic, starting with antenna 0 */
 -     B43_ANTENNA2,
 +     B43_ANTENNA0 = 0,       /* Antenna 0 */
 +     B43_ANTENNA1 = 1,       /* Antenna 1 */
 +     B43_ANTENNA_AUTO0 = 2,  /* Automatic, starting with antenna 0 */
 +     B43_ANTENNA_AUTO1 = 3,  /* Automatic, starting with antenna 1 */
 +     B43_ANTENNA2 = 4,
       B43_ANTENNA3 = 8,

       B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
 diff --git a/drivers/net/wireless/b43/phy_g.c 
 b/drivers/net/wireless/b43/phy_g.c
 index c6c9d2f..c6d639d 100644
 --- a/drivers/net/wireless/b43/phy_g.c
 +++ b/drivers/net/wireless/b43/phy_g.c
 @@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct 
 b43_wldev *dev, int antenna)

       tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
       tmp = ~B43_PHY_BBANDCFG_RXANT;
 -     tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
 +     tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
                        B43_PHY_BBANDCFG_RXANT_SHIFT;
       b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);

 diff --git a/drivers/net/wireless/b43/phy_lp.c 
 b/drivers/net/wireless/b43/phy_lp.c
 index 837d952..055c0f7 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)

  static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
  {
 -     //TODO
 +     int autodiv = ;

 Does this compile?

That's a typo. Also, the autodiv variable shouldn't be there at all.
Will respin.


 +
 +     if (dev-phy.rev = 2)
 +             return; // rev2+ doesn't support antenna diversity
 +
 +     if (B43_WARN_ON(antenna  B43_ANTENNA_AUTO1))
 +             return;
 +
 +     b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna  0x2);
 +     b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna  0x1);
  }

  static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)



 --
 Greetings, Michael.




-- 
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 v2] b43: Implement antenna diversity support for LP-PHY

2009-08-27 Thread Gábor Stefanik
The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
v2: Fix a typo.

 drivers/net/wireless/b43/main.c   |3 ++-
 drivers/net/wireless/b43/phy_a.c  |2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +-
 drivers/net/wireless/b43/phy_g.c  |2 +-
 drivers/net/wireless/b43/phy_lp.c |9 -
 5 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
return B43_TXH_PHY_ANT2;
case B43_ANTENNA3:
return B43_TXH_PHY_ANT3;
-   case B43_ANTENNA_AUTO:
+   case B43_ANTENNA_AUTO0:
+   case B43_ANTENNA_AUTO1:
return B43_TXH_PHY_ANT01AUTO;
}
B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..28e3846 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-   B43_ANTENNA0,   /* Antenna 0 */
-   B43_ANTENNA1,   /* Antenna 0 */
-   B43_ANTENNA_AUTO1,  /* Automatic, starting with antenna 1 */
-   B43_ANTENNA_AUTO0,  /* Automatic, starting with antenna 0 */
-   B43_ANTENNA2,
+   B43_ANTENNA0 = 0,   /* Antenna 0 */
+   B43_ANTENNA1 = 1,   /* Antenna 1 */
+   B43_ANTENNA_AUTO0 = 2,  /* Automatic, starting with antenna 0 */
+   B43_ANTENNA_AUTO1 = 3,  /* Automatic, starting with antenna 1 */
+   B43_ANTENNA2 = 4,
B43_ANTENNA3 = 8,
 
B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev 
*dev, int antenna)
 
tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
tmp = ~B43_PHY_BBANDCFG_RXANT;
-   tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+   tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 B43_PHY_BBANDCFG_RXANT_SHIFT;
b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 837d952..fded6e5 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,14 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-   //TODO
+   if (dev-phy.rev = 2)
+   return; // rev2+ doesn't support antenna diversity
+
+   if (B43_WARN_ON(antenna  B43_ANTENNA_AUTO1))
+   return;
+
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna  0x2);
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna  0x1);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4



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


[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 netrolller...@gmail.com
---
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


[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 netrolller...@gmail.com
---
 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] 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 netrolller...@gmail.com
---
 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

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

2009-08-26 Thread Gábor Stefanik
From: root Gábor Stefanik netrolller...@gmail.com

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 netrolller...@gmail.com
---
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


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

2009-08-26 Thread Gábor Stefanik
2009/8/26 Michael Buesch m...@bu3sch.de:
 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 netrolller...@gmail.com
 ---
  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

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

2009-08-26 Thread Gábor Stefanik
From: root r...@nr3dmain.nr3d

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 netrolller...@gmail.com
---
 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 Gábor Stefanik
2009/8/26 Gábor Stefanik netrolller...@gmail.com:
 From: root r...@nr3dmain.nr3d

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 netrolller...@gmail.com
 ---
  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 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 netrolller...@gmail.com
---
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


[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 netrolller...@gmail.com
---
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


Re: Congratulations

2009-08-26 Thread Gábor Stefanik
2009/8/27 Larry Finger larry.fin...@lwfinger.net:
 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


[PATCH] b43: LP-PHY: Fix a few typos in the RC calibration code

2009-08-25 Thread Gábor Stefanik
The RC calibration code has some typos - fix them.
Also, make the default channel 7, as channel 1 is still
broken (only channels 7 and 8, and occasionally 9 work).

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

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 2d3a5d8..7e70c07 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 1;
+   return 7; //FIXME temporary - channel 1 is broken
return 36;
 }
 
@@ -705,7 +705,7 @@ static void lpphy_set_rc_cap(struct b43_wldev *dev)
u8 rc_cap = (lpphy-rc_cap  0x1F)  1;
 
if (dev-phy.rev == 1) //FIXME check channel 14!
-   rc_cap = max_t(u8, rc_cap + 5, 15);
+   rc_cap = min_t(u8, rc_cap + 5, 15);
 
b43_radio_write(dev, B2062_N_RXBB_CALIB2,
max_t(u8, lpphy-rc_cap - 4, 0x80));
@@ -1008,6 +1008,7 @@ static int lpphy_loopback(struct b43_wldev *dev)
 
b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x3);
b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
+   b43_phy_set(dev, B43_LPPHY_AFE_CTL_OVR, 1);
b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFFE);
b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x800);
b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x800);
@@ -1213,7 +1214,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
mean_sq_pwr = ideal_pwr - normal_pwr;
mean_sq_pwr *= mean_sq_pwr;
inner_sum += mean_sq_pwr;
-   if ((i = 128) || (inner_sum  mean_sq_pwr_min)) {
+   if ((i == 128) || (inner_sum  mean_sq_pwr_min)) {
lpphy-rc_cap = i;
mean_sq_pwr_min = inner_sum;
}
-- 
1.5.6

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


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

2009-08-25 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 netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |   14 --
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 7e70c07..d0280d5 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1034,7 +1034,7 @@ static int lpphy_loopback(struct b43_wldev *dev)
 
 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 +1042,14 @@ 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;
quotient = 1;
-   if (remainder = roundup)
-   remainder = (tmp  1) + rbit;
-   else
-   remainder = 1;
+   quotient |= (remainder  1) / divisor;
+   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


Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!

2009-08-20 Thread Gábor Stefanik
2009/8/20 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 2009/8/19 Mark Huijgen mark.sf@huijgen.tk:

 To summarize, all cases with patches and new firmware:
 case 1: cold boot with default channel 7, RC calib error and 'init
 channel failed' error,
 case 2: recompile+reload b43 with default channel 1, just 'init channel
 failed' error,
 case 3: recompile+reload b43 with default channel 7, works


 You mean 'iw dev wlan0 set channel 1' for example?

 In case 2 (with default chan 1), ifconfig wlan0 gives error
 SIOCSIFFLAGS: Input/output error

 # iw dev wlan0 set channel 1
 no output generated, also nothing in dmesg

 # iw dev wlan0 scan trigger
 command failed: Network is down (-100)
 nothing in dmesg.

 Both commands do not give any output in dmesg in case 3 either.

 Tried channel 1 up to 11, 12 and higher gives 'command failed: Invalid
 argument (-22)', which is expected I think.


 Set your regulatory domain to something that allows higher channels
 (e.g. iw reg set JP - this one unlocks channels 1-14 (14 is
 CCK/802.11b only); or iw reg set HU - channels 1-13) to test channels
 14 and up.

 # iw reg set JP
 [  606.879287] cfg80211: Calling CRDA for country: JP
 # iw phy phy5 info
 snip
                        * 2467 MHz [12] (disabled)
                        * 2472 MHz [13] (disabled)
                        * 2484 MHz [14] (disabled)
 snip

 # iw dev wlan0 set channel 14
 command failed: Invalid argument (-22)



 Also, test this:

 Create a monitor interface (iw dev wlan0 interface add mon0 type monitor)
 Up the interface (ifconfig mon0 up)
 Set channel to 1 (iwconfig mon0 channel 1 or iw dev wlan0 set channel 1)
 Run tcpdump on the interface (tcpdump -i mon0).

 This produces quite a lot of packages, small snippet:
 08:35:31.676268 171437241us tsft 1.0 Mb/s 31 MHz (0x00a0) -82dB signal
 0dB noise antenna 0 [0x000e] Beacon ESS, PRIVACY
 08:35:31.679047 171439995us tsft 1.0 Mb/s 31 MHz (0x00a0) -82dB signal
 0dB noise antenna 0 [0x000e] Beacon ESS, PRIVACY
 08:35:31.691757 171454461us tsft 1.0 Mb/s 31 MHz (0x00a0) -72dB signal
 0dB noise antenna 0 [0x000e] Data IV:8a27a7 Pad 20 KeyID 1
 08:35:31.693722 171457076us tsft 2.0 Mb/s 31 MHz (0x00a0) -58dB signal
 0dB noise antenna 0 [0x000e] Probe Request () [1.0* 2.0* 5.5* 11.0*
 9.0 18.0 36.0 54.0 Mbit]
 08:35:31.710293 171472955us tsft 1.0 Mb/s 31 MHz (0x00a0) -59dB signal
 0dB noise antenna 0 [0x000e] Beacon ESS, PRIVACY

 So channel 1 does receive packets it seems. Should I be able to see data
 packets from another system thats associated and downloading from my AP
 on channel 1? Protected by WPA. Or are they not shown?
 I don't see any, only thin I notice is the number of pkgs/second is a
 lot less when I'm downloading something on the other system.

 If I cycle through the channels with iw dev mon0 set channel N, all
 channels give similar output in tcpdump.

 Try for other channel values as well. (You don't need to recreate the
 interface for each channel, just use the channel-setting command to
 switch the channel.) You should see packets on all channels.

 Another thing to try: add a printk to b43_lpphy_op_set_channel and
 print out new_channel. This will log all channel change requests
 (including automatic ones) to dmesg, which can be helpful.

 Done, see further down in this mail.
 If you set your AP to channel 11, can you connect to it  use it as normal?

 After doing my tripple module load/recompile to switch default chan from
 7-1-7,
 yes, then everything seems to work on channel 11. Then all reloads with
 default chan 7 still work fine,
 but if I try a default chan of 1 again, it fails to bring the inteface up.

 I cannot connect to my AP on channel 1, since it does not show up in the
 scan results (on another system right beside it, with another type of
 card, it does show up and work).


 With the added printk in switch channel:

 After cold boot with default chan 1:
 [   70.066976] b43-phy1 debug: Switching to channel: 7
 [   70.071314] b43-phy1 debug: Switching to channel: 1
 [   70.071808] b43-phy1 debug: Switch to init channel failed, error = -5.
 [   70.071844] b43-phy1 debug: Switching to channel: 1
 [   70.072341] b43-phy1 ERROR: PHY init: Channel switch to default failed

 After recompile with default chan 7:
 [  226.810985] b43-phy2 debug: Switching to channel: 7
 [  226.815320] b43-phy2 debug: Switching to channel: 7
 [  226.815632] b43-phy2 debug: Switching to channel: 7
 [  226.824062] b43-phy2 debug: Chip initialized
 [  226.824274] b43-phy2 debug: 64-bit DMA initialized
 [  226.845588] Registered led device: b43-phy2::tx
 [  226.845610] Registered led device: b43-phy2::rx
 [  226.845630] Registered led device: b43-phy2::radio
 [  226.845696] b43-phy2 debug: Wireless interface started
 [  226.845717] b43-phy2 debug: Adding Interface type 2
 [  226.845812] b43-phy2 debug: Switching to channel: 1

 And a working interface.

 Another cold boot, this time starting with default chan 7

Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) now ready for testing!

2009-08-19 Thread Gábor Stefanik
2009/8/19 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 Hello World!

 Great news for Broadcom BCM4310/4312/4315 (PCI 14e4:4315) users:
 LP-PHY support is now at the point where it can be tested for functionality!

 So, go ahead, give it a try, and let's rock!

 Patches applied, well manually, cause I wasn't able to extract a working
 version from the emails or the weblink provided. Whats the recommended
 method to apply these git patches on mailinglists?

 Here goes:

 # modprobe b43 verbose=3
 [ 1596.228088] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
 0x4243)
 [ 1596.228100] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
 vendor 0x4243)
 [ 1596.228110] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
 [ 1596.228120] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
 [ 1596.248050] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
 [ 1596.256780] ssb: SPROM revision 8 detected.
 [ 1596.276093] ssb: Sonics Silicon Backplane found on PCI device
 :10:00.0
 [ 1596.281108] b43-phy2: Broadcom 4312 WLAN found (core revision 15)
 [ 1596.324046] b43-phy2 debug: Found PHY: Analog 6, Type 5, Revision 1
 [ 1596.324060] b43-phy2 debug: Found Radio: Manuf 0x17F, Version 0x2062,
 Revision 2
 [ 1596.348233] phy2: Selected rate control algorithm 'minstrel'
 [ 1596.348349] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
 FW13 ]

 # ifconfig wlan0 up
 SIOCSIFFLAGS: Input/output error

 [ 1689.356055] b43 ssb0:0: firmware: requesting b43/ucode15.fw
 [ 1689.703918] b43 ssb0:0: firmware: requesting b43/lp0initvals15.fw
 [ 1689.710418] b43 ssb0:0: firmware: requesting b43/lp0bsinitvals15.fw
 [ 1689.852058] b43-phy2: Loading firmware version 410.2160 (2007-05-26
 15:32:10)
 [ 1689.854963] b43-phy2 debug: b2062: Using crystal tab entry 19200 kHz.
 [ 1689.855468] b43-phy2 debug: RC calib: Failed to switch to channel 7,
 error = -5
 [ 1689.860016] b43-phy2 debug: Switch to init channel failed, error = -5.

Hmm, error -5 is EIO, which in the channel switch code is used to
represent PLL charge pump out of range. This is specifically the
error I was trying to fix... could you try without the 2 extra
patches? Maybe I did something wrong. (Without the 2 patches, channels
1..6 and 9..11 (12...14 not tested) throw this error, but channels 7
and 8 work.)

Also try extracting firmware from
ftp://downloads.netgear.com/files/GPL/WNDR3300-V1.0.29_gpl_src.zip's
wl_apsta.o file (newer than the one on mirror.openwrt.org - you may
need to add the extraction defines to fwcutter first; there is a
script in the fwcutter git tree, probably also in tarballs, that
generates extraction lists.) This is the firmware the specs are
written for; it's possible that the current firmware is simply not
good for LP-PHY (or maybe it needs code based on older specs).

 [ 1689.860543] b43-phy2 ERROR: PHY init: Channel switch to default failed

 Interface is not coming up, so cannot scan:
 # iwlist wlan0 scan
 wlan0     Interface doesn't support scanning : Network is down

When testing mac80211 drivers, always use iw dev wlan0 scan, not
iwlist wlan0 scan. (Though this shouldn't affect your results in
this case.)

Try bringing up the interface in monitor mode.
Also, try changing get_default_chan to return 7 instead of 1.



 # iwconfig wlan0
 wlan0     IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated
          Tx-Power=0 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

 # iw dev wlan0 info
 Interface wlan0
        ifindex 5
        type managed

 # iw phy phy2 info
 Wiphy phy2
        Band 1:
                Frequencies:
                        * 2412 MHz [1] (27.0 dBm)
                        * 2417 MHz [2] (27.0 dBm)
                        * 2422 MHz [3] (27.0 dBm)
                        * 2427 MHz [4] (27.0 dBm)
                        * 2432 MHz [5] (27.0 dBm)
                        * 2437 MHz [6] (27.0 dBm)
                        * 2442 MHz [7] (27.0 dBm)
                        * 2447 MHz [8] (27.0 dBm)
                        * 2452 MHz [9] (27.0 dBm)
                        * 2457 MHz [10] (27.0 dBm)
                        * 2462 MHz [11] (27.0 dBm)
                        * 2467 MHz [12] (disabled)
                        * 2472 MHz [13] (disabled)
                        * 2484 MHz [14] (disabled)
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
        max # scan SSIDs: 4
        Supported interface modes

Re: [PATCH] b43: LP-PHY: Implement spec updates and remove resolved FIXMEs

2009-08-19 Thread Gábor Stefanik
John, please hold off this patch for now, it appears to be causing
regressions. I will investigate this.

2009/8/18 Gábor Stefanik netrolller...@gmail.com:
 Larry has started re-checking all current routines against a new
 version of the Broadcom MIPS driver. This patch implements the first
 round of changes he documented on the specs wiki.

 Also remove a few FIXMEs regarding missing initial values for variables
 with dynamic initial values where reading the values has been implemented.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 drivers/net/wireless/b43/phy_lp.c       |   98
 +++
 drivers/net/wireless/b43/phy_lp.h       |   18 +++---
 drivers/net/wireless/b43/tables_lpphy.c |   12 -
 3 files changed, 82 insertions(+), 46 deletions(-)

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 242338f..6c69cdb 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -719,9 +719,39 @@ static void lpphy_set_bb_mult(struct b43_wldev *dev, u8
 bb_mult)
        b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
 }

 -static void lpphy_disable_crs(struct b43_wldev *dev)
 +static void lpphy_set_deaf(struct b43_wldev *dev, bool user)
 {
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 1;
 +       else
 +               lpphy-crs_sys_disable = 1;
        b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
 +}
 +
 +static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
 +{
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 0;
 +       else
 +               lpphy-crs_sys_disable = 0;
 +
 +       if (!lpphy-crs_usr_disable  !lpphy-crs_sys_disable) {
 +               if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x60);
 +               else
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x20);
 +       }
 +}
 +
 +static void lpphy_disable_crs(struct b43_wldev *dev, bool user)
 +{
 +       lpphy_set_deaf(dev, user);
        b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
        b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
 @@ -749,12 +779,9 @@ static void lpphy_disable_crs(struct b43_wldev *dev)
        b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
 }

 -static void lpphy_restore_crs(struct b43_wldev *dev)
 +static void lpphy_restore_crs(struct b43_wldev *dev, bool user)
 {
 -       if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
 -       else
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
 +       lpphy_clear_deaf(dev, user);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
 }
 @@ -800,10 +827,11 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                                0xF800, rf_gain);
        } else {
 -               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x7F00;
 +               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x1FC0;
 +               pa_gain = 2;
                b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                              (gains.pga  8) | gains.gm);
 -               b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
 +               b43_phy_maskset(dev, B43_PHY_OFDM(0xFB),
                                0x8000, gains.pad | pa_gain);
                b43_phy_write(dev, B43_PHY_OFDM(0xFC),
                              (gains.pga  8) | gains.gm);
 @@ -817,7 +845,7 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F, 1 
 7);
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF, 1 
 14);
        }
 -       b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFBF, 1  6);
 +       b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF, 1  6);
 }

 static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain)
 @@ -857,33 +885,33 @@ static void lpphy_rev2plus_set_rx_gain(struct
 b43_wldev *dev, u32 gain)
        }
 }

 -static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
 +static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 {
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFEF);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFBF);
        if (dev-phy.rev = 2) {
                b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF);
 -               if (b43_current_band(dev-wl

Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!

2009-08-19 Thread Gábor Stefanik
On Wed, Aug 19, 2009 at 3:04 PM, Johannes Bergjohan...@sipsolutions.net wrote:
 On Wed, 2009-08-19 at 14:43 +0200, Mark Huijgen wrote:

 After running the included python script, patching the cutter and
 extracting firmware, I now get ucode version 478.104 in dmesg. Next test
 is also without the 2 patches. Following log is from modprobe+ifconfig
 wlan0 up:

 Not really surprising, the firmware is for the MAC _only_, it doesn't
 really ever touch the PHY, so it's very unlikely to matter.

 johannes


Actually, the output does change with the new firmware.

Current outputs:
1. Patches not applied, old firmware, default chan = 1: the channel
switch to 7 during calibration works, but nothing else.
2. Patches applied, old firmware, default chan = 1: no channels work
(not even the channel 7 switch in the calibration routine), ifup
fails.
3. Patches not applied, new firmware, default chan = 1 (I got this
from Larry in private mail): only channels 7 and 8 work, but ifup
works(?).
(4. Patches applied, new firmware, default chan = 1: please test!)
(5. Patches not applied, old firmware, default chan = 7: probably ifup
succeeds, but only channel 7 works. Not tested.)
(6. Patches applied, old firmware, default chan = 7: unknown, probably
doesn't work at all.)
(7. Patches not applied, new firmware, default chan = 7: Unknown.)
8. Patches applied, new firmware, default chan = 7: interface comes
up, scans (but only channels 6 and above show results), associates to
WPA AP on channel 11 and gets DHCP address (meaning, both TX and RX
working)!

Notice that 2 and 8 only differ in the FW ver and the default channel,
and in 8 (with new firmware), the switch to channel 7 during RC
calibration (before the switch to default channel) works - in 2, it
fails. Looks like the routines reverse-engineered from the newer
driver depend on the firmware included in that driver; or maybe the
old firmware simply doesn't properly handle LP-PHY. Initvals are also
a possible candidate for this. (Larry, what do you think about this?)

Mark, could you produce a dmesg output with the new firmware, patches
applied, and channel set to 1? Post the output of dmesg after scanning
 probably associating, if possible. (Scan/assoc may produce messages
in dmesg.)

(The news about TX working is great by the way!)

-- 
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


Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!

2009-08-19 Thread Gábor Stefanik
2009/8/19 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 Mark, could you produce a dmesg output with the new firmware, patches
 applied, and channel set to 1? Post the output of dmesg after scanning
  probably associating, if possible. (Scan/assoc may produce messages
 in dmesg.)

 I tested this already, but with default chan set to 1, I cannot get the
 interface up.
 This is somewhere in my mail, but it got a bit messy after I noticed
 that after
 changing some of the code my modules got installed in another directory
 (-dirty).

 I just restarted the notebook, but now the results are different again...

 New firmware, with patches applied and default channel 7:
 [   72.160057] b43-phy1: Loading firmware version 478.104 (2008-07-01
 00:50:23)
 [   72.163484] b43-phy1 debug: RC calib: Failed to switch to channel 7,
 error = -5
 [   72.168100] b43-phy1 debug: Switch to init channel failed, error = -5.

 Recompile module with default chan 1, patches still applied and new
 firmware,
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  430.259877] b43-phy2 debug: Switch to init channel failed, error = -5.

 Recompile again, but with default chan back to 7, still patched and
 still new firmware.
 So same as in first situation:
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  524.748062] b43-phy3 debug: Chip initialized

 And I can get my interface up and working!

 Without this procedure I have not been able to get a working chip. Seems
 the partially
 initialized state after each try, allows the next try to get a bit
 further. And together with
 the default channel switching between 1 and 7, I get a working chip, but
 a chip that does
 not seem to be able to find my AP thats on channel 1.

 If I now change default chan to 1 again, I am getting the same error as
 in step 2 above.
 I have not been able to get the interface up with default chan set to 1.

 Mark



What do you see in dmesg after running a scan?

-- 
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


Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!

2009-08-19 Thread Gábor Stefanik
2009/8/19 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 2009/8/19 Mark Huijgen mark.sf@huijgen.tk:

 Gábor Stefanik wrote:

 Mark, could you produce a dmesg output with the new firmware, patches
 applied, and channel set to 1? Post the output of dmesg after scanning
  probably associating, if possible. (Scan/assoc may produce messages
 in dmesg.)


 I tested this already, but with default chan set to 1, I cannot get the
 interface up.
 This is somewhere in my mail, but it got a bit messy after I noticed
 that after
 changing some of the code my modules got installed in another directory
 (-dirty).

 I just restarted the notebook, but now the results are different again...

 New firmware, with patches applied and default channel 7:
 [   72.160057] b43-phy1: Loading firmware version 478.104 (2008-07-01
 00:50:23)
 [   72.163484] b43-phy1 debug: RC calib: Failed to switch to channel 7,
 error = -5
 [   72.168100] b43-phy1 debug: Switch to init channel failed, error = -5.

 Recompile module with default chan 1, patches still applied and new
 firmware,
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  430.259877] b43-phy2 debug: Switch to init channel failed, error = -5.

 Recompile again, but with default chan back to 7, still patched and
 still new firmware.
 So same as in first situation:
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  524.748062] b43-phy3 debug: Chip initialized

 And I can get my interface up and working!

 Without this procedure I have not been able to get a working chip. Seems
 the partially
 initialized state after each try, allows the next try to get a bit
 further. And together with
 the default channel switching between 1 and 7, I get a working chip, but
 a chip that does
 not seem to be able to find my AP thats on channel 1.

 If I now change default chan to 1 again, I am getting the same error as
 in step 2 above.
 I have not been able to get the interface up with default chan set to 1.

 Mark




 What do you see in dmesg after running a scan?

 After step 2, interface cannot be brought up:
 # iw dev wlan0 scan
 command failed: Network is down (-100)

 No extra output in dmesg

 After step 3 (so with default chan 7 again), interface comes up and I
 can scan:
 # iw dev wlan0 scan
 list of scan results

 No extra output generated in dmesg.

 I must add that I do not have debugging messages enabled for any
 mac80211 related options, only for b43 module.

That's not needed.

However, try iw dev wlan0 scan trigger.

Also, try switching to all B/G channels manually.

One more thing to try is create a monitor interface and run kismet on
it. In addition, you can use aireplay-ng on the monitor interface to
test TX.


 Mark






-- 
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


Re: [ANN] b43 LP-PHY support (BCM4310/4312/4315) working (partially)!

2009-08-19 Thread Gábor Stefanik
2009/8/19 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 2009/8/19 Mark Huijgen mark.sf@huijgen.tk:

 Gábor Stefanik wrote:

 2009/8/19 Mark Huijgen mark.sf@huijgen.tk:


 Gábor Stefanik wrote:


 Mark, could you produce a dmesg output with the new firmware, patches
 applied, and channel set to 1? Post the output of dmesg after scanning
  probably associating, if possible. (Scan/assoc may produce messages
 in dmesg.)



 I tested this already, but with default chan set to 1, I cannot get the
 interface up.
 This is somewhere in my mail, but it got a bit messy after I noticed
 that after
 changing some of the code my modules got installed in another directory
 (-dirty).

 I just restarted the notebook, but now the results are different again...

 New firmware, with patches applied and default channel 7:
 [   72.160057] b43-phy1: Loading firmware version 478.104 (2008-07-01
 00:50:23)
 [   72.163484] b43-phy1 debug: RC calib: Failed to switch to channel 7,
 error = -5
 [   72.168100] b43-phy1 debug: Switch to init channel failed, error = -5.

 Recompile module with default chan 1, patches still applied and new
 firmware,
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  430.259877] b43-phy2 debug: Switch to init channel failed, error = -5.

 Recompile again, but with default chan back to 7, still patched and
 still new firmware.
 So same as in first situation:
 # modprobe -r b43  modprobe b43 verbose=3  ifconfig wlan0 up

 [  524.748062] b43-phy3 debug: Chip initialized

 And I can get my interface up and working!

 Without this procedure I have not been able to get a working chip. Seems
 the partially
 initialized state after each try, allows the next try to get a bit
 further. And together with
 the default channel switching between 1 and 7, I get a working chip, but
 a chip that does
 not seem to be able to find my AP thats on channel 1.

 If I now change default chan to 1 again, I am getting the same error as
 in step 2 above.
 I have not been able to get the interface up with default chan set to 1.

 Mark




 What do you see in dmesg after running a scan?


 After step 2, interface cannot be brought up:
 # iw dev wlan0 scan
 command failed: Network is down (-100)

 No extra output in dmesg

 After step 3 (so with default chan 7 again), interface comes up and I
 can scan:
 # iw dev wlan0 scan
 list of scan results

 No extra output generated in dmesg.

 I must add that I do not have debugging messages enabled for any
 mac80211 related options, only for b43 module.


 That's not needed.

 However, try iw dev wlan0 scan trigger.

 Also, try switching to all B/G channels manually.

 To summarize, all cases with patches and new firmware:
 case 1: cold boot with default channel 7, RC calib error and 'init
 channel failed' error,
 case 2: recompile+reload b43 with default channel 1, just 'init channel
 failed' error,
 case 3: recompile+reload b43 with default channel 7, works


 You mean 'iw dev wlan0 set channel 1' for example?

 In case 2 (with default chan 1), ifconfig wlan0 gives error
 SIOCSIFFLAGS: Input/output error

 # iw dev wlan0 set channel 1
 no output generated, also nothing in dmesg

 # iw dev wlan0 scan trigger
 command failed: Network is down (-100)
 nothing in dmesg.

 Both commands do not give any output in dmesg in case 3 either.

 Tried channel 1 up to 11, 12 and higher gives 'command failed: Invalid
 argument (-22)', which is expected I think.

Set your regulatory domain to something that allows higher channels
(e.g. iw reg set JP - this one unlocks channels 1-14 (14 is
CCK/802.11b only); or iw reg set HU - channels 1-13) to test channels
14 and up.

Also, test this:

Create a monitor interface (iw dev wlan0 interface add mon0 type monitor)
Up the interface (ifconfig mon0 up)
Set channel to 1 (iwconfig mon0 channel 1 or iw dev wlan0 set channel 1)
Run tcpdump on the interface (tcpdump -i mon0).

Try for other channel values as well. (You don't need to recreate the
interface for each channel, just use the channel-setting command to
switch the channel.) You should see packets on all channels.

Another thing to try: add a printk to b43_lpphy_op_set_channel and
print out new_channel. This will log all channel change requests
(including automatic ones) to dmesg, which can be helpful.

If you set your AP to channel 11, can you connect to it  use it as normal?




 One more thing to try is create a monitor interface and run kismet on
 it. In addition, you can use aireplay-ng on the monitor interface to
 test TX.

 Never done anything with monitor mode before, so when I have some time
 I'll look into it.




-- 
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


Re: [PATCH] b43: LP-PHY: Implement spec updates and remove resolved FIXMEs

2009-08-19 Thread Gábor Stefanik
False alert, sorry. Feel free to apply. The regression apparently
resulted from the use of an incorrect firmware image - when Mark
switched to the same firmware as Larry, his card started working
again.

2009/8/19 Gábor Stefanik netrolller...@gmail.com:
 John, please hold off this patch for now, it appears to be causing
 regressions. I will investigate this.

 2009/8/18 Gábor Stefanik netrolller...@gmail.com:
 Larry has started re-checking all current routines against a new
 version of the Broadcom MIPS driver. This patch implements the first
 round of changes he documented on the specs wiki.

 Also remove a few FIXMEs regarding missing initial values for variables
 with dynamic initial values where reading the values has been implemented.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 drivers/net/wireless/b43/phy_lp.c       |   98
 +++
 drivers/net/wireless/b43/phy_lp.h       |   18 +++---
 drivers/net/wireless/b43/tables_lpphy.c |   12 -
 3 files changed, 82 insertions(+), 46 deletions(-)

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 242338f..6c69cdb 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -719,9 +719,39 @@ static void lpphy_set_bb_mult(struct b43_wldev *dev, u8
 bb_mult)
        b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
 }

 -static void lpphy_disable_crs(struct b43_wldev *dev)
 +static void lpphy_set_deaf(struct b43_wldev *dev, bool user)
 {
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 1;
 +       else
 +               lpphy-crs_sys_disable = 1;
        b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
 +}
 +
 +static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
 +{
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 0;
 +       else
 +               lpphy-crs_sys_disable = 0;
 +
 +       if (!lpphy-crs_usr_disable  !lpphy-crs_sys_disable) {
 +               if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x60);
 +               else
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x20);
 +       }
 +}
 +
 +static void lpphy_disable_crs(struct b43_wldev *dev, bool user)
 +{
 +       lpphy_set_deaf(dev, user);
        b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
        b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
 @@ -749,12 +779,9 @@ static void lpphy_disable_crs(struct b43_wldev *dev)
        b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
 }

 -static void lpphy_restore_crs(struct b43_wldev *dev)
 +static void lpphy_restore_crs(struct b43_wldev *dev, bool user)
 {
 -       if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
 -       else
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
 +       lpphy_clear_deaf(dev, user);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
 }
 @@ -800,10 +827,11 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                                0xF800, rf_gain);
        } else {
 -               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x7F00;
 +               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x1FC0;
 +               pa_gain = 2;
                b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                              (gains.pga  8) | gains.gm);
 -               b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
 +               b43_phy_maskset(dev, B43_PHY_OFDM(0xFB),
                                0x8000, gains.pad | pa_gain);
                b43_phy_write(dev, B43_PHY_OFDM(0xFC),
                              (gains.pga  8) | gains.gm);
 @@ -817,7 +845,7 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F, 1 
 7);
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF, 1 
 14);
        }
 -       b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFBF, 1  6);
 +       b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF, 1  6);
 }

 static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain)
 @@ -857,33 +885,33 @@ static void lpphy_rev2plus_set_rx_gain(struct
 b43_wldev *dev, u32 gain)
        }
 }

 -static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
 +static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 {
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE

Re: [PATCH] b43: LP-PHY: Implement spec updates and remove resolved FIXMEs

2009-08-19 Thread Gábor Stefanik
Seeing that this is still not in wireless-testing - this patch should
be applied, the previously mentioned regressions were false alerts
(Larry tested without this patch and with v478 firmware, which worked;
while Mark applied this patch and used v410 firmware, which didn't
work - when Mark upgraded to v478 firmware, his card too came to
life.) So, please apply.

2009/8/18 Gábor Stefanik netrolller...@gmail.com:
 Larry has started re-checking all current routines against a new
 version of the Broadcom MIPS driver. This patch implements the first
 round of changes he documented on the specs wiki.

 Also remove a few FIXMEs regarding missing initial values for variables
 with dynamic initial values where reading the values has been implemented.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 drivers/net/wireless/b43/phy_lp.c       |   98
 +++
 drivers/net/wireless/b43/phy_lp.h       |   18 +++---
 drivers/net/wireless/b43/tables_lpphy.c |   12 -
 3 files changed, 82 insertions(+), 46 deletions(-)

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 242338f..6c69cdb 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -719,9 +719,39 @@ static void lpphy_set_bb_mult(struct b43_wldev *dev, u8
 bb_mult)
        b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
 }

 -static void lpphy_disable_crs(struct b43_wldev *dev)
 +static void lpphy_set_deaf(struct b43_wldev *dev, bool user)
 {
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 1;
 +       else
 +               lpphy-crs_sys_disable = 1;
        b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
 +}
 +
 +static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
 +{
 +       struct b43_phy_lp *lpphy = dev-phy.lp;
 +
 +       if (user)
 +               lpphy-crs_usr_disable = 0;
 +       else
 +               lpphy-crs_sys_disable = 0;
 +
 +       if (!lpphy-crs_usr_disable  !lpphy-crs_sys_disable) {
 +               if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x60);
 +               else
 +                       b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
 +                                       0xFF1F, 0x20);
 +       }
 +}
 +
 +static void lpphy_disable_crs(struct b43_wldev *dev, bool user)
 +{
 +       lpphy_set_deaf(dev, user);
        b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
        b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
 @@ -749,12 +779,9 @@ static void lpphy_disable_crs(struct b43_wldev *dev)
        b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
 }

 -static void lpphy_restore_crs(struct b43_wldev *dev)
 +static void lpphy_restore_crs(struct b43_wldev *dev, bool user)
 {
 -       if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
 -       else
 -               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
 +       lpphy_clear_deaf(dev, user);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
 }
 @@ -800,10 +827,11 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                                0xF800, rf_gain);
        } else {
 -               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x7F00;
 +               pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x1FC0;
 +               pa_gain = 2;
                b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
                              (gains.pga  8) | gains.gm);
 -               b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
 +               b43_phy_maskset(dev, B43_PHY_OFDM(0xFB),
                                0x8000, gains.pad | pa_gain);
                b43_phy_write(dev, B43_PHY_OFDM(0xFC),
                              (gains.pga  8) | gains.gm);
 @@ -817,7 +845,7 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F, 1 
 7);
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF, 1 
 14);
        }
 -       b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFBF, 1  6);
 +       b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF, 1  6);
 }

 static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain)
 @@ -857,33 +885,33 @@ static void lpphy_rev2plus_set_rx_gain(struct
 b43_wldev *dev, u32 gain)
        }
 }

 -static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
 +static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 {
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE

[PATCH] b43: LP-PHY: Implement spec updates and remove resolved FIXMEs

2009-08-18 Thread Gábor Stefanik
Larry has started re-checking all current routines against a new
version of the Broadcom MIPS driver. This patch implements the first
round of changes he documented on the specs wiki.

Also remove a few FIXMEs regarding missing initial values for variables
with dynamic initial values where reading the values has been implemented.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c   |   98 +++
 drivers/net/wireless/b43/phy_lp.h   |   18 +++---
 drivers/net/wireless/b43/tables_lpphy.c |   12 -
 3 files changed, 82 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 242338f..6c69cdb 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -719,9 +719,39 @@ static void lpphy_set_bb_mult(struct b43_wldev *dev, u8 
bb_mult)
b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
 }
 
-static void lpphy_disable_crs(struct b43_wldev *dev)
+static void lpphy_set_deaf(struct b43_wldev *dev, bool user)
 {
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+
+   if (user)
+   lpphy-crs_usr_disable = 1;
+   else
+   lpphy-crs_sys_disable = 1;
b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
+}
+
+static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
+{
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+
+   if (user)
+   lpphy-crs_usr_disable = 0;
+   else
+   lpphy-crs_sys_disable = 0;
+
+   if (!lpphy-crs_usr_disable  !lpphy-crs_sys_disable) {
+   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
+   0xFF1F, 0x60);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
+   0xFF1F, 0x20);
+   }
+}
+
+static void lpphy_disable_crs(struct b43_wldev *dev, bool user)
+{
+   lpphy_set_deaf(dev, user);
b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
@@ -749,12 +779,9 @@ static void lpphy_disable_crs(struct b43_wldev *dev)
b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
 }
 
-static void lpphy_restore_crs(struct b43_wldev *dev)
+static void lpphy_restore_crs(struct b43_wldev *dev, bool user)
 {
-   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
-   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
-   else
-   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
+   lpphy_clear_deaf(dev, user);
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
 }
@@ -800,10 +827,11 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
0xF800, rf_gain);
} else {
-   pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x7F00;
+   pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x1FC0;
+   pa_gain = 2;
b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
  (gains.pga  8) | gains.gm);
-   b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
+   b43_phy_maskset(dev, B43_PHY_OFDM(0xFB),
0x8000, gains.pad | pa_gain);
b43_phy_write(dev, B43_PHY_OFDM(0xFC),
  (gains.pga  8) | gains.gm);
@@ -817,7 +845,7 @@ static void lpphy_set_tx_gains(struct b43_wldev *dev,
b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F, 1  7);
b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF, 1  14);
}
-   b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFBF, 1  6);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF, 1  6);
 }
 
 static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain)
@@ -857,33 +885,33 @@ static void lpphy_rev2plus_set_rx_gain(struct b43_wldev 
*dev, u32 gain)
}
 }
 
-static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
+static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
 {
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE);
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFEF);
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFBF);
if (dev-phy.rev = 2) {
b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF);
-   if (b43_current_band(dev-wl) != IEEE80211_BAND_2GHZ)
-   return;
-   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFBFF);
-   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFF7

[PATCH] b43: LP-PHY: Two small spec updates

2009-08-18 Thread Gábor Stefanik
The specs are beginning to support rev3 LP-PHYs - implement one of
the changes needed for rev3 support.
Also, in the new MIPS driver, the Japan TX filter was renamed to
analog TX filter init - however, calling it init is confusing,
so name it set analog filter, with a comment for easier future
identification.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |   17 -
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 6c69cdb..65f0010 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -609,9 +609,14 @@ static void lpphy_2063_init(struct b43_wldev *dev)
b43_radio_write(dev, B2063_PA_SP7, 0);
b43_radio_write(dev, B2063_TX_RF_SP6, 0x20);
b43_radio_write(dev, B2063_TX_RF_SP9, 0x40);
-   b43_radio_write(dev, B2063_PA_SP3, 0xa0);
-   b43_radio_write(dev, B2063_PA_SP4, 0xa0);
-   b43_radio_write(dev, B2063_PA_SP2, 0x18);
+   if (dev-phy.rev == 2) {
+   b43_radio_write(dev, B2063_PA_SP3, 0xa0);
+   b43_radio_write(dev, B2063_PA_SP4, 0xa0);
+   b43_radio_write(dev, B2063_PA_SP2, 0x18);
+   } else {
+   b43_radio_write(dev, B2063_PA_SP3, 0x20);
+   b43_radio_write(dev, B2063_PA_SP2, 0x20);
+   }
 }
 
 struct lpphy_stx_table_entry {
@@ -1996,7 +2001,9 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
return err;
 }
 
-static void lpphy_japan_filter(struct b43_wldev *dev, int channel)
+
+/* This was previously called lpphy_japan_filter */
+static void lpphy_set_analog_filter(struct b43_wldev *dev, int channel)
 {
struct b43_phy_lp *lpphy = dev-phy.lp;
u16 tmp = (channel == 14); //SPEC FIXME check japanwidefilter!
@@ -2165,7 +2172,7 @@ static int b43_lpphy_op_switch_channel(struct b43_wldev 
*dev,
err = lpphy_b2062_tune(dev, new_channel);
if (err)
return err;
-   lpphy_japan_filter(dev, new_channel);
+   lpphy_set_analog_filter(dev, new_channel);
lpphy_adjust_gain_table(dev, channel2freq_lp(new_channel));
}
 
-- 
1.6.2.4



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


[ANN] b43 LP-PHY support (BCM4310/4312/4315) now ready for testing!

2009-08-18 Thread Gábor Stefanik
Hello World!

Great news for Broadcom BCM4310/4312/4315 (PCI 14e4:4315) users:
LP-PHY support is now at the point where it can be tested for functionality!

There are still problems with channel switching (a few patches ago,
only 802.11b/g channels 7 and 8 were working - no tests have been
performed since then)  TX is untested, but Larry has reported that he
can get scan results from channels 7 and 8. He doesn't have any AP on
these channels, so can't test if association works, but it should be
working too. It's also possible that recent patches have fixed the
channel switching bug, as the codepaths for channel switching have
been touched extensively, probably fixing a major miscalculation issue
(Qdiv roundup was completely wrong).

So, go ahead, give it a try, and let's rock!

Note that the code in wireless-testing is enough to start testing,
however it's recommended that you apply the following 2 pending fixes:
http://marc.info/?l=linux-wirelessm=125061590101156w=2 and
http://marc.info/?l=linux-wirelessm=125062611720517w=2

Tomorrow's compat-wireless tarball, together with the above patches,
should also be good for testing. Not sure about today's tarball.

--Gábor

-- 
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


Re: [PATCH] b43: LP-PHY: Fix reading old mode in the set TX power control routine

2009-08-17 Thread Gábor Stefanik
2009/8/14 Gábor Stefanik netrolller...@gmail.com:
 Check the mode the hardware is in, not the mode we used the last time.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 Mark, please test if this fixes the TX power control WARN_ON you were
 seeing.

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

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 292ee51..76457f7 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -1015,9 +1015,9 @@ static void lpphy_set_tx_power_control(struct
 b43_wldev *dev,
        struct b43_phy_lp *lpphy = dev-phy.lp;
        enum b43_lpphy_txpctl_mode oldmode;

 -       oldmode = lpphy-txpctl_mode;
        lpphy_read_tx_pctl_mode_from_hardware(dev);
 -       if (lpphy-txpctl_mode == mode)
 +       oldmode = lpphy-txpctl_mode;
 +       if (oldmode == mode)
                return;
        lpphy-txpctl_mode = mode;

 --
 1.6.2.4


John, any news on this one? I can't see it in wireless testing.

-- 
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


Re: [PATCH] b43: LP-PHY: Fix setting TX power control mode during RC calibration

2009-08-17 Thread Gábor Stefanik
2009/8/17 John W. Linville linvi...@tuxdriver.com:
 On Mon, Aug 17, 2009 at 09:32:42PM +0200, Gábor Stefanik wrote:
 2009/8/14 Gábor Stefanik netrolller...@gmail.com:
  Call set_tx_power_control with a LPPHY_TXPCTL rather than an
  LPPHY_TX_PWR_CTL_CMD_MODE.
 
  Signed-off-by: Gábor Stefanik netrolller...@gmail.com
  ---
  This should fix the WARN_ON testers were seeing during init.
 
  drivers/net/wireless/b43/phy_lp.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
  diff --git a/drivers/net/wireless/b43/phy_lp.c
  b/drivers/net/wireless/b43/phy_lp.c
  index adfa7bf..558224b 100644
  --- a/drivers/net/wireless/b43/phy_lp.c
  +++ b/drivers/net/wireless/b43/phy_lp.c
  @@ -1080,7 +1080,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
  *dev)
         old_txpctl = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_CMD) 
                                         B43_LPPHY_TX_PWR_CTL_CMD_MODE;
 
  -       lpphy_set_tx_power_control(dev, B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF);
  +       lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
         lpphy_disable_crs(dev);
         loopback = lpphy_loopback(dev);
         if (loopback == -1)
  --
  1.6.2.4
 

 John, any news on this one? I can't see it in wireless testing.

 Larry said:

 With this one, I still get WARNING: at
 drivers/net/wireless/b43/phy_lp.c:1006
 lpphy_set_tx_power_control+0xbf/0xdd [b43]().


Previously, he was getting 2 warnings. This fixes one of them, the
other one is handled by commit
1181d724fc2897f11f95bf6ebc86ae111390929c (Fix another TX power
control abuse).

 --
 John W. Linville                Someday the world will need a hero, and you
 linvi...@tuxdriver.com                  might be all we have.  Be ready.




-- 
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


Re: [PATCH] b43: LP-PHY: Fix reading old mode in the set TX power control routine

2009-08-17 Thread Gábor Stefanik
2009/8/17 John W. Linville linvi...@tuxdriver.com:
 On Mon, Aug 17, 2009 at 09:33:06PM +0200, Gábor Stefanik wrote:
 2009/8/14 Gábor Stefanik netrolller...@gmail.com:
  Check the mode the hardware is in, not the mode we used the last time.
 
  Signed-off-by: Gábor Stefanik netrolller...@gmail.com
  ---
  Mark, please test if this fixes the TX power control WARN_ON you were
  seeing.
 
  drivers/net/wireless/b43/phy_lp.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/net/wireless/b43/phy_lp.c
  b/drivers/net/wireless/b43/phy_lp.c
  index 292ee51..76457f7 100644
  --- a/drivers/net/wireless/b43/phy_lp.c
  +++ b/drivers/net/wireless/b43/phy_lp.c
  @@ -1015,9 +1015,9 @@ static void lpphy_set_tx_power_control(struct
  b43_wldev *dev,
         struct b43_phy_lp *lpphy = dev-phy.lp;
         enum b43_lpphy_txpctl_mode oldmode;
 
  -       oldmode = lpphy-txpctl_mode;
         lpphy_read_tx_pctl_mode_from_hardware(dev);
  -       if (lpphy-txpctl_mode == mode)
  +       oldmode = lpphy-txpctl_mode;
  +       if (oldmode == mode)
                 return;
         lpphy-txpctl_mode = mode;
 
  --
  1.6.2.4
 

 John, any news on this one? I can't see it in wireless testing.

 Larry said It does not fix it here. I'll take a look at the specs...

It did not fix the warning, but it is nevertheless a legitimate fix.
(I found this bug when I was looking for the source of the WARN_ON -
this is not the source of the WARN_ON, but still a bug.)


 --
 John W. Linville                Someday the world will need a hero, and you
 linvi...@tuxdriver.com                  might be all we have.  Be ready.




-- 
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: Fix a spec error in the B2062 channel switch routine

2009-08-16 Thread Gábor Stefanik
The channel switch routine had a whole instruction missing. Add it.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index a51da6e..3889519 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1939,6 +1939,10 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
tmp5 = tmp7 * 0x100;
tmp6 = tmp5 / tmp4;
tmp7 = tmp5 % tmp4;
+   b43_radio_write(dev, B2062_S_RFPLL_CTL27, tmp6);
+   tmp5 = tmp7 * 0x100;
+   tmp6 = tmp5 / tmp4;
+   tmp7 = tmp5 % tmp4;
b43_radio_write(dev, B2062_S_RFPLL_CTL28, tmp6);
tmp5 = tmp7 * 0x100;
tmp6 = tmp5 / tmp4;
-- 
1.6.2.4



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


[PATCH v2] b43: LP-PHY: Update code for spec fixes, and fix a few typos

2009-08-16 Thread Gábor Stefanik
A few typos have been discovered in both the specs and the code.
This patch fixes them.

Also use lpphy_op_switch_channel consistently, and make all users
of it print its return value for easier debugging.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
V2: Fix one more typo (this time a harmless one).

 drivers/net/wireless/b43/phy_lp.c |   53 
 1 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index d949cfa..1de4a74 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -554,7 +554,7 @@ static void lpphy_2062_init(struct b43_wldev *dev)
B43_WARN_ON(!(bus-chipco.capabilities  SSB_CHIPCO_CAP_PMU));
B43_WARN_ON(crystalfreq == 0);
 
-   if (crystalfreq = 3000) {
+   if (crystalfreq = 3000) {
lpphy-pdiv = 1;
b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB);
} else {
@@ -562,14 +562,16 @@ static void lpphy_2062_init(struct b43_wldev *dev)
b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4);
}
 
-   tmp = (8 * lpphy-pdiv + crystalfreq) /
- (3200 * lpphy-pdiv);
-   tmp = (tmp - 1)  0xFF;
+   tmp = (((8 * lpphy-pdiv + crystalfreq) /
+ (2 * crystalfreq)) - 8)  0xFF;
+   b43_radio_write(dev, B2062_S_RFPLL_CTL7, tmp);
+
+   tmp = (((100 * crystalfreq + 1600 * lpphy-pdiv) /
+ (3200 * lpphy-pdiv)) - 1)  0xFF;
b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp);
 
-   tmp = (2 * crystalfreq + 100 * lpphy-pdiv) /
- (200 * lpphy-pdiv);
-   tmp = ((tmp  0xFF) - 1)  0x;
+   tmp = (((2 * crystalfreq + 100 * lpphy-pdiv) /
+ (200 * lpphy-pdiv)) - 1)  0xFF;
b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp);
 
ref = (1000 * lpphy-pdiv + 2 * crystalfreq) / (2000 * lpphy-pdiv);
@@ -673,7 +675,7 @@ static void lpphy_radio_init(struct b43_wldev *dev)
b43_phy_mask(dev, B43_LPPHY_FOURWIRE_CTL, 0xFFFD);
udelay(1);
 
-   if (dev-phy.rev  2) {
+   if (dev-phy.radio_ver == 0x2062) {
lpphy_2062_init(dev);
} else {
lpphy_2063_init(dev);
@@ -690,11 +692,18 @@ struct lpphy_iq_est { u32 iq_prod, i_pwr, q_pwr; };
 
 static void lpphy_set_rc_cap(struct b43_wldev *dev)
 {
-   u8 rc_cap = dev-phy.lp-rc_cap;
+   struct b43_phy_lp *lpphy = dev-phy.lp;
 
-   b43_radio_write(dev, B2062_N_RXBB_CALIB2, max_t(u8, rc_cap-4, 0x80));
-   b43_radio_write(dev, B2062_N_TX_CTL_A, ((rc_cap  0x1F)  1) | 0x80);
-   b43_radio_write(dev, B2062_S_RXG_CNT16, ((rc_cap  0x1F)  2) | 0x80);
+   u8 rc_cap = (lpphy-rc_cap  0x1F)  1;
+   
+   if (dev-phy.rev == 1) //FIXME check channel 14!
+   rc_cap = max_t(u8, rc_cap + 5, 15);
+
+   b43_radio_write(dev, B2062_N_RXBB_CALIB2,
+   max_t(u8, lpphy-rc_cap - 4, 0x80));
+   b43_radio_write(dev, B2062_N_TX_CTL_A, rc_cap | 0x80);
+   b43_radio_write(dev, B2062_S_RXG_CNT16,
+   ((lpphy-rc_cap  0x1F)  2) | 0x80);
 }
 
 static u8 lpphy_get_bb_mult(struct b43_wldev *dev)
@@ -1103,6 +1112,9 @@ static void lpphy_set_tx_power_control(struct b43_wldev 
*dev,
lpphy_write_tx_pctl_mode_to_hardware(dev);
 }
 
+static int b43_lpphy_op_switch_channel(struct b43_wldev *dev,
+  unsigned int new_channel);
+
 static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
 {
struct b43_phy_lp *lpphy = dev-phy.lp;
@@ -1120,11 +1132,16 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
old_rf2_ovr, old_rf2_ovrval, old_phy_ctl;
enum b43_lpphy_txpctl_mode old_txpctl;
u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0;
-   int loopback, i, j, inner_sum;
+   int loopback, i, j, inner_sum, err;
 
memset(iq_est, 0, sizeof(iq_est));
 
-   b43_switch_channel(dev, 7);
+   err = b43_lpphy_op_switch_channel(dev, 7);
+   if (err) {
+   b43dbg(dev-wl,
+  RC calib: Failed to switch to channel 7, error = %d,
+  err);
+   }
old_txg_ovr = (b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR)  6)  1;
old_bbmult = lpphy_get_bb_mult(dev);
if (old_txg_ovr)
@@ -1883,14 +1900,14 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
 {
struct b43_phy_lp *lpphy = dev-phy.lp;
struct ssb_bus *bus = dev-dev-bus;
-   static const struct b206x_channel *chandata = NULL;
+   const struct b206x_channel *chandata = NULL;
u32 crystal_freq = bus-chipco.pmu.crystalfreq * 1000;
u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9;
int i, err = 0;
 
-   for (i = 0; i  ARRAY_SIZE(b2063_chantbl); i++) {
-   if (b2063_chantbl[i].channel == channel

[PATCH] b43: LP-PHY: Remove BROKEN from B43_PHY_LP

2009-08-16 Thread Gábor Stefanik
Larry has reported success getting scan data with an LP-PHY device,
so it's probably time to release LP-PHY support for testing.

Also add a temporary BROKEN Kconfig symbol to disable 5GHz support,
as 5GHz currently causes the driver to panic (NULL pointer deref).

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/Kconfig  |   25 +++--
 drivers/net/wireless/b43/main.c   |2 ++
 drivers/net/wireless/b43/phy_lp.c |2 ++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 67f564e..13414c9 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -80,16 +80,29 @@ config B43_NPHY
  SAY N.
 
 config B43_PHY_LP
-   bool IEEE 802.11g LP-PHY support (BROKEN)
-   depends on B43  EXPERIMENTAL  BROKEN
+   bool Support for low-power (LP-PHY) devices (VERY EXPERIMENTAL)
+   depends on B43  EXPERIMENTAL
---help---
  Support for the LP-PHY.
- The LP-PHY is an IEEE 802.11g based PHY built into some notebooks
- and embedded devices.
+ The LP-PHY is a low-power PHY built into some notebooks
+ and embedded devices. It supports 802.11a/g
+ (802.11a support is optional, and currently disabled).
 
- THIS IS BROKEN AND DOES NOT WORK YET.
+ Known LP-PHY devices include the BCM4310, BCM4312 (PCI ID 0x4315),
+ BCM4325 (currently unsupported), BCM4326  BCM4328 wireless cards
+ and the BCM5354 SoC.
 
- SAY N.
+ This is heavily experimental, and probably will not work for you.
+ Say N unless you want to help debug the driver.
+
+config B43_PHY_LP_5GHZ
+   bool Enable 802.11a support for LP-PHYs (BROKEN)
+   depends on B43_PHY_LP  BROKEN
+   ---help---
+ Enable the 5GHz band of LP-PHY devices. Currently, all it
+ does is cause the driver to panic on startup.
+
+ Only select this if you are a developer working on this feature.
 
 # This config option automatically enables b43 LEDS support,
 # if it's possible.
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 99b41ce..0096d25 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4514,7 +4514,9 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
have_5ghz_phy = 1;
break;
case B43_PHYTYPE_LP: //FIXME not always!
+#ifdef CONFIG_B43_PHY_LP_5GHZ
have_5ghz_phy = 1;
+#endif
case B43_PHYTYPE_G:
case B43_PHYTYPE_N:
have_2ghz_phy = 1;
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 3889519..c902dd1 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -43,7 +43,9 @@ static inline u16 channel2freq_lp(u8 channel)
 
 static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev)
 {
+#ifdef CONFIG_B43_PHY_LP_5GHZ
if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
+#endif
return 1;
return 36;
 }
-- 
1.6.2.4



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


[PATCH] b43: LP-PHY: Update B2062 radio init with recent spec changes

2009-08-16 Thread Gábor Stefanik
The spec for initializing the B2062 radio have changed recently,
update the code to match the changes.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 5a7b873..34b7910 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -539,10 +539,15 @@ static void lpphy_2062_init(struct b43_wldev *dev)
b43_radio_write(dev, B2062_N_TX_CTL3, 0);
b43_radio_write(dev, B2062_N_TX_CTL4, 0);
b43_radio_write(dev, B2062_N_TX_CTL5, 0);
+   b43_radio_write(dev, B2062_N_TX_CTL6, 0);
b43_radio_write(dev, B2062_N_PDN_CTL0, 0x40);
b43_radio_write(dev, B2062_N_PDN_CTL0, 0);
b43_radio_write(dev, B2062_N_CALIB_TS, 0x10);
b43_radio_write(dev, B2062_N_CALIB_TS, 0);
+   if (dev-phy.rev  0) {
+   b43_radio_write(dev, B2062_S_BG_CTL1,
+   (b43_radio_read(dev, B2062_N_COMM2)  1) | 0x80);
+   }
if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
b43_radio_set(dev, B2062_N_TSSI_CTL0, 0x1);
else
-- 
1.6.2.4



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


[PATCH v2] b43: LP-PHY: Remove BROKEN from B43_PHY_LP

2009-08-16 Thread Gábor Stefanik
Larry has reported success getting scan data with an LP-PHY device,
so it's probably time to release LP-PHY support for testing.

Also disable 802.11a support for now, as 802.11a currently causes
the driver to panic on startup (NULL pointer dereference).

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
V2:
-Remove VERY from the warning in the symbol name.
-Remove list of known devices.
-Don't create a separate symbol for 5GHz, just disable it in the code.

 drivers/net/wireless/b43/Kconfig |   14 +++---
 drivers/net/wireless/b43/main.c  |2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 67f564e..237b1aa 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -80,16 +80,16 @@ config B43_NPHY
  SAY N.
 
 config B43_PHY_LP
-   bool IEEE 802.11g LP-PHY support (BROKEN)
-   depends on B43  EXPERIMENTAL  BROKEN
+   bool Support for low-power (LP-PHY) devices (EXPERIMENTAL)
+   depends on B43  EXPERIMENTAL
---help---
  Support for the LP-PHY.
- The LP-PHY is an IEEE 802.11g based PHY built into some notebooks
- and embedded devices.
-
- THIS IS BROKEN AND DOES NOT WORK YET.
+ The LP-PHY is a low-power PHY built into some notebooks
+ and embedded devices. It supports 802.11a/g
+ (802.11a support is optional, and currently disabled).
 
- SAY N.
+ 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.
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 99b41ce..c5bece0 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4514,7 +4514,9 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
have_5ghz_phy = 1;
break;
case B43_PHYTYPE_LP: //FIXME not always!
+#if 0 //FIXME enabling 5GHz causes a NULL pointer dereference
have_5ghz_phy = 1;
+#endif
case B43_PHYTYPE_G:
case B43_PHYTYPE_N:
have_2ghz_phy = 1;
-- 
1.6.2.4



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


BCM4325 question

2009-08-15 Thread Gábor Stefanik
You asked on the bcm43xx-dev list a year ago if the BCM4325 is
supported - is this question still current?
I am asking because we are implementing LP-PHY support right now
(BCM4325 is an LP-PHY), and will soon need a tester with a revision 2
LP-PHY chip (the 4325 is rev.2, but everyone in the team has only a
rev.0 or rev.1 chip).
Also, where did you obtain a 4325-based wireless solution; is it a
custom-built board with a 4325 chip mounted directly, or some
commercially available BCM4325-based solution? (The team will likely
need one for testing.)

Thanks,
Gábor Stefanik
B43 Linux wireless driver development team

-- 
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: Update baseband init for recent spec changes

2009-08-15 Thread Gábor Stefanik
The spec had some nasty typos, and a large part of the rev0/1 BB
init procedure was also missing. Fix these.

Also make the init-time channel switch debuggable.

(The change from -EINVAL to -EIO is simply to make it possible
to distinguish the PLL charge pump error from a channel-not-found
error.)

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |   71 ++---
 1 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 3872a31..72e1d8c 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -204,8 +204,61 @@ static void lpphy_table_init(struct b43_wldev *dev)
 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
 {
struct ssb_bus *bus = dev-dev-bus;
+   struct b43_phy_lp *lpphy = dev-phy.lp;
u16 tmp, tmp2;
 
+   b43_phy_mask(dev, B43_LPPHY_AFE_DAC_CTL, 0xF7FF);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
+   b43_phy_set(dev, B43_LPPHY_AFE_DAC_CTL, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x0078);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
+   b43_phy_write(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x0016);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_0, 0xFFF8, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5400);
+   b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2400);
+   b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0x0006);
+   b43_phy_mask(dev, B43_LPPHY_RX_RADIO_CTL, 0xFFFE);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC10, 0x0180);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x3800);
+   b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFFF0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_GAIN_MISMATCH_LIMIT, 0xFFC0, 0x001A);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0x00B3);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
+   b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
+   0xFF00, lpphy-rx_pwr_offset);
+   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
+*/
+   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
+   b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
+   0xFFCF, 0x0020);
+   b43_lptab_write(dev, B43_LPTAB16(11, 7), 100);
+   }
+   tmp = lpphy-rssi_vf | lpphy-rssi_vc  4 | 0xA000;
+   b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp);
+   if (bus-sprom.boardflags_hi  B43_BFH_RSSIINV)
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA);
+   b43_lptab_write(dev, B43_LPTAB16(11, 1), 24);
+   b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL,
+   0xFFF9, (lpphy-bx_arch  1));
if (dev-phy.rev == 1 
   (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
@@ -255,7 +308,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700);
}
-   if (dev-phy.rev == 1) {
+   if (dev-phy.rev == 1  (bus-sprom.boardflags_hi  B43_BFH_PAREF)) {
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3);
@@ -267,6 +320,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
b43_phy_write(dev

[PATCH v2] b43: LP-PHY: Update baseband init for recent spec changes

2009-08-15 Thread Gábor Stefanik
The spec had some nasty typos, and a large part of the rev0/1 BB
init procedure was also missing. Fix these.

Also make the init-time channel switch debuggable.

(The change from -EINVAL to -EIO is simply to make it possible
to distinguish the PLL charge pump error from a channel-not-found
error.)

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
V2: Coding style fix suggested by Michael on IRC.

 drivers/net/wireless/b43/phy_lp.c |   72 ++---
 1 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 3872a31..c7f6c75 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -204,8 +204,62 @@ static void lpphy_table_init(struct b43_wldev *dev)
 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
 {
struct ssb_bus *bus = dev-dev-bus;
+   struct b43_phy_lp *lpphy = dev-phy.lp;
u16 tmp, tmp2;
 
+   b43_phy_mask(dev, B43_LPPHY_AFE_DAC_CTL, 0xF7FF);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
+   b43_phy_set(dev, B43_LPPHY_AFE_DAC_CTL, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x0078);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
+   b43_phy_write(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x0016);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_0, 0xFFF8, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5400);
+   b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2400);
+   b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0x0006);
+   b43_phy_mask(dev, B43_LPPHY_RX_RADIO_CTL, 0xFFFE);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC10, 0x0180);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x3800);
+   b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFFF0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_GAIN_MISMATCH_LIMIT, 0xFFC0, 0x001A);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0x00B3);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
+   b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
+   0xFF00, lpphy-rx_pwr_offset);
+   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
+*/
+   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
+   b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
+   0xFFCF, 0x0020);
+   b43_lptab_write(dev, B43_LPTAB16(11, 7), 100);
+   }
+   tmp = lpphy-rssi_vf | lpphy-rssi_vc  4 | 0xA000;
+   b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp);
+   if (bus-sprom.boardflags_hi  B43_BFH_RSSIINV)
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA);
+   b43_lptab_write(dev, B43_LPTAB16(11, 1), 24);
+   b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL,
+   0xFFF9, (lpphy-bx_arch  1));
if (dev-phy.rev == 1 
   (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
@@ -255,7 +309,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700);
}
-   if (dev-phy.rev == 1) {
+   if (dev-phy.rev == 1  (bus-sprom.boardflags_hi  B43_BFH_PAREF)) {
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3);
@@ -267,6 +321,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
b43_phy_write(dev

[PATCH v3] b43: LP-PHY: Update baseband init for recent spec changes

2009-08-15 Thread Gábor Stefanik
The spec had some nasty typos, and a large part of the rev0/1 BB
init procedure was also missing. Fix these.

Also make the init-time channel switch debuggable.

(The change from -EINVAL to -EIO is simply to make it possible
to distinguish the PLL charge pump error from a channel-not-found
error.)

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
V2: Coding style fix suggested by Michael on IRC.
V3: Another coding style fix.

 drivers/net/wireless/b43/phy_lp.c |   73 ++---
 1 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 3872a31..e4a040b 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -204,8 +204,62 @@ static void lpphy_table_init(struct b43_wldev *dev)
 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
 {
struct ssb_bus *bus = dev-dev-bus;
+   struct b43_phy_lp *lpphy = dev-phy.lp;
u16 tmp, tmp2;
 
+   b43_phy_mask(dev, B43_LPPHY_AFE_DAC_CTL, 0xF7FF);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0);
+   b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
+   b43_phy_set(dev, B43_LPPHY_AFE_DAC_CTL, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x0078);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
+   b43_phy_write(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x0016);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_0, 0xFFF8, 0x0004);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5400);
+   b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2400);
+   b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
+   b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0x0006);
+   b43_phy_mask(dev, B43_LPPHY_RX_RADIO_CTL, 0xFFFE);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC10, 0x0180);
+   b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x3800);
+   b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFFF0, 0x0005);
+   b43_phy_maskset(dev, B43_LPPHY_GAIN_MISMATCH_LIMIT, 0xFFC0, 0x001A);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0x00B3);
+   b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
+   b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
+   0xFF00, lpphy-rx_pwr_offset);
+   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
+*/
+   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
+   b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
+   0xFFCF, 0x0020);
+   b43_lptab_write(dev, B43_LPTAB16(11, 7), 100);
+   }
+   tmp = lpphy-rssi_vf | lpphy-rssi_vc  4 | 0xA000;
+   b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp);
+   if (bus-sprom.boardflags_hi  B43_BFH_RSSIINV)
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA);
+   b43_lptab_write(dev, B43_LPTAB16(11, 1), 24);
+   b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL,
+   0xFFF9, (lpphy-bx_arch  1));
if (dev-phy.rev == 1 
   (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
@@ -255,7 +309,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700);
}
-   if (dev-phy.rev == 1) {
+   if (dev-phy.rev == 1  (bus-sprom.boardflags_hi  B43_BFH_PAREF)) {
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3);
@@ -267,6 +321,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006

Re: [PATCH] b43: LP-PHY: Implement channel switching for rev0/1/B2062 radio

2009-08-14 Thread Gábor Stefanik
2009/8/14 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:
 Rev0/1/B2062 will now hopefully show some signs of life, though
 it won't work at full performance, as calibration is still missing.


 Just compiled wireless-testing.git**, enabled LP phy support in config,
 to see how far it gets here:

Wireless-testing doesn't have all the needed patches yet - apply the
outstanding patches from the list to test the real current state.


 modprobe b43 verbose=3

 [ 1068.690053] b43-phy3: Broadcom 4312 WLAN found (core revision 15)
 [ 1068.732048] b43-phy3 debug: Found PHY: Analog 6, Type 5, Revision 1
 [ 1068.732062] b43-phy3 debug: Found Radio: Manuf 0x17F, Version 0x2062,
 Revision 2
 [ 1068.756465] phy3: Selected rate control algorithm 'minstrel'
 [ 1068.756581] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID:
 FW13 ]


 ifconfig wlan0
 wlan0     Link encap:Ethernet  HWaddr FF:FF:FF:FF:FF:FF
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

 ifconfig wlan0 up
 SIOCSIFFLAGS: Cannot assign requested address

Uhh, that doesn't look good...


 Did some looking around and it seems b43_op_start() is never called, so
 its bailing out somewhere in mac80211? Something to do with the mac addr
 being alls FF's?

Yes, FF:FF:FF:FF:FF:FF is not a valid MAC. Mac80211 refuses to
initialize a card with an invalid MAC address.
Now, the question is, how does the MAC address end up being
FF:FF:FF:FF:FF:FF...? Presumably there is a switch(phy-type) in the
generic (non-LP-specific) code that doesn't have case B43_PHYTYPE_LP
and returns FF:FF:FF:FF:FF:FF as the default. I'll investigate.

BTW could you post the output of iwconfig wlan0, iw dev wlan0 info
and iw phy phy3 info (replace phy3 with the phy name from dmesg)?


 Mark


 * Card pci id:
 10:00.0 0280: 14e4:4315 (rev 01)
        Subsystem: 103c:137d

 ** git version:
 http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commit;h=b2004c4a9483b295a7413d41d08604943670ab26




-- 
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


Re: [PATCH] b43: LP-PHY: Implement channel switching for rev0/1/B2062 radio

2009-08-14 Thread Gábor Stefanik
2009/8/14 Mark Huijgen mark.sf@huijgen.tk:
 Gábor Stefanik wrote:

 ifconfig wlan0
 wlan0     Link encap:Ethernet  HWaddr FF:FF:FF:FF:FF:FF
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

 ifconfig wlan0 up
 SIOCSIFFLAGS: Cannot assign requested address


 Uhh, that doesn't look good...

 I've investigated with some SSB debugging:
 [ 4895.592113] ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x16, vendor
 0x4243)
 [ 4895.592125] ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0F,
 vendor 0x4243)
 [ 4895.592135] ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x0A, vendor 0x4243)
 [ 4895.592145] ssb: Core 3 found: PCI-E (cc 0x820, rev 0x09, vendor 0x4243)
 [ 4895.612051] ssb: Found rev 1 PMU (capabilities 0x02A62F01)
 [ 4895.620727] ssb: SPROM revision 8 detected.
 [ 4895.620732] ssb: MAC ff:ff:ff:ff:ff:ff
 [ 4895.642495] ssb: Sonics Silicon Backplane found on PCI device
 :10:00.0

 I added the ssb: MAC line, sprom extraction seems incorrect for this
 device (is ssb up to date enough in wireless-testing for this device?).

Hmm... could you run sudo cat $(find /sys -name ssb_sprom) 
~/ssb_sprom_copy, then upload ~/ssb_sprom_copy to somewhere?
SSB in wireless-testing is up-to-date to the best of my knowledge - it
definitely handles MAC address extraction.



 Did some looking around and it seems b43_op_start() is never called, so
 its bailing out somewhere in mac80211? Something to do with the mac addr
 being alls FF's?


 Yes, FF:FF:FF:FF:FF:FF is not a valid MAC. Mac80211 refuses to
 initialize a card with an invalid MAC address.
 Now, the question is, how does the MAC address end up being
 FF:FF:FF:FF:FF:FF...? Presumably there is a switch(phy-type) in the
 generic (non-LP-specific) code that doesn't have case B43_PHYTYPE_LP
 and returns FF:FF:FF:FF:FF:FF as the default. I'll investigate.

 BTW could you post the output of iwconfig wlan0, iw dev wlan0 info
 and iw phy phy3 info (replace phy3 with the phy name from dmesg)?

 # iwconfig wlan0
 wlan0     IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated
          Tx-Power=0 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

 # iw dev wlan0 info
 Interface wlan0
        ifindex 16
        type managed

 # iw phy phy13 info
 Wiphy phy13
        Band 1:
                Frequencies:
                        * 2412 MHz [1] (27.0 dBm)
                        * 2417 MHz [2] (27.0 dBm)
                        * 2422 MHz [3] (27.0 dBm)
                        * 2427 MHz [4] (27.0 dBm)
                        * 2432 MHz [5] (27.0 dBm)
                        * 2437 MHz [6] (27.0 dBm)
                        * 2442 MHz [7] (27.0 dBm)
                        * 2447 MHz [8] (27.0 dBm)
                        * 2452 MHz [9] (27.0 dBm)
                        * 2457 MHz [10] (27.0 dBm)
                        * 2462 MHz [11] (27.0 dBm)
                        * 2467 MHz [12] (disabled)
                        * 2472 MHz [13] (disabled)
                        * 2484 MHz [14] (disabled)
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
        max # scan SSIDs: 4
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * WDS
                 * monitor

That's also wrong - the driver should be registering an 5GHz band as
well (as I haven't yet added a check as to whether the LP-PHY in
question is A/G or G-only - so getting only one band means something
is limiting registration to G mode).

BTW there is another problem that will prevent starting the device
once this is fixed (firmware loading fails) - I'm about to submit a
patch for that one soon.

-- 
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: Fix another TX power control abuse

2009-08-14 Thread Gábor Stefanik
This should fix the remaining WARN_ON.

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

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index bf89173..3872a31 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1059,7 +1059,8 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
bool old_txg_ovr;
u8 old_bbmult;
u16 old_rf_ovr, old_rf_ovrval, old_afe_ovr, old_afe_ovrval,
-   old_rf2_ovr, old_rf2_ovrval, old_phy_ctl, old_txpctl;
+   old_rf2_ovr, old_rf2_ovrval, old_phy_ctl;
+   enum b43_lpphy_txpctl_mode old_txpctl;
u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0;
int loopback, i, j, inner_sum;
 
@@ -1077,8 +1078,8 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
old_rf2_ovr = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2);
old_rf2_ovrval = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2_VAL);
old_phy_ctl = b43_phy_read(dev, B43_LPPHY_LP_PHY_CTL);
-   old_txpctl = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_CMD) 
-   B43_LPPHY_TX_PWR_CTL_CMD_MODE;
+   lpphy_read_tx_pctl_mode_from_hardware(dev);
+   old_txpctl = lpphy-txpctl_mode;
 
lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
lpphy_disable_crs(dev);
-- 
1.6.2.4



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


Re: [PATCH] b43: Fix sparse warnings

2009-08-14 Thread Gábor Stefanik
On Fri, Aug 14, 2009 at 11:00 PM, Michael Bueschm...@bu3sch.de wrote:
 On Friday 14 August 2009 22:52:13 Pavel Roskin wrote:
 On Fri, 2009-08-14 at 22:15 +0200, Michael Buesch wrote:

   -                 b43_phy_mask(dev, 0x048A, (u16)~0x8000);
   +                 b43_phy_mask(dev, 0x048A, (u16)(~0x8000  0x));
 

 I would just use 0x7fff here.

 That does not work if 0x8000 is a #defined bit.

What about ~((u16)0x8000)? (Or maybe ~(u16)0x8000 is enough, without
the extra parentheses.)


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




-- 
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


Re: [PATCH] b43: LP-PHY: Fix another TX power control abuse

2009-08-14 Thread Gábor Stefanik
2009/8/14 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 This should fix the remaining WARN_ON.

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

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index bf89173..3872a31 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -1059,7 +1059,8 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
 *dev)
     bool old_txg_ovr;
     u8 old_bbmult;
     u16 old_rf_ovr, old_rf_ovrval, old_afe_ovr, old_afe_ovrval,
 -        old_rf2_ovr, old_rf2_ovrval, old_phy_ctl, old_txpctl;
 +        old_rf2_ovr, old_rf2_ovrval, old_phy_ctl;
 +    enum b43_lpphy_txpctl_mode old_txpctl;
     u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0;
     int loopback, i, j, inner_sum;

 @@ -1077,8 +1078,8 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev
 *dev)
     old_rf2_ovr = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2);
     old_rf2_ovrval = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2_VAL);
     old_phy_ctl = b43_phy_read(dev, B43_LPPHY_LP_PHY_CTL);
 -    old_txpctl = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_CMD) 
 -                    B43_LPPHY_TX_PWR_CTL_CMD_MODE;
 +    lpphy_read_tx_pctl_mode_from_hardware(dev);
 +    old_txpctl = lpphy-txpctl_mode;

     lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
     lpphy_disable_crs(dev);

 Yes, this one got rid of the warnings.

 Larry



I guess the device still doesn't TX/RX.

-- 
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: Handle B43_PHYTYPE_LP in RX path

2009-08-14 Thread Gábor Stefanik
Don't drop all packets received from an LP-PHY with WARN_ON.
Also update a comment with LP-specific information.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/wa.c   |2 +-
 drivers/net/wireless/b43/xmit.c |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c
index 73e97fa..97c7916 100644
--- a/drivers/net/wireless/b43/wa.c
+++ b/drivers/net/wireless/b43/wa.c
@@ -628,7 +628,7 @@ void b43_wa_all(struct b43_wldev *dev)
B43_WARN_ON(1);
}
b43_wa_boards_g(dev);
-   } else { /* No N PHY support so far */
+   } else { /* No N PHY support so far, LP PHY is in phy_lp.c */
B43_WARN_ON(1);
}
 
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 5280ebc..be1c53e 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -655,6 +655,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, 
const void *_rxhdr)
status.freq = chanid + 2400;
break;
case B43_PHYTYPE_N:
+   case B43_PHYTYPE_LP:
/* chanid is the SHM channel cookie. Which is the plain
 * channel number in b43. */
if (chanstat  B43_RX_CHAN_5GHZ) {
-- 
1.6.2.4



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


[PATCH v2] b43: Update dummy transmission to match V4 specs

2009-08-13 Thread Gábor Stefanik
The V4 dummy transmission has two extra bools in its prototype,
so update all callers with the 2 bools.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
v2: Convert all callers to v4, and drop the v3-v4 wrapper.

 drivers/net/wireless/b43/lo.c|2 +-
 drivers/net/wireless/b43/main.c  |   42 ++---
 drivers/net/wireless/b43/main.h  |2 +-
 drivers/net/wireless/b43/phy_g.c |6 ++--
 drivers/net/wireless/b43/wa.c|2 +-
 5 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c
index 22d0fbd..976104f 100644
--- a/drivers/net/wireless/b43/lo.c
+++ b/drivers/net/wireless/b43/lo.c
@@ -477,7 +477,7 @@ static void lo_measure_setup(struct b43_wldev *dev,
} else
b43_phy_write(dev, B43_PHY_CCK(0x2B), 0x0802);
if (phy-rev = 2)
-   b43_dummy_transmission(dev);
+   b43_dummy_transmission(dev, false, true);
b43_gphy_channel_switch(dev, 6, 0);
b43_radio_read16(dev, 0x51);/* dummy read */
if (phy-type == B43_PHYTYPE_G)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index cb4a871..fbcbe4f 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -684,9 +684,9 @@ static void b43_synchronize_irq(struct b43_wldev *dev)
 }
 
 /* DummyTransmission function, as documented on
- * http://bcm-specs.sipsolutions.net/DummyTransmission
+ * http://bcm-v4.sipsolutions.net/802.11/DummyTransmission
  */
-void b43_dummy_transmission(struct b43_wldev *dev)
+void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on)
 {
struct b43_wl *wl = dev-wl;
struct b43_phy *phy = dev-phy;
@@ -700,19 +700,12 @@ void b43_dummy_transmission(struct b43_wldev *dev)
0x,
};
 
-   switch (phy-type) {
-   case B43_PHYTYPE_A:
+   if (ofdm) {
max_loop = 0x1E;
buffer[0] = 0x000201CC;
-   break;
-   case B43_PHYTYPE_B:
-   case B43_PHYTYPE_G:
+   } else {
max_loop = 0xFA;
buffer[0] = 0x000B846E;
-   break;
-   default:
-   B43_WARN_ON(1);
-   return;
}
 
spin_lock_irq(wl-irq_lock);
@@ -721,20 +714,35 @@ void b43_dummy_transmission(struct b43_wldev *dev)
for (i = 0; i  5; i++)
b43_ram_write(dev, i * 4, buffer[i]);
 
-   /* Commit writes */
-   b43_read32(dev, B43_MMIO_MACCTL);
-
b43_write16(dev, 0x0568, 0x);
-   b43_write16(dev, 0x07C0, 0x);
-   value = ((phy-type == B43_PHYTYPE_A) ? 1 : 0);
+   if (dev-dev-id.revision  11)
+   b43_write16(dev, 0x07C0, 0x);
+   else
+   b43_write16(dev, 0x07C0, 0x0100);
+   value = (ofdm ? 0x41 : 0x40);
b43_write16(dev, 0x050C, value);
+   if ((phy-type == B43_PHYTYPE_N) || (phy-type == B43_PHYTYPE_LP))
+   b43_write16(dev, 0x0514, 0x1A02);
b43_write16(dev, 0x0508, 0x);
b43_write16(dev, 0x050A, 0x);
b43_write16(dev, 0x054C, 0x);
b43_write16(dev, 0x056A, 0x0014);
b43_write16(dev, 0x0568, 0x0826);
b43_write16(dev, 0x0500, 0x);
-   b43_write16(dev, 0x0502, 0x0030);
+   if (!pa_on  (phy-type == B43_PHYTYPE_N)) {
+   //SPEC TODO
+   }
+
+   switch (phy-type) {
+   case B43_PHYTYPE_N:
+   b43_write16(dev, 0x0502, 0x00D0);
+   break;
+   case B43_PHYTYPE_LP:
+   b43_write16(dev, 0x0502, 0x0050);
+   break;
+   default:
+   b43_write16(dev, 0x0502, 0x0030);
+   }
 
if (phy-radio_ver == 0x2050  phy-radio_rev = 0x5)
b43_radio_write16(dev, 0x0051, 0x0017);
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 40abcf5..2d23f65 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -124,7 +124,7 @@ void __b43_shm_write16(struct b43_wldev *dev, u16 routing, 
u16 offset, u16 value
 u64 b43_hf_read(struct b43_wldev *dev);
 void b43_hf_write(struct b43_wldev *dev, u64 value);
 
-void b43_dummy_transmission(struct b43_wldev *dev);
+void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on);
 
 void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags);
 
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index e7b98f0..e75a39d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -333,7 +333,7 @@ static void b43_set_all_gains(struct b43_wldev *dev,
b43_phy_maskset(dev, 0x04A1, 0xBFBF, tmp);
b43_phy_maskset(dev, 0x04A2, 0xBFBF, tmp);
}
-   b43_dummy_transmission(dev);
+   b43_dummy_transmission(dev, false, true);
 }
 
 static void b43_set_original_gains(struct b43_wldev *dev

[PATCH v3] b43: LP-PHY: Initialize TX power control

2009-08-13 Thread Gábor Stefanik
The HW TX power control init still needs work.
The SW init is complete according to the specs.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
v3: WARN_ON() setting TSSI mux mode to Ext, per Larry's suggestion.
v2: Address Michael's comments, and update for the dummy transmission changes.

This depends on both the rev0/1 RC calibration patch and the
updated V4 dummy transmission patch I submitted earlier.

Larry, please review the SPEC TODO/SPEC FIXME comments!

 drivers/net/wireless/b43/phy_lp.c |  105 ++---
 drivers/net/wireless/b43/phy_lp.h |5 ++
 2 files changed, 103 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 2441a8d..b4e51f0 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -1257,18 +1257,109 @@ static void lpphy_calibration(struct b43_wldev *dev)
b43_mac_enable(dev);
 }
 
+static void lpphy_set_tssi_mux(struct b43_wldev *dev, enum tssi_mux_mode mode)
+{
+   if (mode != TSSI_MUX_EXT) {
+   b43_radio_set(dev, B2063_PA_SP1, 0x2);
+   b43_phy_set(dev, B43_PHY_OFDM(0xF3), 0x1000);
+   b43_radio_write(dev, B2063_PA_CTL10, 0x51);
+   if (mode == TSSI_MUX_POSTPA) {
+   b43_radio_mask(dev, B2063_PA_SP1, 0xFFFE);
+   b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFC7);
+   } else {
+   b43_radio_maskset(dev, B2063_PA_SP1, 0xFFFE, 0x1);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVRVAL,
+   0xFFC7, 0x20);
+   }
+   } else {
+   B43_WARN_ON(1);
+   }
+}
+
+static void lpphy_tx_pctl_init_hw(struct b43_wldev *dev)
+{
+   u16 tmp;
+   int i;
+
+   //SPEC TODO Call LP PHY Clear TX Power offsets
+   for (i = 0; i  64; i++) {
+   if (dev-phy.rev = 2)
+   b43_lptab_write(dev, B43_LPTAB32(7, i + 1), i);
+   else
+   b43_lptab_write(dev, B43_LPTAB32(10, i + 1), i);
+   }
+
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xFF00, 0xFF);
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0x8FFF, 0x5000);
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0xFFC0, 0x1F);
+   if (dev-phy.rev  2) {
+   b43_phy_mask(dev, B43_LPPHY_LP_PHY_CTL, 0xEFFF);
+   b43_phy_maskset(dev, B43_LPPHY_LP_PHY_CTL, 0xDFFF, 0x2000);
+   } else {
+   b43_phy_mask(dev, B43_PHY_OFDM(0x103), 0xFFFE);
+   b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFFB, 0x4);
+   b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFEF, 0x10);
+   b43_radio_maskset(dev, B2063_IQ_CALIB_CTL2, 0xF3, 0x1);
+   lpphy_set_tssi_mux(dev, TSSI_MUX_POSTPA);
+   }
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0x7FFF, 0x8000);
+   b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xFF);
+   b43_phy_write(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xA);
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD,
+   (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE,
+   B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF);
+   b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xF8FF);
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD,
+   (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE,
+   B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW);
+
+   if (dev-phy.rev  2) {
+   b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF, 0x1000);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xEFFF);
+   } else {
+   lpphy_set_tx_power_by_index(dev, 0x7F);
+   }
+
+   b43_dummy_transmission(dev, true, true);
+
+   tmp = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_STAT);
+   if (tmp  0x8000) {
+   b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI,
+   0xFFC0, (tmp  0xFF) - 32);
+   }
+
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF);
+
+   // (SPEC?) TODO Set Target TX frequency variable to 0
+   // SPEC FIXME Set BB Multiplier to 0xE000 impossible - bb_mult is u8!
+}
+
+static void lpphy_tx_pctl_init_sw(struct b43_wldev *dev)
+{
+   struct lpphy_tx_gains gains;
+
+   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ) {
+   gains.gm = 4;
+   gains.pad = 12;
+   gains.pga = 12;
+   gains.dac = 0;
+   } else {
+   gains.gm = 7;
+   gains.pad = 14;
+   gains.pga = 15;
+   gains.dac = 0;
+   }
+   lpphy_set_tx_gains(dev, gains);
+   lpphy_set_bb_mult(dev, 150);
+}
+
 /* Initialize TX power control */
 static void lpphy_tx_pctl_init(struct b43_wldev *dev)
 {
if (0/*FIXME HWPCTL capable */) {
-   //TODO

[PATCH] b43: Implement RC calibration for rev.0/1 LP-PHYs

2009-08-12 Thread Gábor Stefanik
Also implement get/set BB mult, get/set TX gain, set RX gain,
disable/restore CRS, run/stop DDFS, RX IQ est and QDIV roundup
in the process.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
Larry, please review the SPEC FIXME comments!

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

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 689c932..b283b58 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -605,6 +605,8 @@ static void lpphy_radio_init(struct b43_wldev *dev)
}
 }
 
+struct lpphy_iq_est { u32 iq_prod, i_pwr, q_pwr; };
+
 static void lpphy_set_rc_cap(struct b43_wldev *dev)
 {
u8 rc_cap = dev-phy.lp-rc_cap;
@@ -614,9 +616,419 @@ static void lpphy_set_rc_cap(struct b43_wldev *dev)
b43_radio_write(dev, B2062_S_RXG_CNT16, ((rc_cap  0x1F)  2) | 0x80);
 }
 
+static u8 lpphy_get_bb_mult(struct b43_wldev *dev)
+{
+   return (b43_lptab_read(dev, B43_LPTAB16(0, 87))  0xFF00)  8;
+}
+
+static void lpphy_set_bb_mult(struct b43_wldev *dev, u8 bb_mult)
+{
+   b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
+}
+
+static void lpphy_disable_crs(struct b43_wldev *dev)
+{
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
+   b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x4);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFF7);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x10);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x10);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFDF);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFBF);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x7);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x38);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFF3F);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x100);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFDFF);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL0, 0);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL1, 1);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL2, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFBFF);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xF7FF);
+   b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, 0);
+   b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, 0x45AF);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
+}
+
+static void lpphy_restore_crs(struct b43_wldev *dev)
+{
+   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
+}
+
+struct lpphy_tx_gains { u16 gm, pga, pad, dac; };
+
+static struct lpphy_tx_gains lpphy_get_tx_gains(struct b43_wldev *dev)
+{
+   struct lpphy_tx_gains gains;
+   u16 tmp;
+
+   gains.dac = (b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL)  0x380)  7;
+   if (dev-phy.rev  2) {
+   tmp = b43_phy_read(dev,
+  B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL)  0x7FF;
+   gains.gm = tmp  0x0007;
+   gains.pga = (tmp  0x0078)  3;
+   gains.pad = (tmp  0x780)  7;
+   } else {
+   tmp = b43_phy_read(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL);
+   gains.pad = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0xFF;
+   gains.gm = tmp  0xFF;
+   gains.pga = (tmp8)  0xFF;
+   }
+
+   return gains;
+}
+
+static void lpphy_set_dac_gain(struct b43_wldev *dev, u16 dac)
+{
+   u16 ctl = b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL)  0xC7F;
+   ctl |= dac  7;
+   b43_phy_maskset(dev, B43_LPPHY_AFE_DAC_CTL, 0xF000, ctl);
+}
+
+static void lpphy_set_tx_gains(struct b43_wldev *dev,
+  struct lpphy_tx_gains gains)
+{
+   u16 rf_gain, pa_gain;
+
+   if (dev-phy.rev  2) {
+   rf_gain = (gains.pad  7) | (gains.pga  3) | gains.gm;
+   b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
+   0xF800, rf_gain);
+   } else {
+   pa_gain = b43_phy_read(dev, B43_PHY_OFDM(0xFB))  0x7F00;
+   b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL,
+ (gains.pga  8) | gains.gm

[PATCH v2] b43: Implement RC calibration for rev.0/1 LP-PHYs

2009-08-12 Thread Gábor Stefanik
Also implement get/set BB mult, get/set TX gain, set RX gain,
disable/restore CRS, run/stop DDFS, RX IQ est and QDIV roundup
in the process.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
Changes from v1-v2:
-Coding style fixes as suggested by Michael.
-Added missing static to lpphy_qdiv_roundup.
-Moved set_tx_power_control  related functions before rev0/1 RC calibration,
 and removed forward declaration
-Reordered variable declarations at the start of rev0_1_rc_calib.
-The ideal power table is now static const.

Interdiff v1-v2 available @ http://b43.pastebin.com/f5fe6ba3c for easier 
review.

 drivers/net/wireless/b43/phy_lp.c |  508 +
 1 files changed, 461 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 689c932..e05981b 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -605,6 +605,8 @@ static void lpphy_radio_init(struct b43_wldev *dev)
}
 }
 
+struct lpphy_iq_est { u32 iq_prod, i_pwr, q_pwr; };
+
 static void lpphy_set_rc_cap(struct b43_wldev *dev)
 {
u8 rc_cap = dev-phy.lp-rc_cap;
@@ -614,79 +616,327 @@ static void lpphy_set_rc_cap(struct b43_wldev *dev)
b43_radio_write(dev, B2062_S_RXG_CNT16, ((rc_cap  0x1F)  2) | 0x80);
 }
 
-static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
+static u8 lpphy_get_bb_mult(struct b43_wldev *dev)
 {
-   //TODO and SPEC FIXME
+   return (b43_lptab_read(dev, B43_LPTAB16(0, 87))  0xFF00)  8;
 }
 
-static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev)
+static void lpphy_set_bb_mult(struct b43_wldev *dev, u8 bb_mult)
 {
-   struct ssb_bus *bus = dev-dev-bus;
-   u32 crystal_freq = bus-chipco.pmu.crystalfreq * 1000;
-   u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8)  0xFF;
-   int i;
+   b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult  8);
+}
 
-   b43_radio_write(dev, B2063_RX_BB_SP8, 0x0);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7E);
-   b43_radio_mask(dev, B2063_PLL_SP1, 0xF7);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7C);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL2, 0x15);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL3, 0x70);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL4, 0x52);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL5, 0x1);
-   b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7D);
+static void lpphy_disable_crs(struct b43_wldev *dev)
+{
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80);
+   b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, 0x1);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x4);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFF7);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x10);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x10);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFDF);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFBF);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x7);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x38);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFF3F);
+   b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x100);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFDFF);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL0, 0);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL1, 1);
+   b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL2, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFBFF);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xF7FF);
+   b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, 0);
+   b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, 0x45AF);
+   b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF);
+}
 
-   for (i = 0; i  1; i++) {
-   if (b43_radio_read(dev, B2063_RC_CALIB_CTL6)  0x2)
-   break;
-   msleep(1);
+static void lpphy_restore_crs(struct b43_wldev *dev)
+{
+   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x60);
+   else
+   b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x20);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80);
+   b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00);
+}
+
+struct lpphy_tx_gains { u16 gm, pga, pad, dac; };
+
+static struct lpphy_tx_gains lpphy_get_tx_gains(struct b43_wldev *dev)
+{
+   struct lpphy_tx_gains gains;
+   u16 tmp;
+
+   gains.dac = (b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL)  0x380)  7;
+   if (dev-phy.rev  2) {
+   tmp

[PATCH] b43: Update dummy transmission to match V4 specs

2009-08-12 Thread Gábor Stefanik
The V4 dummy transmission function has two extra bools in its
prototype, so add a wrapper function for callers that expect the
V3 version.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/main.c |   60 ---
 drivers/net/wireless/b43/main.h |1 +
 2 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index cb4a871..80bc962 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -683,11 +683,29 @@ static void b43_synchronize_irq(struct b43_wldev *dev)
tasklet_kill(dev-isr_tasklet);
 }
 
-/* DummyTransmission function, as documented on
- * http://bcm-specs.sipsolutions.net/DummyTransmission
+/* Wrapper for callers of the old V3 dummy transmission function
+ * Please don't use this in new code, call the v4 routine directly instead.
  */
 void b43_dummy_transmission(struct b43_wldev *dev)
 {
+   switch (dev-phy.type) {
+   case B43_PHYTYPE_A:
+   b43_dummy_transmission_v4(dev, true, true);
+   break;
+   case B43_PHYTYPE_B:
+   case B43_PHYTYPE_G:
+   b43_dummy_transmission_v4(dev, false, true);
+   break;
+   default:
+   B43_WARN_ON(1);
+   }
+}
+
+/* DummyTransmission function, as documented on
+ * http://bcm-v4.sipsolutions.net/802.11/DummyTransmission
+ */
+void b43_dummy_transmission_v4(struct b43_wldev *dev, bool ofdm, bool pa_on)
+{
struct b43_wl *wl = dev-wl;
struct b43_phy *phy = dev-phy;
unsigned int i, max_loop;
@@ -700,19 +718,12 @@ void b43_dummy_transmission(struct b43_wldev *dev)
0x,
};
 
-   switch (phy-type) {
-   case B43_PHYTYPE_A:
+   if (ofdm) {
max_loop = 0x1E;
buffer[0] = 0x000201CC;
-   break;
-   case B43_PHYTYPE_B:
-   case B43_PHYTYPE_G:
+   } else {
max_loop = 0xFA;
buffer[0] = 0x000B846E;
-   break;
-   default:
-   B43_WARN_ON(1);
-   return;
}
 
spin_lock_irq(wl-irq_lock);
@@ -721,20 +732,35 @@ void b43_dummy_transmission(struct b43_wldev *dev)
for (i = 0; i  5; i++)
b43_ram_write(dev, i * 4, buffer[i]);
 
-   /* Commit writes */
-   b43_read32(dev, B43_MMIO_MACCTL);
-
b43_write16(dev, 0x0568, 0x);
-   b43_write16(dev, 0x07C0, 0x);
-   value = ((phy-type == B43_PHYTYPE_A) ? 1 : 0);
+   if (dev-dev-id.revision  11)
+   b43_write16(dev, 0x07C0, 0x);
+   else
+   b43_write16(dev, 0x07C0, 0x0100);
+   value = (ofdm ? 0x41 : 0x40);
b43_write16(dev, 0x050C, value);
+   if ((phy-type == B43_PHYTYPE_N) || (phy-type == B43_PHYTYPE_LP))
+   b43_write16(dev, 0x0514, 0x1A02);
b43_write16(dev, 0x0508, 0x);
b43_write16(dev, 0x050A, 0x);
b43_write16(dev, 0x054C, 0x);
b43_write16(dev, 0x056A, 0x0014);
b43_write16(dev, 0x0568, 0x0826);
b43_write16(dev, 0x0500, 0x);
-   b43_write16(dev, 0x0502, 0x0030);
+   if (!pa_on  (phy-type == B43_PHYTYPE_N)) {
+   //SPEC TODO
+   }
+
+   switch (phy-type) {
+   case B43_PHYTYPE_N:
+   b43_write16(dev, 0x0502, 0x00D0);
+   break;
+   case B43_PHYTYPE_LP:
+   b43_write16(dev, 0x0502, 0x0050);
+   break;
+   default:
+   b43_write16(dev, 0x0502, 0x0030);
+   }
 
if (phy-radio_ver == 0x2050  phy-radio_rev = 0x5)
b43_radio_write16(dev, 0x0051, 0x0017);
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 40abcf5..7f26fd9 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -125,6 +125,7 @@ u64 b43_hf_read(struct b43_wldev *dev);
 void b43_hf_write(struct b43_wldev *dev, u64 value);
 
 void b43_dummy_transmission(struct b43_wldev *dev);
+void b43_dummy_transmission_v4(struct b43_wldev *dev, bool ofdm, bool pa_on);
 
 void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags);
 
-- 
1.6.2.4



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


[RFC] b43: LP-PHY: Initialize SW TX power control

2009-08-11 Thread Gábor Stefanik
I'm not sure at all if writing to offset 0 in the TX gain table
is the right thing to do... please clarify.

Not-yet-signed-off-by: Gábor Stefanik netrolller...@gmail.com

---
If this is indeed the right thing to do, please inform me,
and I will resubmit this as a formal patch.

 phy_lp.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 689c932..93451c9 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -847,15 +847,23 @@ static void lpphy_calibration(struct b43_wldev *dev)
 /* Initialize TX power control */
 static void lpphy_tx_pctl_init(struct b43_wldev *dev)
 {
+   lpphy_tx_gain_table_entry txgain;
if (0/*FIXME HWPCTL capable */) {
//TODO
} else { /* This device is only software TX power control capable. */
+   txgain.bb_mult = 0x96;
if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ) {
-   //TODO
+   txgain.gm = 4;
+   txgain.pad = 12;
+   txgain.pga = 12;
+   txgain.dac = 0;
} else {
-   //TODO
-   }
-   //TODO set BB multiplier to 0x0096
+   txgain.gm = 7;
+   txgain.pad = 15;
+   txgain.pga = 14;
+   txgain.dac = 0;
+   } // FIXME offset 0 is just a guess!
+   lpphy_write_gain_table(dev, 0, txgain);
}
 }
 


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


Re: [RFC PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-10 Thread Gábor Stefanik
2009/8/10 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 Implement LP-PHY baseband table init for all revisions.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com

 ---
 Sorry for the size; it's difficult to cut short changes like this
 (most of the patch is just table data). Please review, there may always be
 bugs that I failed to catch while reading through the code. I have added
 comments to places that were not quite clear to me.

 phy_lp.c       |   41 tables_lpphy.c | 3223
 +
 tables_lpphy.h |    3 3 files changed, 3263 insertions(+), 4 deletions(-)

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 27eadee..cf17489 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -59,9 +59,43 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
     dev-phy.lp = NULL;
 }

 +static void lpphy_adjust_gain_table(struct b43_wldev *dev)
 +{
 +    struct b43_phy_lp *lpphy = dev-phy.lp;
 +    u32 freq = dev-wl-hw-conf.channel-center_freq;
 +    u16 temp[3];
 +    u16 isolation;
 +
 +    B43_WARN_ON(dev-phy.rev = 2);
 +
 +    if (freq  2400) /* FIXME Can this ever happen? Should we WARN_ON? */

 This was a typo. It should be 2500, not 2400.

Thanks! So it is actually better to implement this as if
(b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)? That would make
it easier to implement non-standard channels similar to how it was
done for ath5k (Richard Farina's frequency patch - assuming the HW is
capable of something like that).


 +        isolation = lpphy-tx_isolation_med_band;
 +    else if (freq = 5320)

 --snip --

 +void lpphy_rev2plus_table_init(struct b43_wldev *dev)
 +{
 +    struct ssb_bus *bus = dev-dev-bus;
 +    int i;
 +
 +    B43_WARN_ON(dev-phy.rev  2);
 +
 +    //XXX should this be done using b43_lptab_write_bulk?
 +    for (i = 0; i  704; i++)
 +        b43_lptab_write(dev, B43_LPTAB32(7, i), 0);

 No. The bulk write is for writing tables with length greater than 1.
 In this case, you have 704 different tables each of length 1.

By the way, looking at the implementation again, it looks a bit fishy
to me - we write zeros to 4 bytes of table ID 7, then increase the
offset by 1 byte, and again write 4 bytes - 3 of which are the same
bytes we already zeroed in the previous step.

I suspect this would suffice:

for (i = 0; i  704; i += 4)
   b43_lptab_write(dev, B43_LPTAB32(7, i), 0);

This version cuts the write count in half, and removes redundant byte writes.

Maybe this should be tested once the code is functional.


 I am still looking through the patch. I'll let you know of any thing I
 find.

 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


Re: [RFC PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-10 Thread Gábor Stefanik
2009/8/10 Michael Buesch m...@bu3sch.de:
 On Monday 10 August 2009 03:00:46 Gábor Stefanik wrote:
 +static const u16 lpphy_sw_control_table[] = {
 +     0x0128,
 +     0x0128,
 +     0x0009,
 +     0x0009,
 +     0x0028,
 +     0x0028,

 Is it possible to use more than one value per line for all these tables?
 Make sure to make best use of the 80 columns limit.
 This would significantly decrease the patch/file length. (linewise)

 --
 Greetings, Michael.


Well, I converted the tables directly from the Wikitext on
bcm-v4.sipsolutions.net using regex searchreplace - if you know a
good regex to convert the tables to use multiple values on each line,
please post it.

-- 
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


Re: [RFC PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-10 Thread Gábor Stefanik
2009/8/10 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 2009/8/10 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 Implement LP-PHY baseband table init for all revisions.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com

 ---
 Sorry for the size; it's difficult to cut short changes like this
 (most of the patch is just table data). Please review, there may always be
 bugs that I failed to catch while reading through the code. I have added
 comments to places that were not quite clear to me.

 phy_lp.c       |   41 tables_lpphy.c | 3223
 +
 tables_lpphy.h |    3 3 files changed, 3263 insertions(+), 4 deletions(-)

 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 27eadee..cf17489 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -59,9 +59,43 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
     dev-phy.lp = NULL;
 }

 +static void lpphy_adjust_gain_table(struct b43_wldev *dev)
 +{
 +    struct b43_phy_lp *lpphy = dev-phy.lp;
 +    u32 freq = dev-wl-hw-conf.channel-center_freq;
 +    u16 temp[3];
 +    u16 isolation;
 +
 +    B43_WARN_ON(dev-phy.rev = 2);
 +
 +    if (freq  2400) /* FIXME Can this ever happen? Should we WARN_ON? */
 This was a typo. It should be 2500, not 2400.

 Thanks! So it is actually better to implement this as if
 (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ)? That would make
 it easier to implement non-standard channels similar to how it was
 done for ath5k (Richard Farina's frequency patch - assuming the HW is
 capable of something like that).

 Yes, that would work for the 2.4 GHz band, and I guess there could be
 similar routines or macros to split the 5 GHz band into low, medium
 and high channels.

AFAIK there is no need to do that - using current_band for 2GHz is
specifically to ensure that channels in the 2500...3000MHz range don't
get parsed as 5GHz. There is currently no band above 5GHz used for
wlan, so this problem can't show up on 5GHz.


 +        isolation = lpphy-tx_isolation_med_band;
 +    else if (freq = 5320)
 --snip --

 +void lpphy_rev2plus_table_init(struct b43_wldev *dev)
 +{
 +    struct ssb_bus *bus = dev-dev-bus;
 +    int i;
 +
 +    B43_WARN_ON(dev-phy.rev  2);
 +
 +    //XXX should this be done using b43_lptab_write_bulk?
 +    for (i = 0; i  704; i++)
 +        b43_lptab_write(dev, B43_LPTAB32(7, i), 0);
 No. The bulk write is for writing tables with length greater than 1.
 In this case, you have 704 different tables each of length 1.

 By the way, looking at the implementation again, it looks a bit fishy
 to me - we write zeros to 4 bytes of table ID 7, then increase the
 offset by 1 byte, and again write 4 bytes - 3 of which are the same
 bytes we already zeroed in the previous step.

 I suspect this would suffice:

 for (i = 0; i  704; i += 4)
            b43_lptab_write(dev, B43_LPTAB32(7, i), 0);

 This version cuts the write count in half, and removes redundant byte writes.

 Maybe this should be tested once the code is functional.

 Without knowing what the firmware does with these values, I'm not sure
 that the two steps are equivalent, but that can be tested. I'm sure of
 the specs in this instance.

 Larry


Thanks, I have added a big comment to this code so that this won't be forgotten.

I'm gonna re-submit this as a formal patch soon.

-- 
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: Update LP-PHY rev2+ baseband init to match the specs

2009-08-10 Thread Gábor Stefanik
The rev2+ BB init spec has changed behind us, and thus the code is
no longer up to date. Update the code to match the current specs.
Also implement save/restore dig filt state, as required by the
new specification (implemented as 2 separate functions).

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
 drivers/net/wireless/b43/phy_lp.c |   73 +++--
 drivers/net/wireless/b43/phy_lp.h |3 ++
 2 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index d2af924..128d75a 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -195,6 +195,56 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
}
 }
 
+static void lpphy_save_dig_flt_state(struct b43_wldev *dev)
+{
+   static const u16 addr[] = {
+   B43_PHY_OFDM(0xC1),
+   B43_PHY_OFDM(0xC2),
+   B43_PHY_OFDM(0xC3),
+   B43_PHY_OFDM(0xC4),
+   B43_PHY_OFDM(0xC5),
+   B43_PHY_OFDM(0xC6),
+   B43_PHY_OFDM(0xC7),
+   B43_PHY_OFDM(0xC8),
+   B43_PHY_OFDM(0xCF),
+   };
+
+   static const u16 coeffs[] = {
+   0xDE5E, 0xE832, 0xE331, 0x4D26,
+   0x0026, 0x1420, 0x0020, 0xFE08,
+   0x0008,
+   };
+
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+   int i;
+
+   for (i = 0; i  9; i++) {
+   lpphy-dig_flt_state[i] = b43_phy_read(dev, addr[i]);
+   b43_phy_write(dev, addr[i], coefs[i]);
+   }
+}
+
+static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
+{
+   static const u16 addr[] = {
+   B43_PHY_OFDM(0xC1),
+   B43_PHY_OFDM(0xC2),
+   B43_PHY_OFDM(0xC3),
+   B43_PHY_OFDM(0xC4),
+   B43_PHY_OFDM(0xC5),
+   B43_PHY_OFDM(0xC6),
+   B43_PHY_OFDM(0xC7),
+   B43_PHY_OFDM(0xC8),
+   B43_PHY_OFDM(0xCF),
+   };
+
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+   int i;
+
+   for (i = 0; i  9; i++)
+   b43_phy_write(dev, addr[i], lpphy-dig_flt_state[i]);
+}
+
 static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
 {
struct ssb_bus *bus = dev-dev-bus;
@@ -209,7 +259,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev 
*dev)
b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0);
b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0);
b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10);
-   b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x78);
+   b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0xB4);
b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200);
b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F);
b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40);
@@ -217,7 +267,12 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev 
*dev)
b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000);
b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000);
b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1);
-   b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10);
+   if (bus-boardinfo.rev = 0x18) {
+   b43_lptab_write(dev, B43_LPTAB32(17, 65), 0xEC);
+   b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x14);
+   } else {
+   b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10);
+   }
b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4);
b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100);
b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48);
@@ -247,8 +302,10 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev 
*dev)
b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12);
b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000);
 
-   b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0);
-   b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
+   if ((bus-chip_id == 0x4325)  (bus-chip_rev == 1)) {
+   b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0);
+   b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
+   }
 
if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ) {
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40);
@@ -268,6 +325,14 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev 
*dev)
b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1,
  0x2000 | ((u16)lpphy-rssi_gs  10) |
  ((u16)lpphy-rssi_vc  4) | lpphy-rssi_vf);
+
+   if ((bus-chip_id == 0x4325)  (bus-chip_rev == 0)) {
+   b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800);
+   b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400

[PATCH RFC] ssb: Implement the remaining rev.8 SPROM vars needed for LP-PHY

2009-08-10 Thread Gábor Stefanik
Also add a SPEX32 macro for extracting 32-bit SPROM variables.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
I'm not quite sure that the SPEX32 macro is sane endianness-wise;
please review it carefully. (In the future, we will probably need
a SPEX64 macro too, to correctly extract boardflags.)

 drivers/ssb/pci.c|   53 +-
 include/linux/ssb/ssb.h  |   44 +++
 include/linux/ssb/ssb_regs.h |   66 +
 3 files changed, 148 insertions(+), 15 deletions(-)

diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 40ea417..50811e4 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -169,8 +169,14 @@ err_pci:
 /* Get the word-offset for a SSB_SPROM_XXX define. */
 #define SPOFF(offset)  (((offset) - SSB_SPROM_BASE) / sizeof(u16))
 /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. 
*/
-#define SPEX(_outvar, _offset, _mask, _shift)  \
+#define SPEX16(_outvar, _offset, _mask, _shift)\
out-_outvar = ((in[SPOFF(_offset)]  (_mask))  (_shift))
+#define SPEX32(_outvar, _offset, _mask, _shift)\
+   out-_outvar = in[SPOFF((_offset)+2)]  sizeof(u16)) | \
+  in[SPOFF(_offset)])  (_mask))  (_shift))
+#define SPEX(_outvar, _offset, _mask, _shift) \
+   SPEX16(_outvar, _offset, _mask, _shift)
+
 
 static inline u8 ssb_crc8(u8 crc, u8 data)
 {
@@ -480,6 +486,8 @@ static void sprom_extract_r8(struct ssb_sprom *out, const 
u16 *in)
SPEX(country_code, SSB_SPROM8_CCODE, 0x, 0);
SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0x, 0);
SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0x, 0);
+   SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0x, 0);
+   SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, 0x, 0);
SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A,
 SSB_SPROM8_ANTAVAIL_A_SHIFT);
SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG,
@@ -490,12 +498,55 @@ static void sprom_extract_r8(struct ssb_sprom *out, const 
u16 *in)
SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0);
SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A,
 SSB_SPROM8_ITSSI_A_SHIFT);
+   SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0);
+   SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK,
+SSB_SPROM8_MAXP_AL_SHIFT);
SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0);
SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1,
 SSB_SPROM8_GPIOA_P1_SHIFT);
SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0);
SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3,
 SSB_SPROM8_GPIOB_P3_SHIFT);
+   SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0);
+   SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G,
+SSB_SPROM8_TRI5G_SHIFT);
+   SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0);
+   SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH,
+SSB_SPROM8_TRI5GH_SHIFT);
+   SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, 0);
+   SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G,
+SSB_SPROM8_RXPO5G_SHIFT);
+   SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0);
+   SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G,
+SSB_SPROM8_RSSISMC2G_SHIFT);
+   SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G,
+SSB_SPROM8_RSSISAV2G_SHIFT);
+   SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G,
+SSB_SPROM8_BXA2G_SHIFT);
+   SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0);
+   SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G,
+SSB_SPROM8_RSSISMC5G_SHIFT);
+   SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G,
+SSB_SPROM8_RSSISAV5G_SHIFT);
+   SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G,
+SSB_SPROM8_BXA5G_SHIFT);
+   SPEX(pa0b0, SSB_SPROM8_PA0B0, 0x, 0);
+   SPEX(pa0b1, SSB_SPROM8_PA0B1, 0x, 0);
+   SPEX(pa0b2, SSB_SPROM8_PA0B2, 0x, 0);
+   SPEX(pa1b0, SSB_SPROM8_PA1B0, 0x, 0);
+   SPEX(pa1b1, SSB_SPROM8_PA1B1, 0x, 0);
+   SPEX(pa1b2, SSB_SPROM8_PA1B2, 0x, 0);
+   SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, 0x, 0);
+   SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, 0x, 0);
+   SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, 0x, 0);
+   SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, 0x, 0);
+   SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, 0x, 0);
+   SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, 0x, 0);
+   SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, 0x, 0);
+   SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, 0x, 0);
+   SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, 0x, 0);
+   SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, 0x, 0);
+   SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0x, 0

Re: [PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-10 Thread Gábor Stefanik
2009/8/10 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 Implement LP-PHY baseband table init for all revisions.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 Changes from RFC:
 -Improved table formatting in the code.
 -The 2GHz check in adjust_gain_table now uses b43_current_band.
 -Added a comment to rev2plus_table_init about a possible future
 improvement.

 I like the new table formatting.

 The comment in rev2plus_table_init has a typo - ben should be
 been. Otherwise it looks good. Thanks for all your work.

 Larry


John, can you fix that when checking in, or should I resubmit with the
typo fixed?

-- 
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


Re: [PATCH RFC] ssb: Implement the remaining rev.8 SPROM vars needed for LP-PHY

2009-08-10 Thread Gábor Stefanik
2009/8/10 Michael Buesch m...@bu3sch.de:
 On Monday 10 August 2009 20:49:02 Gábor Stefanik wrote:
 Also add a SPEX32 macro for extracting 32-bit SPROM variables.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 ---
 I'm not quite sure that the SPEX32 macro is sane endianness-wise;
 please review it carefully. (In the future, we will probably need
 a SPEX64 macro too, to correctly extract boardflags.)

  drivers/ssb/pci.c            |   53 +-
  include/linux/ssb/ssb.h      |   44 +++
  include/linux/ssb/ssb_regs.h |   66 
 +
  3 files changed, 148 insertions(+), 15 deletions(-)

 diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
 index 40ea417..50811e4 100644
 --- a/drivers/ssb/pci.c
 +++ b/drivers/ssb/pci.c
 @@ -169,8 +169,14 @@ err_pci:
  /* Get the word-offset for a SSB_SPROM_XXX define. */
  #define SPOFF(offset)        (((offset) - SSB_SPROM_BASE) / sizeof(u16))
  /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX 
 defines. */
 -#define SPEX(_outvar, _offset, _mask, _shift)        \
 +#define SPEX16(_outvar, _offset, _mask, _shift)      \
       out-_outvar = ((in[SPOFF(_offset)]  (_mask))  (_shift))
 +#define SPEX32(_outvar, _offset, _mask, _shift)      \
 +     out-_outvar = in[SPOFF((_offset)+2)]  sizeof(u16)) | \
                                                  ^^
 This shifts by 2 bit. Did you want 16 bits? Just write   16  then.
Good catch, thanks!

 Also, it seems you need +1 instead of +2 (it is an u16 pointer).
I'm adding to _offset, not to SPOFF(_offset). AFAICS _offset is not an
u16 pointer, it's a plain #defined number, unlike SPOFF(_offset).

 I also usually cast u16 values to u32 before shifting =16 bits.
 The result of shifting a 16bit variable left by 16bits is machine dependent.
 It works as expected for every linux architecture, but I prefer the cast 
 anyway.
Will do, thanks.


 Your macro extracts the value in littleendian format. I didn't check if this 
 is
 correct for your values. But there also are values stored in BE format.
Larry, do you have any comments on this?



 --
 Greetings, Michael.




-- 
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] ssb: Implement the remaining rev.8 SPROM vars needed for LP-PHY

2009-08-10 Thread Gábor Stefanik
Also add a SPEX32 macro for extracting 32-bit SPROM variables.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
Changes from RFC:
-Fixed a bug in the SPEX32 macro.
-in[SPOFF...] is now cast to u32 to be extra-safe.

The macro still extracts little-endian, as that is probably
what the driver expects (at least for the regular SPEX macro) -
however, Larry said that SPEX is broken (it should extract big
endian), and the driver may be relying on incorrect behavior.
This should be looked into eventually.

 drivers/ssb/pci.c|   53 +-
 include/linux/ssb/ssb.h  |   44 +++
 include/linux/ssb/ssb_regs.h |   66 +
 3 files changed, 148 insertions(+), 15 deletions(-)

diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 40ea417..50811e4 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -169,8 +169,14 @@ err_pci:
 /* Get the word-offset for a SSB_SPROM_XXX define. */
 #define SPOFF(offset)  (((offset) - SSB_SPROM_BASE) / sizeof(u16))
 /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. 
*/
-#define SPEX(_outvar, _offset, _mask, _shift)  \
+#define SPEX16(_outvar, _offset, _mask, _shift)\
out-_outvar = ((in[SPOFF(_offset)]  (_mask))  (_shift))
+#define SPEX32(_outvar, _offset, _mask, _shift)\
+   out-_outvar = (u32)in[SPOFF((_offset)+2)]  16 | \
+  in[SPOFF(_offset)])  (_mask))  (_shift))
+#define SPEX(_outvar, _offset, _mask, _shift) \
+   SPEX16(_outvar, _offset, _mask, _shift)
+
 
 static inline u8 ssb_crc8(u8 crc, u8 data)
 {
@@ -480,6 +486,8 @@ static void sprom_extract_r8(struct ssb_sprom *out, const 
u16 *in)
SPEX(country_code, SSB_SPROM8_CCODE, 0x, 0);
SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0x, 0);
SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0x, 0);
+   SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0x, 0);
+   SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, 0x, 0);
SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A,
 SSB_SPROM8_ANTAVAIL_A_SHIFT);
SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG,
@@ -490,12 +498,55 @@ static void sprom_extract_r8(struct ssb_sprom *out, const 
u16 *in)
SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0);
SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A,
 SSB_SPROM8_ITSSI_A_SHIFT);
+   SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0);
+   SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK,
+SSB_SPROM8_MAXP_AL_SHIFT);
SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0);
SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1,
 SSB_SPROM8_GPIOA_P1_SHIFT);
SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0);
SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3,
 SSB_SPROM8_GPIOB_P3_SHIFT);
+   SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0);
+   SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G,
+SSB_SPROM8_TRI5G_SHIFT);
+   SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0);
+   SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH,
+SSB_SPROM8_TRI5GH_SHIFT);
+   SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, 0);
+   SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G,
+SSB_SPROM8_RXPO5G_SHIFT);
+   SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0);
+   SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G,
+SSB_SPROM8_RSSISMC2G_SHIFT);
+   SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G,
+SSB_SPROM8_RSSISAV2G_SHIFT);
+   SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G,
+SSB_SPROM8_BXA2G_SHIFT);
+   SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0);
+   SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G,
+SSB_SPROM8_RSSISMC5G_SHIFT);
+   SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G,
+SSB_SPROM8_RSSISAV5G_SHIFT);
+   SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G,
+SSB_SPROM8_BXA5G_SHIFT);
+   SPEX(pa0b0, SSB_SPROM8_PA0B0, 0x, 0);
+   SPEX(pa0b1, SSB_SPROM8_PA0B1, 0x, 0);
+   SPEX(pa0b2, SSB_SPROM8_PA0B2, 0x, 0);
+   SPEX(pa1b0, SSB_SPROM8_PA1B0, 0x, 0);
+   SPEX(pa1b1, SSB_SPROM8_PA1B1, 0x, 0);
+   SPEX(pa1b2, SSB_SPROM8_PA1B2, 0x, 0);
+   SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, 0x, 0);
+   SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, 0x, 0);
+   SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, 0x, 0);
+   SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, 0x, 0);
+   SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, 0x, 0);
+   SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, 0x, 0);
+   SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, 0x, 0);
+   SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO

Re: [PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-10 Thread Gábor Stefanik
2009/8/10 John W. Linville linvi...@tuxdriver.com:
 On Mon, Aug 10, 2009 at 08:58:44PM +0200, Gábor Stefanik wrote:
 2009/8/10 Larry Finger larry.fin...@lwfinger.net:
  Gábor Stefanik wrote:
  Implement LP-PHY baseband table init for all revisions.
 
  Signed-off-by: Gábor Stefanik netrolller...@gmail.com
  ---
  Changes from RFC:
  -Improved table formatting in the code.
  -The 2GHz check in adjust_gain_table now uses b43_current_band.
  -Added a comment to rev2plus_table_init about a possible future
  improvement.
 
  I like the new table formatting.
 
  The comment in rev2plus_table_init has a typo - ben should be
  been. Otherwise it looks good. Thanks for all your work.
 
  Larry
 

 John, can you fix that when checking in, or should I resubmit with the
 typo fixed?

 Sure, fine...

 --
 John W. Linville                Someday the world will need a hero, and you
 linvi...@tuxdriver.com                  might be all we have.  Be ready.

Thanks!


-- 
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 RFC] b43: LP-PHY: Implement reading band SPROM

2009-08-10 Thread Gábor Stefanik
Some of the new variables in b43_phy_lp appear to be dead code in
the vendor driver; they will be removed if they remain unused when
LP-PHY implementation is finished.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
I've added a few FIXME comments, please review them.
Also please check that I used the correct types (e.g. u16) for the new 
variables.

Variable name mappings vs. the specification:
cckpo = tmp3
ofdmpo = tmp2
maxpwr = tmp1

The array txpwr_srom_max[3] has been broken up into 3 variables,
each called max_tx_pwr_{low|med|hi}_band. A struct holding 3 named u16s
may also be a good choice, but I am not fond of using an array for this.
 
 drivers/net/wireless/b43/phy_lp.c |   83 -
 drivers/net/wireless/b43/phy_lp.h |   16 +++
 2 files changed, 98 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 43272a8..46fe476 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -59,6 +59,87 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
dev-phy.lp = NULL;
 }
 
+static void lpphy_read_band_sprom(struct b43_wldev *dev)
+{
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+   struct ssb_bus *bus = dev-dev-bus;
+   u16 cckpo, maxpwr;
+   u32 ofdmpo;
+   int i;
+
+   if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ) {
+   lpphy-tx_isolation_med_band = bus-sprom.tri2g;
+   lpphy-bx_arch = bus-sprom.bxa2g;
+   lpphy-rssi_vf = bus-sprom.rssismf2g;
+   lpphy-rssi_vc = bus-sprom.rssismc2g;
+   lpphy-rssi_gs = bus-sprom.rssisav2g;
+   lpphy-txpa[0] = bus-sprom.pa0b0;
+   lpphy-txpa[1] = bus-sprom.pa0b1;
+   lpphy-txpa[2] = bus-sprom.pa0b2;
+   maxpwr = bus-sprom.maxpwr_bg;
+   lpphy-max_tx_pwr_med_band = maxpwr;
+   cckpo = bus-sprom.cck2gpo;
+   ofdmpo = bus-sprom.ofdm2gpo;
+   if (cckpo) {
+   for (i = 0; i  4; i++) {
+   lpphy-tx_max_rate[i] =
+   maxpwr - (ofdmpo  0xF) * 2;
+   ofdmpo  4;
+   }
+   ofdmpo = bus-sprom.ofdm2gpo;
+   for (i = 4; i  15; i++) {
+   lpphy-tx_max_rate[i] =
+   maxpwr - (ofdmpo  0xF) * 2;
+   ofdmpo  4;
+   }
+   } else {
+   ofdmpo = 0xFF;
+   for (i = 0; i  4; i++)
+   lpphy-tx_max_rate[i] = maxpwr;
+   for (i = 4; i  15; i++)
+   lpphy-tx_max_rate[i] = maxpwr - ofdmpo;
+   }
+   } else { /* 5GHz */
+   lpphy-tx_isolation_low_band = bus-sprom.tri5gl;
+   lpphy-tx_isolation_med_band = bus-sprom.tri5g;
+   lpphy-tx_isolation_hi_band = bus-sprom.tri5gh;
+   lpphy-bx_arch = bus-sprom.bxa5g;
+   lpphy-rssi_vf = bus-sprom.rssismf5g;
+   lpphy-rssi_vc = bus-sprom.rssismc5g;
+   lpphy-rssi_gs = bus-sprom.rssisav5g;
+   lpphy-txpa[0] = bus-sprom.pa1b0;
+   lpphy-txpa[1] = bus-sprom.pa1b1;
+   lpphy-txpa[2] = bus-sprom.pa1b2;
+   lpphy-txpal[0] = bus-sprom.pa1lob0;
+   lpphy-txpal[1] = bus-sprom.pa1lob1;
+   lpphy-txpal[2] = bus-sprom.pa1lob2;
+   lpphy-txpah[0] = bus-sprom.pa1hib0;
+   lpphy-txpah[1] = bus-sprom.pa1hib1;
+   lpphy-txpah[2] = bus-sprom.pa1hib2;
+   maxpwr = bus-sprom.maxpwr_al;
+   ofdmpo = bus-sprom.ofdm5glpo;
+   lpphy-max_tx_pwr_low_band = maxpwr;
+   for (i = 4; i  12; i++) {
+   lpphy-tx_max_ratel[i] = maxpwr - (ofdmpo  0xF) * 2;
+   ofdmpo  4;
+   }
+   maxpwr = bus-sprom.maxpwr_a;
+   ofdmpo = bus-sprom.ofdm5gpo;
+   lpphy-max_tx_pwr_med_band = maxpwr;
+   for (i = 4; i  12; i++) {
+   lpphy-tx_max_rate[i] = maxpwr - (ofdmpo  0xF) * 2;
+   ofdmpo  4;
+   }
+   maxpwr = bus-sprom.maxpwr_ah;
+   ofdmpo = bus-sprom.ofdm5ghpo;
+   lpphy-max_tx_pwr_hi_band = maxpwr;
+   for (i = 4; i  12; i++) {
+   lpphy-tx_max_rateh[i] = maxpwr - (ofdmpo  0xF) * 2;
+   ofdmpo  4;
+   }
+   }
+}
+
 static void lpphy_adjust_gain_table(struct b43_wldev *dev)
 {
struct b43_phy_lp *lpphy = dev-phy.lp;
@@ -694,7 +775,7 @@ static void lpphy_tx_pctl_init(struct b43_wldev *dev)
 
 static int b43_lpphy_op_init(struct b43_wldev *dev

[PATCH] b43: Fix a typo in the sync_stx routine

2009-08-10 Thread Gábor Stefanik
I completely missed the one's complement instruction from the specs.

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

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 46fe476..34ad738 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -578,7 +578,7 @@ static void lpphy_sync_stx(struct b43_wldev *dev)
tmp = e-rf_shift;
tmp = e-phy_shift;
b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e-phy_offset),
-   e-mask  e-phy_shift, tmp);
+   ~(e-mask  e-phy_shift), tmp);
}
 }
 
-- 
1.6.2.4


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


[PATCH] b43: LP-PHY: Implement STX synchronization

2009-08-09 Thread Gábor Stefanik
The v2+ radio init (B2063) is now complete, modulo BCM4325 support.

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

diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 5d50943..27eadee 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -346,9 +346,60 @@ static void lpphy_2063_init(struct b43_wldev *dev)
b43_radio_write(dev, B2063_PA_SP2, 0x18);
 }
 
+struct lpphy_stx_table_entry {
+   u16 phy_offset;
+   u16 phy_shift;
+   u16 rf_addr;
+   u16 rf_shift;
+   u16 mask;
+};
+
+static const struct lpphy_stx_table_entry lpphy_stx_table[] = {
+   { .phy_offset = 2, .phy_shift = 6, .rf_addr = 0x3d, .rf_shift = 3, 
.mask = 0x01, },
+   { .phy_offset = 1, .phy_shift = 12, .rf_addr = 0x4c, .rf_shift = 1, 
.mask = 0x01, },
+   { .phy_offset = 1, .phy_shift = 8, .rf_addr = 0x50, .rf_shift = 0, 
.mask = 0x7f, },
+   { .phy_offset = 0, .phy_shift = 8, .rf_addr = 0x44, .rf_shift = 0, 
.mask = 0xff, },
+   { .phy_offset = 1, .phy_shift = 0, .rf_addr = 0x4a, .rf_shift = 0, 
.mask = 0xff, },
+   { .phy_offset = 0, .phy_shift = 4, .rf_addr = 0x4d, .rf_shift = 0, 
.mask = 0xff, },
+   { .phy_offset = 1, .phy_shift = 4, .rf_addr = 0x4e, .rf_shift = 0, 
.mask = 0xff, },
+   { .phy_offset = 0, .phy_shift = 12, .rf_addr = 0x4f, .rf_shift = 0, 
.mask = 0x0f, },
+   { .phy_offset = 1, .phy_shift = 0, .rf_addr = 0x4f, .rf_shift = 4, 
.mask = 0x0f, },
+   { .phy_offset = 3, .phy_shift = 0, .rf_addr = 0x49, .rf_shift = 0, 
.mask = 0x0f, },
+   { .phy_offset = 4, .phy_shift = 3, .rf_addr = 0x46, .rf_shift = 4, 
.mask = 0x07, },
+   { .phy_offset = 3, .phy_shift = 15, .rf_addr = 0x46, .rf_shift = 0, 
.mask = 0x01, },
+   { .phy_offset = 4, .phy_shift = 0, .rf_addr = 0x46, .rf_shift = 1, 
.mask = 0x07, },
+   { .phy_offset = 3, .phy_shift = 8, .rf_addr = 0x48, .rf_shift = 4, 
.mask = 0x07, },
+   { .phy_offset = 3, .phy_shift = 11, .rf_addr = 0x48, .rf_shift = 0, 
.mask = 0x0f, },
+   { .phy_offset = 3, .phy_shift = 4, .rf_addr = 0x49, .rf_shift = 4, 
.mask = 0x0f, },
+   { .phy_offset = 2, .phy_shift = 15, .rf_addr = 0x45, .rf_shift = 0, 
.mask = 0x01, },
+   { .phy_offset = 5, .phy_shift = 13, .rf_addr = 0x52, .rf_shift = 4, 
.mask = 0x07, },
+   { .phy_offset = 6, .phy_shift = 0, .rf_addr = 0x52, .rf_shift = 7, 
.mask = 0x01, },
+   { .phy_offset = 5, .phy_shift = 3, .rf_addr = 0x41, .rf_shift = 5, 
.mask = 0x07, },
+   { .phy_offset = 5, .phy_shift = 6, .rf_addr = 0x41, .rf_shift = 0, 
.mask = 0x0f, },
+   { .phy_offset = 5, .phy_shift = 10, .rf_addr = 0x42, .rf_shift = 5, 
.mask = 0x07, },
+   { .phy_offset = 4, .phy_shift = 15, .rf_addr = 0x42, .rf_shift = 0, 
.mask = 0x01, },
+   { .phy_offset = 5, .phy_shift = 0, .rf_addr = 0x42, .rf_shift = 1, 
.mask = 0x07, },
+   { .phy_offset = 4, .phy_shift = 11, .rf_addr = 0x43, .rf_shift = 4, 
.mask = 0x0f, },
+   { .phy_offset = 4, .phy_shift = 7, .rf_addr = 0x43, .rf_shift = 0, 
.mask = 0x0f, },
+   { .phy_offset = 4, .phy_shift = 6, .rf_addr = 0x45, .rf_shift = 1, 
.mask = 0x01, },
+   { .phy_offset = 2, .phy_shift = 7, .rf_addr = 0x40, .rf_shift = 4, 
.mask = 0x0f, },
+   { .phy_offset = 2, .phy_shift = 11, .rf_addr = 0x40, .rf_shift = 0, 
.mask = 0x0f, },
+};
+
 static void lpphy_sync_stx(struct b43_wldev *dev)
 {
-   //TODO
+   const struct lpphy_stx_table_entry *e;
+   unsigned int i;
+   u16 tmp;
+
+   for (i = 0; i  ARRAY_SIZE(lpphy_stx_table); i++) {
+   e = lpphy_stx_table[i];
+   tmp = b43_radio_read(dev, e-rf_addr);
+   tmp = e-rf_shift;
+   tmp = e-phy_shift;
+   b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e-phy_offset),
+   e-mask  e-phy_shift, tmp);
+   }
 }
 
 static void lpphy_radio_init(struct b43_wldev *dev)
@@ -366,7 +417,9 @@ static void lpphy_radio_init(struct b43_wldev *dev)
lpphy_sync_stx(dev);
b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80);
b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0);
-   //TODO Do something on the backplane
+   if (dev-dev-bus-chip_id == 0x4325) {
+   // TODO SSB PMU recalibration
+   }
}
 }
 
-- 
1.6.2.4


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


Re: BCM 4310 USB (14e4:4315). Any progress?

2009-08-05 Thread Gábor Stefanik
On Thu, Aug 6, 2009 at 12:05 AM, Roman Medina-Heigl
Hernandezro...@rs-labs.com wrote:
 Hello,

 Sorry for pinging this list but I did some searches and I couldn't find
 responses...

 I've got a new Dell Mini-10 (Inspiron 1010), with the following wifi
 chipset: BCM 4310 USB. It's got PCI-ID: 14e4:4315. Despite being marked
 as USB, I suppose it's a  mini-pci (as stated in this list's archives and
 some other places).

 But looking at:
 http://linuxwireless.org/en/users/Drivers/b43#Known_PCI_devices
 I can see:

 14e4:4315      not supported   BCM4312 802.11b/g - low power

 So my 1st question is: are BCM4312 and BCM4310 the same? Why do they have
 the same pci-id?

The correct name of the card is BCM4312; some older pci.ids files
incorrectly list it as BCM4310 USB. Update your pci.ids to fix this.


 My second question: at the same page I can read:

 BCM 4310 USB - This device has an LP PHY. We think that means low power.
 In any case, previous code does not work. The reverse engineers have
 generated specs for the code writers and development is in progress. Note:
 This card uses the PCI bus, despite its name.

 Please, could you update this info? I don't know whether the comment is up
 to date or whether (perhaps) some progress happened since then... any
 experimental driver out there?

 Thank you.

There is no experimental driver yet. I'm currently working on an
implementation, but right now, not even the hardware init code is
complete.


 --

 Saludos,
 -Roman

 PGP Fingerprint:
 09BB EFCD 21ED 4E79 25FB  29E1 E47F 8A7D EAD5 6742
 [Key ID: 0xEAD56742. Available at KeyServ]
 ___
 Bcm43xx-dev mailing list
 Bcm43xx-dev@lists.berlios.de
 https://lists.berlios.de/mailman/listinfo/bcm43xx-dev




-- 
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: Typo fixes minor cleanup

2009-08-04 Thread Gábor Stefanik
Fix a typo in the HostFlags #defines.
Make use of HostFlags defines in the LP-PHY code.
Fix fallout from the IEEE80211_IF_TYPE to NL80211_IFTYPE change.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---

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

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 41ca727..5d79d10 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -300,7 +300,7 @@ enum {
 #define B43_HF_TXBTCHECK   0x0200ULL /* Bluetooth check during 
transmission */
 #define B43_HF_SKCFPUP 0x0400ULL /* Skip CFP update */
 #define B43_HF_N40W0x0800ULL /* N PHY 40 MHz workaround 
(rev = 13 only) */
-#define B43_HF_ANTSEL  0x2000ULL /* Antenna selection (for 
testing antenna div.) */
+#define B43_HF_ANTSEL  0x1000ULL /* Antenna selection (for 
testing antenna div.) */
 #define B43_HF_BT3COEXT0x2000ULL /* Bluetooth 3-wire 
coexistence (rev = 13 only) */
 #define B43_HF_BTCANT  0x4000ULL /* Bluetooth coexistence 
(antenna mode) (rev = 13 only) */
 #define B43_HF_ANTSELEN0x0001ULL /* Antenna selection 
enabled (rev = 13 only) */
@@ -627,7 +627,7 @@ struct b43_wl {
u8 mac_addr[ETH_ALEN];
/* Current BSSID */
u8 bssid[ETH_ALEN];
-   /* Interface type. (IEEE80211_IF_TYPE_XXX) */
+   /* Interface type. (NL80211_IFTYPE_XXX) */
int if_type;
/* Is the card operating in AP, STA or IBSS mode? */
bool operating;
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 5d50943..03a9b50 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -130,7 +130,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev 
*dev)
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0x);
-   b43_hf_write(dev, b43_hf_read(dev) | 0x0800ULL  32);
+   b43_hf_write(dev, b43_hf_read(dev) | B43_HF_PR45960W);
}
if (b43_current_band(dev-wl) == IEEE80211_BAND_2GHZ) {
b43_phy_set(dev, B43_LPPHY_LP_PHY_CTL, 0x8000);
-- 
1.6.2.4



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


[PATCH V3] b43: implement baseband init for LP-PHY = rev1

2009-08-04 Thread Gábor Stefanik
Implement baseband init for rev.0 and rev.1 LP PHYs. Convert boardflags_hi 
values to defines.
Implement b43_phy_copy for easier copying between registers, as needed by 
LP-PHY init.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
Cc: Michael Buesch m...@bu3sch.de
Cc: Larry Finger larry.fin...@lwfinger.net
---
V3:
-Added FIXME to the b43_hf_write call.
-The b43_hf_write call now uses a #defined value, rather than a magic number.

V2:
-Reversed argument order for b43_phy_copy.
-Named all registers, no more magic numbers.
-Whitespace errors hopefully fixed (I hope my mailer doesn't re-introduce 
them...)

 drivers/net/wireless/b43/b43.h|   11 
 drivers/net/wireless/b43/phy_common.c |7 +++
 drivers/net/wireless/b43/phy_common.h |5 ++
 drivers/net/wireless/b43/phy_lp.c |   95 -
 drivers/net/wireless/b43/phy_lp.h |   11 +++-
 drivers/net/wireless/b43/phy_n.c  |3 +-
 6 files changed, 128 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 4e8ad84..41ca727 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -142,6 +142,17 @@
 #define B43_BFL_BTCMOD 0x4000  /* BFL_BTCOEXIST is given in 
alternate GPIOs */
 #define B43_BFL_ALTIQ  0x8000  /* alternate I/Q settings */
 
+/* SPROM boardflags_hi values */
+#define B43_BFH_NOPA   0x0001  /* has no PA */
+#define B43_BFH_RSSIINV0x0002  /* RSSI uses positive 
slope (not TSSI) */
+#define B43_BFH_PAREF  0x0004  /* uses the PARef LDO */
+#define B43_BFH_3TSWITCH   0x0008  /* uses a triple throw switch 
shared
+* with bluetooth */
+#define B43_BFH_PHASESHIFT 0x0010  /* can support phase shifter */
+#define B43_BFH_BUCKBOOST  0x0020  /* has buck/booster */
+#define B43_BFH_FEM_BT 0x0040  /* has FEM and switch to share 
antenna
+* with bluetooth */
+
 /* GPIO register offset, in both ChipCommon and PCI core. */
 #define B43_GPIO_CONTROL   0x6c
 
diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index e176b6e..1661b03 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -240,6 +240,13 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 
value)
dev-phy.ops-phy_write(dev, reg, value);
 }
 
+void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
+{
+   assert_mac_suspended(dev);
+   dev-phy.ops-phy_write(dev, destreg,
+   dev-phy.ops-phy_read(dev, srcreg));
+}
+
 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
 {
b43_phy_write(dev, offset,
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index b2d9910..c7a7d6b 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -291,6 +291,11 @@ u16 b43_phy_read(struct b43_wldev *dev, u16 reg);
 void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value);
 
 /**
+ * b43_phy_copy - copy contents of 16bit PHY register to another
+ */
+void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg);
+
+/**
  * b43_phy_mask - Mask a PHY register with a mask
  */
 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask);
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 58e319d..e47eca6 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -66,7 +66,100 @@ static void lpphy_table_init(struct b43_wldev *dev)
 
 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
 {
-   B43_WARN_ON(1);//TODO rev  2 not supported, yet.
+   struct ssb_bus *bus = dev-dev-bus;
+   u16 tmp, tmp2;
+
+   if (dev-phy.rev == 1 
+  (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00);
+   b43_phy_maskset

[PATCH] b43: Fix fallout from the IEEE80211_IF_TYPE to NL80211_IFTYPE change.

2009-08-04 Thread Gábor Stefanik
Update a comment that still says IEEE80211_IF_TYPE instead of NL80211_IFTYPE.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
---
This patch replaces b43: Typo fixes and minor cleanup,
the other half of which has been integrated into the LP rev01 init patch.

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

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 41ca727..52fd6d6 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -627,7 +627,7 @@ struct b43_wl {
u8 mac_addr[ETH_ALEN];
/* Current BSSID */
u8 bssid[ETH_ALEN];
-   /* Interface type. (IEEE80211_IF_TYPE_XXX) */
+   /* Interface type. (NL80211_IFTYPE_XXX) */
int if_type;
/* Is the card operating in AP, STA or IBSS mode? */
bool operating;
-- 
1.6.2.4



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


Re: [PATCH V3] b43: implement baseband init for LP-PHY = rev1

2009-08-04 Thread Gábor Stefanik
2009/8/5 Larry Finger larry.fin...@lwfinger.net:
 Gábor Stefanik wrote:
 Implement baseband init for rev.0 and rev.1 LP PHYs. Convert
 boardflags_hi values to defines.
 Implement b43_phy_copy for easier copying between registers, as needed
 by LP-PHY init.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 Cc: Michael Buesch m...@bu3sch.de
 Cc: Larry Finger larry.fin...@lwfinger.net
 ---
 V3:
 -Added FIXME to the b43_hf_write call.
 -The b43_hf_write call now uses a #defined value, rather than a magic
 number.

 It looks to me that V2 was put into wireless-testing. You will need to
 prepare a separate patch to make the V2 = V3 changes.

 Larry

OK, I will be sending one today.

Note to John: Please apply the Fix fallout patch, but not the
Cleanups one. The second part of Cleanups will be resubmitted,
combined with other V2-V3 changes.

Larry, my next target is
http://bcm-v4.sipsolutions.net/802.11/PHY/LP/SYNCHSTX - however, what
is the definition of struct lpphy_extstxdata_t? Where does the stx
array get its values (or what are its initial values, if it needs to
be initialized here)?
Also, with Sync-STX, =rev2 radio init is essentially complete, except
for with interrupts disabled, do something with backplane (TODO) -
when can we expect documentation on this step?

-- 
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 RESEND] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
Implement baseband init for rev.0 and rev.1 LP PHYs. Convert
boardflags_hi values to defines.
Implement b43_phy_copy for easier copying between registers, as needed
by LP-PHY init.

Signed-off-by: Gábor Stefaniknetrolller...@gmail.com
Cc: Michael Bueschm...@bu3sch.de
Cc: Larry Fingerlarry.fin...@lwfinger.net
---

Hopefully this mail will survive the trip through the arcane world of Gmail's 
servers...

If this very-very-very-long line (including a   few tab 
characters) doesn't get mangled, chances are that the mail didn't get mangled. 
More text to make this line even longer.

  b43.h|   11 ++
  phy_common.c |7 
  phy_lp.c |   95 
++-
  phy_lp.h |8 +++-
  phy_n.c  |3 +
  5 files changed, 120 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 4e8ad84..41ca727 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -142,6 +142,17 @@
  #define B43_BFL_BTCMOD0x4000  /* BFL_BTCOEXIST is 
given in alternate GPIOs */
  #define B43_BFL_ALTIQ 0x8000  /* alternate I/Q settings */

+/* SPROM boardflags_hi values */
+#define B43_BFH_NOPA   0x0001  /* has no PA */
+#define B43_BFH_RSSIINV0x0002  /* RSSI uses positive 
slope (not TSSI) */
+#define B43_BFH_PAREF  0x0004  /* uses the PARef LDO */
+#define B43_BFH_3TSWITCH   0x0008  /* uses a triple throw switch 
shared
+* with bluetooth */
+#define B43_BFH_PHASESHIFT 0x0010  /* can support phase shifter */
+#define B43_BFH_BUCKBOOST  0x0020  /* has buck/booster */
+#define B43_BFH_FEM_BT 0x0040  /* has FEM and switch to share 
antenna
+* with bluetooth */
+
  /* GPIO register offset, in both ChipCommon and PCI core. */
  #define B43_GPIO_CONTROL  0x6c

diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index e176b6e..999e0bd 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -240,6 +240,13 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 
value)
dev-phy.ops-phy_write(dev, reg, value);
  }

+void b43_phy_copy(struct b43_wldev *dev, u16 srcreg, u16 destreg)
+{
+   assert_mac_suspended(dev);
+   dev-phy.ops-phy_write(dev, destreg,
+   dev-phy.ops-phy_read(dev, srcreg));
+}
+
  void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
  {
b43_phy_write(dev, offset,
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 58e319d..dbaa2e4 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -66,7 +66,100 @@ static void lpphy_table_init(struct b43_wldev *dev)

  static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
  {
-   B43_WARN_ON(1);//TODO rev  2 not supported, yet.
+   struct ssb_bus *bus = dev-dev-bus;
+   struct b43_phy_lp *lpphy = dev-phy.lp;
+   u16 tmp, tmp2;
+
+   if (dev-phy.rev == 1
+  (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00);
+   } else if (b43_current_band(dev-wl) == IEEE80211_BAND_5GHZ ||
+ (bus-boardinfo.type == 0x048A) || ((dev-phy.rev == 0)
+ (bus-sprom.boardflags_lo  B43_BFL_FEM))) {
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001);
+ 

[PATCH] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
Implement baseband init for rev.0 and rev.1 LP PHYs. Convert 
boardflags_hi values to defines.
Implement b43_phy_copy for easier copying between registers, as needed 
by LP-PHY init.

Signed-off-by: Gábor Stefanik netrolller...@gmail.com
Cc: Michael Buesch m...@bu3sch.de
Cc: Larry Finger larry.fin...@lwfinger.net
---
  b43.h|   11 ++
  phy_common.c |7 
  phy_lp.c |   95 
++-
  phy_lp.h |8 +++-
  phy_n.c  |3 +
  5 files changed, 120 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 4e8ad84..41ca727 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -142,6 +142,17 @@
  #define B43_BFL_BTCMOD0x4000/* BFL_BTCOEXIST is given 
in alternate GPIOs */
  #define B43_BFL_ALTIQ0x8000/* alternate I/Q settings */

+/* SPROM boardflags_hi values */
+#define B43_BFH_NOPA0x0001/* has no PA */
+#define B43_BFH_RSSIINV0x0002/* RSSI uses positive 
slope (not TSSI) */
+#define B43_BFH_PAREF0x0004/* uses the PARef LDO */
+#define B43_BFH_3TSWITCH0x0008/* uses a triple throw switch 
shared
+ * with bluetooth */
+#define B43_BFH_PHASESHIFT0x0010/* can support phase shifter */
+#define B43_BFH_BUCKBOOST0x0020/* has buck/booster */
+#define B43_BFH_FEM_BT0x0040/* has FEM and switch to 
share antenna
+ * with bluetooth */
+
  /* GPIO register offset, in both ChipCommon and PCI core. */
  #define B43_GPIO_CONTROL0x6c

diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index e176b6e..999e0bd 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -240,6 +240,13 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, 
u16 value)
  dev-phy.ops-phy_write(dev, reg, value);
  }

+void b43_phy_copy(struct b43_wldev *dev, u16 srcreg, u16 destreg)
+{
+assert_mac_suspended(dev);
+dev-phy.ops-phy_write(dev, destreg,
+dev-phy.ops-phy_read(dev, srcreg));
+}
+
  void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
  {
  b43_phy_write(dev, offset,
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 58e319d..dbaa2e4 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -66,7 +66,100 @@ static void lpphy_table_init(struct b43_wldev *dev)

  static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
  {
-B43_WARN_ON(1);//TODO rev  2 not supported, yet.
+struct ssb_bus *bus = dev-dev-bus;
+struct b43_phy_lp *lpphy = dev-phy.lp;
+u16 tmp, tmp2;
+
+if (dev-phy.rev == 1 
+   (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00);
+} else if (b43_current_band(dev-wl) == IEEE80211_BAND_5GHZ ||
+  (bus-boardinfo.type == 0x048A) || ((dev-phy.rev == 0) 
+  (bus-sprom.boardflags_lo  B43_BFL_FEM))) {
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0500);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x0002);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0800);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0A00);
+} else if (dev-phy.rev == 1 ||
+  (bus-sprom.boardflags_lo  B43_BFL_FEM)) {
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0004);
+b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF

Re: [PATCH RESEND] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
2009/8/3 Gábor Stefanik netrolller...@gmail.com:
 Implement baseband init for rev.0 and rev.1 LP PHYs. Convert
 boardflags_hi values to defines.
 Implement b43_phy_copy for easier copying between registers, as needed
 by LP-PHY init.

 Signed-off-by: Gábor Stefaniknetrolller...@gmail.com
 Cc: Michael Bueschm...@bu3sch.de
 Cc: Larry Fingerlarry.fin...@lwfinger.net
 ---


Looks like this one survived.

-- 
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


Re: [PATCH] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
Whitespace-damaged, sorry. Resend coming soon.

2009/8/3 Gábor Stefanik netrolller...@gmail.com:
 Implement baseband init for rev.0 and rev.1 LP PHYs. Convert boardflags_hi
 values to defines.
 Implement b43_phy_copy for easier copying between registers, as needed by
 LP-PHY init.

 Signed-off-by: Gábor Stefanik netrolller...@gmail.com
 Cc: Michael Buesch m...@bu3sch.de
 Cc: Larry Finger larry.fin...@lwfinger.net
 ---
  b43.h        |   11 ++
  phy_common.c |    7 
  phy_lp.c     |   95
 ++-
  phy_lp.h     |    8 +++-
  phy_n.c      |    3 +
  5 files changed, 120 insertions(+), 4 deletions(-)

 diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
 index 4e8ad84..41ca727 100644
 --- a/drivers/net/wireless/b43/b43.h
 +++ b/drivers/net/wireless/b43/b43.h
 @@ -142,6 +142,17 @@
  #define B43_BFL_BTCMOD            0x4000    /* BFL_BTCOEXIST is given in
 alternate GPIOs */
  #define B43_BFL_ALTIQ            0x8000    /* alternate I/Q settings */

 +/* SPROM boardflags_hi values */
 +#define B43_BFH_NOPA            0x0001    /* has no PA */
 +#define B43_BFH_RSSIINV            0x0002    /* RSSI uses positive slope
 (not TSSI) */
 +#define B43_BFH_PAREF            0x0004    /* uses the PARef LDO */
 +#define B43_BFH_3TSWITCH        0x0008    /* uses a triple throw switch
 shared
 +                         * with bluetooth */
 +#define B43_BFH_PHASESHIFT        0x0010    /* can support phase shifter */
 +#define B43_BFH_BUCKBOOST        0x0020    /* has buck/booster */
 +#define B43_BFH_FEM_BT            0x0040    /* has FEM and switch to share
 antenna
 +                         * with bluetooth */
 +
  /* GPIO register offset, in both ChipCommon and PCI core. */
  #define B43_GPIO_CONTROL        0x6c

 diff --git a/drivers/net/wireless/b43/phy_common.c
 b/drivers/net/wireless/b43/phy_common.c
 index e176b6e..999e0bd 100644
 --- a/drivers/net/wireless/b43/phy_common.c
 +++ b/drivers/net/wireless/b43/phy_common.c
 @@ -240,6 +240,13 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16
 value)
     dev-phy.ops-phy_write(dev, reg, value);
  }

 +void b43_phy_copy(struct b43_wldev *dev, u16 srcreg, u16 destreg)
 +{
 +    assert_mac_suspended(dev);
 +    dev-phy.ops-phy_write(dev, destreg,
 +        dev-phy.ops-phy_read(dev, srcreg));
 +}
 +
  void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
  {
     b43_phy_write(dev, offset,
 diff --git a/drivers/net/wireless/b43/phy_lp.c
 b/drivers/net/wireless/b43/phy_lp.c
 index 58e319d..dbaa2e4 100644
 --- a/drivers/net/wireless/b43/phy_lp.c
 +++ b/drivers/net/wireless/b43/phy_lp.c
 @@ -66,7 +66,100 @@ static void lpphy_table_init(struct b43_wldev *dev)

  static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
  {
 -    B43_WARN_ON(1);//TODO rev  2 not supported, yet.
 +    struct ssb_bus *bus = dev-dev-bus;
 +    struct b43_phy_lp *lpphy = dev-phy.lp;
 +    u16 tmp, tmp2;
 +
 +    if (dev-phy.rev == 1 
 +       (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00);
 +    } else if (b43_current_band(dev-wl) == IEEE80211_BAND_5GHZ ||
 +          (bus-boardinfo.type == 0x048A) || ((dev-phy.rev == 0) 
 +          (bus-sprom.boardflags_lo  B43_BFL_FEM))) {
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0500);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x0002);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0800);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002);
 +        b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0A00);
 +    } else if (dev-phy.rev == 1 ||
 +          (bus

Re: [PATCH V2] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
On Mon, Aug 3, 2009 at 1:28 AM, Gábor Stefaniknetrolller...@gmail.com wrote:
 Implement baseband init for rev.0 and rev.1 LP PHYs. Convert boardflags_hi
 values to defines.
 Implement b43_phy_copy for easier copying between registers, as needed by
 LP-PHY init.

 Signed-off-by: Gábor Stefaniknetrolller...@gmail.com
 Cc: Michael Bueschm...@bu3sch.de
 Cc: Larry Fingerlarry.fin...@lwfinger.net
 ---
 V2:
 -Reversed argument order for b43_phy_copy.
 -Named all registers, no more magic numbers.
 -Whitespace errors hopefully fixed (I hope my mailer doesn't re-introduce
 them...)

Phew! No more whitespace corruption, it seems... looks like
Thunderbird doesn't like the Linux coding style. :-)

-- 
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 V2] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
Implement baseband init for rev.0 and rev.1 LP PHYs. Convert boardflags_hi 
values to defines.
Implement b43_phy_copy for easier copying between registers, as needed by 
LP-PHY init.

Signed-off-by: Gábor Stefaniknetrolller...@gmail.com
Cc: Michael Bueschm...@bu3sch.de
Cc: Larry Fingerlarry.fin...@lwfinger.net
---
V2:
-Reversed argument order for b43_phy_copy.
-Named all registers, no more magic numbers.
-Whitespace errors hopefully fixed (I hope my mailer doesn't re-introduce 
them...)

 b43.h|   11 ++
 phy_common.c |7 
 phy_common.h |5 +++
 phy_lp.c |   94 ++-
 phy_lp.h |   11 +-
 phy_n.c  |3 +
 6 files changed, 127 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 4e8ad84..41ca727 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -142,6 +142,17 @@
 #define B43_BFL_BTCMOD 0x4000  /* BFL_BTCOEXIST is given in 
alternate GPIOs */
 #define B43_BFL_ALTIQ  0x8000  /* alternate I/Q settings */
 
+/* SPROM boardflags_hi values */
+#define B43_BFH_NOPA   0x0001  /* has no PA */
+#define B43_BFH_RSSIINV0x0002  /* RSSI uses positive 
slope (not TSSI) */
+#define B43_BFH_PAREF  0x0004  /* uses the PARef LDO */
+#define B43_BFH_3TSWITCH   0x0008  /* uses a triple throw switch 
shared
+* with bluetooth */
+#define B43_BFH_PHASESHIFT 0x0010  /* can support phase shifter */
+#define B43_BFH_BUCKBOOST  0x0020  /* has buck/booster */
+#define B43_BFH_FEM_BT 0x0040  /* has FEM and switch to share 
antenna
+* with bluetooth */
+
 /* GPIO register offset, in both ChipCommon and PCI core. */
 #define B43_GPIO_CONTROL   0x6c
 
diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index e176b6e..1661b03 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -240,6 +240,13 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 
value)
dev-phy.ops-phy_write(dev, reg, value);
 }
 
+void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
+{
+   assert_mac_suspended(dev);
+   dev-phy.ops-phy_write(dev, destreg,
+   dev-phy.ops-phy_read(dev, srcreg));
+}
+
 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
 {
b43_phy_write(dev, offset,
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index b2d9910..c7a7d6b 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -291,6 +291,11 @@ u16 b43_phy_read(struct b43_wldev *dev, u16 reg);
 void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value);
 
 /**
+ * b43_phy_copy - copy contents of 16bit PHY register to another
+ */
+void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg);
+
+/**
  * b43_phy_mask - Mask a PHY register with a mask
  */
 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask);
diff --git a/drivers/net/wireless/b43/phy_lp.c 
b/drivers/net/wireless/b43/phy_lp.c
index 58e319d..9653b5a 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -66,7 +66,99 @@ static void lpphy_table_init(struct b43_wldev *dev)
 
 static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
 {
-   B43_WARN_ON(1);//TODO rev  2 not supported, yet.
+   struct ssb_bus *bus = dev-dev-bus;
+   u16 tmp, tmp2;
+
+   if (dev-phy.rev == 1 
+  (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)) {
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900);
+   b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
+   b43_phy_maskset(dev, 

Re: [PATCH RESEND] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
On Mon, Aug 3, 2009 at 11:15 AM, Michael Bueschm...@bu3sch.de wrote:
 On Monday 03 August 2009 11:13:37 Michael Buesch wrote:
 On Monday 03 August 2009 00:18:22 Gábor Stefanik wrote:
  Implement baseband init for rev.0 and rev.1 LP PHYs. Convert
  boardflags_hi values to defines.
  Implement b43_phy_copy for easier copying between registers, as needed
  by LP-PHY init.

  +   if (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)
  +      (bus-chip_id == 0x5354)
  +      (bus-chip_package == SSB_CHIPPACK_BCM4712S)) {
  +           b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
  +           b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
  +           b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0x);
  +           b43_hf_write(dev, b43_hf_read | 0x0800ULL  32);
  +   }

 The HF write is wrong. Read the specification:
 http://bcm-v4.sipsolutions.net/802.11/Mhf

 Patch otherwise looks ok.

 Sorry, I replied to the wrong mail. But this does also apply to V2 patch.

 --
 Greetings, Michael.


In V2, this line is as follows (b43_hf_read corrected):

b43_hf_write(dev, b43_hf_read(dev) | 0x0800ULL  32)

The command in the specs is this:

mhf(2, 0x800, 0x800, 1)

2 means B43_SHM_SH_HOSTFHI, 0x800 is the bit to set, and 1 is
allbands, which, per Larry, can be ignored in our current
implementation (it is specific to the caching behavior of the mips
driver).

From what I read in b43_hf_write, writing to HOSTFHI can be achieved
by left-shifting by 32 (16 for HOSTFMI).

Is the problem that we write all 3 hostflags registers here?

(BTW are there any other known host flags? If there are, maybe we
should #define them.)

-- 
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


Re: [PATCH RESEND] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
2009/8/3 Michael Buesch m...@bu3sch.de:
 On Monday 03 August 2009 15:55:29 Gábor Stefanik wrote:
 On Mon, Aug 3, 2009 at 11:15 AM, Michael Bueschm...@bu3sch.de wrote:
  On Monday 03 August 2009 11:13:37 Michael Buesch wrote:
  On Monday 03 August 2009 00:18:22 Gábor Stefanik wrote:
   Implement baseband init for rev.0 and rev.1 LP PHYs. Convert
   boardflags_hi values to defines.
   Implement b43_phy_copy for easier copying between registers, as needed
   by LP-PHY init.
 
   +   if (bus-sprom.boardflags_hi  B43_BFH_FEM_BT)
   +      (bus-chip_id == 0x5354)
   +      (bus-chip_package == SSB_CHIPPACK_BCM4712S)) {
   +           b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
   +           b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
   +           b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0x);
   +           b43_hf_write(dev, b43_hf_read | 0x0800ULL  32);
   +   }
 
  The HF write is wrong. Read the specification:
  http://bcm-v4.sipsolutions.net/802.11/Mhf
 
  Patch otherwise looks ok.
 
  Sorry, I replied to the wrong mail. But this does also apply to V2 patch.
 
  --
  Greetings, Michael.
 

 In V2, this line is as follows (b43_hf_read corrected):

 b43_hf_write(dev, b43_hf_read(dev) | 0x0800ULL  32)

 The command in the specs is this:

 mhf(2, 0x800, 0x800, 1)

 2 means B43_SHM_SH_HOSTFHI, 0x800 is the bit to set, and 1 is
 allbands, which, per Larry, can be ignored in our current
 implementation (it is specific to the caching behavior of the mips
 driver).

 From what I read in b43_hf_write, writing to HOSTFHI can be achieved
 by left-shifting by 32 (16 for HOSTFMI).

 Is the problem that we write all 3 hostflags registers here?

 (BTW are there any other known host flags? If there are, maybe we
 should #define them.)


 My point is that update_mhf does not write to actual hardware, as far
 as I understand the code. Larry, can you please explain that part of the
 specs?


From 802.11/Mhf:
If core-clk is not zero AND band-mhfs[idx] is not equal to tmp:
   1. Write band-mhfs[idx] to Shared Memory Address addr[idx]

This looks to me like it does indeed write to SHM, though the actual
mhf() tries to avoid writing to SHM if possible, while b43_hf_write
doesn't perform this optimization. (We don't have a band-mhfs, nor a
bandstate[] array.)

-- 
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


Re: [PATCH RESEND] b43: implement baseband init for LP-PHY = rev1

2009-08-03 Thread Gábor Stefanik
On Mon, Aug 3, 2009 at 11:16 PM, Michael Bueschm...@bu3sch.de wrote:
 On Monday 03 August 2009 22:58:30 Larry Finger wrote:
 Gábor states it the way the Broadcom routine is written. They have the
 flags divided into 3 16-bit values - high, middle, and low. The values
 are kept in arrays - one set is for the current band and the other is
 for both bands. When the routine is entered, the appropriate quantity
 is saved in a temporary, then the array value is maskset. Only when
 the resulting value changes is the shared memory location updated. The
 implication is that shared memory writes are expensive. Is that true?

 No. I think it has other reasons.

 --
 Greetings, Michael.


In that case, is the code correct:

-- 
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


Re:

2009-07-29 Thread Gábor Stefanik
On Wed, Jul 29, 2009 at 6:38 PM, Larry Fingerlarry.fin...@lwfinger.net wrote:
 Brian J. Mc Hugh wrote:
 I have a Gateway Solo 9300 laptop and a Linksys Wireless-G Notebook Adapter.
 I've installed the latest Debian release (v5.0.2) and the latest b43
 driver (4.150.10.5).

 This is a firmware version not a driver version.

 My WiFi card receives signal from my wireless router, but I suspect it
 isn't able to transmit signal and I'm not able to establish an Internet
 connection via my WiFi card.

 The WiFi card has worked with previous Debian releases.

 What kernel was in the previous release that you used?

 Can anyone understand why I'm unable to establish communication with the
 Internet based on the replies of the five diagnostic messages I've
 included below?
 Thanks,
 Brian

 *1) uname -r *
 2.6.26-2-686

 I do not remember any killer bugs in 2.6.26, but that was a long time
 ago. You will probably do better if you install compat-wireless-old.
 See http://wireless.kernel.org/en/users/Download/compat-wireless-old

 There may be a deb package for Lenny. If so, I didn't find it with a
 quick look; however, http://forum.eeeuser.com/viewtopic.php?id=65376
 shows what to do to build the package.

 Everything else looks OK; however, your interface was unable to use
 DHCP to get an IP address. It appears that TX is messed up.

Hmm, sounds familiar...

A hint: Debian Etch shipped with 2.6.18, which still had bcm43xx (no
BT coex support). I guess we are looking at yet another card where
trying to use BT coexistence disables TX.

-- 
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


Re: Who is working on b43 LP-PHY?

2009-07-25 Thread Gábor Stefanik
On Sat, Jul 25, 2009 at 10:31 PM, Michael Bueschm...@bu3sch.de wrote:
 I'm wondering who is currently working on the b43 LP-PHY code.

 I'm just wondering, because there are maybe 20 people who promised to me
 to work on the code. Who is left _working_ on it? (I mean _working_, not
 looking or planning to work). What about patches?

 Are you guys all scared away and dropped the plan to work on LP?

I'm actually working on it, but most of my work was done in a virtual
machine on Windows, and I've recently reinstalled Windows and still in
the process of setting up my environment (don't worry, the virtual HDD
was not lost). Once everything is ready, I'll move development over to
my real Linux install.

BTW are there any desktop cards (PCI/PCIE) with an LP-PHY? Or
alternatively a MiniPCIE one (not MiniPCI - I've recently bought a
PCIE-to-miniPCIE adapter to work on iwl5300)?

Thanks,
Gábor


-- 
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


Re: BCM4312 and phy_lp.c

2009-06-28 Thread Gábor Stefanik
On Sun, Jun 28, 2009 at 4:14 PM, Michael Bueschm...@bu3sch.de wrote:
 On Sunday 28 June 2009 15:18:30 Richard Hughes wrote:
 Are you awaiting more data about the chipset, or have just run out of
 developer time? The documentation looks pretty comprehensive, although
 core bit of the code still need writing. Could I offer myself to fill
 in some of the TODOs? I might need a bit of coaching to get me up to
 speed with the device internals. Or, do you think that I would be
 better to be more patient and wait for you to code this? I would
 really like to get the 4312 working, rather than just replacing it
 with an Intel chipset.

 I'm currently not working on it, because I have other higher priority tasks.
 The documentation should be more or less complete, so if you feel like, just
 start implementing something. Look at phy_lp.c, find a gap and implement it.
 Please do _small_ patches and submit patches _early_.
 Big patches will be rejected.

I've started working on baseband init, but I have a small problem with
this step in the specs:
Call mhf with arguments ( 2, 0x0800, 0x0800, 1)

Is mhf implemented already for other PHYs? (If so, under what name?)
Is it supposed to be used anywhere outside LP init?

Thanks,
Gábor
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] b43 : remove old kidx API

2009-06-19 Thread Gábor Stefanik
On Fri, Jun 19, 2009 at 9:29 PM, Michael Bueschm...@bu3sch.de wrote:
 On Friday 19 June 2009 21:17:04 gregor kowski wrote:
 On 6/12/09, gregor kowski gregor.kow...@gmail.com wrote:
  Remove old kidx API.
  This simplify the code, and fix a potential key overflow.
 
 Michael,

 any comment on this ?
 I wait your ack to resubmit tkip hardware support.

 If you want my ack, you should probably CC me. I basically don't read the 
 list.


Also, given that this is a b43-related issue, CC bcm43xx-...@lists.berlios.de.

-- 
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


Re: 4311 not detected at all

2009-06-13 Thread Gábor Stefanik
On Sat, Jun 13, 2009 at 1:35 AM, Larry Fingerlarry.fin...@lwfinger.net wrote:
 Fabio A. Correa wrote:
 Hey, I found an updated BIOS available in the HP site, obviously
 requiring Windows. I had deleted those partitions, so I will get a
 Windows hard disk/CD and try to flash it. I did not work under Wine...
 I will keep you informed.

 If you have access to a running Windows XP system on another computer,
 there is a way to build a Windows Live CD from which to run your BIOS
 update. Download the Bart's PE file (http://www.nu2.nu/pebuilder/) and
 install it. Run it with a Windows distribution CD mounted.

 If you have the Windows CD, but not access to a machine running
 Windows, the .iso can be built in a virtual machine. I used a
 VirtualBox copy of Windows XP. Unfortunately, the builder will not run
 in Wine.

Alternatively, you can use a Windows Vista/Windows 7 RC setup DVD as
is, unmodified. (Use the recovery environment.)

-- 
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


Re: b43 Hostap Performance

2009-04-10 Thread Gábor Stefanik
On Fri, Apr 10, 2009 at 12:28 AM, Francesco Gringoli
francesco.gring...@ing.unibs.it wrote:

 On Apr 9, 2009, at 11:56 PM, Michael Buesch wrote:
 4318 is good enough for STA mode, but in AP mode it doesn't work
 correctly, because
 it simply loses too many packets. So it loses important management
 frames, etc... .
 If you limit the TX rate to 24M it becomes usable, however.
 4306 is _much_ better in AP mode.
 You mean that it misses to transmit some frames? Do you have
 hypotheses on why AP mode should complete change the behavior of the
 board from good enough to not working correctly? The only
 difference between station and AP mode AFAIK is that AP mode honors
 the TBTT condition and transmit the beacon when a beacon is needed. I
 say honor since that condition and the other about beacon needed are
 raised also in station mode but they are not handled. I'm confused.


 Of course, there always are exceptions to these rules, because there
 are about
 a million completely different 4318 and and 4306 cards out there.
 So you might be lucky to pick one of the few 4318 that works well in
 AP mode, or
 you might pick one of the few 4306 that don't work too well.
 Ok, that could be. I have only 4318 branded as Asus, they are all
 equal. Probably the fact the linksys does not work in AP mode confirm
 what you say.

 I have noticed, however a strange fact with these 4318 based linksys:
 when I set one of them in AP mode, beaconing is perfect and I can join
 it from other stations. When I ping the AP from stations I get echo
 reply. If, instead, I ping stations from the AP, no packet is sent! at
 all; if I telnet from stations to the AP, e.g., to port 22, 3whs ends
 but then the TCP session dies. The strange fact is that it seems that
 there are problems for all the frames whose generation involves a
 contest switching from userspace to kernel, in other words a complete
 cross of the mac80211+b43 layers. If instead, on the AP, I completely
 bypass the network stack and directly ask b43 to transmit a frame
 (with a modified b43) the frame is transmitted, at every rate I choose
 (I choose the rate inside the kernel code, I'm not referring to the
 rate set by iwconfig).

 Do you have some of these flawed 4318?

 -Francesco

Can you please release the patch you used to transmit frames using b43
directly, with a complete bypass of the stack? Also, what results do
you get if you instead try to use mac80211's radiotap injection
feature (which bypasses most, but not all of mac80211)?

Thanks,
Gábor

-- 
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


Re: [PATCH, RFC] b44: Add fw capabilities

2009-04-08 Thread Gábor Stefanik
I assume b44 in the title is a typo.

On Wed, Apr 8, 2009 at 2:11 AM, Michael Buesch m...@bu3sch.de wrote:
 Completely untested patch to implement firmware capabilities
 and automagic QoS-disabling.


 Index: wireless-testing/drivers/net/wireless/b43/b43.h
 ===
 --- wireless-testing.orig/drivers/net/wireless/b43/b43.h        2009-04-07 
 19:52:34.0 +0200
 +++ wireless-testing/drivers/net/wireless/b43/b43.h     2009-04-08 
 01:57:58.0 +0200
 @@ -163,6 +163,7 @@ enum {
  #define B43_SHM_SH_WLCOREREV           0x0016  /* 802.11 core revision */
  #define B43_SHM_SH_PCTLWDPOS           0x0008
  #define B43_SHM_SH_RXPADOFF            0x0034  /* RX Padding data offset 
 (PIO only) */
 +#define B43_SHM_SH_FWCAPA              0x0042  /* Firmware capabilities 
 (Opensource firmware only) */
  #define B43_SHM_SH_PHYVER              0x0050  /* PHY version */
  #define B43_SHM_SH_PHYTYPE             0x0052  /* PHY type */
  #define B43_SHM_SH_ANTSWAP             0x005C  /* Antenna swap threshold */
 @@ -297,6 +298,10 @@ enum {
  #define B43_HF_MLADVW          0x0010ULL /* N PHY ML ADV workaround 
 (rev = 13 only) */
  #define B43_HF_PR45960W                0x0800ULL /* PR 45960 
 workaround (rev = 13 only) */

 +/* Firmware capabilities field in SHM (Opensource firmware only) */
 +#define B43_FWCAPA_HWCRYPTO    0x0001
 +#define B43_FWCAPA_QOS         0x0002
 +
  /* MacFilter offsets. */
  #define B43_MACFILTER_SELF             0x
  #define B43_MACFILTER_BSSID            0x0003
 @@ -596,6 +601,13 @@ struct b43_wl {
        /* Pointer to the ieee80211 hardware data structure */
        struct ieee80211_hw *hw;

 +       /* The number of queues that were registered with the mac80211 
 subsystem
 +        * initially. This is a backup copy of hw-queues in case hw-queues 
 has
 +        * to be dynamically lowered at runtime (Firmware does not support 
 QoS).
 +        * hw-queues has to be restored to the original value before 
 unregistering
 +        * from the mac80211 subsystem. */
 +       u16 mac80211_initially_registered_queues;
 +
        struct mutex mutex;
        spinlock_t irq_lock;
        /* R/W lock for data transmission.
 @@ -752,6 +764,8 @@ struct b43_wldev {
        bool dfq_valid;         /* Directed frame queue valid (IBSS PS mode, 
 ATIM) */
        bool radio_hw_enable;   /* saved state of radio hardware enabled state 
 */
        bool suspend_in_progress;       /* TRUE, if we are in a suspend/resume 
 cycle */
 +       bool qos_enabled;               /* TRUE, if QoS is used. */
 +       bool hwcrypto_enabled;          /* TRUE, if HW crypto acceleration is 
 enabled. */

        /* PHY/Radio device. */
        struct b43_phy phy;
 Index: wireless-testing/drivers/net/wireless/b43/dma.c
 ===
 --- wireless-testing.orig/drivers/net/wireless/b43/dma.c        2009-04-07 
 19:58:22.0 +0200
 +++ wireless-testing/drivers/net/wireless/b43/dma.c     2009-04-08 
 01:53:56.0 +0200
 @@ -1285,7 +1285,7 @@ static struct b43_dmaring *select_ring_b
  {
        struct b43_dmaring *ring;

 -       if (b43_modparam_qos) {
 +       if (dev-qos_enabled) {
                /* 0 = highest priority */
                switch (queue_prio) {
                default:
 Index: wireless-testing/drivers/net/wireless/b43/main.c
 ===
 --- wireless-testing.orig/drivers/net/wireless/b43/main.c       2009-04-07 
 19:55:03.0 +0200
 +++ wireless-testing/drivers/net/wireless/b43/main.c    2009-04-08 
 02:02:19.0 +0200
 @@ -80,8 +80,8 @@ static int modparam_nohwcrypt;
  module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
  MODULE_PARM_DESC(nohwcrypt, Disable hardware encryption.);

 -int b43_modparam_qos = 1;
 -module_param_named(qos, b43_modparam_qos, int, 0444);
 +static int modparam_qos = 1;
 +module_param_named(qos, modparam_qos, int, 0444);
  MODULE_PARM_DESC(qos, Enable QOS support (default on));

  static int modparam_btcoex = 1;
 @@ -538,6 +538,13 @@ void b43_hf_write(struct b43_wldev *dev,
        b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTFHI, hi);
  }

 +/* Read the firmware capabilities bitmask (Opensource firmware only) */
 +static u16 b43_fwcapa_read(struct b43_wldev *dev)
 +{
 +       B43_WARN_ON(!dev-fw.opensource);
 +       return b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_FWCAPA);
 +}
 +
  void b43_tsf_read(struct b43_wldev *dev, u64 *tsf)
  {
        u32 low, high;
 @@ -2330,12 +2337,34 @@ static int b43_upload_microcode(struct b
        dev-fw.patch = fwpatch;
        dev-fw.opensource = (fwdate == 0x);

 +       /* Default to use-all-queues. */
 +       dev-wl-hw-queues = dev-wl-mac80211_initially_registered_queues;
 +       dev-qos_enabled = !!modparam_qos;
 +       /* Default to firmware/hardware crypto acceleration. */
 +       

Re: PCI adapters do not work for rate control and high bit rates

2009-03-03 Thread Gábor Stefanik
On Tue, Mar 3, 2009 at 2:41 PM, Bo Han hanb...@gmail.com wrote:
 Hi,

 I am having troubles when using ASUS WL-138G V2 Wireless LAN PCI Adapters.
 I am using ad-hoc mode and kernel version 2.6.28.7.  There is no rate
 control for these cards.  When I set the bit rate to auto, they always use 1
 Mbps (they are very close to each other, around 1 meter).  Also when two PCI
 cards talk with each other, they do not support bit rates 48 and 54 Mbps.
 The link quality for 36 Mbps is very good.  When I ping from one to another,
 most of the time, no packets can get through.  Sometimes, I can get two ICMP
 responses.  They can use these rates for ACK frames when talking with an AP,
 which means the modulation is there, but not works well for data packet?.

 I also attached the output of dmesg and lspci below.

 Thanks,
 -Bo

 ***

 output of dmesg:

 [  443.929045] b43-phy0: Broadcom 4318 WLAN found
 [  443.939533] cfg80211: Regulatory domain changed to country: US
 [  443.939542]     (start_freq - end_freq @ bandwidth), (max_antenna_gain,
 max_eirp)
 [  443.939548]     (2402000 KHz - 2472000 KHz @ 4 KHz), (300 mBi, 2700
 mBm)
 [  443.939553]     (517 KHz - 525 KHz @ 4 KHz), (300 mBi, 1700
 mBm)
 [  443.939558]     (525 KHz - 533 KHz @ 4 KHz), (300 mBi, 2000
 mBm)
 [  443.939563]     (549 KHz - 571 KHz @ 4 KHz), (300 mBi, 2000
 mBm)
 [  443.939568]     (5735000 KHz - 5835000 KHz @ 4 KHz), (300 mBi, 3000
 mBm)
 [  443.972021] b43-phy0 debug: Found PHY: Analog 3, Type 2, Revision 7
 [  443.972048] b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2050,
 Revision 8
 [  444.013508] phy0: Selected rate control algorithm 'pid'
 [  444.014981] Broadcom 43xx driver loaded [ Features: PMLR, Firmware-ID:
 FW13 ]
 [  444.180267] input: b43-phy0 as /class/input/input6
 [  444.272050] b43 ssb0:0: firmware: requesting b43/ucode5.fw
 [  444.283513] b43 ssb0:0: firmware: requesting b43/pcm5.fw
 [  444.325147] b43 ssb0:0: firmware: requesting b43/b0g0initvals5.fw
 [  444.350355] b43 ssb0:0: firmware: requesting b43/b0g0bsinitvals5.fw
 [  444.484033] b43-phy0: Loading firmware version 410.2160 (2007-05-26
 15:32:10)
 [  444.504040] b43-phy0 debug: Chip initialized
 [  444.504461] b43-phy0 debug: 32-bit DMA initialized
 [  444.524509] Registered led device: b43-phy0::tx
 [  444.524553] Registered led device: b43-phy0::rx
 [  444.524587] Registered led device: b43-phy0::assoc
 [  444.524622] Registered led device: b43-phy0::radio
 [  444.524655] b43-phy0 debug: Wireless interface started

 output of lspic:

 00:13.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g]
 802.11g Wireless LAN Controller (rev 02)
     Subsystem: ASUSTeK Computer Inc. Device 100f
     Flags: bus master, fast devsel, latency 32, IRQ 18
     Memory at dd80 (32-bit, non-prefetchable) [size=8K]
     Kernel driver in use: b43-pci-bridge
     Kernel modules: ssb


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



A distance of ~1m is actually too close, it can result in antenna
saturation. Try reducing the TX power of the cards.

-- 
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


Re: b43 driver support ?(14e4:4300) - Japanese Buffalo card

2009-01-27 Thread Gábor Stefanik
On Tue, Jan 27, 2009 at 11:07 PM, Kajikawa Jeremy belxjan...@gmail.com wrote:
 Ive had this card a while and know it worked with the old bcm43xx
 driver...

 but I would like to get it working on the newer drivers with an updated
 kernel.

 especially as this is an install for 64bit and the old install was
 32bit.

 current kernel version is 2.6.28 and I hand-compiled from sources.

 is there any options or other I can use or do I need to find
  some means of bss update for my card to use newer firmware and
  become functional?

 I am *needing* this to keep a server online (and not require a laptop as
 net-card)

 any help at all will be appreciated

 Sincerely,
  Jeremy


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



That is likely a b43legacy card - you need the same firmware as for
bcm43xx, but you must cut it using b43-fwcutter instead of
bcm43xx-fwcutter.

-- 
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


Re: 4318 Question Frame Check Sequence Errors

2009-01-26 Thread Gábor Stefanik
On Mon, Jan 26, 2009 at 10:17 PM, Tex ccmc...@verizon.net wrote:
 I have been running some surveys with the Atheros and Broadcom Drivers.
 When viewing the frames from wireshark , while in monitor mode, I
 noticed that the Atheros driver is reporting FCS errors on some frames,
 but the Broadcom driver isn't, in the radiotap header. If I expand the
 frame and look at the FCS wireshark reports the frame as bad and shows
 what the CRC should be. I put printk's in pio_rx_frame() (see below) and
 noticed that the macstat is being reported as zero. Does this mean that
 the status is not being sent to the driver from the chip or firmware? Is
 there some way for me to configure it to report bad FCS frames?

 macstat = le32_to_cpu(rxhdr.mac_status);
 printk (KERN_DEBUG pio_rx_frame macstat is %x\n, macstat);
 if (macstat  B43_RX_MAC_FCSERR) {
 if (!(q-dev-wl-filter_flags  FIF_FCSFAIL)) {
 /* Drop frames with failed FCS. */
 err_msg = Frame FCS error;
 goto rx_error;
 }

 b43_op_configure filter has the following flags set:
*fflags = FIF_PROMISC_IN_BSS |
  FIF_ALLMULTI |
  FIF_FCSFAIL |
  FIF_PLCPFAIL |
  FIF_CONTROL |
  FIF_OTHER_BSS |
  FIF_BCN_PRBRESP_PROMISC;

changed = FIF_PROMISC_IN_BSS |
   FIF_ALLMULTI |
   FIF_FCSFAIL |
   FIF_PLCPFAIL |
   FIF_CONTROL |
   FIF_OTHER_BSS |
   FIF_BCN_PRBRESP_PROMISC;




 Thanks much
 Tex

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


Note that you will never see correct FCS values in the Radiotap
header, as Linux does not actually insert the FCS into the header -
what Wireshark parses as the FCS field is actually RX Flags. (OpenBSD
uses index 14 for FCS, while all others use it for RX flags.
Wireshark, for some reason, follows the OpenBSD spec.)

-- 
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


<    1   2