[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: [RFC PATCH] b43: Implement LP-PHY baseband table initialization

2009-08-09 Thread Larry Finger
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.

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

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

Larry

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