mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 12:14:01 +08:00
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>
This commit is contained in:
parent
9cfb0009da
commit
7b58416397
@ -46,6 +46,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "debugfs.h"
|
#include "debugfs.h"
|
||||||
#include "phy.h"
|
#include "phy.h"
|
||||||
|
#include "nphy.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
#include "pio.h"
|
#include "pio.h"
|
||||||
#include "sysfs.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 */
|
/* Turn the Analog ON/OFF */
|
||||||
static void b43_switch_analog(struct b43_wldev *dev, int on)
|
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)
|
void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
|
||||||
|
@ -240,7 +240,6 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
|
|||||||
|
|
||||||
b43_phy_set(dev, B43_NPHY_IQFLIP,
|
b43_phy_set(dev, B43_NPHY_IQFLIP,
|
||||||
B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2);
|
B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2);
|
||||||
//FIXME the following condition is different in the specs.
|
|
||||||
if (1 /* FIXME band is 2.4GHz */) {
|
if (1 /* FIXME band is 2.4GHz */) {
|
||||||
b43_phy_set(dev, B43_NPHY_CLASSCTL,
|
b43_phy_set(dev, B43_NPHY_CLASSCTL,
|
||||||
B43_NPHY_CLASSCTL_CCKEN);
|
B43_NPHY_CLASSCTL_CCKEN);
|
||||||
|
@ -513,7 +513,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
|
|||||||
u32 macstat;
|
u32 macstat;
|
||||||
u16 chanid;
|
u16 chanid;
|
||||||
u16 phytype;
|
u16 phytype;
|
||||||
u8 jssi;
|
|
||||||
int padding;
|
int padding;
|
||||||
|
|
||||||
memset(&status, 0, sizeof(status));
|
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. */
|
/* Get metadata about the frame from the header. */
|
||||||
phystat0 = le16_to_cpu(rxhdr->phy_status0);
|
phystat0 = le16_to_cpu(rxhdr->phy_status0);
|
||||||
phystat3 = le16_to_cpu(rxhdr->phy_status3);
|
phystat3 = le16_to_cpu(rxhdr->phy_status3);
|
||||||
jssi = rxhdr->jssi;
|
|
||||||
macstat = le32_to_cpu(rxhdr->mac_status);
|
macstat = le32_to_cpu(rxhdr->mac_status);
|
||||||
mactime = le16_to_cpu(rxhdr->mac_time);
|
mactime = le16_to_cpu(rxhdr->mac_time);
|
||||||
chanstat = le16_to_cpu(rxhdr->channel);
|
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,
|
/* Link quality statistics */
|
||||||
(phystat0 & B43_RX_PHYST0_OFDM),
|
|
||||||
(phystat0 & B43_RX_PHYST0_GAINCTL),
|
|
||||||
(phystat3 & B43_RX_PHYST3_TRSTATE));
|
|
||||||
status.noise = dev->stats.link_noise;
|
status.noise = dev->stats.link_noise;
|
||||||
/* the next line looks wrong, but is what mac80211 wants */
|
if ((chanstat & B43_RX_CHAN_PHYTYPE) == B43_PHYTYPE_N) {
|
||||||
status.signal = (jssi * 100) / B43_RX_MAX_SSI;
|
// 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)
|
if (phystat0 & B43_RX_PHYST0_OFDM)
|
||||||
status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp,
|
status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp,
|
||||||
phytype == B43_PHYTYPE_A);
|
phytype == B43_PHYTYPE_A);
|
||||||
|
@ -212,8 +212,19 @@ struct b43_rxhdr_fw4 {
|
|||||||
__le16 frame_len; /* Frame length */
|
__le16 frame_len; /* Frame length */
|
||||||
PAD_BYTES(2);
|
PAD_BYTES(2);
|
||||||
__le16 phy_status0; /* PHY RX Status 0 */
|
__le16 phy_status0; /* PHY RX Status 0 */
|
||||||
__u8 jssi; /* PHY RX Status 1: JSSI */
|
union {
|
||||||
__u8 sig_qual; /* PHY RX Status 1: Signal Quality */
|
/* 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_status2; /* PHY RX Status 2 */
|
||||||
__le16 phy_status3; /* PHY RX Status 3 */
|
__le16 phy_status3; /* PHY RX Status 3 */
|
||||||
__le32 mac_status; /* MAC RX status */
|
__le32 mac_status; /* MAC RX status */
|
||||||
|
Loading…
Reference in New Issue
Block a user