aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-04-03 12:01:12 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 16:44:41 -0400
commit7b584163979a9fe2ebfdd57a9d64cbe27166ab70 (patch)
treedfea5d287564ecb38513f71ed21c68d54059c5bb
parent9cfb0009dab6d6b4c5a15c5d74ab60d7a7a7371b (diff)
b43: Add more N-PHY stuff
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>
-rw-r--r--drivers/net/wireless/b43/main.c14
-rw-r--r--drivers/net/wireless/b43/nphy.c1
-rw-r--r--drivers/net/wireless/b43/xmit.c23
-rw-r--r--drivers/net/wireless/b43/xmit.h15
4 files changed, 41 insertions, 12 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 355f28a2f7f5..3fb4ef816842 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -46,6 +46,7 @@
46#include "main.h" 46#include "main.h"
47#include "debugfs.h" 47#include "debugfs.h"
48#include "phy.h" 48#include "phy.h"
49#include "nphy.h"
49#include "dma.h" 50#include "dma.h"
50#include "pio.h" 51#include "pio.h"
51#include "sysfs.h" 52#include "sysfs.h"
@@ -1019,7 +1020,18 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
1019/* Turn the Analog ON/OFF */ 1020/* Turn the Analog ON/OFF */
1020static void b43_switch_analog(struct b43_wldev *dev, int on) 1021static void b43_switch_analog(struct b43_wldev *dev, int on)
1021{ 1022{
1022 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4); 1023 switch (dev->phy.type) {
1024 case B43_PHYTYPE_A:
1025 case B43_PHYTYPE_G:
1026 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
1027 break;
1028 case B43_PHYTYPE_N:
1029 b43_phy_write(dev, B43_NPHY_AFECTL_OVER,
1030 on ? 0 : 0x7FFF);
1031 break;
1032 default:
1033 B43_WARN_ON(1);
1034 }
1023} 1035}
1024 1036
1025void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) 1037void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
diff --git a/drivers/net/wireless/b43/nphy.c b/drivers/net/wireless/b43/nphy.c
index 705131ef4bfa..8695eb223476 100644
--- a/drivers/net/wireless/b43/nphy.c
+++ b/drivers/net/wireless/b43/nphy.c
@@ -240,7 +240,6 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
240 240
241 b43_phy_set(dev, B43_NPHY_IQFLIP, 241 b43_phy_set(dev, B43_NPHY_IQFLIP,
242 B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2); 242 B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2);
243 //FIXME the following condition is different in the specs.
244 if (1 /* FIXME band is 2.4GHz */) { 243 if (1 /* FIXME band is 2.4GHz */) {
245 b43_phy_set(dev, B43_NPHY_CLASSCTL, 244 b43_phy_set(dev, B43_NPHY_CLASSCTL,
246 B43_NPHY_CLASSCTL_CCKEN); 245 B43_NPHY_CLASSCTL_CCKEN);
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index b2a3123f42db..19aefbfb2c93 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -513,7 +513,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
513 u32 macstat; 513 u32 macstat;
514 u16 chanid; 514 u16 chanid;
515 u16 phytype; 515 u16 phytype;
516 u8 jssi;
517 int padding; 516 int padding;
518 517
519 memset(&status, 0, sizeof(status)); 518 memset(&status, 0, sizeof(status));
@@ -521,7 +520,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
521 /* Get metadata about the frame from the header. */ 520 /* Get metadata about the frame from the header. */
522 phystat0 = le16_to_cpu(rxhdr->phy_status0); 521 phystat0 = le16_to_cpu(rxhdr->phy_status0);
523 phystat3 = le16_to_cpu(rxhdr->phy_status3); 522 phystat3 = le16_to_cpu(rxhdr->phy_status3);
524 jssi = rxhdr->jssi;
525 macstat = le32_to_cpu(rxhdr->mac_status); 523 macstat = le32_to_cpu(rxhdr->mac_status);
526 mactime = le16_to_cpu(rxhdr->mac_time); 524 mactime = le16_to_cpu(rxhdr->mac_time);
527 chanstat = le16_to_cpu(rxhdr->channel); 525 chanstat = le16_to_cpu(rxhdr->channel);
@@ -575,13 +573,22 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
575 } 573 }
576 } 574 }
577 575
578 status.ssi = b43_rssi_postprocess(dev, jssi, 576 /* Link quality statistics */
579 (phystat0 & B43_RX_PHYST0_OFDM),
580 (phystat0 & B43_RX_PHYST0_GAINCTL),
581 (phystat3 & B43_RX_PHYST3_TRSTATE));
582 status.noise = dev->stats.link_noise; 577 status.noise = dev->stats.link_noise;
583 /* the next line looks wrong, but is what mac80211 wants */ 578 if ((chanstat & B43_RX_CHAN_PHYTYPE) == B43_PHYTYPE_N) {
584 status.signal = (jssi * 100) / B43_RX_MAX_SSI; 579// s8 rssi = max(rxhdr->power0, rxhdr->power1);
580 //TODO: Find out what the rssi value is (dBm or percentage?)
581 // and also find out what the maximum possible value is.
582 // Fill status.ssi and status.signal fields.
583 } else {
584 status.ssi = b43_rssi_postprocess(dev, rxhdr->jssi,
585 (phystat0 & B43_RX_PHYST0_OFDM),
586 (phystat0 & B43_RX_PHYST0_GAINCTL),
587 (phystat3 & B43_RX_PHYST3_TRSTATE));
588 /* the next line looks wrong, but is what mac80211 wants */
589 status.signal = (rxhdr->jssi * 100) / B43_RX_MAX_SSI;
590 }
591
585 if (phystat0 & B43_RX_PHYST0_OFDM) 592 if (phystat0 & B43_RX_PHYST0_OFDM)
586 status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp, 593 status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp,
587 phytype == B43_PHYTYPE_A); 594 phytype == B43_PHYTYPE_A);
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 4f26988a5132..b05f44e0d626 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -212,8 +212,19 @@ struct b43_rxhdr_fw4 {
212 __le16 frame_len; /* Frame length */ 212 __le16 frame_len; /* Frame length */
213 PAD_BYTES(2); 213 PAD_BYTES(2);
214 __le16 phy_status0; /* PHY RX Status 0 */ 214 __le16 phy_status0; /* PHY RX Status 0 */
215 __u8 jssi; /* PHY RX Status 1: JSSI */ 215 union {
216 __u8 sig_qual; /* PHY RX Status 1: Signal Quality */ 216 /* RSSI for A/B/G-PHYs */
217 struct {
218 __u8 jssi; /* PHY RX Status 1: JSSI */
219 __u8 sig_qual; /* PHY RX Status 1: Signal Quality */
220 } __attribute__ ((__packed__));
221
222 /* RSSI for N-PHYs */
223 struct {
224 __s8 power0; /* PHY RX Status 1: Power 0 */
225 __s8 power1; /* PHY RX Status 1: Power 1 */
226 } __attribute__ ((__packed__));
227 } __attribute__ ((__packed__));
217 __le16 phy_status2; /* PHY RX Status 2 */ 228 __le16 phy_status2; /* PHY RX Status 2 */
218 __le16 phy_status3; /* PHY RX Status 3 */ 229 __le16 phy_status3; /* PHY RX Status 3 */
219 __le32 mac_status; /* MAC RX status */ 230 __le32 mac_status; /* MAC RX status */