2010-08-16 20:39:16

by Gábor Stefanik

[permalink] [raw]
Subject: [PATCH 1/4] b43: N-PHY: Implement Host Flags write during device init

Signed-off-by: Gábor Stefanik <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 5a72570..cb815cc 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -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);
--
1.6.4.2



2010-08-16 20:39:22

by Gábor Stefanik

[permalink] [raw]
Subject: [PATCH 3/4] b43: N-PHY: Implement MAC PHY clock set

Signed-off-by: Gábor Stefanik <[email protected]>

---
drivers/net/wireless/b43/phy_n.c | 13 ++++++++++++-
include/linux/ssb/ssb_regs.h | 1 +
2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index f1b5707..d2dab55 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -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);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index a6d5225..b2d4bed 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -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 */
--
1.6.4.2


2010-08-16 20:47:38

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 4/4] b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs

On 08/16/2010 10:39 PM, Gábor Stefanik wrote:
> +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.

--
Greetings Michael.

2010-08-16 20:39:17

by Gábor Stefanik

[permalink] [raw]
Subject: [PATCH 2/4] b43: N-PHY: Fix typo in function name (gain_crtl -> gain_ctrl)

Signed-off-by: Gábor Stefanik <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index cb815cc..f1b5707 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -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)
--
1.6.4.2


2010-08-16 20:39:24

by Gábor Stefanik

[permalink] [raw]
Subject: [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.

Signed-off-by: Gábor Stefanik <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 40 +++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index d2dab55..92cf8b8 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -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 */

--
1.6.4.2


2010-08-17 06:38:26

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 4/4] b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs

On Mon, Aug 16, 2010 at 10:47 PM, Michael B?sch <[email protected]> wrote:
> On 08/16/2010 10:39 PM, G?bor Stefanik wrote:
>>
>> +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").

>
> --
> Greetings Michael.
>



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