]> err.no Git - linux-2.6/commitdiff
b43: Add more N-PHY stuff
authorMichael Buesch <mb@bu3sch.de>
Thu, 3 Apr 2008 16:01:12 +0000 (18:01 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Apr 2008 20:44:41 +0000 (16:44 -0400)
This adds some minor stuff for N-PHY support. Nothing special.
Adds Analog switching and some TODOs for RSSI processing.
Just a patch I had floating around for quite some time now.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/nphy.c
drivers/net/wireless/b43/xmit.c
drivers/net/wireless/b43/xmit.h

index 355f28a2f7f557b10a370d8e4d2ba2c23c002b66..3fb4ef816842618abc7e49187328ef49bad18ec2 100644 (file)
@@ -46,6 +46,7 @@
 #include "main.h"
 #include "debugfs.h"
 #include "phy.h"
+#include "nphy.h"
 #include "dma.h"
 #include "pio.h"
 #include "sysfs.h"
@@ -1019,7 +1020,18 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
 /* Turn the Analog ON/OFF */
 static void b43_switch_analog(struct b43_wldev *dev, int on)
 {
-       b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
+       switch (dev->phy.type) {
+       case B43_PHYTYPE_A:
+       case B43_PHYTYPE_G:
+               b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
+               break;
+       case B43_PHYTYPE_N:
+               b43_phy_write(dev, B43_NPHY_AFECTL_OVER,
+                             on ? 0 : 0x7FFF);
+               break;
+       default:
+               B43_WARN_ON(1);
+       }
 }
 
 void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
index 705131ef4bfaa74e1ab1e046267c97e52d784bde..8695eb2234763a6420e70b06e1149e1c1c73824b 100644 (file)
@@ -240,7 +240,6 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
 
        b43_phy_set(dev, B43_NPHY_IQFLIP,
                    B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2);
-       //FIXME the following condition is different in the specs.
        if (1 /* FIXME band is 2.4GHz */) {
                b43_phy_set(dev, B43_NPHY_CLASSCTL,
                            B43_NPHY_CLASSCTL_CCKEN);
index b2a3123f42dbc985335258203cd938584742ca83..19aefbfb2c930137d6ca8ea1d5a5532713a1f46f 100644 (file)
@@ -513,7 +513,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        u32 macstat;
        u16 chanid;
        u16 phytype;
-       u8 jssi;
        int padding;
 
        memset(&status, 0, sizeof(status));
@@ -521,7 +520,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        /* Get metadata about the frame from the header. */
        phystat0 = le16_to_cpu(rxhdr->phy_status0);
        phystat3 = le16_to_cpu(rxhdr->phy_status3);
-       jssi = rxhdr->jssi;
        macstat = le32_to_cpu(rxhdr->mac_status);
        mactime = le16_to_cpu(rxhdr->mac_time);
        chanstat = le16_to_cpu(rxhdr->channel);
@@ -575,13 +573,22 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
                }
        }
 
-       status.ssi = b43_rssi_postprocess(dev, jssi,
-                                         (phystat0 & B43_RX_PHYST0_OFDM),
-                                         (phystat0 & B43_RX_PHYST0_GAINCTL),
-                                         (phystat3 & B43_RX_PHYST3_TRSTATE));
+       /* Link quality statistics */
        status.noise = dev->stats.link_noise;
-       /* the next line looks wrong, but is what mac80211 wants */
-       status.signal = (jssi * 100) / B43_RX_MAX_SSI;
+       if ((chanstat & B43_RX_CHAN_PHYTYPE) == B43_PHYTYPE_N) {
+//             s8 rssi = max(rxhdr->power0, rxhdr->power1);
+               //TODO: Find out what the rssi value is (dBm or percentage?)
+               //      and also find out what the maximum possible value is.
+               //      Fill status.ssi and status.signal fields.
+       } else {
+               status.ssi = b43_rssi_postprocess(dev, rxhdr->jssi,
+                                                 (phystat0 & B43_RX_PHYST0_OFDM),
+                                                 (phystat0 & B43_RX_PHYST0_GAINCTL),
+                                                 (phystat3 & B43_RX_PHYST3_TRSTATE));
+               /* the next line looks wrong, but is what mac80211 wants */
+               status.signal = (rxhdr->jssi * 100) / B43_RX_MAX_SSI;
+       }
+
        if (phystat0 & B43_RX_PHYST0_OFDM)
                status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp,
                                                phytype == B43_PHYTYPE_A);
index 4f26988a5132aa866ff15cc06e399f6d9f1ab289..b05f44e0d626cfcb8eb8148df36327071325a4dc 100644 (file)
@@ -212,8 +212,19 @@ struct b43_rxhdr_fw4 {
        __le16 frame_len;       /* Frame length */
         PAD_BYTES(2);
        __le16 phy_status0;     /* PHY RX Status 0 */
-       __u8 jssi;              /* PHY RX Status 1: JSSI */
-       __u8 sig_qual;          /* PHY RX Status 1: Signal Quality */
+       union {
+               /* RSSI for A/B/G-PHYs */
+               struct {
+                       __u8 jssi;      /* PHY RX Status 1: JSSI */
+                       __u8 sig_qual;  /* PHY RX Status 1: Signal Quality */
+               } __attribute__ ((__packed__));
+
+               /* RSSI for N-PHYs */
+               struct {
+                       __s8 power0;    /* PHY RX Status 1: Power 0 */
+                       __s8 power1;    /* PHY RX Status 1: Power 1 */
+               } __attribute__ ((__packed__));
+       } __attribute__ ((__packed__));
        __le16 phy_status2;     /* PHY RX Status 2 */
        __le16 phy_status3;     /* PHY RX Status 3 */
        __le32 mac_status;      /* MAC RX status */