Skip to contentSkip to conversation

b43: N-PHY: Implement Host Flags write during device init

PATCH New Gábor Stefanik 2 participants 6 messages Aug 16, 2010 – Aug 17, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 b43: N-PHY: Implement Host Flags write during device init

---
 drivers/net/wireless/b43/phy_n.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/phy_n.c +2 -1
index 5a72570..cb815cc 100644
@@ -1098,7 +1098,8 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
 
 		if (dev->phy.rev < 2) {
 			if (b43_phy_read(dev, B43_NPHY_RXCTL) & 0x2)
-				; /*TODO: b43_mhf(dev, 2, 0x0010, 0x0010, 3);*/
+				b43_hf_write(dev, b43_hf_read(dev) |
+						B43_HF_MLADVW);
 		} else if (dev->phy.rev == 2) {
 			b43_phy_write(dev, B43_NPHY_CRSCHECK2, 0);
 			b43_phy_write(dev, B43_NPHY_CRSCHECK3, 0);
Signature · 1 line
1.6.4.2
#1 lore raw

PATCH 2/4 b43: N-PHY: Fix typo in function name (gain_crtl -> gain_ctrl)

---
 drivers/net/wireless/b43/phy_n.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/b43/phy_n.c +2 -2
index cb815cc..f1b5707 100644
@@ -893,7 +893,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
 }
 
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
-static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
+static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev)
 {
 	struct b43_phy_n *nphy = dev->phy.n;
 	u8 i, j;
@@ -1094,7 +1094,7 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
 		b43_nphy_set_rf_sequence(dev, 0, events1, delays1, 7);
 		b43_nphy_set_rf_sequence(dev, 1, events2, delays2, 7);
 
-		b43_nphy_gain_crtl_workarounds(dev);
+		b43_nphy_gain_ctrl_workarounds(dev);
 
 		if (dev->phy.rev < 2) {
 			if (b43_phy_read(dev, B43_NPHY_RXCTL) & 0x2)
Signature · 1 line
1.6.4.2
#2 lore raw

PATCH 3/4 b43: N-PHY: Implement MAC PHY clock set

---
 drivers/net/wireless/b43/phy_n.c |   13 ++++++++++++-
 include/linux/ssb/ssb_regs.h     |    1 +
 2 files changed, 13 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/phy_n.c +12 -1
index f1b5707..d2dab55 100644
@@ -3074,6 +3074,17 @@ static int b43_nphy_cal_rx_iq(struct b43_wldev *dev,
 		return b43_nphy_rev2_cal_rx_iq(dev, target, type, debug);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
+static void b43_nphy_mac_phy_clock_set(struct b43_wldev *dev, bool on)
+{
+	u32 tmslow = ssb_read32(dev->dev, SSB_TMSLOW);
+	if (on)
+		tmslow |= SSB_TMSLOW_PHYCLK;
+	else
+		tmslow &= ~SSB_TMSLOW_PHYCLK;
+	ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
+}
+
 /*
  * Init N-PHY
  * http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N
@@ -3174,7 +3185,7 @@ int b43_phy_initn(struct b43_wldev *dev)
 	b43_phy_write(dev, B43_NPHY_BBCFG, tmp & ~B43_NPHY_BBCFG_RSTCCA);
 	b43_nphy_bmac_clock_fgc(dev, 0);
 
-	/* TODO N PHY MAC PHY Clock Set with argument 1 */
+	b43_nphy_mac_phy_clock_set(dev, true);
 
 	b43_nphy_pa_override(dev, false);
 	b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX);
include/linux/ssb/ssb_regs.h +1 -0
index a6d5225..b2d4bed 100644
@@ -97,6 +97,7 @@
 #define  SSB_TMSLOW_RESET	0x00000001 /* Reset */
 #define  SSB_TMSLOW_REJECT_22	0x00000002 /* Reject (Backplane rev 2.2) */
 #define  SSB_TMSLOW_REJECT_23	0x00000004 /* Reject (Backplane rev 2.3) */
+#define  SSB_TMSLOW_PHYCLK	0x00000010 /* MAC PHY Clock Control Enable */
 #define  SSB_TMSLOW_CLOCK	0x00010000 /* Clock Enable */
 #define  SSB_TMSLOW_FGC		0x00020000 /* Force Gated Clocks On */
 #define  SSB_TMSLOW_PE		0x40000000 /* Power Management Enable */
Signature · 1 line
1.6.4.2
#3 lore raw

PATCH 4/4 b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs

Rev.3+ support coming in a later patch.

---
 drivers/net/wireless/b43/phy_n.c |   40 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/phy_n.c +39 -1
index d2dab55..92cf8b8 100644
@@ -3085,6 +3085,44 @@ static void b43_nphy_mac_phy_clock_set(struct b43_wldev *dev, bool on)
 	ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
+static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
+{
+	struct b43_phy *phy = &dev->phy;
+	struct b43_phy_n *nphy = phy->n;
+	u16 buf[16];
+
+	if (0 /* FIXME clk */)
+		return;
+
+	b43_mac_suspend(dev);
+
+	if (nphy->hang_avoid)
+		b43_nphy_stay_in_carrier_search(dev, true);
+
+	b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN,
+			(mask & 0x3) << B43_NPHY_RFSEQCA_RXEN_SHIFT);
+
+	if (maskbits & 0x3 != 0x3) {
+		b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 1);
+		if (dev->phy.rev >= 3) {
+			/* TODO */
+		}
+	} else {
+		b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 0x1E);
+		if (dev->phy.rev >= 3) {
+			/* TODO */
+		}
+	}
+
+	b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
+
+	if (nphy->hang_avoid)
+		b43_nphy_stay_in_carrier_search(dev, false);
+
+	b43_mac_enable(dev);
+}
+
 /*
  * Init N-PHY
  * http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N
@@ -3211,7 +3249,7 @@ int b43_phy_initn(struct b43_wldev *dev)
 	}
 
 	if (nphy->phyrxchain != 3)
-		;/* TODO N PHY RX Core Set State with phyrxchain as argument */
+		b43_nphy_set_rx_core_state(dev, nphy->phyrxchain);
 	if (nphy->mphase_cal_phase_id > 0)
 		;/* TODO PHY Periodic Calibration Multi-Phase Restart */
 
Signature · 1 line
1.6.4.2
#4 lore raw

PATCH 4/4 b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs

drivers/net/wireless/b43/phy_n.c static void b43_nphy_mac_phy_clock_set(struct b43_wldev *dev, bool on)

Quoted 7 lines · G?bor Stefanik
drivers/net/wireless/b43/phy_n.c +6 -0
+static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
+{
+	struct b43_phy *phy =&dev->phy;
+	struct b43_phy_n *nphy = phy->n;
+	u16 buf[16];
 
+	if (maskbits&  0x3 != 0x3) {

Does this even compile? I don't see maskbits being defined.

Signature · 1 line
Greetings Michael.
#5 lore raw

PATCH 4/4 b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs

Quoted 11 lines · Michael B?sch

Review

Quoted 8 lines · G?bor Stefanik
(quoted diff) +6 -0
+static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
+{
+ ? ? ? struct b43_phy *phy =&dev->phy;
+ ? ? ? struct b43_phy_n *nphy = phy->n;
+ ? ? ? u16 buf[16];
 
+ ? ? ? if (maskbits& ?0x3 != 0x3) {

Does this even compile? I don't see maskbits being defined.

Typo, should be just "mask" (without "bits").

Quoted 4 lines

--
Greetings Michael.

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