b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] b43: LCN-PHY: minor fixes
@ 2011-08-31 21:36 Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 2/6] b43: LCN-PHY: put tables functions in correct file Rafał Miłecki
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

The biggest change is reversing order of reading 32-bit table value.
MMIO dumps has shown it's done that way for LCN-PHY.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/b43.h            |    2 ++
 drivers/net/wireless/b43/main.c           |    1 +
 drivers/net/wireless/b43/tables_phy_lcn.c |   10 ++++------
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 8ff7062..f8615cd 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -110,6 +110,8 @@
 #define B43_MMIO_TSF_CFP_START_LOW	0x604
 #define B43_MMIO_TSF_CFP_START_HIGH	0x606
 #define B43_MMIO_TSF_CFP_PRETBTT	0x612
+#define B43_MMIO_TSF_CLK_FRAC_LOW	0x62E
+#define B43_MMIO_TSF_CLK_FRAC_HIGH	0x630
 #define B43_MMIO_TSF_0			0x632	/* core rev < 3 only */
 #define B43_MMIO_TSF_1			0x634	/* core rev < 3 only */
 #define B43_MMIO_TSF_2			0x636	/* core rev < 3 only */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 1722941..6bca727 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2953,6 +2953,7 @@ static void b43_rate_memory_init(struct b43_wldev *dev)
 	case B43_PHYTYPE_N:
 	case B43_PHYTYPE_LP:
 	case B43_PHYTYPE_HT:
+	case B43_PHYTYPE_LCN:
 		b43_rate_memory_write(dev, B43_OFDM_RATE_6MB, 1);
 		b43_rate_memory_write(dev, B43_OFDM_RATE_12MB, 1);
 		b43_rate_memory_write(dev, B43_OFDM_RATE_18MB, 1);
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index 0a58428..916d3f1 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -318,9 +318,8 @@ u32 b43_lcntab_read(struct b43_wldev *dev, u32 offset)
 		break;
 	case B43_LCNTAB_32BIT:
 		b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
-		value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATAHI);
-		value <<= 16;
-		value |= b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO);
+		value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO);
+		value |= (b43_phy_read(dev, B43_PHY_LCN_TABLE_DATAHI) << 16);
 		break;
 	default:
 		B43_WARN_ON(1);
@@ -357,10 +356,9 @@ void b43_lcntab_read_bulk(struct b43_wldev *dev, u32 offset,
 			break;
 		case B43_LCNTAB_32BIT:
 			*((u32 *)data) = b43_phy_read(dev,
-						      B43_PHY_LCN_TABLE_DATAHI);
-			*((u32 *)data) <<= 16;
-			*((u32 *)data) |= b43_phy_read(dev,
 						B43_PHY_LCN_TABLE_DATALO);
+			*((u32 *)data) |= (b43_phy_read(dev,
+					   B43_PHY_LCN_TABLE_DATAHI) << 16);
 			data += 4;
 			break;
 		default:
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/6] b43: LCN-PHY: put tables functions in correct file
  2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
@ 2011-08-31 21:36 ` Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 3/6] b43: LCN-PHY: rewrite 0x7 table at the end of init Rafał Miłecki
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki


Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/phy_lcn.c        |   10 ----------
 drivers/net/wireless/b43/tables_phy_lcn.c |   17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index b617e1f..9e57577 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -137,14 +137,6 @@ static void b43_phy_lcn_afe_set_unset(struct b43_wldev *dev)
 	b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1);
 }
 
-static void b43_phy_lcn_clean_0x18_table(struct b43_wldev *dev)
-{
-	u8 i;
-
-	for (i = 0; i < 0x80; i++)
-		b43_lcntab_write(dev, B43_LCNTAB32(0x18, i), 0x80000);
-}
-
 static void b43_phy_lcn_clear_0x07_table(struct b43_wldev *dev)
 {
 	u8 i;
@@ -319,8 +311,6 @@ static int b43_phy_lcn_op_init(struct b43_wldev *dev)
 	b43_phy_maskset(dev, 0x663, 0xFF00, 0x64);
 
 	b43_phy_lcn_tables_init(dev);
-	/* TODO: various tables ops here */
-	b43_phy_lcn_clean_0x18_table(dev);
 
 	b43_phy_lcn_pre_radio_init(dev);
 	b43_phy_lcn_clear_0x07_table(dev);
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index 916d3f1..f74c00a 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -445,7 +445,7 @@ void b43_lcntab_write_bulk(struct b43_wldev *dev, u32 offset,
 #define lcntab_upload(dev, offset, data) do { \
 		b43_lcntab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \
 	} while (0)
-void b43_phy_lcn_tables_init(struct b43_wldev *dev)
+static void b43_phy_lcn_upload_static_tables(struct b43_wldev *dev)
 {
 	lcntab_upload(dev, B43_LCNTAB16(0x02, 0), b43_lcntab_0x02);
 	lcntab_upload(dev, B43_LCNTAB16(0x01, 0), b43_lcntab_0x01);
@@ -462,3 +462,18 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 	lcntab_upload(dev, B43_LCNTAB16(0x00, 0), b43_lcntab_0x00);
 	lcntab_upload(dev, B43_LCNTAB32(0x18, 0), b43_lcntab_0x18);
 }
+
+static void b43_phy_lcn_clean_0x18_table(struct b43_wldev *dev)
+{
+	u8 i;
+
+	for (i = 0; i < 0x80; i++)
+		b43_lcntab_write(dev, B43_LCNTAB32(0x18, i), 0x80000);
+}
+
+void b43_phy_lcn_tables_init(struct b43_wldev *dev)
+{
+	b43_phy_lcn_upload_static_tables(dev);
+	/* TODO: various tables ops here */
+	b43_phy_lcn_clean_0x18_table(dev);
+}
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/6] b43: LCN-PHY: rewrite 0x7 table at the end of init
  2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 2/6] b43: LCN-PHY: put tables functions in correct file Rafał Miłecki
@ 2011-08-31 21:36 ` Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 4/6] b43: LCN-PHY: upload additional 0x7 table Rafał Miłecki
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

This is not implemented in brcmsmac, but was noticed in (newer) wl. Can
be workaround for some hardware bug.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/tables_phy_lcn.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index f74c00a..95efea6 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -463,6 +463,17 @@ static void b43_phy_lcn_upload_static_tables(struct b43_wldev *dev)
 	lcntab_upload(dev, B43_LCNTAB32(0x18, 0), b43_lcntab_0x18);
 }
 
+/* Not implemented in brcmsmac, noticed in wl in MMIO dump */
+static void b43_phy_lcn_rewrite_tables(struct b43_wldev *dev)
+{
+	int i;
+	u32 tmp;
+	for (i = 0; i < 128; i++) {
+		tmp = b43_lcntab_read(dev, B43_LCNTAB32(0x7, 0x240 + i));
+		b43_lcntab_write(dev, B43_LCNTAB32(0x7, 0x240 + i), tmp);
+	}
+}
+
 static void b43_phy_lcn_clean_0x18_table(struct b43_wldev *dev)
 {
 	u8 i;
@@ -475,5 +486,6 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 {
 	b43_phy_lcn_upload_static_tables(dev);
 	/* TODO: various tables ops here */
+	b43_phy_lcn_rewrite_tables(dev);
 	b43_phy_lcn_clean_0x18_table(dev);
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/6] b43: LCN-PHY: upload additional 0x7 table
  2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 2/6] b43: LCN-PHY: put tables functions in correct file Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 3/6] b43: LCN-PHY: rewrite 0x7 table at the end of init Rafał Miłecki
@ 2011-08-31 21:36 ` Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 5/6] b43: LCN-PHY: rename functions, get rid of magic names Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 6/6] b43: LCN-PHY: add conditions for few operations Rafał Miłecki
  4 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki


Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/tables_phy_lcn.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index 95efea6..fd2b16d 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -295,6 +295,20 @@ static const u32 b43_lcntab_0x18[] = {
 	0x00080000, 0x00080000, 0x00080000, 0x00080000,
 };
 
+const u16 b43_lcntab_0x0f_late[] = {
+	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
+	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
+	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
+	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
+	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
+	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
+	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
+	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
+	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
+	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
+	0x0002, 0x0008, 0x0004, 0x0001,
+};
+
 /**************************************************
  * R/W ops.
  **************************************************/
@@ -486,6 +500,9 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 {
 	b43_phy_lcn_upload_static_tables(dev);
 	/* TODO: various tables ops here */
+	b43_lcntab_write_bulk(dev, B43_LCNTAB16(0xf, 0),
+			ARRAY_SIZE(b43_lcntab_0x0f_late), b43_lcntab_0x0f_late);
+	/* TODO: various tables ops here */
 	b43_phy_lcn_rewrite_tables(dev);
 	b43_phy_lcn_clean_0x18_table(dev);
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/6] b43: LCN-PHY: rename functions, get rid of magic names
  2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
                   ` (2 preceding siblings ...)
  2011-08-31 21:36 ` [PATCH 4/6] b43: LCN-PHY: upload additional 0x7 table Rafał Miłecki
@ 2011-08-31 21:36 ` Rafał Miłecki
  2011-08-31 21:36 ` [PATCH 6/6] b43: LCN-PHY: add conditions for few operations Rafał Miłecki
  4 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

We've compared b43 with brcmsmac and took functions names from the
later.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/phy_lcn.c        |   29 +++++++++++++++++++++++------
 drivers/net/wireless/b43/tables_phy_lcn.c |   10 ++++++----
 2 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index 9e57577..b461278 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -31,6 +31,7 @@
  * Radio 2064.
  **************************************************/
 
+/* wlc_lcnphy_radio_2064_channel_tune_4313 */
 static void b43_radio_2064_channel_setup(struct b43_wldev *dev)
 {
 	u16 save[2];
@@ -73,6 +74,7 @@ static void b43_radio_2064_channel_setup(struct b43_wldev *dev)
 	b43_radio_write(dev, 0x091, 0x7);
 }
 
+/* wlc_radio_2064_init */
 static void b43_radio_2064_init(struct b43_wldev *dev)
 {
 	b43_radio_write(dev, 0x09c, 0x0020);
@@ -122,6 +124,7 @@ static void b43_radio_2064_init(struct b43_wldev *dev)
  * Various PHY ops
  **************************************************/
 
+/* wlc_lcnphy_toggle_afe_pwdn */
 static void b43_phy_lcn_afe_set_unset(struct b43_wldev *dev)
 {
 	u16 afe_ctl2 = b43_phy_read(dev, B43_PHY_LCN_AFE_CTL2);
@@ -137,7 +140,8 @@ static void b43_phy_lcn_afe_set_unset(struct b43_wldev *dev)
 	b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1);
 }
 
-static void b43_phy_lcn_clear_0x07_table(struct b43_wldev *dev)
+/* wlc_lcnphy_clear_tx_power_offsets */
+static void b43_phy_lcn_clear_tx_power_offsets(struct b43_wldev *dev)
 {
 	u8 i;
 
@@ -154,7 +158,8 @@ static void b43_phy_lcn_clear_0x07_table(struct b43_wldev *dev)
 	}
 }
 
-static void b43_phy_lcn_pre_radio_init(struct b43_wldev *dev)
+/* wlc_lcnphy_rev0_baseband_init */
+static void b43_phy_lcn_rev0_baseband_init(struct b43_wldev *dev)
 {
 	b43_radio_write(dev, 0x11c, 0);
 
@@ -181,7 +186,11 @@ static void b43_phy_lcn_pre_radio_init(struct b43_wldev *dev)
 	b43_phy_maskset(dev, 0x448, ~0x300, 0x100);
 	b43_phy_maskset(dev, 0x608, ~0xff, 0x17);
 	b43_phy_maskset(dev, 0x604, ~0x7ff, 0x3ea);
+}
 
+/* wlc_lcnphy_bu_tweaks */
+static void b43_phy_lcn_bu_tweaks(struct b43_wldev *dev)
+{
 	b43_phy_set(dev, 0x805, 0x1);
 
 	b43_phy_maskset(dev, 0x42f, ~0x7, 0x3);
@@ -203,9 +212,16 @@ static void b43_phy_lcn_pre_radio_init(struct b43_wldev *dev)
 	b43_phy_write(dev, 0x7d6, 0x0902);
 
 	/* TODO: more ops */
+
+	if (dev->phy.rev == 1) {
+		/* TODO: more ops */
+
+		b43_phy_lcn_clear_tx_power_offsets(dev);
+	}
 }
 
-static void b43_phy_lcn_save_configsth_restore(struct b43_wldev *dev)
+/* wlc_lcnphy_vbat_temp_sense_setup */
+static void b43_phy_lcn_sense_setup(struct b43_wldev *dev)
 {
 	u8 i;
 
@@ -297,6 +313,7 @@ static void b43_phy_lcn_op_prepare_structs(struct b43_wldev *dev)
 	memset(phy_lcn, 0, sizeof(*phy_lcn));
 }
 
+/* wlc_phy_init_lcnphy */
 static int b43_phy_lcn_op_init(struct b43_wldev *dev)
 {
 	b43_phy_set(dev, 0x44a, 0x80);
@@ -312,15 +329,15 @@ static int b43_phy_lcn_op_init(struct b43_wldev *dev)
 
 	b43_phy_lcn_tables_init(dev);
 
-	b43_phy_lcn_pre_radio_init(dev);
-	b43_phy_lcn_clear_0x07_table(dev);
+	b43_phy_lcn_rev0_baseband_init(dev);
+	b43_phy_lcn_bu_tweaks(dev);
 
 	if (dev->phy.radio_ver == 0x2064)
 		b43_radio_2064_init(dev);
 	else
 		B43_WARN_ON(1);
 
-	b43_phy_lcn_save_configsth_restore(dev);
+	b43_phy_lcn_sense_setup(dev);
 
 	return 0;
 }
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index fd2b16d..c62a940 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -295,7 +295,7 @@ static const u32 b43_lcntab_0x18[] = {
 	0x00080000, 0x00080000, 0x00080000, 0x00080000,
 };
 
-const u16 b43_lcntab_0x0f_late[] = {
+const u16 b43_lcntab_sw_ctl_4313_epa_rev0[] = {
 	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
 	0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001,
 	0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008,
@@ -488,7 +488,8 @@ static void b43_phy_lcn_rewrite_tables(struct b43_wldev *dev)
 	}
 }
 
-static void b43_phy_lcn_clean_0x18_table(struct b43_wldev *dev)
+/* wlc_lcnphy_clear_papd_comptable */
+static void b43_phy_lcn_clean_papd_comp_table(struct b43_wldev *dev)
 {
 	u8 i;
 
@@ -501,8 +502,9 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 	b43_phy_lcn_upload_static_tables(dev);
 	/* TODO: various tables ops here */
 	b43_lcntab_write_bulk(dev, B43_LCNTAB16(0xf, 0),
-			ARRAY_SIZE(b43_lcntab_0x0f_late), b43_lcntab_0x0f_late);
+			ARRAY_SIZE(b43_lcntab_sw_ctl_4313_epa_rev0),
+			b43_lcntab_sw_ctl_4313_epa_rev0);
 	/* TODO: various tables ops here */
 	b43_phy_lcn_rewrite_tables(dev);
-	b43_phy_lcn_clean_0x18_table(dev);
+	b43_phy_lcn_clean_papd_comp_table(dev);
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 6/6] b43: LCN-PHY: add conditions for few operations
  2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
                   ` (3 preceding siblings ...)
  2011-08-31 21:36 ` [PATCH 5/6] b43: LCN-PHY: rename functions, get rid of magic names Rafał Miłecki
@ 2011-08-31 21:36 ` Rafał Miłecki
  4 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2011-08-31 21:36 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

It was not possible to guess the conditions from MMIO dumps. Take them
from brcmsmac code.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/phy_lcn.c        |   44 ++++++++++++++++++++--------
 drivers/net/wireless/b43/tables_phy_lcn.c |    8 ++++-
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index b461278..d0f106e 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -39,6 +39,7 @@ static void b43_radio_2064_channel_setup(struct b43_wldev *dev)
 	b43_radio_set(dev, 0x09d, 0x4);
 	b43_radio_write(dev, 0x09e, 0xf);
 
+	/* Channel specific values in theory, in practice always the same */
 	b43_radio_write(dev, 0x02a, 0xb);
 	b43_radio_maskset(dev, 0x030, ~0x3, 0xa);
 	b43_radio_maskset(dev, 0x091, ~0x3, 0);
@@ -70,22 +71,31 @@ static void b43_radio_2064_channel_setup(struct b43_wldev *dev)
 	b43_radio_write(dev, 0x044, save[0]);
 	b43_radio_write(dev, 0x12b, save[1]);
 
-	b43_radio_write(dev, 0x038, 0x0);
-	b43_radio_write(dev, 0x091, 0x7);
+	if (dev->phy.rev == 1) {
+		/* brcmsmac uses outdated 0x3 for 0x038 */
+		b43_radio_write(dev, 0x038, 0x0);
+		b43_radio_write(dev, 0x091, 0x7);
+	}
 }
 
 /* wlc_radio_2064_init */
 static void b43_radio_2064_init(struct b43_wldev *dev)
 {
-	b43_radio_write(dev, 0x09c, 0x0020);
-	b43_radio_write(dev, 0x105, 0x0008);
+	if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+		b43_radio_write(dev, 0x09c, 0x0020);
+		b43_radio_write(dev, 0x105, 0x0008);
+	} else {
+		/* TODO */
+	}
 	b43_radio_write(dev, 0x032, 0x0062);
 	b43_radio_write(dev, 0x033, 0x0019);
 	b43_radio_write(dev, 0x090, 0x0010);
 	b43_radio_write(dev, 0x010, 0x0000);
-	b43_radio_write(dev, 0x060, 0x007f);
-	b43_radio_write(dev, 0x061, 0x0072);
-	b43_radio_write(dev, 0x062, 0x007f);
+	if (dev->phy.rev == 1) {
+		b43_radio_write(dev, 0x060, 0x007f);
+		b43_radio_write(dev, 0x061, 0x0072);
+		b43_radio_write(dev, 0x062, 0x007f);
+	}
 	b43_radio_write(dev, 0x01d, 0x0002);
 	b43_radio_write(dev, 0x01e, 0x0006);
 
@@ -145,10 +155,12 @@ static void b43_phy_lcn_clear_tx_power_offsets(struct b43_wldev *dev)
 {
 	u8 i;
 
-	b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x340);
-	for (i = 0; i < 30; i++) {
-		b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0);
-		b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0);
+	if (1) { /* FIXME */
+		b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x340);
+		for (i = 0; i < 30; i++) {
+			b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0);
+			b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0);
+		}
 	}
 
 	b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x80);
@@ -178,8 +190,13 @@ static void b43_phy_lcn_rev0_baseband_init(struct b43_wldev *dev)
 	b43_phy_set(dev, 0x44a, 0x44);
 	b43_phy_write(dev, 0x44a, 0x80);
 
+	if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM))
+		; /* TODO */
 	b43_phy_maskset(dev, 0x634, ~0xff, 0xc);
-	b43_phy_maskset(dev, 0x634, ~0xff, 0xa);
+	if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM) {
+		b43_phy_maskset(dev, 0x634, ~0xff, 0xa);
+		b43_phy_write(dev, 0x910, 0x1);
+	}
 
 	b43_phy_write(dev, 0x910, 0x1);
 
@@ -207,7 +224,8 @@ static void b43_phy_lcn_bu_tweaks(struct b43_wldev *dev)
 	b43_phy_maskset(dev, 0x434, ~0xff, 0xfd);
 	b43_phy_maskset(dev, 0x420, ~0xff, 0x10);
 
-	b43_radio_set(dev, 0x09b, 0xf0);
+	if (dev->dev->bus_sprom->board_rev >= 0x1204)
+		b43_radio_set(dev, 0x09b, 0xf0);
 
 	b43_phy_write(dev, 0x7d6, 0x0902);
 
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index c62a940..7bf7057 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -501,9 +501,15 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 {
 	b43_phy_lcn_upload_static_tables(dev);
 	/* TODO: various tables ops here */
-	b43_lcntab_write_bulk(dev, B43_LCNTAB16(0xf, 0),
+
+	if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM &&
+	    !(dev->dev->bus_sprom->boardflags_hi & B43_BFH_FEM_BT))
+		b43_lcntab_write_bulk(dev, B43_LCNTAB16(0xf, 0),
 			ARRAY_SIZE(b43_lcntab_sw_ctl_4313_epa_rev0),
 			b43_lcntab_sw_ctl_4313_epa_rev0);
+	else
+		b43err(dev->wl, "SW ctl table is unknown for this card\n");
+
 	/* TODO: various tables ops here */
 	b43_phy_lcn_rewrite_tables(dev);
 	b43_phy_lcn_clean_papd_comp_table(dev);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-31 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31 21:36 [PATCH 1/6] b43: LCN-PHY: minor fixes Rafał Miłecki
2011-08-31 21:36 ` [PATCH 2/6] b43: LCN-PHY: put tables functions in correct file Rafał Miłecki
2011-08-31 21:36 ` [PATCH 3/6] b43: LCN-PHY: rewrite 0x7 table at the end of init Rafał Miłecki
2011-08-31 21:36 ` [PATCH 4/6] b43: LCN-PHY: upload additional 0x7 table Rafał Miłecki
2011-08-31 21:36 ` [PATCH 5/6] b43: LCN-PHY: rename functions, get rid of magic names Rafał Miłecki
2011-08-31 21:36 ` [PATCH 6/6] b43: LCN-PHY: add conditions for few operations Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).