mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 01:43:08 +02:00
Update b43 to work in AP mode
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12300 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ccec079b2f
commit
d3fbe99b9d
@ -29,6 +29,13 @@ PKG_FWCUTTER_SOURCE:=$(PKG_FWCUTTER_NAME)-$(PKG_FWCUTTER_VERSION).tar.bz2
|
||||
PKG_FWCUTTER_SOURCE_URL:=http://bu3sch.de/b43/fwcutter/
|
||||
PKG_FWCUTTER_MD5SUM:=3db2f4de85a459451f5b391cf67a8d44
|
||||
|
||||
PKG_SRC_NAME:=b43-src
|
||||
PKG_SRC_VERSION:=2008-08-06
|
||||
|
||||
PKG_SRC_SOURCE:=compat-wireless-$(PKG_SRC_VERSION).tar.bz2
|
||||
PKG_SRC_SOURCE_URL:=http://www.orbit-lab.org/kernel/compat-wireless-2.6/2008/08/
|
||||
PKG_SRC_MD5SUM:=9563ceeed86bca0859ad5f010623277c
|
||||
|
||||
define KernelPackage/b43
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=Broadcom 43xx wireless support
|
||||
@ -72,9 +79,10 @@ $(DL_DIR)/$(PKG_FWCUTTER_SOURCE):
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
tar xjf "$(DL_DIR)/$(PKG_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)"
|
||||
tar xjf "$(DL_DIR)/$(PKG_FWCUTTER_SOURCE)" -C "$(PKG_BUILD_DIR)"
|
||||
tar xjf "$(DL_DIR)/$(PKG_SRC_SOURCE)" -C "$(PKG_BUILD_DIR)"
|
||||
$(CP) $(PKG_BUILD_DIR)/compat-wireless-$(PKG_SRC_VERSION)/drivers/net/wireless/b43/* $(PKG_BUILD_DIR)/
|
||||
$(Build/Patch)
|
||||
$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
|
||||
endef
|
||||
|
@ -1,26 +0,0 @@
|
||||
Index: b43/main.c
|
||||
===================================================================
|
||||
--- b43.orig/main.c 2008-02-15 22:39:48.000000000 +0100
|
||||
+++ b43/main.c 2008-02-15 22:45:38.000000000 +0100
|
||||
@@ -2939,7 +2942,7 @@ static int b43_op_set_key(struct ieee802
|
||||
u8 algorithm;
|
||||
u8 index;
|
||||
int err;
|
||||
- DECLARE_MAC_BUF(mac);
|
||||
+// DECLARE_MAC_BUF(mac);
|
||||
|
||||
if (modparam_nohwcrypt)
|
||||
return -ENOSPC; /* User disabled HW-crypto */
|
||||
@@ -3019,10 +3022,12 @@ out_unlock:
|
||||
spin_unlock_irqrestore(&wl->irq_lock, flags);
|
||||
mutex_unlock(&wl->mutex);
|
||||
if (!err) {
|
||||
+#if 0
|
||||
b43dbg(wl, "%s hardware based encryption for keyidx: %d, "
|
||||
"mac: %s\n",
|
||||
cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
|
||||
print_mac(mac, addr));
|
||||
+#endif
|
||||
}
|
||||
return err;
|
||||
}
|
152
package/b43/patches/002-ssb-backport.patch
Normal file
152
package/b43/patches/002-ssb-backport.patch
Normal file
@ -0,0 +1,152 @@
|
||||
Index: b43/dma.c
|
||||
===================================================================
|
||||
--- b43.orig/dma.c 2008-07-27 13:56:25.000000000 +0200
|
||||
+++ b43/dma.c 2008-07-27 14:02:26.000000000 +0200
|
||||
@@ -328,11 +328,11 @@ static inline
|
||||
dma_addr_t dmaaddr;
|
||||
|
||||
if (tx) {
|
||||
- dmaaddr = ssb_dma_map_single(ring->dev->dev,
|
||||
- buf, len, DMA_TO_DEVICE);
|
||||
+ dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
|
||||
+ buf, len, DMA_TO_DEVICE);
|
||||
} else {
|
||||
- dmaaddr = ssb_dma_map_single(ring->dev->dev,
|
||||
- buf, len, DMA_FROM_DEVICE);
|
||||
+ dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
|
||||
+ buf, len, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
return dmaaddr;
|
||||
@@ -343,11 +343,11 @@ static inline
|
||||
dma_addr_t addr, size_t len, int tx)
|
||||
{
|
||||
if (tx) {
|
||||
- ssb_dma_unmap_single(ring->dev->dev,
|
||||
- addr, len, DMA_TO_DEVICE);
|
||||
+ dma_unmap_single(ring->dev->dev->dma_dev,
|
||||
+ addr, len, DMA_TO_DEVICE);
|
||||
} else {
|
||||
- ssb_dma_unmap_single(ring->dev->dev,
|
||||
- addr, len, DMA_FROM_DEVICE);
|
||||
+ dma_unmap_single(ring->dev->dev->dma_dev,
|
||||
+ addr, len, DMA_FROM_DEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,8 +356,8 @@ static inline
|
||||
dma_addr_t addr, size_t len)
|
||||
{
|
||||
B43_WARN_ON(ring->tx);
|
||||
- ssb_dma_sync_single_for_cpu(ring->dev->dev,
|
||||
- addr, len, DMA_FROM_DEVICE);
|
||||
+ dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
|
||||
+ addr, len, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -365,8 +365,8 @@ static inline
|
||||
dma_addr_t addr, size_t len)
|
||||
{
|
||||
B43_WARN_ON(ring->tx);
|
||||
- ssb_dma_sync_single_for_device(ring->dev->dev,
|
||||
- addr, len, DMA_FROM_DEVICE);
|
||||
+ dma_sync_single_for_device(ring->dev->dev->dma_dev,
|
||||
+ addr, len, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -381,6 +381,7 @@ static inline
|
||||
|
||||
static int alloc_ringmemory(struct b43_dmaring *ring)
|
||||
{
|
||||
+ struct device *dma_dev = ring->dev->dev->dma_dev;
|
||||
gfp_t flags = GFP_KERNEL;
|
||||
|
||||
/* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
|
||||
@@ -391,14 +392,11 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
|
||||
* For unknown reasons - possibly a hardware error - the BCM4311 rev
|
||||
* 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
|
||||
* which accounts for the GFP_DMA flag below.
|
||||
- *
|
||||
- * The flags here must match the flags in free_ringmemory below!
|
||||
*/
|
||||
if (ring->type == B43_DMA_64BIT)
|
||||
flags |= GFP_DMA;
|
||||
- ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
|
||||
- B43_DMA_RINGMEMSIZE,
|
||||
- &(ring->dmabase), flags);
|
||||
+ ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
|
||||
+ &(ring->dmabase), flags);
|
||||
if (!ring->descbase) {
|
||||
b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
|
||||
return -ENOMEM;
|
||||
@@ -410,13 +408,10 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
|
||||
|
||||
static void free_ringmemory(struct b43_dmaring *ring)
|
||||
{
|
||||
- gfp_t flags = GFP_KERNEL;
|
||||
-
|
||||
- if (ring->type == B43_DMA_64BIT)
|
||||
- flags |= GFP_DMA;
|
||||
+ struct device *dma_dev = ring->dev->dev->dma_dev;
|
||||
|
||||
- ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE,
|
||||
- ring->descbase, ring->dmabase, flags);
|
||||
+ dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
|
||||
+ ring->descbase, ring->dmabase);
|
||||
}
|
||||
|
||||
/* Reset the RX DMA channel */
|
||||
@@ -523,7 +518,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring,
|
||||
dma_addr_t addr,
|
||||
size_t buffersize, bool dma_to_device)
|
||||
{
|
||||
- if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
|
||||
+ if (unlikely(dma_mapping_error(addr)))
|
||||
return 1;
|
||||
|
||||
switch (ring->type) {
|
||||
@@ -849,10 +844,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
|
||||
goto err_kfree_meta;
|
||||
|
||||
/* test for ability to dma to txhdr_cache */
|
||||
- dma_test = ssb_dma_map_single(dev->dev,
|
||||
- ring->txhdr_cache,
|
||||
- b43_txhdr_size(dev),
|
||||
- DMA_TO_DEVICE);
|
||||
+ dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
+ ring->txhdr_cache,
|
||||
+ b43_txhdr_size(dev),
|
||||
+ DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
@@ -864,10 +859,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
|
||||
if (!ring->txhdr_cache)
|
||||
goto err_kfree_meta;
|
||||
|
||||
- dma_test = ssb_dma_map_single(dev->dev,
|
||||
- ring->txhdr_cache,
|
||||
- b43_txhdr_size(dev),
|
||||
- DMA_TO_DEVICE);
|
||||
+ dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
+ ring->txhdr_cache,
|
||||
+ b43_txhdr_size(dev),
|
||||
+ DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
@@ -878,9 +873,9 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
|
||||
}
|
||||
}
|
||||
|
||||
- ssb_dma_unmap_single(dev->dev,
|
||||
- dma_test, b43_txhdr_size(dev),
|
||||
- DMA_TO_DEVICE);
|
||||
+ dma_unmap_single(dev->dev->dma_dev,
|
||||
+ dma_test, b43_txhdr_size(dev),
|
||||
+ DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
err = alloc_ringmemory(ring);
|
@ -1,95 +0,0 @@
|
||||
config B43
|
||||
tristate "Broadcom 43xx wireless support (mac80211 stack)"
|
||||
depends on SSB_POSSIBLE && MAC80211 && WLAN_80211
|
||||
select SSB
|
||||
select FW_LOADER
|
||||
select HW_RANDOM
|
||||
---help---
|
||||
b43 is a driver for the Broadcom 43xx series wireless devices.
|
||||
|
||||
Check "lspci" for something like
|
||||
"Broadcom Corporation BCM43XX 802.11 Wireless LAN Controller"
|
||||
to determine whether you own such a device.
|
||||
|
||||
This driver supports the new BCM43xx IEEE 802.11G devices, but not
|
||||
the old IEEE 802.11B devices. Old devices are supported by
|
||||
the b43legacy driver.
|
||||
Note that this has nothing to do with the standard that your AccessPoint
|
||||
supports (A, B, G or a combination).
|
||||
IEEE 802.11G devices can talk to IEEE 802.11B AccessPoints.
|
||||
|
||||
It is safe to include both b43 and b43legacy as the underlying glue
|
||||
layer will automatically load the correct version for your device.
|
||||
|
||||
This driver uses V4 firmware, which must be installed separately using
|
||||
b43-fwcutter.
|
||||
|
||||
This driver can be built as a module (recommended) that will be called "b43".
|
||||
If unsure, say M.
|
||||
|
||||
# Auto-select SSB PCI-HOST support, if possible
|
||||
config B43_PCI_AUTOSELECT
|
||||
bool
|
||||
depends on B43 && SSB_PCIHOST_POSSIBLE
|
||||
select SSB_PCIHOST
|
||||
default y
|
||||
|
||||
# Auto-select SSB PCICORE driver, if possible
|
||||
config B43_PCICORE_AUTOSELECT
|
||||
bool
|
||||
depends on B43 && SSB_DRIVER_PCICORE_POSSIBLE
|
||||
select SSB_DRIVER_PCICORE
|
||||
default y
|
||||
|
||||
config B43_PCMCIA
|
||||
bool "Broadcom 43xx PCMCIA device support (EXPERIMENTAL)"
|
||||
depends on B43 && SSB_PCMCIAHOST_POSSIBLE && EXPERIMENTAL
|
||||
select SSB_PCMCIAHOST
|
||||
---help---
|
||||
Broadcom 43xx PCMCIA device support.
|
||||
|
||||
Support for 16bit PCMCIA devices.
|
||||
Please note that most PC-CARD devices are _NOT_ 16bit PCMCIA
|
||||
devices, but 32bit CardBUS devices. CardBUS devices are supported
|
||||
out of the box by b43.
|
||||
|
||||
With this config option you can drive b43 cards in
|
||||
CompactFlash formfactor in a PCMCIA adaptor.
|
||||
CF b43 cards can sometimes be found in handheld PCs.
|
||||
|
||||
It's safe to select Y here, even if you don't have a B43 PCMCIA device.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config B43_NPHY
|
||||
bool "Pre IEEE 802.11n support (BROKEN)"
|
||||
depends on B43 && EXPERIMENTAL
|
||||
---help---
|
||||
Support for the IEEE 802.11n draft.
|
||||
|
||||
THIS IS BROKEN AND DOES NOT WORK YET.
|
||||
|
||||
SAY N.
|
||||
|
||||
# This config option automatically enables b43 LEDS support,
|
||||
# if it's possible.
|
||||
config B43_LEDS
|
||||
bool
|
||||
depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
|
||||
default y
|
||||
|
||||
# This config option automatically enables b43 RFKILL support,
|
||||
# if it's possible.
|
||||
config B43_RFKILL
|
||||
bool
|
||||
depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43)
|
||||
default y
|
||||
|
||||
config B43_DEBUG
|
||||
bool "Broadcom 43xx debugging"
|
||||
depends on B43
|
||||
---help---
|
||||
Broadcom 43xx debugging messages.
|
||||
|
||||
Say Y, if you want to find out why the driver does not
|
||||
work for you.
|
@ -1,17 +0,0 @@
|
||||
b43-y += main.o
|
||||
b43-y += tables.o
|
||||
b43-$(CONFIG_B43_NPHY) += tables_nphy.o
|
||||
b43-y += phy.o
|
||||
b43-$(CONFIG_B43_NPHY) += nphy.o
|
||||
b43-y += sysfs.o
|
||||
b43-y += xmit.o
|
||||
b43-y += lo.o
|
||||
b43-y += wa.o
|
||||
b43-y += dma.o
|
||||
b43-$(CONFIG_B43_PIO) += pio.o
|
||||
b43-$(CONFIG_B43_RFKILL) += rfkill.o
|
||||
b43-$(CONFIG_B43_LEDS) += leds.o
|
||||
b43-$(CONFIG_B43_PCMCIA) += pcmcia.o
|
||||
b43-$(CONFIG_B43_DEBUG) += debugfs.o
|
||||
|
||||
obj-$(CONFIG_B43) += b43.o
|
@ -1,976 +0,0 @@
|
||||
#ifndef B43_H_
|
||||
#define B43_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/hw_random.h>
|
||||
#include <linux/ssb/ssb.h>
|
||||
#include <net/mac80211.h>
|
||||
|
||||
#include "debugfs.h"
|
||||
#include "leds.h"
|
||||
#include "rfkill.h"
|
||||
#include "lo.h"
|
||||
#include "phy.h"
|
||||
|
||||
|
||||
/* The unique identifier of the firmware that's officially supported by
|
||||
* this driver version. */
|
||||
#define B43_SUPPORTED_FIRMWARE_ID "FW13"
|
||||
|
||||
|
||||
#ifdef CONFIG_B43_DEBUG
|
||||
# define B43_DEBUG 1
|
||||
#else
|
||||
# define B43_DEBUG 0
|
||||
#endif
|
||||
|
||||
#define B43_RX_MAX_SSI 60
|
||||
|
||||
/* MMIO offsets */
|
||||
#define B43_MMIO_DMA0_REASON 0x20
|
||||
#define B43_MMIO_DMA0_IRQ_MASK 0x24
|
||||
#define B43_MMIO_DMA1_REASON 0x28
|
||||
#define B43_MMIO_DMA1_IRQ_MASK 0x2C
|
||||
#define B43_MMIO_DMA2_REASON 0x30
|
||||
#define B43_MMIO_DMA2_IRQ_MASK 0x34
|
||||
#define B43_MMIO_DMA3_REASON 0x38
|
||||
#define B43_MMIO_DMA3_IRQ_MASK 0x3C
|
||||
#define B43_MMIO_DMA4_REASON 0x40
|
||||
#define B43_MMIO_DMA4_IRQ_MASK 0x44
|
||||
#define B43_MMIO_DMA5_REASON 0x48
|
||||
#define B43_MMIO_DMA5_IRQ_MASK 0x4C
|
||||
#define B43_MMIO_MACCTL 0x120 /* MAC control */
|
||||
#define B43_MMIO_MACCMD 0x124 /* MAC command */
|
||||
#define B43_MMIO_GEN_IRQ_REASON 0x128
|
||||
#define B43_MMIO_GEN_IRQ_MASK 0x12C
|
||||
#define B43_MMIO_RAM_CONTROL 0x130
|
||||
#define B43_MMIO_RAM_DATA 0x134
|
||||
#define B43_MMIO_PS_STATUS 0x140
|
||||
#define B43_MMIO_RADIO_HWENABLED_HI 0x158
|
||||
#define B43_MMIO_SHM_CONTROL 0x160
|
||||
#define B43_MMIO_SHM_DATA 0x164
|
||||
#define B43_MMIO_SHM_DATA_UNALIGNED 0x166
|
||||
#define B43_MMIO_XMITSTAT_0 0x170
|
||||
#define B43_MMIO_XMITSTAT_1 0x174
|
||||
#define B43_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */
|
||||
#define B43_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */
|
||||
#define B43_MMIO_TSF_CFP_REP 0x188
|
||||
#define B43_MMIO_TSF_CFP_START 0x18C
|
||||
#define B43_MMIO_TSF_CFP_MAXDUR 0x190
|
||||
|
||||
/* 32-bit DMA */
|
||||
#define B43_MMIO_DMA32_BASE0 0x200
|
||||
#define B43_MMIO_DMA32_BASE1 0x220
|
||||
#define B43_MMIO_DMA32_BASE2 0x240
|
||||
#define B43_MMIO_DMA32_BASE3 0x260
|
||||
#define B43_MMIO_DMA32_BASE4 0x280
|
||||
#define B43_MMIO_DMA32_BASE5 0x2A0
|
||||
/* 64-bit DMA */
|
||||
#define B43_MMIO_DMA64_BASE0 0x200
|
||||
#define B43_MMIO_DMA64_BASE1 0x240
|
||||
#define B43_MMIO_DMA64_BASE2 0x280
|
||||
#define B43_MMIO_DMA64_BASE3 0x2C0
|
||||
#define B43_MMIO_DMA64_BASE4 0x300
|
||||
#define B43_MMIO_DMA64_BASE5 0x340
|
||||
|
||||
/* PIO on core rev < 11 */
|
||||
#define B43_MMIO_PIO_BASE0 0x300
|
||||
#define B43_MMIO_PIO_BASE1 0x310
|
||||
#define B43_MMIO_PIO_BASE2 0x320
|
||||
#define B43_MMIO_PIO_BASE3 0x330
|
||||
#define B43_MMIO_PIO_BASE4 0x340
|
||||
#define B43_MMIO_PIO_BASE5 0x350
|
||||
#define B43_MMIO_PIO_BASE6 0x360
|
||||
#define B43_MMIO_PIO_BASE7 0x370
|
||||
/* PIO on core rev >= 11 */
|
||||
#define B43_MMIO_PIO11_BASE0 0x200
|
||||
#define B43_MMIO_PIO11_BASE1 0x240
|
||||
#define B43_MMIO_PIO11_BASE2 0x280
|
||||
#define B43_MMIO_PIO11_BASE3 0x2C0
|
||||
#define B43_MMIO_PIO11_BASE4 0x300
|
||||
#define B43_MMIO_PIO11_BASE5 0x340
|
||||
|
||||
#define B43_MMIO_PHY_VER 0x3E0
|
||||
#define B43_MMIO_PHY_RADIO 0x3E2
|
||||
#define B43_MMIO_PHY0 0x3E6
|
||||
#define B43_MMIO_ANTENNA 0x3E8
|
||||
#define B43_MMIO_CHANNEL 0x3F0
|
||||
#define B43_MMIO_CHANNEL_EXT 0x3F4
|
||||
#define B43_MMIO_RADIO_CONTROL 0x3F6
|
||||
#define B43_MMIO_RADIO_DATA_HIGH 0x3F8
|
||||
#define B43_MMIO_RADIO_DATA_LOW 0x3FA
|
||||
#define B43_MMIO_PHY_CONTROL 0x3FC
|
||||
#define B43_MMIO_PHY_DATA 0x3FE
|
||||
#define B43_MMIO_MACFILTER_CONTROL 0x420
|
||||
#define B43_MMIO_MACFILTER_DATA 0x422
|
||||
#define B43_MMIO_RCMTA_COUNT 0x43C
|
||||
#define B43_MMIO_RADIO_HWENABLED_LO 0x49A
|
||||
#define B43_MMIO_GPIO_CONTROL 0x49C
|
||||
#define B43_MMIO_GPIO_MASK 0x49E
|
||||
#define B43_MMIO_TSF_CFP_START_LOW 0x604
|
||||
#define B43_MMIO_TSF_CFP_START_HIGH 0x606
|
||||
#define B43_MMIO_TSF_CFP_PRETBTT 0x612
|
||||
#define B43_MMIO_TSF_0 0x632 /* core rev < 3 only */
|
||||
#define B43_MMIO_TSF_1 0x634 /* core rev < 3 only */
|
||||
#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */
|
||||
#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */
|
||||
#define B43_MMIO_RNG 0x65A
|
||||
#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */
|
||||
#define B43_MMIO_IFSCTL_USE_EDCF 0x0004
|
||||
#define B43_MMIO_POWERUP_DELAY 0x6A8
|
||||
|
||||
/* SPROM boardflags_lo values */
|
||||
#define B43_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */
|
||||
#define B43_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */
|
||||
#define B43_BFL_AIRLINEMODE 0x0004 /* implements GPIO 13 radio disable indication */
|
||||
#define B43_BFL_RSSI 0x0008 /* software calculates nrssi slope. */
|
||||
#define B43_BFL_ENETSPI 0x0010 /* has ephy roboswitch spi */
|
||||
#define B43_BFL_XTAL_NOSLOW 0x0020 /* no slow clock available */
|
||||
#define B43_BFL_CCKHIPWR 0x0040 /* can do high power CCK transmission */
|
||||
#define B43_BFL_ENETADM 0x0080 /* has ADMtek switch */
|
||||
#define B43_BFL_ENETVLAN 0x0100 /* can do vlan */
|
||||
#define B43_BFL_AFTERBURNER 0x0200 /* supports Afterburner mode */
|
||||
#define B43_BFL_NOPCI 0x0400 /* leaves PCI floating */
|
||||
#define B43_BFL_FEM 0x0800 /* supports the Front End Module */
|
||||
#define B43_BFL_EXTLNA 0x1000 /* has an external LNA */
|
||||
#define B43_BFL_HGPA 0x2000 /* had high gain PA */
|
||||
#define B43_BFL_BTCMOD 0x4000 /* BFL_BTCOEXIST is given in alternate GPIOs */
|
||||
#define B43_BFL_ALTIQ 0x8000 /* alternate I/Q settings */
|
||||
|
||||
/* GPIO register offset, in both ChipCommon and PCI core. */
|
||||
#define B43_GPIO_CONTROL 0x6c
|
||||
|
||||
/* SHM Routing */
|
||||
enum {
|
||||
B43_SHM_UCODE, /* Microcode memory */
|
||||
B43_SHM_SHARED, /* Shared memory */
|
||||
B43_SHM_SCRATCH, /* Scratch memory */
|
||||
B43_SHM_HW, /* Internal hardware register */
|
||||
B43_SHM_RCMTA, /* Receive match transmitter address (rev >= 5 only) */
|
||||
};
|
||||
/* SHM Routing modifiers */
|
||||
#define B43_SHM_AUTOINC_R 0x0200 /* Auto-increment address on read */
|
||||
#define B43_SHM_AUTOINC_W 0x0100 /* Auto-increment address on write */
|
||||
#define B43_SHM_AUTOINC_RW (B43_SHM_AUTOINC_R | \
|
||||
B43_SHM_AUTOINC_W)
|
||||
|
||||
/* Misc SHM_SHARED offsets */
|
||||
#define B43_SHM_SH_WLCOREREV 0x0016 /* 802.11 core revision */
|
||||
#define B43_SHM_SH_PCTLWDPOS 0x0008
|
||||
#define B43_SHM_SH_RXPADOFF 0x0034 /* RX Padding data offset (PIO only) */
|
||||
#define B43_SHM_SH_PHYVER 0x0050 /* PHY version */
|
||||
#define B43_SHM_SH_PHYTYPE 0x0052 /* PHY type */
|
||||
#define B43_SHM_SH_ANTSWAP 0x005C /* Antenna swap threshold */
|
||||
#define B43_SHM_SH_HOSTFLO 0x005E /* Hostflags for ucode options (low) */
|
||||
#define B43_SHM_SH_HOSTFMI 0x0060 /* Hostflags for ucode options (middle) */
|
||||
#define B43_SHM_SH_HOSTFHI 0x0062 /* Hostflags for ucode options (high) */
|
||||
#define B43_SHM_SH_RFATT 0x0064 /* Current radio attenuation value */
|
||||
#define B43_SHM_SH_RADAR 0x0066 /* Radar register */
|
||||
#define B43_SHM_SH_PHYTXNOI 0x006E /* PHY noise directly after TX (lower 8bit only) */
|
||||
#define B43_SHM_SH_RFRXSP1 0x0072 /* RF RX SP Register 1 */
|
||||
#define B43_SHM_SH_CHAN 0x00A0 /* Current channel (low 8bit only) */
|
||||
#define B43_SHM_SH_CHAN_5GHZ 0x0100 /* Bit set, if 5Ghz channel */
|
||||
#define B43_SHM_SH_BCMCFIFOID 0x0108 /* Last posted cookie to the bcast/mcast FIFO */
|
||||
/* SHM_SHARED TX FIFO variables */
|
||||
#define B43_SHM_SH_SIZE01 0x0098 /* TX FIFO size for FIFO 0 (low) and 1 (high) */
|
||||
#define B43_SHM_SH_SIZE23 0x009A /* TX FIFO size for FIFO 2 and 3 */
|
||||
#define B43_SHM_SH_SIZE45 0x009C /* TX FIFO size for FIFO 4 and 5 */
|
||||
#define B43_SHM_SH_SIZE67 0x009E /* TX FIFO size for FIFO 6 and 7 */
|
||||
/* SHM_SHARED background noise */
|
||||
#define B43_SHM_SH_JSSI0 0x0088 /* Measure JSSI 0 */
|
||||
#define B43_SHM_SH_JSSI1 0x008A /* Measure JSSI 1 */
|
||||
#define B43_SHM_SH_JSSIAUX 0x008C /* Measure JSSI AUX */
|
||||
/* SHM_SHARED crypto engine */
|
||||
#define B43_SHM_SH_DEFAULTIV 0x003C /* Default IV location */
|
||||
#define B43_SHM_SH_NRRXTRANS 0x003E /* # of soft RX transmitter addresses (max 8) */
|
||||
#define B43_SHM_SH_KTP 0x0056 /* Key table pointer */
|
||||
#define B43_SHM_SH_TKIPTSCTTAK 0x0318
|
||||
#define B43_SHM_SH_KEYIDXBLOCK 0x05D4 /* Key index/algorithm block (v4 firmware) */
|
||||
#define B43_SHM_SH_PSM 0x05F4 /* PSM transmitter address match block (rev < 5) */
|
||||
/* SHM_SHARED WME variables */
|
||||
#define B43_SHM_SH_EDCFSTAT 0x000E /* EDCF status */
|
||||
#define B43_SHM_SH_TXFCUR 0x0030 /* TXF current index */
|
||||
#define B43_SHM_SH_EDCFQ 0x0240 /* EDCF Q info */
|
||||
/* SHM_SHARED powersave mode related */
|
||||
#define B43_SHM_SH_SLOTT 0x0010 /* Slot time */
|
||||
#define B43_SHM_SH_DTIMPER 0x0012 /* DTIM period */
|
||||
#define B43_SHM_SH_NOSLPZNATDTIM 0x004C /* NOSLPZNAT DTIM */
|
||||
/* SHM_SHARED beacon/AP variables */
|
||||
#define B43_SHM_SH_BTL0 0x0018 /* Beacon template length 0 */
|
||||
#define B43_SHM_SH_BTL1 0x001A /* Beacon template length 1 */
|
||||
#define B43_SHM_SH_BTSFOFF 0x001C /* Beacon TSF offset */
|
||||
#define B43_SHM_SH_TIMBPOS 0x001E /* TIM B position in beacon */
|
||||
#define B43_SHM_SH_DTIMP 0x0012 /* DTIP period */
|
||||
#define B43_SHM_SH_MCASTCOOKIE 0x00A8 /* Last bcast/mcast frame ID */
|
||||
#define B43_SHM_SH_SFFBLIM 0x0044 /* Short frame fallback retry limit */
|
||||
#define B43_SHM_SH_LFFBLIM 0x0046 /* Long frame fallback retry limit */
|
||||
#define B43_SHM_SH_BEACPHYCTL 0x0054 /* Beacon PHY TX control word (see PHY TX control) */
|
||||
#define B43_SHM_SH_EXTNPHYCTL 0x00B0 /* Extended bytes for beacon PHY control (N) */
|
||||
/* SHM_SHARED ACK/CTS control */
|
||||
#define B43_SHM_SH_ACKCTSPHYCTL 0x0022 /* ACK/CTS PHY control word (see PHY TX control) */
|
||||
/* SHM_SHARED probe response variables */
|
||||
#define B43_SHM_SH_PRSSID 0x0160 /* Probe Response SSID */
|
||||
#define B43_SHM_SH_PRSSIDLEN 0x0048 /* Probe Response SSID length */
|
||||
#define B43_SHM_SH_PRTLEN 0x004A /* Probe Response template length */
|
||||
#define B43_SHM_SH_PRMAXTIME 0x0074 /* Probe Response max time */
|
||||
#define B43_SHM_SH_PRPHYCTL 0x0188 /* Probe Response PHY TX control word */
|
||||
/* SHM_SHARED rate tables */
|
||||
#define B43_SHM_SH_OFDMDIRECT 0x01C0 /* Pointer to OFDM direct map */
|
||||
#define B43_SHM_SH_OFDMBASIC 0x01E0 /* Pointer to OFDM basic rate map */
|
||||
#define B43_SHM_SH_CCKDIRECT 0x0200 /* Pointer to CCK direct map */
|
||||
#define B43_SHM_SH_CCKBASIC 0x0220 /* Pointer to CCK basic rate map */
|
||||
/* SHM_SHARED microcode soft registers */
|
||||
#define B43_SHM_SH_UCODEREV 0x0000 /* Microcode revision */
|
||||
#define B43_SHM_SH_UCODEPATCH 0x0002 /* Microcode patchlevel */
|
||||
#define B43_SHM_SH_UCODEDATE 0x0004 /* Microcode date */
|
||||
#define B43_SHM_SH_UCODETIME 0x0006 /* Microcode time */
|
||||
#define B43_SHM_SH_UCODESTAT 0x0040 /* Microcode debug status code */
|
||||
#define B43_SHM_SH_UCODESTAT_INVALID 0
|
||||
#define B43_SHM_SH_UCODESTAT_INIT 1
|
||||
#define B43_SHM_SH_UCODESTAT_ACTIVE 2
|
||||
#define B43_SHM_SH_UCODESTAT_SUSP 3 /* suspended */
|
||||
#define B43_SHM_SH_UCODESTAT_SLEEP 4 /* asleep (PS) */
|
||||
#define B43_SHM_SH_MAXBFRAMES 0x0080 /* Maximum number of frames in a burst */
|
||||
#define B43_SHM_SH_SPUWKUP 0x0094 /* pre-wakeup for synth PU in us */
|
||||
#define B43_SHM_SH_PRETBTT 0x0096 /* pre-TBTT in us */
|
||||
|
||||
/* SHM_SCRATCH offsets */
|
||||
#define B43_SHM_SC_MINCONT 0x0003 /* Minimum contention window */
|
||||
#define B43_SHM_SC_MAXCONT 0x0004 /* Maximum contention window */
|
||||
#define B43_SHM_SC_CURCONT 0x0005 /* Current contention window */
|
||||
#define B43_SHM_SC_SRLIMIT 0x0006 /* Short retry count limit */
|
||||
#define B43_SHM_SC_LRLIMIT 0x0007 /* Long retry count limit */
|
||||
#define B43_SHM_SC_DTIMC 0x0008 /* Current DTIM count */
|
||||
#define B43_SHM_SC_BTL0LEN 0x0015 /* Beacon 0 template length */
|
||||
#define B43_SHM_SC_BTL1LEN 0x0016 /* Beacon 1 template length */
|
||||
#define B43_SHM_SC_SCFB 0x0017 /* Short frame transmit count threshold for rate fallback */
|
||||
#define B43_SHM_SC_LCFB 0x0018 /* Long frame transmit count threshold for rate fallback */
|
||||
|
||||
/* Hardware Radio Enable masks */
|
||||
#define B43_MMIO_RADIO_HWENABLED_HI_MASK (1 << 16)
|
||||
#define B43_MMIO_RADIO_HWENABLED_LO_MASK (1 << 4)
|
||||
|
||||
/* HostFlags. See b43_hf_read/write() */
|
||||
#define B43_HF_ANTDIVHELP 0x000000000001ULL /* ucode antenna div helper */
|
||||
#define B43_HF_SYMW 0x000000000002ULL /* G-PHY SYM workaround */
|
||||
#define B43_HF_RXPULLW 0x000000000004ULL /* RX pullup workaround */
|
||||
#define B43_HF_CCKBOOST 0x000000000008ULL /* 4dB CCK power boost (exclusive with OFDM boost) */
|
||||
#define B43_HF_BTCOEX 0x000000000010ULL /* Bluetooth coexistance */
|
||||
#define B43_HF_GDCW 0x000000000020ULL /* G-PHY DC canceller filter bw workaround */
|
||||
#define B43_HF_OFDMPABOOST 0x000000000040ULL /* Enable PA gain boost for OFDM */
|
||||
#define B43_HF_ACPR 0x000000000080ULL /* Disable for Japan, channel 14 */
|
||||
#define B43_HF_EDCF 0x000000000100ULL /* on if WME and MAC suspended */
|
||||
#define B43_HF_TSSIRPSMW 0x000000000200ULL /* TSSI reset PSM ucode workaround */
|
||||
#define B43_HF_20IN40IQW 0x000000000200ULL /* 20 in 40 MHz I/Q workaround (rev >= 13 only) */
|
||||
#define B43_HF_DSCRQ 0x000000000400ULL /* Disable slow clock request in ucode */
|
||||
#define B43_HF_ACIW 0x000000000800ULL /* ACI workaround: shift bits by 2 on PHY CRS */
|
||||
#define B43_HF_2060W 0x000000001000ULL /* 2060 radio workaround */
|
||||
#define B43_HF_RADARW 0x000000002000ULL /* Radar workaround */
|
||||
#define B43_HF_USEDEFKEYS 0x000000004000ULL /* Enable use of default keys */
|
||||
#define B43_HF_AFTERBURNER 0x000000008000ULL /* Afterburner enabled */
|
||||
#define B43_HF_BT4PRIOCOEX 0x000000010000ULL /* Bluetooth 4-priority coexistance */
|
||||
#define B43_HF_FWKUP 0x000000020000ULL /* Fast wake-up ucode */
|
||||
#define B43_HF_VCORECALC 0x000000040000ULL /* Force VCO recalculation when powering up synthpu */
|
||||
#define B43_HF_PCISCW 0x000000080000ULL /* PCI slow clock workaround */
|
||||
#define B43_HF_4318TSSI 0x000000200000ULL /* 4318 TSSI */
|
||||
#define B43_HF_FBCMCFIFO 0x000000400000ULL /* Flush bcast/mcast FIFO immediately */
|
||||
#define B43_HF_HWPCTL 0x000000800000ULL /* Enable hardwarre power control */
|
||||
#define B43_HF_BTCOEXALT 0x000001000000ULL /* Bluetooth coexistance in alternate pins */
|
||||
#define B43_HF_TXBTCHECK 0x000002000000ULL /* Bluetooth check during transmission */
|
||||
#define B43_HF_SKCFPUP 0x000004000000ULL /* Skip CFP update */
|
||||
#define B43_HF_N40W 0x000008000000ULL /* N PHY 40 MHz workaround (rev >= 13 only) */
|
||||
#define B43_HF_ANTSEL 0x000020000000ULL /* Antenna selection (for testing antenna div.) */
|
||||
#define B43_HF_BT3COEXT 0x000020000000ULL /* Bluetooth 3-wire coexistence (rev >= 13 only) */
|
||||
#define B43_HF_BTCANT 0x000040000000ULL /* Bluetooth coexistence (antenna mode) (rev >= 13 only) */
|
||||
#define B43_HF_ANTSELEN 0x000100000000ULL /* Antenna selection enabled (rev >= 13 only) */
|
||||
#define B43_HF_ANTSELMODE 0x000200000000ULL /* Antenna selection mode (rev >= 13 only) */
|
||||
#define B43_HF_MLADVW 0x001000000000ULL /* N PHY ML ADV workaround (rev >= 13 only) */
|
||||
#define B43_HF_PR45960W 0x080000000000ULL /* PR 45960 workaround (rev >= 13 only) */
|
||||
|
||||
/* MacFilter offsets. */
|
||||
#define B43_MACFILTER_SELF 0x0000
|
||||
#define B43_MACFILTER_BSSID 0x0003
|
||||
|
||||
/* PowerControl */
|
||||
#define B43_PCTL_IN 0xB0
|
||||
#define B43_PCTL_OUT 0xB4
|
||||
#define B43_PCTL_OUTENABLE 0xB8
|
||||
#define B43_PCTL_XTAL_POWERUP 0x40
|
||||
#define B43_PCTL_PLL_POWERDOWN 0x80
|
||||
|
||||
/* PowerControl Clock Modes */
|
||||
#define B43_PCTL_CLK_FAST 0x00
|
||||
#define B43_PCTL_CLK_SLOW 0x01
|
||||
#define B43_PCTL_CLK_DYNAMIC 0x02
|
||||
|
||||
#define B43_PCTL_FORCE_SLOW 0x0800
|
||||
#define B43_PCTL_FORCE_PLL 0x1000
|
||||
#define B43_PCTL_DYN_XTAL 0x2000
|
||||
|
||||
/* PHYVersioning */
|
||||
#define B43_PHYTYPE_A 0x00
|
||||
#define B43_PHYTYPE_B 0x01
|
||||
#define B43_PHYTYPE_G 0x02
|
||||
#define B43_PHYTYPE_N 0x04
|
||||
#define B43_PHYTYPE_LP 0x05
|
||||
|
||||
/* PHYRegisters */
|
||||
#define B43_PHY_ILT_A_CTRL 0x0072
|
||||
#define B43_PHY_ILT_A_DATA1 0x0073
|
||||
#define B43_PHY_ILT_A_DATA2 0x0074
|
||||
#define B43_PHY_G_LO_CONTROL 0x0810
|
||||
#define B43_PHY_ILT_G_CTRL 0x0472
|
||||
#define B43_PHY_ILT_G_DATA1 0x0473
|
||||
#define B43_PHY_ILT_G_DATA2 0x0474
|
||||
#define B43_PHY_A_PCTL 0x007B
|
||||
#define B43_PHY_G_PCTL 0x0029
|
||||
#define B43_PHY_A_CRS 0x0029
|
||||
#define B43_PHY_RADIO_BITFIELD 0x0401
|
||||
#define B43_PHY_G_CRS 0x0429
|
||||
#define B43_PHY_NRSSILT_CTRL 0x0803
|
||||
#define B43_PHY_NRSSILT_DATA 0x0804
|
||||
|
||||
/* RadioRegisters */
|
||||
#define B43_RADIOCTL_ID 0x01
|
||||
|
||||
/* MAC Control bitfield */
|
||||
#define B43_MACCTL_ENABLED 0x00000001 /* MAC Enabled */
|
||||
#define B43_MACCTL_PSM_RUN 0x00000002 /* Run Microcode */
|
||||
#define B43_MACCTL_PSM_JMP0 0x00000004 /* Microcode jump to 0 */
|
||||
#define B43_MACCTL_SHM_ENABLED 0x00000100 /* SHM Enabled */
|
||||
#define B43_MACCTL_SHM_UPPER 0x00000200 /* SHM Upper */
|
||||
#define B43_MACCTL_IHR_ENABLED 0x00000400 /* IHR Region Enabled */
|
||||
#define B43_MACCTL_PSM_DBG 0x00002000 /* Microcode debugging enabled */
|
||||
#define B43_MACCTL_GPOUTSMSK 0x0000C000 /* GPOUT Select Mask */
|
||||
#define B43_MACCTL_BE 0x00010000 /* Big Endian mode */
|
||||
#define B43_MACCTL_INFRA 0x00020000 /* Infrastructure mode */
|
||||
#define B43_MACCTL_AP 0x00040000 /* AccessPoint mode */
|
||||
#define B43_MACCTL_RADIOLOCK 0x00080000 /* Radio lock */
|
||||
#define B43_MACCTL_BEACPROMISC 0x00100000 /* Beacon Promiscuous */
|
||||
#define B43_MACCTL_KEEP_BADPLCP 0x00200000 /* Keep frames with bad PLCP */
|
||||
#define B43_MACCTL_KEEP_CTL 0x00400000 /* Keep control frames */
|
||||
#define B43_MACCTL_KEEP_BAD 0x00800000 /* Keep bad frames (FCS) */
|
||||
#define B43_MACCTL_PROMISC 0x01000000 /* Promiscuous mode */
|
||||
#define B43_MACCTL_HWPS 0x02000000 /* Hardware Power Saving */
|
||||
#define B43_MACCTL_AWAKE 0x04000000 /* Device is awake */
|
||||
#define B43_MACCTL_CLOSEDNET 0x08000000 /* Closed net (no SSID bcast) */
|
||||
#define B43_MACCTL_TBTTHOLD 0x10000000 /* TBTT Hold */
|
||||
#define B43_MACCTL_DISCTXSTAT 0x20000000 /* Discard TX status */
|
||||
#define B43_MACCTL_DISCPMQ 0x40000000 /* Discard Power Management Queue */
|
||||
#define B43_MACCTL_GMODE 0x80000000 /* G Mode */
|
||||
|
||||
/* MAC Command bitfield */
|
||||
#define B43_MACCMD_BEACON0_VALID 0x00000001 /* Beacon 0 in template RAM is busy/valid */
|
||||
#define B43_MACCMD_BEACON1_VALID 0x00000002 /* Beacon 1 in template RAM is busy/valid */
|
||||
#define B43_MACCMD_DFQ_VALID 0x00000004 /* Directed frame queue valid (IBSS PS mode, ATIM) */
|
||||
#define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */
|
||||
#define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */
|
||||
|
||||
/* 802.11 core specific TM State Low (SSB_TMSLOW) flags */
|
||||
#define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */
|
||||
#define B43_TMSLOW_PHYCLKSPEED 0x00C00000 /* PHY clock speed mask (N-PHY only) */
|
||||
#define B43_TMSLOW_PHYCLKSPEED_40MHZ 0x00000000 /* 40 MHz PHY */
|
||||
#define B43_TMSLOW_PHYCLKSPEED_80MHZ 0x00400000 /* 80 MHz PHY */
|
||||
#define B43_TMSLOW_PHYCLKSPEED_160MHZ 0x00800000 /* 160 MHz PHY */
|
||||
#define B43_TMSLOW_PLLREFSEL 0x00200000 /* PLL Frequency Reference Select (rev >= 5) */
|
||||
#define B43_TMSLOW_MACPHYCLKEN 0x00100000 /* MAC PHY Clock Control Enable (rev >= 5) */
|
||||
#define B43_TMSLOW_PHYRESET 0x00080000 /* PHY Reset */
|
||||
#define B43_TMSLOW_PHYCLKEN 0x00040000 /* PHY Clock Enable */
|
||||
|
||||
/* 802.11 core specific TM State High (SSB_TMSHIGH) flags */
|
||||
#define B43_TMSHIGH_DUALBAND_PHY 0x00080000 /* Dualband PHY available */
|
||||
#define B43_TMSHIGH_FCLOCK 0x00040000 /* Fast Clock Available (rev >= 5) */
|
||||
#define B43_TMSHIGH_HAVE_5GHZ_PHY 0x00020000 /* 5 GHz PHY available (rev >= 5) */
|
||||
#define B43_TMSHIGH_HAVE_2GHZ_PHY 0x00010000 /* 2.4 GHz PHY available (rev >= 5) */
|
||||
|
||||
/* Generic-Interrupt reasons. */
|
||||
#define B43_IRQ_MAC_SUSPENDED 0x00000001
|
||||
#define B43_IRQ_BEACON 0x00000002
|
||||
#define B43_IRQ_TBTT_INDI 0x00000004
|
||||
#define B43_IRQ_BEACON_TX_OK 0x00000008
|
||||
#define B43_IRQ_BEACON_CANCEL 0x00000010
|
||||
#define B43_IRQ_ATIM_END 0x00000020
|
||||
#define B43_IRQ_PMQ 0x00000040
|
||||
#define B43_IRQ_PIO_WORKAROUND 0x00000100
|
||||
#define B43_IRQ_MAC_TXERR 0x00000200
|
||||
#define B43_IRQ_PHY_TXERR 0x00000800
|
||||
#define B43_IRQ_PMEVENT 0x00001000
|
||||
#define B43_IRQ_TIMER0 0x00002000
|
||||
#define B43_IRQ_TIMER1 0x00004000
|
||||
#define B43_IRQ_DMA 0x00008000
|
||||
#define B43_IRQ_TXFIFO_FLUSH_OK 0x00010000
|
||||
#define B43_IRQ_CCA_MEASURE_OK 0x00020000
|
||||
#define B43_IRQ_NOISESAMPLE_OK 0x00040000
|
||||
#define B43_IRQ_UCODE_DEBUG 0x08000000
|
||||
#define B43_IRQ_RFKILL 0x10000000
|
||||
#define B43_IRQ_TX_OK 0x20000000
|
||||
#define B43_IRQ_PHY_G_CHANGED 0x40000000
|
||||
#define B43_IRQ_TIMEOUT 0x80000000
|
||||
|
||||
#define B43_IRQ_ALL 0xFFFFFFFF
|
||||
#define B43_IRQ_MASKTEMPLATE (B43_IRQ_TBTT_INDI | \
|
||||
B43_IRQ_ATIM_END | \
|
||||
B43_IRQ_PMQ | \
|
||||
B43_IRQ_MAC_TXERR | \
|
||||
B43_IRQ_PHY_TXERR | \
|
||||
B43_IRQ_DMA | \
|
||||
B43_IRQ_TXFIFO_FLUSH_OK | \
|
||||
B43_IRQ_NOISESAMPLE_OK | \
|
||||
B43_IRQ_UCODE_DEBUG | \
|
||||
B43_IRQ_RFKILL | \
|
||||
B43_IRQ_TX_OK)
|
||||
|
||||
/* The firmware register to fetch the debug-IRQ reason from. */
|
||||
#define B43_DEBUGIRQ_REASON_REG 63
|
||||
/* Debug-IRQ reasons. */
|
||||
#define B43_DEBUGIRQ_PANIC 0 /* The firmware panic'ed */
|
||||
#define B43_DEBUGIRQ_DUMP_SHM 1 /* Dump shared SHM */
|
||||
#define B43_DEBUGIRQ_DUMP_REGS 2 /* Dump the microcode registers */
|
||||
#define B43_DEBUGIRQ_MARKER 3 /* A "marker" was thrown by the firmware. */
|
||||
#define B43_DEBUGIRQ_ACK 0xFFFF /* The host writes that to ACK the IRQ */
|
||||
|
||||
/* The firmware register that contains the "marker" line. */
|
||||
#define B43_MARKER_ID_REG 2
|
||||
#define B43_MARKER_LINE_REG 3
|
||||
|
||||
/* The firmware register to fetch the panic reason from. */
|
||||
#define B43_FWPANIC_REASON_REG 3
|
||||
/* Firmware panic reason codes */
|
||||
#define B43_FWPANIC_DIE 0 /* Firmware died. Don't auto-restart it. */
|
||||
#define B43_FWPANIC_RESTART 1 /* Firmware died. Schedule a controller reset. */
|
||||
|
||||
|
||||
/* Device specific rate values.
|
||||
* The actual values defined here are (rate_in_mbps * 2).
|
||||
* Some code depends on this. Don't change it. */
|
||||
#define B43_CCK_RATE_1MB 0x02
|
||||
#define B43_CCK_RATE_2MB 0x04
|
||||
#define B43_CCK_RATE_5MB 0x0B
|
||||
#define B43_CCK_RATE_11MB 0x16
|
||||
#define B43_OFDM_RATE_6MB 0x0C
|
||||
#define B43_OFDM_RATE_9MB 0x12
|
||||
#define B43_OFDM_RATE_12MB 0x18
|
||||
#define B43_OFDM_RATE_18MB 0x24
|
||||
#define B43_OFDM_RATE_24MB 0x30
|
||||
#define B43_OFDM_RATE_36MB 0x48
|
||||
#define B43_OFDM_RATE_48MB 0x60
|
||||
#define B43_OFDM_RATE_54MB 0x6C
|
||||
/* Convert a b43 rate value to a rate in 100kbps */
|
||||
#define B43_RATE_TO_BASE100KBPS(rate) (((rate) * 10) / 2)
|
||||
|
||||
#define B43_DEFAULT_SHORT_RETRY_LIMIT 7
|
||||
#define B43_DEFAULT_LONG_RETRY_LIMIT 4
|
||||
|
||||
#define B43_PHY_TX_BADNESS_LIMIT 1000
|
||||
|
||||
/* Max size of a security key */
|
||||
#define B43_SEC_KEYSIZE 16
|
||||
/* Security algorithms. */
|
||||
enum {
|
||||
B43_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */
|
||||
B43_SEC_ALGO_WEP40,
|
||||
B43_SEC_ALGO_TKIP,
|
||||
B43_SEC_ALGO_AES,
|
||||
B43_SEC_ALGO_WEP104,
|
||||
B43_SEC_ALGO_AES_LEGACY,
|
||||
};
|
||||
|
||||
struct b43_dmaring;
|
||||
|
||||
/* The firmware file header */
|
||||
#define B43_FW_TYPE_UCODE 'u'
|
||||
#define B43_FW_TYPE_PCM 'p'
|
||||
#define B43_FW_TYPE_IV 'i'
|
||||
struct b43_fw_header {
|
||||
/* File type */
|
||||
u8 type;
|
||||
/* File format version */
|
||||
u8 ver;
|
||||
u8 __padding[2];
|
||||
/* Size of the data. For ucode and PCM this is in bytes.
|
||||
* For IV this is number-of-ivs. */
|
||||
__be32 size;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
/* Initial Value file format */
|
||||
#define B43_IV_OFFSET_MASK 0x7FFF
|
||||
#define B43_IV_32BIT 0x8000
|
||||
struct b43_iv {
|
||||
__be16 offset_size;
|
||||
union {
|
||||
__be16 d16;
|
||||
__be32 d32;
|
||||
} data __attribute__((__packed__));
|
||||
} __attribute__((__packed__));
|
||||
|
||||
|
||||
struct b43_phy {
|
||||
/* Band support flags. */
|
||||
bool supports_2ghz;
|
||||
bool supports_5ghz;
|
||||
|
||||
/* GMODE bit enabled? */
|
||||
bool gmode;
|
||||
|
||||
/* Analog Type */
|
||||
u8 analog;
|
||||
/* B43_PHYTYPE_ */
|
||||
u8 type;
|
||||
/* PHY revision number. */
|
||||
u8 rev;
|
||||
|
||||
/* Radio versioning */
|
||||
u16 radio_manuf; /* Radio manufacturer */
|
||||
u16 radio_ver; /* Radio version */
|
||||
u8 radio_rev; /* Radio revision */
|
||||
|
||||
bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */
|
||||
|
||||
/* ACI (adjacent channel interference) flags. */
|
||||
bool aci_enable;
|
||||
bool aci_wlan_automatic;
|
||||
bool aci_hw_rssi;
|
||||
|
||||
/* Radio switched on/off */
|
||||
bool radio_on;
|
||||
struct {
|
||||
/* Values saved when turning the radio off.
|
||||
* They are needed when turning it on again. */
|
||||
bool valid;
|
||||
u16 rfover;
|
||||
u16 rfoverval;
|
||||
} radio_off_context;
|
||||
|
||||
u16 minlowsig[2];
|
||||
u16 minlowsigpos[2];
|
||||
|
||||
/* TSSI to dBm table in use */
|
||||
const s8 *tssi2dbm;
|
||||
/* Target idle TSSI */
|
||||
int tgt_idle_tssi;
|
||||
/* Current idle TSSI */
|
||||
int cur_idle_tssi;
|
||||
|
||||
/* LocalOscillator control values. */
|
||||
struct b43_txpower_lo_control *lo_control;
|
||||
/* Values from b43_calc_loopback_gain() */
|
||||
s16 max_lb_gain; /* Maximum Loopback gain in hdB */
|
||||
s16 trsw_rx_gain; /* TRSW RX gain in hdB */
|
||||
s16 lna_lod_gain; /* LNA lod */
|
||||
s16 lna_gain; /* LNA */
|
||||
s16 pga_gain; /* PGA */
|
||||
|
||||
/* Desired TX power level (in dBm).
|
||||
* This is set by the user and adjusted in b43_phy_xmitpower(). */
|
||||
u8 power_level;
|
||||
/* A-PHY TX Power control value. */
|
||||
u16 txpwr_offset;
|
||||
|
||||
/* Current TX power level attenuation control values */
|
||||
struct b43_bbatt bbatt;
|
||||
struct b43_rfatt rfatt;
|
||||
u8 tx_control; /* B43_TXCTL_XXX */
|
||||
|
||||
/* Hardware Power Control enabled? */
|
||||
bool hardware_power_control;
|
||||
|
||||
/* Current Interference Mitigation mode */
|
||||
int interfmode;
|
||||
/* Stack of saved values from the Interference Mitigation code.
|
||||
* Each value in the stack is layed out as follows:
|
||||
* bit 0-11: offset
|
||||
* bit 12-15: register ID
|
||||
* bit 16-32: value
|
||||
* register ID is: 0x1 PHY, 0x2 Radio, 0x3 ILT
|
||||
*/
|
||||
#define B43_INTERFSTACK_SIZE 26
|
||||
u32 interfstack[B43_INTERFSTACK_SIZE]; //FIXME: use a data structure
|
||||
|
||||
/* Saved values from the NRSSI Slope calculation */
|
||||
s16 nrssi[2];
|
||||
s32 nrssislope;
|
||||
/* In memory nrssi lookup table. */
|
||||
s8 nrssi_lt[64];
|
||||
|
||||
/* current channel */
|
||||
u8 channel;
|
||||
|
||||
u16 lofcal;
|
||||
|
||||
u16 initval; //FIXME rename?
|
||||
|
||||
/* PHY TX errors counter. */
|
||||
atomic_t txerr_cnt;
|
||||
|
||||
/* The device does address auto increment for the OFDM tables.
|
||||
* We cache the previously used address here and omit the address
|
||||
* write on the next table access, if possible. */
|
||||
u16 ofdmtab_addr; /* The address currently set in hardware. */
|
||||
enum { /* The last data flow direction. */
|
||||
B43_OFDMTAB_DIRECTION_UNKNOWN = 0,
|
||||
B43_OFDMTAB_DIRECTION_READ,
|
||||
B43_OFDMTAB_DIRECTION_WRITE,
|
||||
} ofdmtab_addr_direction;
|
||||
|
||||
#if B43_DEBUG
|
||||
/* Manual TX-power control enabled? */
|
||||
bool manual_txpower_control;
|
||||
/* PHY registers locked by b43_phy_lock()? */
|
||||
bool phy_locked;
|
||||
#endif /* B43_DEBUG */
|
||||
};
|
||||
|
||||
/* Data structures for DMA transmission, per 80211 core. */
|
||||
struct b43_dma {
|
||||
struct b43_dmaring *tx_ring_AC_BK; /* Background */
|
||||
struct b43_dmaring *tx_ring_AC_BE; /* Best Effort */
|
||||
struct b43_dmaring *tx_ring_AC_VI; /* Video */
|
||||
struct b43_dmaring *tx_ring_AC_VO; /* Voice */
|
||||
struct b43_dmaring *tx_ring_mcast; /* Multicast */
|
||||
|
||||
struct b43_dmaring *rx_ring;
|
||||
};
|
||||
|
||||
struct b43_pio_txqueue;
|
||||
struct b43_pio_rxqueue;
|
||||
|
||||
/* Data structures for PIO transmission, per 80211 core. */
|
||||
struct b43_pio {
|
||||
struct b43_pio_txqueue *tx_queue_AC_BK; /* Background */
|
||||
struct b43_pio_txqueue *tx_queue_AC_BE; /* Best Effort */
|
||||
struct b43_pio_txqueue *tx_queue_AC_VI; /* Video */
|
||||
struct b43_pio_txqueue *tx_queue_AC_VO; /* Voice */
|
||||
struct b43_pio_txqueue *tx_queue_mcast; /* Multicast */
|
||||
|
||||
struct b43_pio_rxqueue *rx_queue;
|
||||
};
|
||||
|
||||
/* Context information for a noise calculation (Link Quality). */
|
||||
struct b43_noise_calculation {
|
||||
u8 channel_at_start;
|
||||
bool calculation_running;
|
||||
u8 nr_samples;
|
||||
s8 samples[8][4];
|
||||
};
|
||||
|
||||
struct b43_stats {
|
||||
u8 link_noise;
|
||||
/* Store the last TX/RX times here for updating the leds. */
|
||||
unsigned long last_tx;
|
||||
unsigned long last_rx;
|
||||
};
|
||||
|
||||
struct b43_key {
|
||||
/* If keyconf is NULL, this key is disabled.
|
||||
* keyconf is a cookie. Don't derefenrence it outside of the set_key
|
||||
* path, because b43 doesn't own it. */
|
||||
struct ieee80211_key_conf *keyconf;
|
||||
u8 algorithm;
|
||||
};
|
||||
|
||||
/* SHM offsets to the QOS data structures for the 4 different queues. */
|
||||
#define B43_QOS_PARAMS(queue) (B43_SHM_SH_EDCFQ + \
|
||||
(B43_NR_QOSPARAMS * sizeof(u16) * (queue)))
|
||||
#define B43_QOS_BACKGROUND B43_QOS_PARAMS(0)
|
||||
#define B43_QOS_BESTEFFORT B43_QOS_PARAMS(1)
|
||||
#define B43_QOS_VIDEO B43_QOS_PARAMS(2)
|
||||
#define B43_QOS_VOICE B43_QOS_PARAMS(3)
|
||||
|
||||
/* QOS parameter hardware data structure offsets. */
|
||||
#define B43_NR_QOSPARAMS 22
|
||||
enum {
|
||||
B43_QOSPARAM_TXOP = 0,
|
||||
B43_QOSPARAM_CWMIN,
|
||||
B43_QOSPARAM_CWMAX,
|
||||
B43_QOSPARAM_CWCUR,
|
||||
B43_QOSPARAM_AIFS,
|
||||
B43_QOSPARAM_BSLOTS,
|
||||
B43_QOSPARAM_REGGAP,
|
||||
B43_QOSPARAM_STATUS,
|
||||
};
|
||||
|
||||
/* QOS parameters for a queue. */
|
||||
struct b43_qos_params {
|
||||
/* The QOS parameters */
|
||||
struct ieee80211_tx_queue_params p;
|
||||
/* Does this need to get uploaded to hardware? */
|
||||
bool need_hw_update;
|
||||
};
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
/* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
|
||||
struct b43_wl {
|
||||
/* Pointer to the active wireless device on this chip */
|
||||
struct b43_wldev *current_dev;
|
||||
/* Pointer to the ieee80211 hardware data structure */
|
||||
struct ieee80211_hw *hw;
|
||||
|
||||
struct mutex mutex;
|
||||
spinlock_t irq_lock;
|
||||
/* R/W lock for data transmission.
|
||||
* Transmissions on 2+ queues can run concurrently, but somebody else
|
||||
* might sync with TX by write_lock_irqsave()'ing. */
|
||||
rwlock_t tx_lock;
|
||||
/* Lock for LEDs access. */
|
||||
spinlock_t leds_lock;
|
||||
/* Lock for SHM access. */
|
||||
spinlock_t shm_lock;
|
||||
|
||||
/* We can only have one operating interface (802.11 core)
|
||||
* at a time. General information about this interface follows.
|
||||
*/
|
||||
|
||||
struct ieee80211_vif *vif;
|
||||
/* The MAC address of the operating interface. */
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
/* Current BSSID */
|
||||
u8 bssid[ETH_ALEN];
|
||||
/* Interface type. (IEEE80211_IF_TYPE_XXX) */
|
||||
int if_type;
|
||||
/* Is the card operating in AP, STA or IBSS mode? */
|
||||
bool operating;
|
||||
/* filter flags */
|
||||
unsigned int filter_flags;
|
||||
/* Stats about the wireless interface */
|
||||
struct ieee80211_low_level_stats ieee_stats;
|
||||
|
||||
struct hwrng rng;
|
||||
u8 rng_initialized;
|
||||
char rng_name[30 + 1];
|
||||
|
||||
/* The RF-kill button */
|
||||
struct b43_rfkill rfkill;
|
||||
|
||||
/* List of all wireless devices on this chip */
|
||||
struct list_head devlist;
|
||||
u8 nr_devs;
|
||||
|
||||
bool radiotap_enabled;
|
||||
|
||||
/* The beacon we are currently using (AP or IBSS mode).
|
||||
* This beacon stuff is protected by the irq_lock. */
|
||||
struct sk_buff *current_beacon;
|
||||
bool beacon0_uploaded;
|
||||
bool beacon1_uploaded;
|
||||
struct work_struct beacon_update_trigger;
|
||||
|
||||
/* The current QOS parameters for the 4 queues.
|
||||
* This is protected by the irq_lock. */
|
||||
struct b43_qos_params qos_params[4];
|
||||
/* Workqueue for updating QOS parameters in hardware. */
|
||||
struct work_struct qos_update_work;
|
||||
};
|
||||
|
||||
/* In-memory representation of a cached microcode file. */
|
||||
struct b43_firmware_file {
|
||||
const char *filename;
|
||||
const struct firmware *data;
|
||||
};
|
||||
|
||||
/* Pointers to the firmware data and meta information about it. */
|
||||
struct b43_firmware {
|
||||
/* Microcode */
|
||||
struct b43_firmware_file ucode;
|
||||
/* PCM code */
|
||||
struct b43_firmware_file pcm;
|
||||
/* Initial MMIO values for the firmware */
|
||||
struct b43_firmware_file initvals;
|
||||
/* Initial MMIO values for the firmware, band-specific */
|
||||
struct b43_firmware_file initvals_band;
|
||||
|
||||
/* Firmware revision */
|
||||
u16 rev;
|
||||
/* Firmware patchlevel */
|
||||
u16 patch;
|
||||
|
||||
/* Set to true, if we are using an opensource firmware. */
|
||||
bool opensource;
|
||||
/* Set to true, if the core needs a PCM firmware, but
|
||||
* we failed to load one. This is always false for
|
||||
* core rev > 10, as these don't need PCM firmware. */
|
||||
bool pcm_request_failed;
|
||||
};
|
||||
|
||||
/* Device (802.11 core) initialization status. */
|
||||
enum {
|
||||
B43_STAT_UNINIT = 0, /* Uninitialized. */
|
||||
B43_STAT_INITIALIZED = 1, /* Initialized, but not started, yet. */
|
||||
B43_STAT_STARTED = 2, /* Up and running. */
|
||||
};
|
||||
#define b43_status(wldev) atomic_read(&(wldev)->__init_status)
|
||||
#define b43_set_status(wldev, stat) do { \
|
||||
atomic_set(&(wldev)->__init_status, (stat)); \
|
||||
smp_wmb(); \
|
||||
} while (0)
|
||||
|
||||
/* XXX--- HOW LOCKING WORKS IN B43 ---XXX
|
||||
*
|
||||
* You should always acquire both, wl->mutex and wl->irq_lock unless:
|
||||
* - You don't need to acquire wl->irq_lock, if the interface is stopped.
|
||||
* - You don't need to acquire wl->mutex in the IRQ handler, IRQ tasklet
|
||||
* and packet TX path (and _ONLY_ there.)
|
||||
*/
|
||||
|
||||
/* Data structure for one wireless device (802.11 core) */
|
||||
struct b43_wldev {
|
||||
struct ssb_device *dev;
|
||||
struct b43_wl *wl;
|
||||
|
||||
/* The device initialization status.
|
||||
* Use b43_status() to query. */
|
||||
atomic_t __init_status;
|
||||
/* Saved init status for handling suspend. */
|
||||
int suspend_init_status;
|
||||
|
||||
bool bad_frames_preempt; /* Use "Bad Frames Preemption" (default off) */
|
||||
bool dfq_valid; /* Directed frame queue valid (IBSS PS mode, ATIM) */
|
||||
bool short_slot; /* TRUE, if short slot timing is enabled. */
|
||||
bool radio_hw_enable; /* saved state of radio hardware enabled state */
|
||||
bool suspend_in_progress; /* TRUE, if we are in a suspend/resume cycle */
|
||||
|
||||
/* PHY/Radio device. */
|
||||
struct b43_phy phy;
|
||||
|
||||
union {
|
||||
/* DMA engines. */
|
||||
struct b43_dma dma;
|
||||
/* PIO engines. */
|
||||
struct b43_pio pio;
|
||||
};
|
||||
/* Use b43_using_pio_transfers() to check whether we are using
|
||||
* DMA or PIO data transfers. */
|
||||
bool __using_pio_transfers;
|
||||
|
||||
/* Various statistics about the physical device. */
|
||||
struct b43_stats stats;
|
||||
|
||||
/* The device LEDs. */
|
||||
struct b43_led led_tx;
|
||||
struct b43_led led_rx;
|
||||
struct b43_led led_assoc;
|
||||
struct b43_led led_radio;
|
||||
|
||||
/* Reason code of the last interrupt. */
|
||||
u32 irq_reason;
|
||||
u32 dma_reason[6];
|
||||
/* saved irq enable/disable state bitfield. */
|
||||
u32 irq_savedstate;
|
||||
/* Link Quality calculation context. */
|
||||
struct b43_noise_calculation noisecalc;
|
||||
/* if > 0 MAC is suspended. if == 0 MAC is enabled. */
|
||||
int mac_suspended;
|
||||
|
||||
/* Interrupt Service Routine tasklet (bottom-half) */
|
||||
struct tasklet_struct isr_tasklet;
|
||||
|
||||
/* Periodic tasks */
|
||||
struct delayed_work periodic_work;
|
||||
unsigned int periodic_state;
|
||||
|
||||
struct work_struct restart_work;
|
||||
|
||||
/* encryption/decryption */
|
||||
u16 ktp; /* Key table pointer */
|
||||
u8 max_nr_keys;
|
||||
struct b43_key key[58];
|
||||
|
||||
/* Firmware data */
|
||||
struct b43_firmware fw;
|
||||
|
||||
/* Devicelist in struct b43_wl (all 802.11 cores) */
|
||||
struct list_head list;
|
||||
|
||||
/* Debugging stuff follows. */
|
||||
#ifdef CONFIG_B43_DEBUG
|
||||
struct b43_dfsentry *dfsentry;
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw)
|
||||
{
|
||||
return hw->priv;
|
||||
}
|
||||
|
||||
static inline struct b43_wldev *dev_to_b43_wldev(struct device *dev)
|
||||
{
|
||||
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
|
||||
return ssb_get_drvdata(ssb_dev);
|
||||
}
|
||||
|
||||
/* Is the device operating in a specified mode (IEEE80211_IF_TYPE_XXX). */
|
||||
static inline int b43_is_mode(struct b43_wl *wl, int type)
|
||||
{
|
||||
return (wl->operating && wl->if_type == type);
|
||||
}
|
||||
|
||||
static inline u16 b43_read16(struct b43_wldev *dev, u16 offset)
|
||||
{
|
||||
return ssb_read16(dev->dev, offset);
|
||||
}
|
||||
|
||||
static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
|
||||
{
|
||||
ssb_write16(dev->dev, offset, value);
|
||||
}
|
||||
|
||||
static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
|
||||
{
|
||||
return ssb_read32(dev->dev, offset);
|
||||
}
|
||||
|
||||
static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
|
||||
{
|
||||
ssb_write32(dev->dev, offset, value);
|
||||
}
|
||||
|
||||
static inline bool b43_using_pio_transfers(struct b43_wldev *dev)
|
||||
{
|
||||
#ifdef CONFIG_B43_PIO
|
||||
return dev->__using_pio_transfers;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_B43_FORCE_PIO
|
||||
# define B43_FORCE_PIO 1
|
||||
#else
|
||||
# define B43_FORCE_PIO 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Message printing */
|
||||
void b43info(struct b43_wl *wl, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
void b43err(struct b43_wl *wl, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
void b43warn(struct b43_wl *wl, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
#if B43_DEBUG
|
||||
void b43dbg(struct b43_wl *wl, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
#else /* DEBUG */
|
||||
# define b43dbg(wl, fmt...) do { /* nothing */ } while (0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* A WARN_ON variant that vanishes when b43 debugging is disabled.
|
||||
* This _also_ evaluates the arg with debugging disabled. */
|
||||
#if B43_DEBUG
|
||||
# define B43_WARN_ON(x) WARN_ON(x)
|
||||
#else
|
||||
static inline bool __b43_warn_on_dummy(bool x) { return x; }
|
||||
# define B43_WARN_ON(x) __b43_warn_on_dummy(unlikely(!!(x)))
|
||||
#endif
|
||||
|
||||
/* Convert an integer to a Q5.2 value */
|
||||
#define INT_TO_Q52(i) ((i) << 2)
|
||||
/* Convert a Q5.2 value to an integer (precision loss!) */
|
||||
#define Q52_TO_INT(q52) ((q52) >> 2)
|
||||
/* Macros for printing a value in Q5.2 format */
|
||||
#define Q52_FMT "%u.%u"
|
||||
#define Q52_ARG(q52) Q52_TO_INT(q52), ((((q52) & 0x3) * 100) / 4)
|
||||
|
||||
#endif /* B43_H_ */
|
@ -1,668 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
debugfs driver debugging code
|
||||
|
||||
Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include "b43.h"
|
||||
#include "main.h"
|
||||
#include "debugfs.h"
|
||||
#include "dma.h"
|
||||
#include "xmit.h"
|
||||
|
||||
|
||||
/* The root directory. */
|
||||
static struct dentry *rootdir;
|
||||
|
||||
struct b43_debugfs_fops {
|
||||
ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize);
|
||||
int (*write)(struct b43_wldev *dev, const char *buf, size_t count);
|
||||
struct file_operations fops;
|
||||
/* Offset of struct b43_dfs_file in struct b43_dfsentry */
|
||||
size_t file_struct_offset;
|
||||
/* Take wl->irq_lock before calling read/write? */
|
||||
bool take_irqlock;
|
||||
};
|
||||
|
||||
static inline
|
||||
struct b43_dfs_file * fops_to_dfs_file(struct b43_wldev *dev,
|
||||
const struct b43_debugfs_fops *dfops)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = dev->dfsentry;
|
||||
p += dfops->file_struct_offset;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#define fappend(fmt, x...) \
|
||||
do { \
|
||||
if (bufsize - count) \
|
||||
count += snprintf(buf + count, \
|
||||
bufsize - count, \
|
||||
fmt , ##x); \
|
||||
else \
|
||||
printk(KERN_ERR "b43: fappend overflow\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* wl->irq_lock is locked */
|
||||
static ssize_t tsf_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
ssize_t count = 0;
|
||||
u64 tsf;
|
||||
|
||||
b43_tsf_read(dev, &tsf);
|
||||
fappend("0x%08x%08x\n",
|
||||
(unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32),
|
||||
(unsigned int)(tsf & 0xFFFFFFFFULL));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* wl->irq_lock is locked */
|
||||
static int tsf_write_file(struct b43_wldev *dev,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
u64 tsf;
|
||||
|
||||
if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1)
|
||||
return -EINVAL;
|
||||
b43_tsf_write(dev, tsf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* wl->irq_lock is locked */
|
||||
static ssize_t ucode_regs_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
ssize_t count = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
fappend("r%d = 0x%04x\n", i,
|
||||
b43_shm_read16(dev, B43_SHM_SCRATCH, i));
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* wl->irq_lock is locked */
|
||||
static ssize_t shm_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
ssize_t count = 0;
|
||||
int i;
|
||||
u16 tmp;
|
||||
__le16 *le16buf = (__le16 *)buf;
|
||||
|
||||
for (i = 0; i < 0x1000; i++) {
|
||||
if (bufsize < sizeof(tmp))
|
||||
break;
|
||||
tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i);
|
||||
le16buf[i] = cpu_to_le16(tmp);
|
||||
count += sizeof(tmp);
|
||||
bufsize -= sizeof(tmp);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t txstat_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
struct b43_txstatus_log *log = &dev->dfsentry->txstatlog;
|
||||
ssize_t count = 0;
|
||||
unsigned long flags;
|
||||
int i, idx;
|
||||
struct b43_txstatus *stat;
|
||||
|
||||
spin_lock_irqsave(&log->lock, flags);
|
||||
if (log->end < 0) {
|
||||
fappend("Nothing transmitted, yet\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
fappend("b43 TX status reports:\n\n"
|
||||
"index | cookie | seq | phy_stat | frame_count | "
|
||||
"rts_count | supp_reason | pm_indicated | "
|
||||
"intermediate | for_ampdu | acked\n" "---\n");
|
||||
i = log->end + 1;
|
||||
idx = 0;
|
||||
while (1) {
|
||||
if (i == B43_NR_LOGGED_TXSTATUS)
|
||||
i = 0;
|
||||
stat = &(log->log[i]);
|
||||
if (stat->cookie) {
|
||||
fappend("%03d | "
|
||||
"0x%04X | 0x%04X | 0x%02X | "
|
||||
"0x%X | 0x%X | "
|
||||
"%u | %u | "
|
||||
"%u | %u | %u\n",
|
||||
idx,
|
||||
stat->cookie, stat->seq, stat->phy_stat,
|
||||
stat->frame_count, stat->rts_count,
|
||||
stat->supp_reason, stat->pm_indicated,
|
||||
stat->intermediate, stat->for_ampdu,
|
||||
stat->acked);
|
||||
idx++;
|
||||
}
|
||||
if (i == log->end)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
out_unlock:
|
||||
spin_unlock_irqrestore(&log->lock, flags);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t txpower_g_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
ssize_t count = 0;
|
||||
|
||||
if (dev->phy.type != B43_PHYTYPE_G) {
|
||||
fappend("Device is not a G-PHY\n");
|
||||
goto out;
|
||||
}
|
||||
fappend("Control: %s\n", dev->phy.manual_txpower_control ?
|
||||
"MANUAL" : "AUTOMATIC");
|
||||
fappend("Baseband attenuation: %u\n", dev->phy.bbatt.att);
|
||||
fappend("Radio attenuation: %u\n", dev->phy.rfatt.att);
|
||||
fappend("TX Mixer Gain: %s\n",
|
||||
(dev->phy.tx_control & B43_TXCTL_TXMIX) ? "ON" : "OFF");
|
||||
fappend("PA Gain 2dB: %s\n",
|
||||
(dev->phy.tx_control & B43_TXCTL_PA2DB) ? "ON" : "OFF");
|
||||
fappend("PA Gain 3dB: %s\n",
|
||||
(dev->phy.tx_control & B43_TXCTL_PA3DB) ? "ON" : "OFF");
|
||||
fappend("\n\n");
|
||||
fappend("You can write to this file:\n");
|
||||
fappend("Writing \"auto\" enables automatic txpower control.\n");
|
||||
fappend
|
||||
("Writing the attenuation values as \"bbatt rfatt txmix pa2db pa3db\" "
|
||||
"enables manual txpower control.\n");
|
||||
fappend("Example: 5 4 0 0 1\n");
|
||||
fappend("Enables manual control with Baseband attenuation 5, "
|
||||
"Radio attenuation 4, No TX Mixer Gain, "
|
||||
"No PA Gain 2dB, With PA Gain 3dB.\n");
|
||||
out:
|
||||
return count;
|
||||
}
|
||||
|
||||
static int txpower_g_write_file(struct b43_wldev *dev,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
if (dev->phy.type != B43_PHYTYPE_G)
|
||||
return -ENODEV;
|
||||
if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) {
|
||||
/* Automatic control */
|
||||
dev->phy.manual_txpower_control = 0;
|
||||
b43_phy_xmitpower(dev);
|
||||
} else {
|
||||
int bbatt = 0, rfatt = 0, txmix = 0, pa2db = 0, pa3db = 0;
|
||||
/* Manual control */
|
||||
if (sscanf(buf, "%d %d %d %d %d", &bbatt, &rfatt,
|
||||
&txmix, &pa2db, &pa3db) != 5)
|
||||
return -EINVAL;
|
||||
b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt);
|
||||
dev->phy.manual_txpower_control = 1;
|
||||
dev->phy.bbatt.att = bbatt;
|
||||
dev->phy.rfatt.att = rfatt;
|
||||
dev->phy.tx_control = 0;
|
||||
if (txmix)
|
||||
dev->phy.tx_control |= B43_TXCTL_TXMIX;
|
||||
if (pa2db)
|
||||
dev->phy.tx_control |= B43_TXCTL_PA2DB;
|
||||
if (pa3db)
|
||||
dev->phy.tx_control |= B43_TXCTL_PA3DB;
|
||||
b43_phy_lock(dev);
|
||||
b43_radio_lock(dev);
|
||||
b43_set_txpower_g(dev, &dev->phy.bbatt,
|
||||
&dev->phy.rfatt, dev->phy.tx_control);
|
||||
b43_radio_unlock(dev);
|
||||
b43_phy_unlock(dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* wl->irq_lock is locked */
|
||||
static int restart_write_file(struct b43_wldev *dev,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (count > 0 && buf[0] == '1') {
|
||||
b43_controller_restart(dev, "manually restarted");
|
||||
} else
|
||||
err = -EINVAL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static unsigned long calc_expire_secs(unsigned long now,
|
||||
unsigned long time,
|
||||
unsigned long expire)
|
||||
{
|
||||
expire = time + expire;
|
||||
|
||||
if (time_after(now, expire))
|
||||
return 0; /* expired */
|
||||
if (expire < now) {
|
||||
/* jiffies wrapped */
|
||||
expire -= MAX_JIFFY_OFFSET;
|
||||
now -= MAX_JIFFY_OFFSET;
|
||||
}
|
||||
B43_WARN_ON(expire < now);
|
||||
|
||||
return (expire - now) / HZ;
|
||||
}
|
||||
|
||||
static ssize_t loctls_read_file(struct b43_wldev *dev,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
ssize_t count = 0;
|
||||
struct b43_txpower_lo_control *lo;
|
||||
int i, err = 0;
|
||||
struct b43_lo_calib *cal;
|
||||
unsigned long now = jiffies;
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (phy->type != B43_PHYTYPE_G) {
|
||||
fappend("Device is not a G-PHY\n");
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
lo = phy->lo_control;
|
||||
fappend("-- Local Oscillator calibration data --\n\n");
|
||||
fappend("HW-power-control enabled: %d\n",
|
||||
dev->phy.hardware_power_control);
|
||||
fappend("TX Bias: 0x%02X, TX Magn: 0x%02X (expire in %lu sec)\n",
|
||||
lo->tx_bias, lo->tx_magn,
|
||||
calc_expire_secs(now, lo->txctl_measured_time,
|
||||
B43_LO_TXCTL_EXPIRE));
|
||||
fappend("Power Vector: 0x%08X%08X (expires in %lu sec)\n",
|
||||
(unsigned int)((lo->power_vector & 0xFFFFFFFF00000000ULL) >> 32),
|
||||
(unsigned int)(lo->power_vector & 0x00000000FFFFFFFFULL),
|
||||
calc_expire_secs(now, lo->pwr_vec_read_time,
|
||||
B43_LO_PWRVEC_EXPIRE));
|
||||
|
||||
fappend("\nCalibrated settings:\n");
|
||||
list_for_each_entry(cal, &lo->calib_list, list) {
|
||||
bool active;
|
||||
|
||||
active = (b43_compare_bbatt(&cal->bbatt, &phy->bbatt) &&
|
||||
b43_compare_rfatt(&cal->rfatt, &phy->rfatt));
|
||||
fappend("BB(%d), RF(%d,%d) -> I=%d, Q=%d "
|
||||
"(expires in %lu sec)%s\n",
|
||||
cal->bbatt.att,
|
||||
cal->rfatt.att, cal->rfatt.with_padmix,
|
||||
cal->ctl.i, cal->ctl.q,
|
||||
calc_expire_secs(now, cal->calib_time,
|
||||
B43_LO_CALIB_EXPIRE),
|
||||
active ? " ACTIVE" : "");
|
||||
}
|
||||
|
||||
fappend("\nUsed RF attenuation values: Value(WithPadmix flag)\n");
|
||||
for (i = 0; i < lo->rfatt_list.len; i++) {
|
||||
fappend("%u(%d), ",
|
||||
lo->rfatt_list.list[i].att,
|
||||
lo->rfatt_list.list[i].with_padmix);
|
||||
}
|
||||
fappend("\n");
|
||||
fappend("\nUsed Baseband attenuation values:\n");
|
||||
for (i = 0; i < lo->bbatt_list.len; i++) {
|
||||
fappend("%u, ",
|
||||
lo->bbatt_list.list[i].att);
|
||||
}
|
||||
fappend("\n");
|
||||
|
||||
out:
|
||||
return err ? err : count;
|
||||
}
|
||||
|
||||
#undef fappend
|
||||
|
||||
static int b43_debugfs_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
file->private_data = inode->i_private;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct b43_wldev *dev;
|
||||
struct b43_debugfs_fops *dfops;
|
||||
struct b43_dfs_file *dfile;
|
||||
ssize_t uninitialized_var(ret);
|
||||
char *buf;
|
||||
const size_t bufsize = 1024 * 16; /* 16 kiB buffer */
|
||||
const size_t buforder = get_order(bufsize);
|
||||
int err = 0;
|
||||
|
||||
if (!count)
|
||||
return 0;
|
||||
dev = file->private_data;
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->wl->mutex);
|
||||
if (b43_status(dev) < B43_STAT_INITIALIZED) {
|
||||
err = -ENODEV;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
dfops = container_of(file->f_op, struct b43_debugfs_fops, fops);
|
||||
if (!dfops->read) {
|
||||
err = -ENOSYS;
|
||||
goto out_unlock;
|
||||
}
|
||||
dfile = fops_to_dfs_file(dev, dfops);
|
||||
|
||||
if (!dfile->buffer) {
|
||||
buf = (char *)__get_free_pages(GFP_KERNEL, buforder);
|
||||
if (!buf) {
|
||||
err = -ENOMEM;
|
||||
goto out_unlock;
|
||||
}
|
||||
memset(buf, 0, bufsize);
|
||||
if (dfops->take_irqlock) {
|
||||
spin_lock_irq(&dev->wl->irq_lock);
|
||||
ret = dfops->read(dev, buf, bufsize);
|
||||
spin_unlock_irq(&dev->wl->irq_lock);
|
||||
} else
|
||||
ret = dfops->read(dev, buf, bufsize);
|
||||
if (ret <= 0) {
|
||||
free_pages((unsigned long)buf, buforder);
|
||||
err = ret;
|
||||
goto out_unlock;
|
||||
}
|
||||
dfile->data_len = ret;
|
||||
dfile->buffer = buf;
|
||||
}
|
||||
|
||||
ret = simple_read_from_buffer(userbuf, count, ppos,
|
||||
dfile->buffer,
|
||||
dfile->data_len);
|
||||
if (*ppos >= dfile->data_len) {
|
||||
free_pages((unsigned long)dfile->buffer, buforder);
|
||||
dfile->buffer = NULL;
|
||||
dfile->data_len = 0;
|
||||
}
|
||||
out_unlock:
|
||||
mutex_unlock(&dev->wl->mutex);
|
||||
|
||||
return err ? err : ret;
|
||||
}
|
||||
|
||||
static ssize_t b43_debugfs_write(struct file *file,
|
||||
const char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct b43_wldev *dev;
|
||||
struct b43_debugfs_fops *dfops;
|
||||
char *buf;
|
||||
int err = 0;
|
||||
|
||||
if (!count)
|
||||
return 0;
|
||||
if (count > PAGE_SIZE)
|
||||
return -E2BIG;
|
||||
dev = file->private_data;
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->wl->mutex);
|
||||
if (b43_status(dev) < B43_STAT_INITIALIZED) {
|
||||
err = -ENODEV;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
dfops = container_of(file->f_op, struct b43_debugfs_fops, fops);
|
||||
if (!dfops->write) {
|
||||
err = -ENOSYS;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
buf = (char *)get_zeroed_page(GFP_KERNEL);
|
||||
if (!buf) {
|
||||
err = -ENOMEM;
|
||||
goto out_unlock;
|
||||
}
|
||||
if (copy_from_user(buf, userbuf, count)) {
|
||||
err = -EFAULT;
|
||||
goto out_freepage;
|
||||
}
|
||||
if (dfops->take_irqlock) {
|
||||
spin_lock_irq(&dev->wl->irq_lock);
|
||||
err = dfops->write(dev, buf, count);
|
||||
spin_unlock_irq(&dev->wl->irq_lock);
|
||||
} else
|
||||
err = dfops->write(dev, buf, count);
|
||||
if (err)
|
||||
goto out_freepage;
|
||||
|
||||
out_freepage:
|
||||
free_page((unsigned long)buf);
|
||||
out_unlock:
|
||||
mutex_unlock(&dev->wl->mutex);
|
||||
|
||||
return err ? err : count;
|
||||
}
|
||||
|
||||
|
||||
#define B43_DEBUGFS_FOPS(name, _read, _write, _take_irqlock) \
|
||||
static struct b43_debugfs_fops fops_##name = { \
|
||||
.read = _read, \
|
||||
.write = _write, \
|
||||
.fops = { \
|
||||
.open = b43_debugfs_open, \
|
||||
.read = b43_debugfs_read, \
|
||||
.write = b43_debugfs_write, \
|
||||
}, \
|
||||
.file_struct_offset = offsetof(struct b43_dfsentry, \
|
||||
file_##name), \
|
||||
.take_irqlock = _take_irqlock, \
|
||||
}
|
||||
|
||||
B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1);
|
||||
B43_DEBUGFS_FOPS(ucode_regs, ucode_regs_read_file, NULL, 1);
|
||||
B43_DEBUGFS_FOPS(shm, shm_read_file, NULL, 1);
|
||||
B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0);
|
||||
B43_DEBUGFS_FOPS(txpower_g, txpower_g_read_file, txpower_g_write_file, 0);
|
||||
B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1);
|
||||
B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0);
|
||||
|
||||
|
||||
int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
|
||||
{
|
||||
return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]);
|
||||
}
|
||||
|
||||
static void b43_remove_dynamic_debug(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_dfsentry *e = dev->dfsentry;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < __B43_NR_DYNDBG; i++)
|
||||
debugfs_remove(e->dyn_debug_dentries[i]);
|
||||
}
|
||||
|
||||
static void b43_add_dynamic_debug(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_dfsentry *e = dev->dfsentry;
|
||||
struct dentry *d;
|
||||
|
||||
#define add_dyn_dbg(name, id, initstate) do { \
|
||||
e->dyn_debug[id] = (initstate); \
|
||||
d = debugfs_create_bool(name, 0600, e->subdir, \
|
||||
&(e->dyn_debug[id])); \
|
||||
if (!IS_ERR(d)) \
|
||||
e->dyn_debug_dentries[id] = d; \
|
||||
} while (0)
|
||||
|
||||
add_dyn_dbg("debug_xmitpower", B43_DBG_XMITPOWER, 0);
|
||||
add_dyn_dbg("debug_dmaoverflow", B43_DBG_DMAOVERFLOW, 0);
|
||||
add_dyn_dbg("debug_dmaverbose", B43_DBG_DMAVERBOSE, 0);
|
||||
add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0);
|
||||
add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0);
|
||||
add_dyn_dbg("debug_lo", B43_DBG_LO, 0);
|
||||
|
||||
#undef add_dyn_dbg
|
||||
}
|
||||
|
||||
void b43_debugfs_add_device(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_dfsentry *e;
|
||||
struct b43_txstatus_log *log;
|
||||
char devdir[16];
|
||||
|
||||
B43_WARN_ON(!dev);
|
||||
e = kzalloc(sizeof(*e), GFP_KERNEL);
|
||||
if (!e) {
|
||||
b43err(dev->wl, "debugfs: add device OOM\n");
|
||||
return;
|
||||
}
|
||||
e->dev = dev;
|
||||
log = &e->txstatlog;
|
||||
log->log = kcalloc(B43_NR_LOGGED_TXSTATUS,
|
||||
sizeof(struct b43_txstatus), GFP_KERNEL);
|
||||
if (!log->log) {
|
||||
b43err(dev->wl, "debugfs: add device txstatus OOM\n");
|
||||
kfree(e);
|
||||
return;
|
||||
}
|
||||
log->end = -1;
|
||||
spin_lock_init(&log->lock);
|
||||
|
||||
dev->dfsentry = e;
|
||||
|
||||
snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy));
|
||||
e->subdir = debugfs_create_dir(devdir, rootdir);
|
||||
if (!e->subdir || IS_ERR(e->subdir)) {
|
||||
if (e->subdir == ERR_PTR(-ENODEV)) {
|
||||
b43dbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not "
|
||||
"enabled in kernel config\n");
|
||||
} else {
|
||||
b43err(dev->wl, "debugfs: cannot create %s directory\n",
|
||||
devdir);
|
||||
}
|
||||
dev->dfsentry = NULL;
|
||||
kfree(log->log);
|
||||
kfree(e);
|
||||
return;
|
||||
}
|
||||
|
||||
#define ADD_FILE(name, mode) \
|
||||
do { \
|
||||
struct dentry *d; \
|
||||
d = debugfs_create_file(__stringify(name), \
|
||||
mode, e->subdir, dev, \
|
||||
&fops_##name.fops); \
|
||||
e->file_##name.dentry = NULL; \
|
||||
if (!IS_ERR(d)) \
|
||||
e->file_##name.dentry = d; \
|
||||
} while (0)
|
||||
|
||||
|
||||
ADD_FILE(tsf, 0600);
|
||||
ADD_FILE(ucode_regs, 0400);
|
||||
ADD_FILE(shm, 0400);
|
||||
ADD_FILE(txstat, 0400);
|
||||
ADD_FILE(txpower_g, 0600);
|
||||
ADD_FILE(restart, 0200);
|
||||
ADD_FILE(loctls, 0400);
|
||||
|
||||
#undef ADD_FILE
|
||||
|
||||
b43_add_dynamic_debug(dev);
|
||||
}
|
||||
|
||||
void b43_debugfs_remove_device(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_dfsentry *e;
|
||||
|
||||
if (!dev)
|
||||
return;
|
||||
e = dev->dfsentry;
|
||||
if (!e)
|
||||
return;
|
||||
b43_remove_dynamic_debug(dev);
|
||||
|
||||
debugfs_remove(e->file_tsf.dentry);
|
||||
debugfs_remove(e->file_ucode_regs.dentry);
|
||||
debugfs_remove(e->file_shm.dentry);
|
||||
debugfs_remove(e->file_txstat.dentry);
|
||||
debugfs_remove(e->file_txpower_g.dentry);
|
||||
debugfs_remove(e->file_restart.dentry);
|
||||
debugfs_remove(e->file_loctls.dentry);
|
||||
|
||||
debugfs_remove(e->subdir);
|
||||
kfree(e->txstatlog.log);
|
||||
kfree(e);
|
||||
}
|
||||
|
||||
/* Called with IRQs disabled. */
|
||||
void b43_debugfs_log_txstat(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
struct b43_dfsentry *e = dev->dfsentry;
|
||||
struct b43_txstatus_log *log;
|
||||
struct b43_txstatus *cur;
|
||||
int i;
|
||||
|
||||
if (!e)
|
||||
return;
|
||||
log = &e->txstatlog;
|
||||
spin_lock(&log->lock); /* IRQs are already disabled. */
|
||||
i = log->end + 1;
|
||||
if (i == B43_NR_LOGGED_TXSTATUS)
|
||||
i = 0;
|
||||
log->end = i;
|
||||
cur = &(log->log[i]);
|
||||
memcpy(cur, status, sizeof(*cur));
|
||||
spin_unlock(&log->lock);
|
||||
}
|
||||
|
||||
void b43_debugfs_init(void)
|
||||
{
|
||||
rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
if (IS_ERR(rootdir))
|
||||
rootdir = NULL;
|
||||
}
|
||||
|
||||
void b43_debugfs_exit(void)
|
||||
{
|
||||
debugfs_remove(rootdir);
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
#ifndef B43_DEBUGFS_H_
|
||||
#define B43_DEBUGFS_H_
|
||||
|
||||
struct b43_wldev;
|
||||
struct b43_txstatus;
|
||||
|
||||
enum b43_dyndbg { /* Dynamic debugging features */
|
||||
B43_DBG_XMITPOWER,
|
||||
B43_DBG_DMAOVERFLOW,
|
||||
B43_DBG_DMAVERBOSE,
|
||||
B43_DBG_PWORK_FAST,
|
||||
B43_DBG_PWORK_STOP,
|
||||
B43_DBG_LO,
|
||||
__B43_NR_DYNDBG,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_B43_DEBUG
|
||||
|
||||
struct dentry;
|
||||
|
||||
#define B43_NR_LOGGED_TXSTATUS 100
|
||||
|
||||
struct b43_txstatus_log {
|
||||
struct b43_txstatus *log;
|
||||
int end;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
struct b43_dfs_file {
|
||||
struct dentry *dentry;
|
||||
char *buffer;
|
||||
size_t data_len;
|
||||
};
|
||||
|
||||
struct b43_dfsentry {
|
||||
struct b43_wldev *dev;
|
||||
struct dentry *subdir;
|
||||
|
||||
struct b43_dfs_file file_tsf;
|
||||
struct b43_dfs_file file_ucode_regs;
|
||||
struct b43_dfs_file file_shm;
|
||||
struct b43_dfs_file file_txstat;
|
||||
struct b43_dfs_file file_txpower_g;
|
||||
struct b43_dfs_file file_restart;
|
||||
struct b43_dfs_file file_loctls;
|
||||
|
||||
struct b43_txstatus_log txstatlog;
|
||||
|
||||
/* Enabled/Disabled list for the dynamic debugging features. */
|
||||
u32 dyn_debug[__B43_NR_DYNDBG];
|
||||
/* Dentries for the dynamic debugging entries. */
|
||||
struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
|
||||
};
|
||||
|
||||
int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
|
||||
|
||||
void b43_debugfs_init(void);
|
||||
void b43_debugfs_exit(void);
|
||||
void b43_debugfs_add_device(struct b43_wldev *dev);
|
||||
void b43_debugfs_remove_device(struct b43_wldev *dev);
|
||||
void b43_debugfs_log_txstat(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status);
|
||||
|
||||
#else /* CONFIG_B43_DEBUG */
|
||||
|
||||
static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void b43_debugfs_init(void)
|
||||
{
|
||||
}
|
||||
static inline void b43_debugfs_exit(void)
|
||||
{
|
||||
}
|
||||
static inline void b43_debugfs_add_device(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_debugfs_remove_device(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_debugfs_log_txstat(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_DEBUG */
|
||||
|
||||
#endif /* B43_DEBUGFS_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,296 +0,0 @@
|
||||
#ifndef B43_DMA_H_
|
||||
#define B43_DMA_H_
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#include "b43.h"
|
||||
|
||||
/* DMA-Interrupt reasons. */
|
||||
#define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \
|
||||
| (1 << 14) | (1 << 15))
|
||||
#define B43_DMAIRQ_NONFATALMASK (1 << 13)
|
||||
#define B43_DMAIRQ_RX_DONE (1 << 16)
|
||||
|
||||
/*** 32-bit DMA Engine. ***/
|
||||
|
||||
/* 32-bit DMA controller registers. */
|
||||
#define B43_DMA32_TXCTL 0x00
|
||||
#define B43_DMA32_TXENABLE 0x00000001
|
||||
#define B43_DMA32_TXSUSPEND 0x00000002
|
||||
#define B43_DMA32_TXLOOPBACK 0x00000004
|
||||
#define B43_DMA32_TXFLUSH 0x00000010
|
||||
#define B43_DMA32_TXADDREXT_MASK 0x00030000
|
||||
#define B43_DMA32_TXADDREXT_SHIFT 16
|
||||
#define B43_DMA32_TXRING 0x04
|
||||
#define B43_DMA32_TXINDEX 0x08
|
||||
#define B43_DMA32_TXSTATUS 0x0C
|
||||
#define B43_DMA32_TXDPTR 0x00000FFF
|
||||
#define B43_DMA32_TXSTATE 0x0000F000
|
||||
#define B43_DMA32_TXSTAT_DISABLED 0x00000000
|
||||
#define B43_DMA32_TXSTAT_ACTIVE 0x00001000
|
||||
#define B43_DMA32_TXSTAT_IDLEWAIT 0x00002000
|
||||
#define B43_DMA32_TXSTAT_STOPPED 0x00003000
|
||||
#define B43_DMA32_TXSTAT_SUSP 0x00004000
|
||||
#define B43_DMA32_TXERROR 0x000F0000
|
||||
#define B43_DMA32_TXERR_NOERR 0x00000000
|
||||
#define B43_DMA32_TXERR_PROT 0x00010000
|
||||
#define B43_DMA32_TXERR_UNDERRUN 0x00020000
|
||||
#define B43_DMA32_TXERR_BUFREAD 0x00030000
|
||||
#define B43_DMA32_TXERR_DESCREAD 0x00040000
|
||||
#define B43_DMA32_TXACTIVE 0xFFF00000
|
||||
#define B43_DMA32_RXCTL 0x10
|
||||
#define B43_DMA32_RXENABLE 0x00000001
|
||||
#define B43_DMA32_RXFROFF_MASK 0x000000FE
|
||||
#define B43_DMA32_RXFROFF_SHIFT 1
|
||||
#define B43_DMA32_RXDIRECTFIFO 0x00000100
|
||||
#define B43_DMA32_RXADDREXT_MASK 0x00030000
|
||||
#define B43_DMA32_RXADDREXT_SHIFT 16
|
||||
#define B43_DMA32_RXRING 0x14
|
||||
#define B43_DMA32_RXINDEX 0x18
|
||||
#define B43_DMA32_RXSTATUS 0x1C
|
||||
#define B43_DMA32_RXDPTR 0x00000FFF
|
||||
#define B43_DMA32_RXSTATE 0x0000F000
|
||||
#define B43_DMA32_RXSTAT_DISABLED 0x00000000
|
||||
#define B43_DMA32_RXSTAT_ACTIVE 0x00001000
|
||||
#define B43_DMA32_RXSTAT_IDLEWAIT 0x00002000
|
||||
#define B43_DMA32_RXSTAT_STOPPED 0x00003000
|
||||
#define B43_DMA32_RXERROR 0x000F0000
|
||||
#define B43_DMA32_RXERR_NOERR 0x00000000
|
||||
#define B43_DMA32_RXERR_PROT 0x00010000
|
||||
#define B43_DMA32_RXERR_OVERFLOW 0x00020000
|
||||
#define B43_DMA32_RXERR_BUFWRITE 0x00030000
|
||||
#define B43_DMA32_RXERR_DESCREAD 0x00040000
|
||||
#define B43_DMA32_RXACTIVE 0xFFF00000
|
||||
|
||||
/* 32-bit DMA descriptor. */
|
||||
struct b43_dmadesc32 {
|
||||
__le32 control;
|
||||
__le32 address;
|
||||
} __attribute__ ((__packed__));
|
||||
#define B43_DMA32_DCTL_BYTECNT 0x00001FFF
|
||||
#define B43_DMA32_DCTL_ADDREXT_MASK 0x00030000
|
||||
#define B43_DMA32_DCTL_ADDREXT_SHIFT 16
|
||||
#define B43_DMA32_DCTL_DTABLEEND 0x10000000
|
||||
#define B43_DMA32_DCTL_IRQ 0x20000000
|
||||
#define B43_DMA32_DCTL_FRAMEEND 0x40000000
|
||||
#define B43_DMA32_DCTL_FRAMESTART 0x80000000
|
||||
|
||||
/*** 64-bit DMA Engine. ***/
|
||||
|
||||
/* 64-bit DMA controller registers. */
|
||||
#define B43_DMA64_TXCTL 0x00
|
||||
#define B43_DMA64_TXENABLE 0x00000001
|
||||
#define B43_DMA64_TXSUSPEND 0x00000002
|
||||
#define B43_DMA64_TXLOOPBACK 0x00000004
|
||||
#define B43_DMA64_TXFLUSH 0x00000010
|
||||
#define B43_DMA64_TXADDREXT_MASK 0x00030000
|
||||
#define B43_DMA64_TXADDREXT_SHIFT 16
|
||||
#define B43_DMA64_TXINDEX 0x04
|
||||
#define B43_DMA64_TXRINGLO 0x08
|
||||
#define B43_DMA64_TXRINGHI 0x0C
|
||||
#define B43_DMA64_TXSTATUS 0x10
|
||||
#define B43_DMA64_TXSTATDPTR 0x00001FFF
|
||||
#define B43_DMA64_TXSTAT 0xF0000000
|
||||
#define B43_DMA64_TXSTAT_DISABLED 0x00000000
|
||||
#define B43_DMA64_TXSTAT_ACTIVE 0x10000000
|
||||
#define B43_DMA64_TXSTAT_IDLEWAIT 0x20000000
|
||||
#define B43_DMA64_TXSTAT_STOPPED 0x30000000
|
||||
#define B43_DMA64_TXSTAT_SUSP 0x40000000
|
||||
#define B43_DMA64_TXERROR 0x14
|
||||
#define B43_DMA64_TXERRDPTR 0x0001FFFF
|
||||
#define B43_DMA64_TXERR 0xF0000000
|
||||
#define B43_DMA64_TXERR_NOERR 0x00000000
|
||||
#define B43_DMA64_TXERR_PROT 0x10000000
|
||||
#define B43_DMA64_TXERR_UNDERRUN 0x20000000
|
||||
#define B43_DMA64_TXERR_TRANSFER 0x30000000
|
||||
#define B43_DMA64_TXERR_DESCREAD 0x40000000
|
||||
#define B43_DMA64_TXERR_CORE 0x50000000
|
||||
#define B43_DMA64_RXCTL 0x20
|
||||
#define B43_DMA64_RXENABLE 0x00000001
|
||||
#define B43_DMA64_RXFROFF_MASK 0x000000FE
|
||||
#define B43_DMA64_RXFROFF_SHIFT 1
|
||||
#define B43_DMA64_RXDIRECTFIFO 0x00000100
|
||||
#define B43_DMA64_RXADDREXT_MASK 0x00030000
|
||||
#define B43_DMA64_RXADDREXT_SHIFT 16
|
||||
#define B43_DMA64_RXINDEX 0x24
|
||||
#define B43_DMA64_RXRINGLO 0x28
|
||||
#define B43_DMA64_RXRINGHI 0x2C
|
||||
#define B43_DMA64_RXSTATUS 0x30
|
||||
#define B43_DMA64_RXSTATDPTR 0x00001FFF
|
||||
#define B43_DMA64_RXSTAT 0xF0000000
|
||||
#define B43_DMA64_RXSTAT_DISABLED 0x00000000
|
||||
#define B43_DMA64_RXSTAT_ACTIVE 0x10000000
|
||||
#define B43_DMA64_RXSTAT_IDLEWAIT 0x20000000
|
||||
#define B43_DMA64_RXSTAT_STOPPED 0x30000000
|
||||
#define B43_DMA64_RXSTAT_SUSP 0x40000000
|
||||
#define B43_DMA64_RXERROR 0x34
|
||||
#define B43_DMA64_RXERRDPTR 0x0001FFFF
|
||||
#define B43_DMA64_RXERR 0xF0000000
|
||||
#define B43_DMA64_RXERR_NOERR 0x00000000
|
||||
#define B43_DMA64_RXERR_PROT 0x10000000
|
||||
#define B43_DMA64_RXERR_UNDERRUN 0x20000000
|
||||
#define B43_DMA64_RXERR_TRANSFER 0x30000000
|
||||
#define B43_DMA64_RXERR_DESCREAD 0x40000000
|
||||
#define B43_DMA64_RXERR_CORE 0x50000000
|
||||
|
||||
/* 64-bit DMA descriptor. */
|
||||
struct b43_dmadesc64 {
|
||||
__le32 control0;
|
||||
__le32 control1;
|
||||
__le32 address_low;
|
||||
__le32 address_high;
|
||||
} __attribute__ ((__packed__));
|
||||
#define B43_DMA64_DCTL0_DTABLEEND 0x10000000
|
||||
#define B43_DMA64_DCTL0_IRQ 0x20000000
|
||||
#define B43_DMA64_DCTL0_FRAMEEND 0x40000000
|
||||
#define B43_DMA64_DCTL0_FRAMESTART 0x80000000
|
||||
#define B43_DMA64_DCTL1_BYTECNT 0x00001FFF
|
||||
#define B43_DMA64_DCTL1_ADDREXT_MASK 0x00030000
|
||||
#define B43_DMA64_DCTL1_ADDREXT_SHIFT 16
|
||||
|
||||
struct b43_dmadesc_generic {
|
||||
union {
|
||||
struct b43_dmadesc32 dma32;
|
||||
struct b43_dmadesc64 dma64;
|
||||
} __attribute__ ((__packed__));
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
/* Misc DMA constants */
|
||||
#define B43_DMA_RINGMEMSIZE PAGE_SIZE
|
||||
#define B43_DMA0_RX_FRAMEOFFSET 30
|
||||
#define B43_DMA3_RX_FRAMEOFFSET 0
|
||||
|
||||
/* DMA engine tuning knobs */
|
||||
#define B43_TXRING_SLOTS 128
|
||||
#define B43_RXRING_SLOTS 64
|
||||
#define B43_DMA0_RX_BUFFERSIZE (2304 + 100)
|
||||
#define B43_DMA3_RX_BUFFERSIZE 16
|
||||
|
||||
struct sk_buff;
|
||||
struct b43_private;
|
||||
struct b43_txstatus;
|
||||
|
||||
struct b43_dmadesc_meta {
|
||||
/* The kernel DMA-able buffer. */
|
||||
struct sk_buff *skb;
|
||||
/* DMA base bus-address of the descriptor buffer. */
|
||||
dma_addr_t dmaaddr;
|
||||
/* ieee80211 TX status. Only used once per 802.11 frag. */
|
||||
bool is_last_fragment;
|
||||
};
|
||||
|
||||
struct b43_dmaring;
|
||||
|
||||
/* Lowlevel DMA operations that differ between 32bit and 64bit DMA. */
|
||||
struct b43_dma_ops {
|
||||
struct b43_dmadesc_generic *(*idx2desc) (struct b43_dmaring * ring,
|
||||
int slot,
|
||||
struct b43_dmadesc_meta **
|
||||
meta);
|
||||
void (*fill_descriptor) (struct b43_dmaring * ring,
|
||||
struct b43_dmadesc_generic * desc,
|
||||
dma_addr_t dmaaddr, u16 bufsize, int start,
|
||||
int end, int irq);
|
||||
void (*poke_tx) (struct b43_dmaring * ring, int slot);
|
||||
void (*tx_suspend) (struct b43_dmaring * ring);
|
||||
void (*tx_resume) (struct b43_dmaring * ring);
|
||||
int (*get_current_rxslot) (struct b43_dmaring * ring);
|
||||
void (*set_current_rxslot) (struct b43_dmaring * ring, int slot);
|
||||
};
|
||||
|
||||
enum b43_dmatype {
|
||||
B43_DMA_30BIT = 30,
|
||||
B43_DMA_32BIT = 32,
|
||||
B43_DMA_64BIT = 64,
|
||||
};
|
||||
|
||||
struct b43_dmaring {
|
||||
/* Lowlevel DMA ops. */
|
||||
const struct b43_dma_ops *ops;
|
||||
/* Kernel virtual base address of the ring memory. */
|
||||
void *descbase;
|
||||
/* Meta data about all descriptors. */
|
||||
struct b43_dmadesc_meta *meta;
|
||||
/* Cache of TX headers for each slot.
|
||||
* This is to avoid an allocation on each TX.
|
||||
* This is NULL for an RX ring.
|
||||
*/
|
||||
u8 *txhdr_cache;
|
||||
/* (Unadjusted) DMA base bus-address of the ring memory. */
|
||||
dma_addr_t dmabase;
|
||||
/* Number of descriptor slots in the ring. */
|
||||
int nr_slots;
|
||||
/* Number of used descriptor slots. */
|
||||
int used_slots;
|
||||
/* Currently used slot in the ring. */
|
||||
int current_slot;
|
||||
/* Total number of packets sent. Statistics only. */
|
||||
unsigned int nr_tx_packets;
|
||||
/* Frameoffset in octets. */
|
||||
u32 frameoffset;
|
||||
/* Descriptor buffer size. */
|
||||
u16 rx_buffersize;
|
||||
/* The MMIO base register of the DMA controller. */
|
||||
u16 mmio_base;
|
||||
/* DMA controller index number (0-5). */
|
||||
int index;
|
||||
/* Boolean. Is this a TX ring? */
|
||||
bool tx;
|
||||
/* The type of DMA engine used. */
|
||||
enum b43_dmatype type;
|
||||
/* Boolean. Is this ring stopped at ieee80211 level? */
|
||||
bool stopped;
|
||||
/* The QOS priority assigned to this ring. Only used for TX rings.
|
||||
* This is the mac80211 "queue" value. */
|
||||
u8 queue_prio;
|
||||
/* Lock, only used for TX. */
|
||||
spinlock_t lock;
|
||||
struct b43_wldev *dev;
|
||||
#ifdef CONFIG_B43_DEBUG
|
||||
/* Maximum number of used slots. */
|
||||
int max_used_slots;
|
||||
/* Last time we injected a ring overflow. */
|
||||
unsigned long last_injected_overflow;
|
||||
/* Statistics: Number of successfully transmitted packets */
|
||||
u64 nr_succeed_tx_packets;
|
||||
/* Statistics: Number of failed TX packets */
|
||||
u64 nr_failed_tx_packets;
|
||||
/* Statistics: Total number of TX plus all retries. */
|
||||
u64 nr_total_packet_tries;
|
||||
#endif /* CONFIG_B43_DEBUG */
|
||||
};
|
||||
|
||||
static inline u32 b43_dma_read(struct b43_dmaring *ring, u16 offset)
|
||||
{
|
||||
return b43_read32(ring->dev, ring->mmio_base + offset);
|
||||
}
|
||||
|
||||
static inline void b43_dma_write(struct b43_dmaring *ring, u16 offset, u32 value)
|
||||
{
|
||||
b43_write32(ring->dev, ring->mmio_base + offset, value);
|
||||
}
|
||||
|
||||
int b43_dma_init(struct b43_wldev *dev);
|
||||
void b43_dma_free(struct b43_wldev *dev);
|
||||
|
||||
void b43_dma_tx_suspend(struct b43_wldev *dev);
|
||||
void b43_dma_tx_resume(struct b43_wldev *dev);
|
||||
|
||||
void b43_dma_get_tx_stats(struct b43_wldev *dev,
|
||||
struct ieee80211_tx_queue_stats *stats);
|
||||
|
||||
int b43_dma_tx(struct b43_wldev *dev,
|
||||
struct sk_buff *skb);
|
||||
void b43_dma_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status);
|
||||
|
||||
void b43_dma_rx(struct b43_dmaring *ring);
|
||||
|
||||
void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
|
||||
unsigned int engine_index, bool enable);
|
||||
|
||||
#endif /* B43_DMA_H_ */
|
@ -1,239 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
LED control
|
||||
|
||||
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
|
||||
Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
|
||||
Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de>
|
||||
Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
|
||||
Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "b43.h"
|
||||
#include "leds.h"
|
||||
|
||||
|
||||
static void b43_led_turn_on(struct b43_wldev *dev, u8 led_index,
|
||||
bool activelow)
|
||||
{
|
||||
struct b43_wl *wl = dev->wl;
|
||||
unsigned long flags;
|
||||
u16 ctl;
|
||||
|
||||
spin_lock_irqsave(&wl->leds_lock, flags);
|
||||
ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL);
|
||||
if (activelow)
|
||||
ctl &= ~(1 << led_index);
|
||||
else
|
||||
ctl |= (1 << led_index);
|
||||
b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl);
|
||||
spin_unlock_irqrestore(&wl->leds_lock, flags);
|
||||
}
|
||||
|
||||
static void b43_led_turn_off(struct b43_wldev *dev, u8 led_index,
|
||||
bool activelow)
|
||||
{
|
||||
struct b43_wl *wl = dev->wl;
|
||||
unsigned long flags;
|
||||
u16 ctl;
|
||||
|
||||
spin_lock_irqsave(&wl->leds_lock, flags);
|
||||
ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL);
|
||||
if (activelow)
|
||||
ctl |= (1 << led_index);
|
||||
else
|
||||
ctl &= ~(1 << led_index);
|
||||
b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl);
|
||||
spin_unlock_irqrestore(&wl->leds_lock, flags);
|
||||
}
|
||||
|
||||
/* Callback from the LED subsystem. */
|
||||
static void b43_led_brightness_set(struct led_classdev *led_dev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct b43_led *led = container_of(led_dev, struct b43_led, led_dev);
|
||||
struct b43_wldev *dev = led->dev;
|
||||
bool radio_enabled;
|
||||
|
||||
/* Checking the radio-enabled status here is slightly racy,
|
||||
* but we want to avoid the locking overhead and we don't care
|
||||
* whether the LED has the wrong state for a second. */
|
||||
radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable);
|
||||
|
||||
if (brightness == LED_OFF || !radio_enabled)
|
||||
b43_led_turn_off(dev, led->index, led->activelow);
|
||||
else
|
||||
b43_led_turn_on(dev, led->index, led->activelow);
|
||||
}
|
||||
|
||||
static int b43_register_led(struct b43_wldev *dev, struct b43_led *led,
|
||||
const char *name, char *default_trigger,
|
||||
u8 led_index, bool activelow)
|
||||
{
|
||||
int err;
|
||||
|
||||
b43_led_turn_off(dev, led_index, activelow);
|
||||
if (led->dev)
|
||||
return -EEXIST;
|
||||
if (!default_trigger)
|
||||
return -EINVAL;
|
||||
led->dev = dev;
|
||||
led->index = led_index;
|
||||
led->activelow = activelow;
|
||||
strncpy(led->name, name, sizeof(led->name));
|
||||
|
||||
led->led_dev.name = led->name;
|
||||
led->led_dev.default_trigger = default_trigger;
|
||||
led->led_dev.brightness_set = b43_led_brightness_set;
|
||||
|
||||
err = led_classdev_register(dev->dev->dev, &led->led_dev);
|
||||
if (err) {
|
||||
b43warn(dev->wl, "LEDs: Failed to register %s\n", name);
|
||||
led->dev = NULL;
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void b43_unregister_led(struct b43_led *led)
|
||||
{
|
||||
if (!led->dev)
|
||||
return;
|
||||
led_classdev_unregister(&led->led_dev);
|
||||
b43_led_turn_off(led->dev, led->index, led->activelow);
|
||||
led->dev = NULL;
|
||||
}
|
||||
|
||||
static void b43_map_led(struct b43_wldev *dev,
|
||||
u8 led_index,
|
||||
enum b43_led_behaviour behaviour,
|
||||
bool activelow)
|
||||
{
|
||||
struct ieee80211_hw *hw = dev->wl->hw;
|
||||
char name[B43_LED_MAX_NAME_LEN + 1];
|
||||
|
||||
/* Map the b43 specific LED behaviour value to the
|
||||
* generic LED triggers. */
|
||||
switch (behaviour) {
|
||||
case B43_LED_INACTIVE:
|
||||
break;
|
||||
case B43_LED_OFF:
|
||||
b43_led_turn_off(dev, led_index, activelow);
|
||||
break;
|
||||
case B43_LED_ON:
|
||||
b43_led_turn_on(dev, led_index, activelow);
|
||||
break;
|
||||
case B43_LED_ACTIVITY:
|
||||
case B43_LED_TRANSFER:
|
||||
case B43_LED_APTRANSFER:
|
||||
snprintf(name, sizeof(name),
|
||||
"b43-%s::tx", wiphy_name(hw->wiphy));
|
||||
b43_register_led(dev, &dev->led_tx, name,
|
||||
ieee80211_get_tx_led_name(hw),
|
||||
led_index, activelow);
|
||||
snprintf(name, sizeof(name),
|
||||
"b43-%s::rx", wiphy_name(hw->wiphy));
|
||||
b43_register_led(dev, &dev->led_rx, name,
|
||||
ieee80211_get_rx_led_name(hw),
|
||||
led_index, activelow);
|
||||
break;
|
||||
case B43_LED_RADIO_ALL:
|
||||
case B43_LED_RADIO_A:
|
||||
case B43_LED_RADIO_B:
|
||||
case B43_LED_MODE_BG:
|
||||
snprintf(name, sizeof(name),
|
||||
"b43-%s::radio", wiphy_name(hw->wiphy));
|
||||
b43_register_led(dev, &dev->led_radio, name,
|
||||
b43_rfkill_led_name(dev),
|
||||
led_index, activelow);
|
||||
/* Sync the RF-kill LED state with the switch state. */
|
||||
if (dev->radio_hw_enable)
|
||||
b43_led_turn_on(dev, led_index, activelow);
|
||||
break;
|
||||
case B43_LED_WEIRD:
|
||||
case B43_LED_ASSOC:
|
||||
snprintf(name, sizeof(name),
|
||||
"b43-%s::assoc", wiphy_name(hw->wiphy));
|
||||
b43_register_led(dev, &dev->led_assoc, name,
|
||||
ieee80211_get_assoc_led_name(hw),
|
||||
led_index, activelow);
|
||||
break;
|
||||
default:
|
||||
b43warn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n",
|
||||
behaviour);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void b43_leds_init(struct b43_wldev *dev)
|
||||
{
|
||||
struct ssb_bus *bus = dev->dev->bus;
|
||||
u8 sprom[4];
|
||||
int i;
|
||||
enum b43_led_behaviour behaviour;
|
||||
bool activelow;
|
||||
|
||||
sprom[0] = bus->sprom.gpio0;
|
||||
sprom[1] = bus->sprom.gpio1;
|
||||
sprom[2] = bus->sprom.gpio2;
|
||||
sprom[3] = bus->sprom.gpio3;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (sprom[i] == 0xFF) {
|
||||
/* There is no LED information in the SPROM
|
||||
* for this LED. Hardcode it here. */
|
||||
activelow = 0;
|
||||
switch (i) {
|
||||
case 0:
|
||||
behaviour = B43_LED_ACTIVITY;
|
||||
activelow = 1;
|
||||
if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ)
|
||||
behaviour = B43_LED_RADIO_ALL;
|
||||
break;
|
||||
case 1:
|
||||
behaviour = B43_LED_RADIO_B;
|
||||
if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK)
|
||||
behaviour = B43_LED_ASSOC;
|
||||
break;
|
||||
case 2:
|
||||
behaviour = B43_LED_RADIO_A;
|
||||
break;
|
||||
case 3:
|
||||
behaviour = B43_LED_OFF;
|
||||
break;
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
behaviour = sprom[i] & B43_LED_BEHAVIOUR;
|
||||
activelow = !!(sprom[i] & B43_LED_ACTIVELOW);
|
||||
}
|
||||
b43_map_led(dev, i, behaviour, activelow);
|
||||
}
|
||||
}
|
||||
|
||||
void b43_leds_exit(struct b43_wldev *dev)
|
||||
{
|
||||
b43_unregister_led(&dev->led_tx);
|
||||
b43_unregister_led(&dev->led_rx);
|
||||
b43_unregister_led(&dev->led_assoc);
|
||||
b43_unregister_led(&dev->led_radio);
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
#ifndef B43_LEDS_H_
|
||||
#define B43_LEDS_H_
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
#ifdef CONFIG_B43_LEDS
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
|
||||
#define B43_LED_MAX_NAME_LEN 31
|
||||
|
||||
struct b43_led {
|
||||
struct b43_wldev *dev;
|
||||
/* The LED class device */
|
||||
struct led_classdev led_dev;
|
||||
/* The index number of the LED. */
|
||||
u8 index;
|
||||
/* If activelow is true, the LED is ON if the
|
||||
* bit is switched off. */
|
||||
bool activelow;
|
||||
/* The unique name string for this LED device. */
|
||||
char name[B43_LED_MAX_NAME_LEN + 1];
|
||||
};
|
||||
|
||||
#define B43_LED_BEHAVIOUR 0x7F
|
||||
#define B43_LED_ACTIVELOW 0x80
|
||||
/* LED behaviour values */
|
||||
enum b43_led_behaviour {
|
||||
B43_LED_OFF,
|
||||
B43_LED_ON,
|
||||
B43_LED_ACTIVITY,
|
||||
B43_LED_RADIO_ALL,
|
||||
B43_LED_RADIO_A,
|
||||
B43_LED_RADIO_B,
|
||||
B43_LED_MODE_BG,
|
||||
B43_LED_TRANSFER,
|
||||
B43_LED_APTRANSFER,
|
||||
B43_LED_WEIRD, //FIXME
|
||||
B43_LED_ASSOC,
|
||||
B43_LED_INACTIVE,
|
||||
};
|
||||
|
||||
void b43_leds_init(struct b43_wldev *dev);
|
||||
void b43_leds_exit(struct b43_wldev *dev);
|
||||
|
||||
|
||||
#else /* CONFIG_B43_LEDS */
|
||||
/* LED support disabled */
|
||||
|
||||
struct b43_led {
|
||||
/* empty */
|
||||
};
|
||||
|
||||
static inline void b43_leds_init(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_leds_exit(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_B43_LEDS */
|
||||
|
||||
#endif /* B43_LEDS_H_ */
|
1036
package/b43/src/lo.c
1036
package/b43/src/lo.c
File diff suppressed because it is too large
Load Diff
@ -1,85 +0,0 @@
|
||||
#ifndef B43_LO_H_
|
||||
#define B43_LO_H_
|
||||
|
||||
#include "phy.h"
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
/* Local Oscillator control value-pair. */
|
||||
struct b43_loctl {
|
||||
/* Control values. */
|
||||
s8 i;
|
||||
s8 q;
|
||||
};
|
||||
/* Debugging: Poison value for i and q values. */
|
||||
#define B43_LOCTL_POISON 111
|
||||
|
||||
/* This struct holds calibrated LO settings for a set of
|
||||
* Baseband and RF attenuation settings. */
|
||||
struct b43_lo_calib {
|
||||
/* The set of attenuation values this set of LO
|
||||
* control values is calibrated for. */
|
||||
struct b43_bbatt bbatt;
|
||||
struct b43_rfatt rfatt;
|
||||
/* The set of control values for the LO. */
|
||||
struct b43_loctl ctl;
|
||||
/* The time when these settings were calibrated (in jiffies) */
|
||||
unsigned long calib_time;
|
||||
/* List. */
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
/* Size of the DC Lookup Table in 16bit words. */
|
||||
#define B43_DC_LT_SIZE 32
|
||||
|
||||
/* Local Oscillator calibration information */
|
||||
struct b43_txpower_lo_control {
|
||||
/* Lists of RF and BB attenuation values for this device.
|
||||
* Used for building hardware power control tables. */
|
||||
struct b43_rfatt_list rfatt_list;
|
||||
struct b43_bbatt_list bbatt_list;
|
||||
|
||||
/* The DC Lookup Table is cached in memory here.
|
||||
* Note that this is only used for Hardware Power Control. */
|
||||
u16 dc_lt[B43_DC_LT_SIZE];
|
||||
|
||||
/* List of calibrated control values (struct b43_lo_calib). */
|
||||
struct list_head calib_list;
|
||||
/* Last time the power vector was read (jiffies). */
|
||||
unsigned long pwr_vec_read_time;
|
||||
/* Last time the txctl values were measured (jiffies). */
|
||||
unsigned long txctl_measured_time;
|
||||
|
||||
/* Current TX Bias value */
|
||||
u8 tx_bias;
|
||||
/* Current TX Magnification Value (if used by the device) */
|
||||
u8 tx_magn;
|
||||
|
||||
/* Saved device PowerVector */
|
||||
u64 power_vector;
|
||||
};
|
||||
|
||||
/* Calibration expire timeouts.
|
||||
* Timeouts must be multiple of 15 seconds. To make sure
|
||||
* the item really expired when the 15 second timer hits, we
|
||||
* subtract two additional seconds from the timeout. */
|
||||
#define B43_LO_CALIB_EXPIRE (HZ * (30 - 2))
|
||||
#define B43_LO_PWRVEC_EXPIRE (HZ * (30 - 2))
|
||||
#define B43_LO_TXCTL_EXPIRE (HZ * (180 - 4))
|
||||
|
||||
|
||||
/* Adjust the Local Oscillator to the saved attenuation
|
||||
* and txctl values.
|
||||
*/
|
||||
void b43_lo_g_adjust(struct b43_wldev *dev);
|
||||
/* Adjust to specific values. */
|
||||
void b43_lo_g_adjust_to(struct b43_wldev *dev,
|
||||
u16 rfatt, u16 bbatt, u16 tx_control);
|
||||
|
||||
void b43_gphy_dc_lt_init(struct b43_wldev *dev, bool update_all);
|
||||
|
||||
void b43_lo_g_maintanance_work(struct b43_wldev *dev);
|
||||
void b43_lo_g_cleanup(struct b43_wldev *dev);
|
||||
void b43_lo_g_init(struct b43_wldev *dev);
|
||||
|
||||
#endif /* B43_LO_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,120 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
|
||||
Stefano Brivio <stefano.brivio@polimi.it>
|
||||
Michael Buesch <mb@bu3sch.de>
|
||||
Danny van Dyk <kugelfang@gentoo.org>
|
||||
Andreas Jaggi <andreas.jaggi@waterwave.ch>
|
||||
|
||||
Some parts of the code in this file are derived from the ipw2200
|
||||
driver Copyright(c) 2003 - 2004 Intel Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef B43_MAIN_H_
|
||||
#define B43_MAIN_H_
|
||||
|
||||
#include "b43.h"
|
||||
|
||||
#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
|
||||
#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
|
||||
/* Magic helper macro to pad structures. Ignore those above. It's magic. */
|
||||
#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
|
||||
|
||||
|
||||
extern int b43_modparam_qos;
|
||||
|
||||
|
||||
/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
|
||||
static inline u8 b43_freq_to_channel_5ghz(int freq)
|
||||
{
|
||||
return ((freq - 5000) / 5);
|
||||
}
|
||||
static inline u8 b43_freq_to_channel_2ghz(int freq)
|
||||
{
|
||||
u8 channel;
|
||||
|
||||
if (freq == 2484)
|
||||
channel = 14;
|
||||
else
|
||||
channel = (freq - 2407) / 5;
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
/* Lightweight function to convert a channel number to a frequency (in Mhz). */
|
||||
static inline int b43_channel_to_freq_5ghz(u8 channel)
|
||||
{
|
||||
return (5000 + (5 * channel));
|
||||
}
|
||||
static inline int b43_channel_to_freq_2ghz(u8 channel)
|
||||
{
|
||||
int freq;
|
||||
|
||||
if (channel == 14)
|
||||
freq = 2484;
|
||||
else
|
||||
freq = 2407 + (5 * channel);
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
static inline int b43_is_cck_rate(int rate)
|
||||
{
|
||||
return (rate == B43_CCK_RATE_1MB ||
|
||||
rate == B43_CCK_RATE_2MB ||
|
||||
rate == B43_CCK_RATE_5MB || rate == B43_CCK_RATE_11MB);
|
||||
}
|
||||
|
||||
static inline int b43_is_ofdm_rate(int rate)
|
||||
{
|
||||
return !b43_is_cck_rate(rate);
|
||||
}
|
||||
|
||||
u8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev,
|
||||
u8 antenna_nr);
|
||||
|
||||
void b43_tsf_read(struct b43_wldev *dev, u64 * tsf);
|
||||
void b43_tsf_write(struct b43_wldev *dev, u64 tsf);
|
||||
|
||||
u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset);
|
||||
u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset);
|
||||
void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value);
|
||||
void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value);
|
||||
|
||||
u64 b43_hf_read(struct b43_wldev *dev);
|
||||
void b43_hf_write(struct b43_wldev *dev, u64 value);
|
||||
|
||||
void b43_dummy_transmission(struct b43_wldev *dev);
|
||||
|
||||
void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags);
|
||||
|
||||
void b43_controller_restart(struct b43_wldev *dev, const char *reason);
|
||||
|
||||
#define B43_PS_ENABLED (1 << 0) /* Force enable hardware power saving */
|
||||
#define B43_PS_DISABLED (1 << 1) /* Force disable hardware power saving */
|
||||
#define B43_PS_AWAKE (1 << 2) /* Force device awake */
|
||||
#define B43_PS_ASLEEP (1 << 3) /* Force device asleep */
|
||||
void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags);
|
||||
|
||||
void b43_mac_suspend(struct b43_wldev *dev);
|
||||
void b43_mac_enable(struct b43_wldev *dev);
|
||||
|
||||
#endif /* B43_MAIN_H_ */
|
@ -1,486 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
IEEE 802.11n PHY support
|
||||
|
||||
Copyright (c) 2008 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "b43.h"
|
||||
#include "nphy.h"
|
||||
#include "tables_nphy.h"
|
||||
|
||||
|
||||
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
|
||||
{//TODO
|
||||
}
|
||||
|
||||
void b43_nphy_xmitpower(struct b43_wldev *dev)
|
||||
{//TODO
|
||||
}
|
||||
|
||||
static void b43_chantab_radio_upload(struct b43_wldev *dev,
|
||||
const struct b43_nphy_channeltab_entry *e)
|
||||
{
|
||||
b43_radio_write16(dev, B2055_PLL_REF, e->radio_pll_ref);
|
||||
b43_radio_write16(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
|
||||
b43_radio_write16(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1);
|
||||
b43_radio_write16(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail);
|
||||
b43_radio_write16(dev, B2055_VCO_CAL1, e->radio_vco_cal1);
|
||||
b43_radio_write16(dev, B2055_VCO_CAL2, e->radio_vco_cal2);
|
||||
b43_radio_write16(dev, B2055_PLL_LFC1, e->radio_pll_lfc1);
|
||||
b43_radio_write16(dev, B2055_PLL_LFR1, e->radio_pll_lfr1);
|
||||
b43_radio_write16(dev, B2055_PLL_LFC2, e->radio_pll_lfc2);
|
||||
b43_radio_write16(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf);
|
||||
b43_radio_write16(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1);
|
||||
b43_radio_write16(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2);
|
||||
b43_radio_write16(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune);
|
||||
b43_radio_write16(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune);
|
||||
b43_radio_write16(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1);
|
||||
b43_radio_write16(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn);
|
||||
b43_radio_write16(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim);
|
||||
b43_radio_write16(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune);
|
||||
b43_radio_write16(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune);
|
||||
b43_radio_write16(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1);
|
||||
b43_radio_write16(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn);
|
||||
b43_radio_write16(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
|
||||
}
|
||||
|
||||
static void b43_chantab_phy_upload(struct b43_wldev *dev,
|
||||
const struct b43_nphy_channeltab_entry *e)
|
||||
{
|
||||
b43_phy_write(dev, B43_NPHY_BW1A, e->phy_bw1a);
|
||||
b43_phy_write(dev, B43_NPHY_BW2, e->phy_bw2);
|
||||
b43_phy_write(dev, B43_NPHY_BW3, e->phy_bw3);
|
||||
b43_phy_write(dev, B43_NPHY_BW4, e->phy_bw4);
|
||||
b43_phy_write(dev, B43_NPHY_BW5, e->phy_bw5);
|
||||
b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6);
|
||||
}
|
||||
|
||||
static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
/* Tune the hardware to a new channel. Don't call this directly.
|
||||
* Use b43_radio_selectchannel() */
|
||||
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
|
||||
{
|
||||
const struct b43_nphy_channeltab_entry *tabent;
|
||||
|
||||
tabent = b43_nphy_get_chantabent(dev, channel);
|
||||
if (!tabent)
|
||||
return -ESRCH;
|
||||
|
||||
//FIXME enable/disable band select upper20 in RXCTL
|
||||
if (0 /*FIXME 5Ghz*/)
|
||||
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
|
||||
else
|
||||
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
|
||||
b43_chantab_radio_upload(dev, tabent);
|
||||
udelay(50);
|
||||
b43_radio_write16(dev, B2055_VCO_CAL10, 5);
|
||||
b43_radio_write16(dev, B2055_VCO_CAL10, 45);
|
||||
b43_radio_write16(dev, B2055_VCO_CAL10, 65);
|
||||
udelay(300);
|
||||
if (0 /*FIXME 5Ghz*/)
|
||||
b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
|
||||
else
|
||||
b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
|
||||
b43_chantab_phy_upload(dev, tabent);
|
||||
b43_nphy_tx_power_fix(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void b43_radio_init2055_pre(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
|
||||
~B43_NPHY_RFCTL_CMD_PORFORCE);
|
||||
b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
|
||||
B43_NPHY_RFCTL_CMD_CHIP0PU |
|
||||
B43_NPHY_RFCTL_CMD_OEPORFORCE);
|
||||
b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
|
||||
B43_NPHY_RFCTL_CMD_PORFORCE);
|
||||
}
|
||||
|
||||
static void b43_radio_init2055_post(struct b43_wldev *dev)
|
||||
{
|
||||
struct ssb_sprom *sprom = &(dev->dev->bus->sprom);
|
||||
struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo);
|
||||
int i;
|
||||
u16 val;
|
||||
|
||||
b43_radio_mask(dev, B2055_MASTER1, 0xFFF3);
|
||||
msleep(1);
|
||||
if ((sprom->revision != 4) || !(sprom->boardflags_hi & 0x0002)) {
|
||||
if ((binfo->vendor != PCI_VENDOR_ID_BROADCOM) ||
|
||||
(binfo->type != 0x46D) ||
|
||||
(binfo->rev < 0x41)) {
|
||||
b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
|
||||
b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0x3F, 0x2C);
|
||||
msleep(1);
|
||||
b43_radio_write16(dev, B2055_CAL_MISC, 0x3C);
|
||||
msleep(1);
|
||||
b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE);
|
||||
msleep(1);
|
||||
b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80);
|
||||
msleep(1);
|
||||
b43_radio_set(dev, B2055_CAL_MISC, 0x1);
|
||||
msleep(1);
|
||||
b43_radio_set(dev, B2055_CAL_MISC, 0x40);
|
||||
msleep(1);
|
||||
for (i = 0; i < 100; i++) {
|
||||
val = b43_radio_read16(dev, B2055_CAL_COUT2);
|
||||
if (val & 0x80)
|
||||
break;
|
||||
udelay(10);
|
||||
}
|
||||
msleep(1);
|
||||
b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
|
||||
msleep(1);
|
||||
b43_radio_selectchannel(dev, dev->phy.channel, 0);
|
||||
b43_radio_write16(dev, B2055_C1_RX_BB_LPF, 0x9);
|
||||
b43_radio_write16(dev, B2055_C2_RX_BB_LPF, 0x9);
|
||||
b43_radio_write16(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
|
||||
b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
|
||||
}
|
||||
|
||||
/* Initialize a Broadcom 2055 N-radio */
|
||||
static void b43_radio_init2055(struct b43_wldev *dev)
|
||||
{
|
||||
b43_radio_init2055_pre(dev);
|
||||
if (b43_status(dev) < B43_STAT_INITIALIZED)
|
||||
b2055_upload_inittab(dev, 0, 1);
|
||||
else
|
||||
b2055_upload_inittab(dev, 0/*FIXME on 5ghz band*/, 0);
|
||||
b43_radio_init2055_post(dev);
|
||||
}
|
||||
|
||||
void b43_nphy_radio_turn_on(struct b43_wldev *dev)
|
||||
{
|
||||
b43_radio_init2055(dev);
|
||||
}
|
||||
|
||||
void b43_nphy_radio_turn_off(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
|
||||
~B43_NPHY_RFCTL_CMD_EN);
|
||||
}
|
||||
|
||||
#define ntab_upload(dev, offset, data) do { \
|
||||
unsigned int i; \
|
||||
for (i = 0; i < (offset##_SIZE); i++) \
|
||||
b43_ntab_write(dev, (offset) + i, (data)[i]); \
|
||||
} while (0)
|
||||
|
||||
/* Upload the N-PHY tables. */
|
||||
static void b43_nphy_tables_init(struct b43_wldev *dev)
|
||||
{
|
||||
/* Static tables */
|
||||
ntab_upload(dev, B43_NTAB_FRAMESTRUCT, b43_ntab_framestruct);
|
||||
ntab_upload(dev, B43_NTAB_FRAMELT, b43_ntab_framelookup);
|
||||
ntab_upload(dev, B43_NTAB_TMAP, b43_ntab_tmap);
|
||||
ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn);
|
||||
ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel);
|
||||
ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot);
|
||||
ntab_upload(dev, B43_NTAB_PILOTLT, b43_ntab_pilotlt);
|
||||
ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0);
|
||||
ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1);
|
||||
ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0);
|
||||
ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1);
|
||||
ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi);
|
||||
ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest);
|
||||
ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs);
|
||||
|
||||
/* Volatile tables */
|
||||
ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10);
|
||||
ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11);
|
||||
ntab_upload(dev, B43_NTAB_C0_ESTPLT, b43_ntab_estimatepowerlt0);
|
||||
ntab_upload(dev, B43_NTAB_C1_ESTPLT, b43_ntab_estimatepowerlt1);
|
||||
ntab_upload(dev, B43_NTAB_C0_ADJPLT, b43_ntab_adjustpower0);
|
||||
ntab_upload(dev, B43_NTAB_C1_ADJPLT, b43_ntab_adjustpower1);
|
||||
ntab_upload(dev, B43_NTAB_C0_GAINCTL, b43_ntab_gainctl0);
|
||||
ntab_upload(dev, B43_NTAB_C1_GAINCTL, b43_ntab_gainctl1);
|
||||
ntab_upload(dev, B43_NTAB_C0_IQLT, b43_ntab_iqlt0);
|
||||
ntab_upload(dev, B43_NTAB_C1_IQLT, b43_ntab_iqlt1);
|
||||
ntab_upload(dev, B43_NTAB_C0_LOFEEDTH, b43_ntab_loftlt0);
|
||||
ntab_upload(dev, B43_NTAB_C1_LOFEEDTH, b43_ntab_loftlt1);
|
||||
}
|
||||
|
||||
static void b43_nphy_workarounds(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
unsigned int i;
|
||||
|
||||
b43_phy_set(dev, B43_NPHY_IQFLIP,
|
||||
B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2);
|
||||
if (1 /* FIXME band is 2.4GHz */) {
|
||||
b43_phy_set(dev, B43_NPHY_CLASSCTL,
|
||||
B43_NPHY_CLASSCTL_CCKEN);
|
||||
} else {
|
||||
b43_phy_mask(dev, B43_NPHY_CLASSCTL,
|
||||
~B43_NPHY_CLASSCTL_CCKEN);
|
||||
}
|
||||
b43_radio_set(dev, B2055_C1_TX_RF_SPARE, 0x8);
|
||||
b43_phy_write(dev, B43_NPHY_TXFRAMEDELAY, 8);
|
||||
|
||||
/* Fixup some tables */
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x00), 0xA);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x10), 0xA);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x02), 0xCDAA);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x12), 0xCDAA);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x08), 0);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x18), 0);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x07), 0x7AAB);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x17), 0x7AAB);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x06), 0x800);
|
||||
b43_ntab_write(dev, B43_NTAB16(8, 0x16), 0x800);
|
||||
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0x301);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301);
|
||||
|
||||
//TODO set RF sequence
|
||||
|
||||
/* Set narrowband clip threshold */
|
||||
b43_phy_write(dev, B43_NPHY_C1_NBCLIPTHRES, 66);
|
||||
b43_phy_write(dev, B43_NPHY_C2_NBCLIPTHRES, 66);
|
||||
|
||||
/* Set wideband clip 2 threshold */
|
||||
b43_phy_maskset(dev, B43_NPHY_C1_CLIPWBTHRES,
|
||||
~B43_NPHY_C1_CLIPWBTHRES_CLIP2,
|
||||
21 << B43_NPHY_C1_CLIPWBTHRES_CLIP2_SHIFT);
|
||||
b43_phy_maskset(dev, B43_NPHY_C2_CLIPWBTHRES,
|
||||
~B43_NPHY_C2_CLIPWBTHRES_CLIP2,
|
||||
21 << B43_NPHY_C2_CLIPWBTHRES_CLIP2_SHIFT);
|
||||
|
||||
/* Set Clip 2 detect */
|
||||
b43_phy_set(dev, B43_NPHY_C1_CGAINI,
|
||||
B43_NPHY_C1_CGAINI_CL2DETECT);
|
||||
b43_phy_set(dev, B43_NPHY_C2_CGAINI,
|
||||
B43_NPHY_C2_CGAINI_CL2DETECT);
|
||||
|
||||
if (0 /*FIXME*/) {
|
||||
/* Set dwell lengths */
|
||||
b43_phy_write(dev, B43_NPHY_CLIP1_NBDWELL_LEN, 43);
|
||||
b43_phy_write(dev, B43_NPHY_CLIP2_NBDWELL_LEN, 43);
|
||||
b43_phy_write(dev, B43_NPHY_W1CLIP1_DWELL_LEN, 9);
|
||||
b43_phy_write(dev, B43_NPHY_W1CLIP2_DWELL_LEN, 9);
|
||||
|
||||
/* Set gain backoff */
|
||||
b43_phy_maskset(dev, B43_NPHY_C1_CGAINI,
|
||||
~B43_NPHY_C1_CGAINI_GAINBKOFF,
|
||||
1 << B43_NPHY_C1_CGAINI_GAINBKOFF_SHIFT);
|
||||
b43_phy_maskset(dev, B43_NPHY_C2_CGAINI,
|
||||
~B43_NPHY_C2_CGAINI_GAINBKOFF,
|
||||
1 << B43_NPHY_C2_CGAINI_GAINBKOFF_SHIFT);
|
||||
|
||||
/* Set HPVGA2 index */
|
||||
b43_phy_maskset(dev, B43_NPHY_C1_INITGAIN,
|
||||
~B43_NPHY_C1_INITGAIN_HPVGA2,
|
||||
6 << B43_NPHY_C1_INITGAIN_HPVGA2_SHIFT);
|
||||
b43_phy_maskset(dev, B43_NPHY_C2_INITGAIN,
|
||||
~B43_NPHY_C2_INITGAIN_HPVGA2,
|
||||
6 << B43_NPHY_C2_INITGAIN_HPVGA2_SHIFT);
|
||||
|
||||
//FIXME verify that the specs really mean to use autoinc here.
|
||||
for (i = 0; i < 3; i++)
|
||||
b43_ntab_write(dev, B43_NTAB16(7, 0x106) + i, 0x673);
|
||||
}
|
||||
|
||||
/* Set minimum gain value */
|
||||
b43_phy_maskset(dev, B43_NPHY_C1_MINMAX_GAIN,
|
||||
~B43_NPHY_C1_MINGAIN,
|
||||
23 << B43_NPHY_C1_MINGAIN_SHIFT);
|
||||
b43_phy_maskset(dev, B43_NPHY_C2_MINMAX_GAIN,
|
||||
~B43_NPHY_C2_MINGAIN,
|
||||
23 << B43_NPHY_C2_MINGAIN_SHIFT);
|
||||
|
||||
if (phy->rev < 2) {
|
||||
b43_phy_mask(dev, B43_NPHY_SCRAM_SIGCTL,
|
||||
~B43_NPHY_SCRAM_SIGCTL_SCM);
|
||||
}
|
||||
|
||||
/* Set phase track alpha and beta */
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_A0, 0x125);
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_A1, 0x1B3);
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_A2, 0x105);
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_B0, 0x16E);
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_B1, 0xCD);
|
||||
b43_phy_write(dev, B43_NPHY_PHASETR_B2, 0x20);
|
||||
}
|
||||
|
||||
static void b43_nphy_reset_cca(struct b43_wldev *dev)
|
||||
{
|
||||
u16 bbcfg;
|
||||
|
||||
ssb_write32(dev->dev, SSB_TMSLOW,
|
||||
ssb_read32(dev->dev, SSB_TMSLOW) | SSB_TMSLOW_FGC);
|
||||
bbcfg = b43_phy_read(dev, B43_NPHY_BBCFG);
|
||||
b43_phy_set(dev, B43_NPHY_BBCFG, B43_NPHY_BBCFG_RSTCCA);
|
||||
b43_phy_write(dev, B43_NPHY_BBCFG,
|
||||
bbcfg & ~B43_NPHY_BBCFG_RSTCCA);
|
||||
ssb_write32(dev->dev, SSB_TMSLOW,
|
||||
ssb_read32(dev->dev, SSB_TMSLOW) & ~SSB_TMSLOW_FGC);
|
||||
}
|
||||
|
||||
enum b43_nphy_rf_sequence {
|
||||
B43_RFSEQ_RX2TX,
|
||||
B43_RFSEQ_TX2RX,
|
||||
B43_RFSEQ_RESET2RX,
|
||||
B43_RFSEQ_UPDATE_GAINH,
|
||||
B43_RFSEQ_UPDATE_GAINL,
|
||||
B43_RFSEQ_UPDATE_GAINU,
|
||||
};
|
||||
|
||||
static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
|
||||
enum b43_nphy_rf_sequence seq)
|
||||
{
|
||||
static const u16 trigger[] = {
|
||||
[B43_RFSEQ_RX2TX] = B43_NPHY_RFSEQTR_RX2TX,
|
||||
[B43_RFSEQ_TX2RX] = B43_NPHY_RFSEQTR_TX2RX,
|
||||
[B43_RFSEQ_RESET2RX] = B43_NPHY_RFSEQTR_RST2RX,
|
||||
[B43_RFSEQ_UPDATE_GAINH] = B43_NPHY_RFSEQTR_UPGH,
|
||||
[B43_RFSEQ_UPDATE_GAINL] = B43_NPHY_RFSEQTR_UPGL,
|
||||
[B43_RFSEQ_UPDATE_GAINU] = B43_NPHY_RFSEQTR_UPGU,
|
||||
};
|
||||
int i;
|
||||
|
||||
B43_WARN_ON(seq >= ARRAY_SIZE(trigger));
|
||||
|
||||
b43_phy_set(dev, B43_NPHY_RFSEQMODE,
|
||||
B43_NPHY_RFSEQMODE_CAOVER | B43_NPHY_RFSEQMODE_TROVER);
|
||||
b43_phy_set(dev, B43_NPHY_RFSEQTR, trigger[seq]);
|
||||
for (i = 0; i < 200; i++) {
|
||||
if (!(b43_phy_read(dev, B43_NPHY_RFSEQST) & trigger[seq]))
|
||||
goto ok;
|
||||
msleep(1);
|
||||
}
|
||||
b43err(dev->wl, "RF sequence status timeout\n");
|
||||
ok:
|
||||
b43_phy_mask(dev, B43_NPHY_RFSEQMODE,
|
||||
~(B43_NPHY_RFSEQMODE_CAOVER | B43_NPHY_RFSEQMODE_TROVER));
|
||||
}
|
||||
|
||||
static void b43_nphy_bphy_init(struct b43_wldev *dev)
|
||||
{
|
||||
unsigned int i;
|
||||
u16 val;
|
||||
|
||||
val = 0x1E1F;
|
||||
for (i = 0; i < 14; i++) {
|
||||
b43_phy_write(dev, B43_PHY_N_BMODE(0x88 + i), val);
|
||||
val -= 0x202;
|
||||
}
|
||||
val = 0x3E3F;
|
||||
for (i = 0; i < 16; i++) {
|
||||
b43_phy_write(dev, B43_PHY_N_BMODE(0x97 + i), val);
|
||||
val -= 0x202;
|
||||
}
|
||||
b43_phy_write(dev, B43_PHY_N_BMODE(0x38), 0x668);
|
||||
}
|
||||
|
||||
/* RSSI Calibration */
|
||||
static void b43_nphy_rssi_cal(struct b43_wldev *dev, u8 type)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
int b43_phy_initn(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u16 tmp;
|
||||
|
||||
//TODO: Spectral management
|
||||
b43_nphy_tables_init(dev);
|
||||
|
||||
/* Clear all overrides */
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_OVER, 0);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, 0);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, 0);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_INTC3, 0);
|
||||
b43_phy_write(dev, B43_NPHY_RFCTL_INTC4, 0);
|
||||
b43_phy_mask(dev, B43_NPHY_RFSEQMODE,
|
||||
~(B43_NPHY_RFSEQMODE_CAOVER |
|
||||
B43_NPHY_RFSEQMODE_TROVER));
|
||||
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, 0);
|
||||
|
||||
tmp = (phy->rev < 2) ? 64 : 59;
|
||||
b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3,
|
||||
~B43_NPHY_BPHY_CTL3_SCALE,
|
||||
tmp << B43_NPHY_BPHY_CTL3_SCALE_SHIFT);
|
||||
|
||||
b43_phy_write(dev, B43_NPHY_AFESEQ_TX2RX_PUD_20M, 0x20);
|
||||
b43_phy_write(dev, B43_NPHY_AFESEQ_TX2RX_PUD_40M, 0x20);
|
||||
|
||||
b43_phy_write(dev, B43_NPHY_TXREALFD, 184);
|
||||
b43_phy_write(dev, B43_NPHY_MIMO_CRSTXEXT, 200);
|
||||
b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 80);
|
||||
b43_phy_write(dev, B43_NPHY_C2_BCLIPBKOFF, 511);
|
||||
|
||||
//TODO MIMO-Config
|
||||
//TODO Update TX/RX chain
|
||||
|
||||
if (phy->rev < 2) {
|
||||
b43_phy_write(dev, B43_NPHY_DUP40_GFBL, 0xAA8);
|
||||
b43_phy_write(dev, B43_NPHY_DUP40_BL, 0x9A4);
|
||||
}
|
||||
b43_nphy_workarounds(dev);
|
||||
b43_nphy_reset_cca(dev);
|
||||
|
||||
ssb_write32(dev->dev, SSB_TMSLOW,
|
||||
ssb_read32(dev->dev, SSB_TMSLOW) | B43_TMSLOW_MACPHYCLKEN);
|
||||
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX);
|
||||
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
|
||||
|
||||
b43_phy_read(dev, B43_NPHY_CLASSCTL); /* dummy read */
|
||||
//TODO read core1/2 clip1 thres regs
|
||||
|
||||
if (1 /* FIXME Band is 2.4GHz */)
|
||||
b43_nphy_bphy_init(dev);
|
||||
//TODO disable TX power control
|
||||
//TODO Fix the TX power settings
|
||||
//TODO Init periodic calibration with reason 3
|
||||
b43_nphy_rssi_cal(dev, 2);
|
||||
b43_nphy_rssi_cal(dev, 0);
|
||||
b43_nphy_rssi_cal(dev, 1);
|
||||
//TODO get TX gain
|
||||
//TODO init superswitch
|
||||
//TODO calibrate LO
|
||||
//TODO idle TSSI TX pctl
|
||||
//TODO TX power control power setup
|
||||
//TODO table writes
|
||||
//TODO TX power control coefficients
|
||||
//TODO enable TX power control
|
||||
//TODO control antenna selection
|
||||
//TODO init radar detection
|
||||
//TODO reset channel if changed
|
||||
|
||||
b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n");
|
||||
return 0;
|
||||
}
|
@ -1,972 +0,0 @@
|
||||
#ifndef B43_NPHY_H_
|
||||
#define B43_NPHY_H_
|
||||
|
||||
#include "phy.h"
|
||||
|
||||
|
||||
/* N-PHY registers. */
|
||||
|
||||
#define B43_NPHY_BBCFG B43_PHY_N(0x001) /* BB config */
|
||||
#define B43_NPHY_BBCFG_RSTCCA 0x4000 /* Reset CCA */
|
||||
#define B43_NPHY_BBCFG_RSTRX 0x8000 /* Reset RX */
|
||||
#define B43_NPHY_CHANNEL B43_PHY_N(0x005) /* Channel */
|
||||
#define B43_NPHY_TXERR B43_PHY_N(0x007) /* TX error */
|
||||
#define B43_NPHY_BANDCTL B43_PHY_N(0x009) /* Band control */
|
||||
#define B43_NPHY_BANDCTL_5GHZ 0x0001 /* Use the 5GHz band */
|
||||
#define B43_NPHY_4WI_ADDR B43_PHY_N(0x00B) /* Four-wire bus address */
|
||||
#define B43_NPHY_4WI_DATAHI B43_PHY_N(0x00C) /* Four-wire bus data high */
|
||||
#define B43_NPHY_4WI_DATALO B43_PHY_N(0x00D) /* Four-wire bus data low */
|
||||
#define B43_NPHY_BIST_STAT0 B43_PHY_N(0x00E) /* Built-in self test status 0 */
|
||||
#define B43_NPHY_BIST_STAT1 B43_PHY_N(0x00F) /* Built-in self test status 1 */
|
||||
|
||||
#define B43_NPHY_C1_DESPWR B43_PHY_N(0x018) /* Core 1 desired power */
|
||||
#define B43_NPHY_C1_CCK_DESPWR B43_PHY_N(0x019) /* Core 1 CCK desired power */
|
||||
#define B43_NPHY_C1_BCLIPBKOFF B43_PHY_N(0x01A) /* Core 1 barely clip backoff */
|
||||
#define B43_NPHY_C1_CCK_BCLIPBKOFF B43_PHY_N(0x01B) /* Core 1 CCK barely clip backoff */
|
||||
#define B43_NPHY_C1_CGAINI B43_PHY_N(0x01C) /* Core 1 compute gain info */
|
||||
#define B43_NPHY_C1_CGAINI_GAINBKOFF 0x001F /* Gain backoff */
|
||||
#define B43_NPHY_C1_CGAINI_GAINBKOFF_SHIFT 0
|
||||
#define B43_NPHY_C1_CGAINI_CLIPGBKOFF 0x03E0 /* Clip gain backoff */
|
||||
#define B43_NPHY_C1_CGAINI_CLIPGBKOFF_SHIFT 5
|
||||
#define B43_NPHY_C1_CGAINI_GAINSTEP 0x1C00 /* Gain step */
|
||||
#define B43_NPHY_C1_CGAINI_GAINSTEP_SHIFT 10
|
||||
#define B43_NPHY_C1_CGAINI_CL2DETECT 0x2000 /* Clip 2 detect mask */
|
||||
#define B43_NPHY_C1_CCK_CGAINI B43_PHY_N(0x01D) /* Core 1 CCK compute gain info */
|
||||
#define B43_NPHY_C1_CCK_CGAINI_GAINBKOFF 0x001F /* Gain backoff */
|
||||
#define B43_NPHY_C1_CCK_CGAINI_CLIPGBKOFF 0x01E0 /* CCK barely clip gain backoff */
|
||||
#define B43_NPHY_C1_MINMAX_GAIN B43_PHY_N(0x01E) /* Core 1 min/max gain */
|
||||
#define B43_NPHY_C1_MINGAIN 0x00FF /* Minimum gain */
|
||||
#define B43_NPHY_C1_MINGAIN_SHIFT 0
|
||||
#define B43_NPHY_C1_MAXGAIN 0xFF00 /* Maximum gain */
|
||||
#define B43_NPHY_C1_MAXGAIN_SHIFT 8
|
||||
#define B43_NPHY_C1_CCK_MINMAX_GAIN B43_PHY_N(0x01F) /* Core 1 CCK min/max gain */
|
||||
#define B43_NPHY_C1_CCK_MINGAIN 0x00FF /* Minimum gain */
|
||||
#define B43_NPHY_C1_CCK_MINGAIN_SHIFT 0
|
||||
#define B43_NPHY_C1_CCK_MAXGAIN 0xFF00 /* Maximum gain */
|
||||
#define B43_NPHY_C1_CCK_MAXGAIN_SHIFT 8
|
||||
#define B43_NPHY_C1_INITGAIN B43_PHY_N(0x020) /* Core 1 initial gain code */
|
||||
#define B43_NPHY_C1_INITGAIN_EXTLNA 0x0001 /* External LNA index */
|
||||
#define B43_NPHY_C1_INITGAIN_LNA 0x0006 /* LNA index */
|
||||
#define B43_NPHY_C1_INITGAIN_LNAIDX_SHIFT 1
|
||||
#define B43_NPHY_C1_INITGAIN_HPVGA1 0x0078 /* HPVGA1 index */
|
||||
#define B43_NPHY_C1_INITGAIN_HPVGA1_SHIFT 3
|
||||
#define B43_NPHY_C1_INITGAIN_HPVGA2 0x0F80 /* HPVGA2 index */
|
||||
#define B43_NPHY_C1_INITGAIN_HPVGA2_SHIFT 7
|
||||
#define B43_NPHY_C1_INITGAIN_TRRX 0x1000 /* TR RX index */
|
||||
#define B43_NPHY_C1_INITGAIN_TRTX 0x2000 /* TR TX index */
|
||||
#define B43_NPHY_C1_CLIP1_HIGAIN B43_PHY_N(0x021) /* Core 1 clip1 high gain code */
|
||||
#define B43_NPHY_C1_CLIP1_MEDGAIN B43_PHY_N(0x022) /* Core 1 clip1 medium gain code */
|
||||
#define B43_NPHY_C1_CLIP1_LOGAIN B43_PHY_N(0x023) /* Core 1 clip1 low gain code */
|
||||
#define B43_NPHY_C1_CLIP2_GAIN B43_PHY_N(0x024) /* Core 1 clip2 gain code */
|
||||
#define B43_NPHY_C1_FILTERGAIN B43_PHY_N(0x025) /* Core 1 filter gain */
|
||||
#define B43_NPHY_C1_LPF_QHPF_BW B43_PHY_N(0x026) /* Core 1 LPF Q HP F bandwidth */
|
||||
#define B43_NPHY_C1_CLIPWBTHRES B43_PHY_N(0x027) /* Core 1 clip wideband threshold */
|
||||
#define B43_NPHY_C1_CLIPWBTHRES_CLIP2 0x003F /* Clip 2 */
|
||||
#define B43_NPHY_C1_CLIPWBTHRES_CLIP2_SHIFT 0
|
||||
#define B43_NPHY_C1_CLIPWBTHRES_CLIP1 0x0FC0 /* Clip 1 */
|
||||
#define B43_NPHY_C1_CLIPWBTHRES_CLIP1_SHIFT 6
|
||||
#define B43_NPHY_C1_W1THRES B43_PHY_N(0x028) /* Core 1 W1 threshold */
|
||||
#define B43_NPHY_C1_EDTHRES B43_PHY_N(0x029) /* Core 1 ED threshold */
|
||||
#define B43_NPHY_C1_SMSIGTHRES B43_PHY_N(0x02A) /* Core 1 small sig threshold */
|
||||
#define B43_NPHY_C1_NBCLIPTHRES B43_PHY_N(0x02B) /* Core 1 NB clip threshold */
|
||||
#define B43_NPHY_C1_CLIP1THRES B43_PHY_N(0x02C) /* Core 1 clip1 threshold */
|
||||
#define B43_NPHY_C1_CLIP2THRES B43_PHY_N(0x02D) /* Core 1 clip2 threshold */
|
||||
|
||||
#define B43_NPHY_C2_DESPWR B43_PHY_N(0x02E) /* Core 2 desired power */
|
||||
#define B43_NPHY_C2_CCK_DESPWR B43_PHY_N(0x02F) /* Core 2 CCK desired power */
|
||||
#define B43_NPHY_C2_BCLIPBKOFF B43_PHY_N(0x030) /* Core 2 barely clip backoff */
|
||||
#define B43_NPHY_C2_CCK_BCLIPBKOFF B43_PHY_N(0x031) /* Core 2 CCK barely clip backoff */
|
||||
#define B43_NPHY_C2_CGAINI B43_PHY_N(0x032) /* Core 2 compute gain info */
|
||||
#define B43_NPHY_C2_CGAINI_GAINBKOFF 0x001F /* Gain backoff */
|
||||
#define B43_NPHY_C2_CGAINI_GAINBKOFF_SHIFT 0
|
||||
#define B43_NPHY_C2_CGAINI_CLIPGBKOFF 0x03E0 /* Clip gain backoff */
|
||||
#define B43_NPHY_C2_CGAINI_CLIPGBKOFF_SHIFT 5
|
||||
#define B43_NPHY_C2_CGAINI_GAINSTEP 0x1C00 /* Gain step */
|
||||
#define B43_NPHY_C2_CGAINI_GAINSTEP_SHIFT 10
|
||||
#define B43_NPHY_C2_CGAINI_CL2DETECT 0x2000 /* Clip 2 detect mask */
|
||||
#define B43_NPHY_C2_CCK_CGAINI B43_PHY_N(0x033) /* Core 2 CCK compute gain info */
|
||||
#define B43_NPHY_C2_CCK_CGAINI_GAINBKOFF 0x001F /* Gain backoff */
|
||||
#define B43_NPHY_C2_CCK_CGAINI_CLIPGBKOFF 0x01E0 /* CCK barely clip gain backoff */
|
||||
#define B43_NPHY_C2_MINMAX_GAIN B43_PHY_N(0x034) /* Core 2 min/max gain */
|
||||
#define B43_NPHY_C2_MINGAIN 0x00FF /* Minimum gain */
|
||||
#define B43_NPHY_C2_MINGAIN_SHIFT 0
|
||||
#define B43_NPHY_C2_MAXGAIN 0xFF00 /* Maximum gain */
|
||||
#define B43_NPHY_C2_MAXGAIN_SHIFT 8
|
||||
#define B43_NPHY_C2_CCK_MINMAX_GAIN B43_PHY_N(0x035) /* Core 2 CCK min/max gain */
|
||||
#define B43_NPHY_C2_CCK_MINGAIN 0x00FF /* Minimum gain */
|
||||
#define B43_NPHY_C2_CCK_MINGAIN_SHIFT 0
|
||||
#define B43_NPHY_C2_CCK_MAXGAIN 0xFF00 /* Maximum gain */
|
||||
#define B43_NPHY_C2_CCK_MAXGAIN_SHIFT 8
|
||||
#define B43_NPHY_C2_INITGAIN B43_PHY_N(0x036) /* Core 2 initial gain code */
|
||||
#define B43_NPHY_C2_INITGAIN_EXTLNA 0x0001 /* External LNA index */
|
||||
#define B43_NPHY_C2_INITGAIN_LNA 0x0006 /* LNA index */
|
||||
#define B43_NPHY_C2_INITGAIN_LNAIDX_SHIFT 1
|
||||
#define B43_NPHY_C2_INITGAIN_HPVGA1 0x0078 /* HPVGA1 index */
|
||||
#define B43_NPHY_C2_INITGAIN_HPVGA1_SHIFT 3
|
||||
#define B43_NPHY_C2_INITGAIN_HPVGA2 0x0F80 /* HPVGA2 index */
|
||||
#define B43_NPHY_C2_INITGAIN_HPVGA2_SHIFT 7
|
||||
#define B43_NPHY_C2_INITGAIN_TRRX 0x1000 /* TR RX index */
|
||||
#define B43_NPHY_C2_INITGAIN_TRTX 0x2000 /* TR TX index */
|
||||
#define B43_NPHY_C2_CLIP1_HIGAIN B43_PHY_N(0x037) /* Core 2 clip1 high gain code */
|
||||
#define B43_NPHY_C2_CLIP1_MEDGAIN B43_PHY_N(0x038) /* Core 2 clip1 medium gain code */
|
||||
#define B43_NPHY_C2_CLIP1_LOGAIN B43_PHY_N(0x039) /* Core 2 clip1 low gain code */
|
||||
#define B43_NPHY_C2_CLIP2_GAIN B43_PHY_N(0x03A) /* Core 2 clip2 gain code */
|
||||
#define B43_NPHY_C2_FILTERGAIN B43_PHY_N(0x03B) /* Core 2 filter gain */
|
||||
#define B43_NPHY_C2_LPF_QHPF_BW B43_PHY_N(0x03C) /* Core 2 LPF Q HP F bandwidth */
|
||||
#define B43_NPHY_C2_CLIPWBTHRES B43_PHY_N(0x03D) /* Core 2 clip wideband threshold */
|
||||
#define B43_NPHY_C2_CLIPWBTHRES_CLIP2 0x003F /* Clip 2 */
|
||||
#define B43_NPHY_C2_CLIPWBTHRES_CLIP2_SHIFT 0
|
||||
#define B43_NPHY_C2_CLIPWBTHRES_CLIP1 0x0FC0 /* Clip 1 */
|
||||
#define B43_NPHY_C2_CLIPWBTHRES_CLIP1_SHIFT 6
|
||||
#define B43_NPHY_C2_W1THRES B43_PHY_N(0x03E) /* Core 2 W1 threshold */
|
||||
#define B43_NPHY_C2_EDTHRES B43_PHY_N(0x03F) /* Core 2 ED threshold */
|
||||
#define B43_NPHY_C2_SMSIGTHRES B43_PHY_N(0x040) /* Core 2 small sig threshold */
|
||||
#define B43_NPHY_C2_NBCLIPTHRES B43_PHY_N(0x041) /* Core 2 NB clip threshold */
|
||||
#define B43_NPHY_C2_CLIP1THRES B43_PHY_N(0x042) /* Core 2 clip1 threshold */
|
||||
#define B43_NPHY_C2_CLIP2THRES B43_PHY_N(0x043) /* Core 2 clip2 threshold */
|
||||
|
||||
#define B43_NPHY_CRS_THRES1 B43_PHY_N(0x044) /* CRS threshold 1 */
|
||||
#define B43_NPHY_CRS_THRES2 B43_PHY_N(0x045) /* CRS threshold 2 */
|
||||
#define B43_NPHY_CRS_THRES3 B43_PHY_N(0x046) /* CRS threshold 3 */
|
||||
#define B43_NPHY_CRSCTL B43_PHY_N(0x047) /* CRS control */
|
||||
#define B43_NPHY_DCFADDR B43_PHY_N(0x048) /* DC filter address */
|
||||
#define B43_NPHY_RXF20_NUM0 B43_PHY_N(0x049) /* RX filter 20 numerator 0 */
|
||||
#define B43_NPHY_RXF20_NUM1 B43_PHY_N(0x04A) /* RX filter 20 numerator 1 */
|
||||
#define B43_NPHY_RXF20_NUM2 B43_PHY_N(0x04B) /* RX filter 20 numerator 2 */
|
||||
#define B43_NPHY_RXF20_DENOM0 B43_PHY_N(0x04C) /* RX filter 20 denominator 0 */
|
||||
#define B43_NPHY_RXF20_DENOM1 B43_PHY_N(0x04D) /* RX filter 20 denominator 1 */
|
||||
#define B43_NPHY_RXF20_NUM10 B43_PHY_N(0x04E) /* RX filter 20 numerator 10 */
|
||||
#define B43_NPHY_RXF20_NUM11 B43_PHY_N(0x04F) /* RX filter 20 numerator 11 */
|
||||
#define B43_NPHY_RXF20_NUM12 B43_PHY_N(0x050) /* RX filter 20 numerator 12 */
|
||||
#define B43_NPHY_RXF20_DENOM10 B43_PHY_N(0x051) /* RX filter 20 denominator 10 */
|
||||
#define B43_NPHY_RXF20_DENOM11 B43_PHY_N(0x052) /* RX filter 20 denominator 11 */
|
||||
#define B43_NPHY_RXF40_NUM0 B43_PHY_N(0x053) /* RX filter 40 numerator 0 */
|
||||
#define B43_NPHY_RXF40_NUM1 B43_PHY_N(0x054) /* RX filter 40 numerator 1 */
|
||||
#define B43_NPHY_RXF40_NUM2 B43_PHY_N(0x055) /* RX filter 40 numerator 2 */
|
||||
#define B43_NPHY_RXF40_DENOM0 B43_PHY_N(0x056) /* RX filter 40 denominator 0 */
|
||||
#define B43_NPHY_RXF40_DENOM1 B43_PHY_N(0x057) /* RX filter 40 denominator 1 */
|
||||
#define B43_NPHY_RXF40_NUM10 B43_PHY_N(0x058) /* RX filter 40 numerator 10 */
|
||||
#define B43_NPHY_RXF40_NUM11 B43_PHY_N(0x059) /* RX filter 40 numerator 11 */
|
||||
#define B43_NPHY_RXF40_NUM12 B43_PHY_N(0x05A) /* RX filter 40 numerator 12 */
|
||||
#define B43_NPHY_RXF40_DENOM10 B43_PHY_N(0x05B) /* RX filter 40 denominator 10 */
|
||||
#define B43_NPHY_RXF40_DENOM11 B43_PHY_N(0x05C) /* RX filter 40 denominator 11 */
|
||||
#define B43_NPHY_PPROC_RSTLEN B43_PHY_N(0x060) /* Packet processing reset length */
|
||||
#define B43_NPHY_INITCARR_DLEN B43_PHY_N(0x061) /* Initial carrier detection length */
|
||||
#define B43_NPHY_CLIP1CARR_DLEN B43_PHY_N(0x062) /* Clip1 carrier detection length */
|
||||
#define B43_NPHY_CLIP2CARR_DLEN B43_PHY_N(0x063) /* Clip2 carrier detection length */
|
||||
#define B43_NPHY_INITGAIN_SLEN B43_PHY_N(0x064) /* Initial gain settle length */
|
||||
#define B43_NPHY_CLIP1GAIN_SLEN B43_PHY_N(0x065) /* Clip1 gain settle length */
|
||||
#define B43_NPHY_CLIP2GAIN_SLEN B43_PHY_N(0x066) /* Clip2 gain settle length */
|
||||
#define B43_NPHY_PACKGAIN_SLEN B43_PHY_N(0x067) /* Packet gain settle length */
|
||||
#define B43_NPHY_CARRSRC_TLEN B43_PHY_N(0x068) /* Carrier search timeout length */
|
||||
#define B43_NPHY_TISRC_TLEN B43_PHY_N(0x069) /* Timing search timeout length */
|
||||
#define B43_NPHY_ENDROP_TLEN B43_PHY_N(0x06A) /* Energy drop timeout length */
|
||||
#define B43_NPHY_CLIP1_NBDWELL_LEN B43_PHY_N(0x06B) /* Clip1 NB dwell length */
|
||||
#define B43_NPHY_CLIP2_NBDWELL_LEN B43_PHY_N(0x06C) /* Clip2 NB dwell length */
|
||||
#define B43_NPHY_W1CLIP1_DWELL_LEN B43_PHY_N(0x06D) /* W1 clip1 dwell length */
|
||||
#define B43_NPHY_W1CLIP2_DWELL_LEN B43_PHY_N(0x06E) /* W1 clip2 dwell length */
|
||||
#define B43_NPHY_W2CLIP1_DWELL_LEN B43_PHY_N(0x06F) /* W2 clip1 dwell length */
|
||||
#define B43_NPHY_PLOAD_CSENSE_EXTLEN B43_PHY_N(0x070) /* Payload carrier sense extension length */
|
||||
#define B43_NPHY_EDROP_CSENSE_EXTLEN B43_PHY_N(0x071) /* Energy drop carrier sense extension length */
|
||||
#define B43_NPHY_TABLE_ADDR B43_PHY_N(0x072) /* Table address */
|
||||
#define B43_NPHY_TABLE_DATALO B43_PHY_N(0x073) /* Table data low */
|
||||
#define B43_NPHY_TABLE_DATAHI B43_PHY_N(0x074) /* Table data high */
|
||||
#define B43_NPHY_WWISE_LENIDX B43_PHY_N(0x075) /* WWiSE length index */
|
||||
#define B43_NPHY_TGNSYNC_LENIDX B43_PHY_N(0x076) /* TGNsync length index */
|
||||
#define B43_NPHY_TXMACIF_HOLDOFF B43_PHY_N(0x077) /* TX MAC IF Hold off */
|
||||
#define B43_NPHY_RFCTL_CMD B43_PHY_N(0x078) /* RF control (command) */
|
||||
#define B43_NPHY_RFCTL_CMD_START 0x0001 /* Start sequence */
|
||||
#define B43_NPHY_RFCTL_CMD_RXTX 0x0002 /* RX/TX */
|
||||
#define B43_NPHY_RFCTL_CMD_CORESEL 0x0038 /* Core select */
|
||||
#define B43_NPHY_RFCTL_CMD_CORESEL_SHIFT 3
|
||||
#define B43_NPHY_RFCTL_CMD_PORFORCE 0x0040 /* POR force */
|
||||
#define B43_NPHY_RFCTL_CMD_OEPORFORCE 0x0080 /* OE POR force */
|
||||
#define B43_NPHY_RFCTL_CMD_RXEN 0x0100 /* RX enable */
|
||||
#define B43_NPHY_RFCTL_CMD_TXEN 0x0200 /* TX enable */
|
||||
#define B43_NPHY_RFCTL_CMD_CHIP0PU 0x0400 /* Chip0 PU */
|
||||
#define B43_NPHY_RFCTL_CMD_EN 0x0800 /* Radio enabled */
|
||||
#define B43_NPHY_RFCTL_CMD_SEQENCORE 0xF000 /* Seq en core */
|
||||
#define B43_NPHY_RFCTL_CMD_SEQENCORE_SHIFT 12
|
||||
#define B43_NPHY_RFCTL_RSSIO1 B43_PHY_N(0x07A) /* RF control (RSSI others 1) */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_RXPD 0x0001 /* RX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_TXPD 0x0002 /* TX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_PAPD 0x0004 /* PA PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_RSSICTL 0x0030 /* RSSI control */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_LPFBW 0x00C0 /* LPF bandwidth */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_HPFBWHI 0x0100 /* HPF bandwidth high */
|
||||
#define B43_NPHY_RFCTL_RSSIO1_HIQDISCO 0x0200 /* HIQ dis core */
|
||||
#define B43_NPHY_RFCTL_RXG1 B43_PHY_N(0x07B) /* RF control (RX gain 1) */
|
||||
#define B43_NPHY_RFCTL_TXG1 B43_PHY_N(0x07C) /* RF control (TX gain 1) */
|
||||
#define B43_NPHY_RFCTL_RSSIO2 B43_PHY_N(0x07D) /* RF control (RSSI others 2) */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_RXPD 0x0001 /* RX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_TXPD 0x0002 /* TX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_PAPD 0x0004 /* PA PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_RSSICTL 0x0030 /* RSSI control */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_LPFBW 0x00C0 /* LPF bandwidth */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_HPFBWHI 0x0100 /* HPF bandwidth high */
|
||||
#define B43_NPHY_RFCTL_RSSIO2_HIQDISCO 0x0200 /* HIQ dis core */
|
||||
#define B43_NPHY_RFCTL_RXG2 B43_PHY_N(0x07E) /* RF control (RX gain 2) */
|
||||
#define B43_NPHY_RFCTL_TXG2 B43_PHY_N(0x07F) /* RF control (TX gain 2) */
|
||||
#define B43_NPHY_RFCTL_RSSIO3 B43_PHY_N(0x080) /* RF control (RSSI others 3) */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_RXPD 0x0001 /* RX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_TXPD 0x0002 /* TX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_PAPD 0x0004 /* PA PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_RSSICTL 0x0030 /* RSSI control */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_LPFBW 0x00C0 /* LPF bandwidth */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_HPFBWHI 0x0100 /* HPF bandwidth high */
|
||||
#define B43_NPHY_RFCTL_RSSIO3_HIQDISCO 0x0200 /* HIQ dis core */
|
||||
#define B43_NPHY_RFCTL_RXG3 B43_PHY_N(0x081) /* RF control (RX gain 3) */
|
||||
#define B43_NPHY_RFCTL_TXG3 B43_PHY_N(0x082) /* RF control (TX gain 3) */
|
||||
#define B43_NPHY_RFCTL_RSSIO4 B43_PHY_N(0x083) /* RF control (RSSI others 4) */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_RXPD 0x0001 /* RX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_TXPD 0x0002 /* TX PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_PAPD 0x0004 /* PA PD */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_RSSICTL 0x0030 /* RSSI control */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_LPFBW 0x00C0 /* LPF bandwidth */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_HPFBWHI 0x0100 /* HPF bandwidth high */
|
||||
#define B43_NPHY_RFCTL_RSSIO4_HIQDISCO 0x0200 /* HIQ dis core */
|
||||
#define B43_NPHY_RFCTL_RXG4 B43_PHY_N(0x084) /* RF control (RX gain 4) */
|
||||
#define B43_NPHY_RFCTL_TXG4 B43_PHY_N(0x085) /* RF control (TX gain 4) */
|
||||
#define B43_NPHY_C1_TXIQ_COMP_OFF B43_PHY_N(0x087) /* Core 1 TX I/Q comp offset */
|
||||
#define B43_NPHY_C2_TXIQ_COMP_OFF B43_PHY_N(0x088) /* Core 2 TX I/Q comp offset */
|
||||
#define B43_NPHY_C1_TXCTL B43_PHY_N(0x08B) /* Core 1 TX control */
|
||||
#define B43_NPHY_C2_TXCTL B43_PHY_N(0x08C) /* Core 2 TX control */
|
||||
#define B43_NPHY_SCRAM_SIGCTL B43_PHY_N(0x090) /* Scram signal control */
|
||||
#define B43_NPHY_SCRAM_SIGCTL_INITST 0x007F /* Initial state value */
|
||||
#define B43_NPHY_SCRAM_SIGCTL_INITST_SHIFT 0
|
||||
#define B43_NPHY_SCRAM_SIGCTL_SCM 0x0080 /* Scram control mode */
|
||||
#define B43_NPHY_SCRAM_SIGCTL_SICE 0x0100 /* Scram index control enable */
|
||||
#define B43_NPHY_SCRAM_SIGCTL_START 0xFE00 /* Scram start bit */
|
||||
#define B43_NPHY_SCRAM_SIGCTL_START_SHIFT 9
|
||||
#define B43_NPHY_RFCTL_INTC1 B43_PHY_N(0x091) /* RF control (intc 1) */
|
||||
#define B43_NPHY_RFCTL_INTC2 B43_PHY_N(0x092) /* RF control (intc 2) */
|
||||
#define B43_NPHY_RFCTL_INTC3 B43_PHY_N(0x093) /* RF control (intc 3) */
|
||||
#define B43_NPHY_RFCTL_INTC4 B43_PHY_N(0x094) /* RF control (intc 4) */
|
||||
#define B43_NPHY_NRDTO_WWISE B43_PHY_N(0x095) /* # datatones WWiSE */
|
||||
#define B43_NPHY_NRDTO_TGNSYNC B43_PHY_N(0x096) /* # datatones TGNsync */
|
||||
#define B43_NPHY_SIGFMOD_WWISE B43_PHY_N(0x097) /* Signal field mod WWiSE */
|
||||
#define B43_NPHY_LEG_SIGFMOD_11N B43_PHY_N(0x098) /* Legacy signal field mod 11n */
|
||||
#define B43_NPHY_HT_SIGFMOD_11N B43_PHY_N(0x099) /* HT signal field mod 11n */
|
||||
#define B43_NPHY_C1_RXIQ_COMPA0 B43_PHY_N(0x09A) /* Core 1 RX I/Q comp A0 */
|
||||
#define B43_NPHY_C1_RXIQ_COMPB0 B43_PHY_N(0x09B) /* Core 1 RX I/Q comp B0 */
|
||||
#define B43_NPHY_C2_RXIQ_COMPA1 B43_PHY_N(0x09C) /* Core 2 RX I/Q comp A1 */
|
||||
#define B43_NPHY_C2_RXIQ_COMPB1 B43_PHY_N(0x09D) /* Core 2 RX I/Q comp B1 */
|
||||
#define B43_NPHY_RXCTL B43_PHY_N(0x0A0) /* RX control */
|
||||
#define B43_NPHY_RXCTL_BSELU20 0x0010 /* Band select upper 20 */
|
||||
#define B43_NPHY_RXCTL_RIFSEN 0x0080 /* RIFS enable */
|
||||
#define B43_NPHY_RFSEQMODE B43_PHY_N(0x0A1) /* RF seq mode */
|
||||
#define B43_NPHY_RFSEQMODE_CAOVER 0x0001 /* Core active override */
|
||||
#define B43_NPHY_RFSEQMODE_TROVER 0x0002 /* Trigger override */
|
||||
#define B43_NPHY_RFSEQCA B43_PHY_N(0x0A2) /* RF seq core active */
|
||||
#define B43_NPHY_RFSEQCA_TXEN 0x000F /* TX enable */
|
||||
#define B43_NPHY_RFSEQCA_TXEN_SHIFT 0
|
||||
#define B43_NPHY_RFSEQCA_RXEN 0x00F0 /* RX enable */
|
||||
#define B43_NPHY_RFSEQCA_RXEN_SHIFT 4
|
||||
#define B43_NPHY_RFSEQCA_TXDIS 0x0F00 /* TX disable */
|
||||
#define B43_NPHY_RFSEQCA_TXDIS_SHIFT 8
|
||||
#define B43_NPHY_RFSEQCA_RXDIS 0xF000 /* RX disable */
|
||||
#define B43_NPHY_RFSEQCA_RXDIS_SHIFT 12
|
||||
#define B43_NPHY_RFSEQTR B43_PHY_N(0x0A3) /* RF seq trigger */
|
||||
#define B43_NPHY_RFSEQTR_RX2TX 0x0001 /* RX2TX */
|
||||
#define B43_NPHY_RFSEQTR_TX2RX 0x0002 /* TX2RX */
|
||||
#define B43_NPHY_RFSEQTR_UPGH 0x0004 /* Update gain H */
|
||||
#define B43_NPHY_RFSEQTR_UPGL 0x0008 /* Update gain L */
|
||||
#define B43_NPHY_RFSEQTR_UPGU 0x0010 /* Update gain U */
|
||||
#define B43_NPHY_RFSEQTR_RST2RX 0x0020 /* Reset to RX */
|
||||
#define B43_NPHY_RFSEQST B43_PHY_N(0x0A4) /* RF seq status. Values same as trigger. */
|
||||
#define B43_NPHY_AFECTL_OVER B43_PHY_N(0x0A5) /* AFE control override */
|
||||
#define B43_NPHY_AFECTL_C1 B43_PHY_N(0x0A6) /* AFE control core 1 */
|
||||
#define B43_NPHY_AFECTL_C2 B43_PHY_N(0x0A7) /* AFE control core 2 */
|
||||
#define B43_NPHY_AFECTL_C3 B43_PHY_N(0x0A8) /* AFE control core 3 */
|
||||
#define B43_NPHY_AFECTL_C4 B43_PHY_N(0x0A9) /* AFE control core 4 */
|
||||
#define B43_NPHY_AFECTL_DACGAIN1 B43_PHY_N(0x0AA) /* AFE control DAC gain 1 */
|
||||
#define B43_NPHY_AFECTL_DACGAIN2 B43_PHY_N(0x0AB) /* AFE control DAC gain 2 */
|
||||
#define B43_NPHY_AFECTL_DACGAIN3 B43_PHY_N(0x0AC) /* AFE control DAC gain 3 */
|
||||
#define B43_NPHY_AFECTL_DACGAIN4 B43_PHY_N(0x0AD) /* AFE control DAC gain 4 */
|
||||
#define B43_NPHY_STR_ADDR1 B43_PHY_N(0x0AE) /* STR address 1 */
|
||||
#define B43_NPHY_STR_ADDR2 B43_PHY_N(0x0AF) /* STR address 2 */
|
||||
#define B43_NPHY_CLASSCTL B43_PHY_N(0x0B0) /* Classifier control */
|
||||
#define B43_NPHY_CLASSCTL_CCKEN 0x0001 /* CCK enable */
|
||||
#define B43_NPHY_CLASSCTL_OFDMEN 0x0002 /* OFDM enable */
|
||||
#define B43_NPHY_CLASSCTL_WAITEDEN 0x0004 /* Waited enable */
|
||||
#define B43_NPHY_IQFLIP B43_PHY_N(0x0B1) /* I/Q flip */
|
||||
#define B43_NPHY_IQFLIP_ADC1 0x0001 /* ADC1 */
|
||||
#define B43_NPHY_IQFLIP_ADC2 0x0010 /* ADC2 */
|
||||
#define B43_NPHY_SISO_SNR_THRES B43_PHY_N(0x0B2) /* SISO SNR threshold */
|
||||
#define B43_NPHY_SIGMA_N_MULT B43_PHY_N(0x0B3) /* Sigma N multiplier */
|
||||
#define B43_NPHY_TXMACDELAY B43_PHY_N(0x0B4) /* TX MAC delay */
|
||||
#define B43_NPHY_TXFRAMEDELAY B43_PHY_N(0x0B5) /* TX frame delay */
|
||||
#define B43_NPHY_MLPARM B43_PHY_N(0x0B6) /* ML parameters */
|
||||
#define B43_NPHY_MLCTL B43_PHY_N(0x0B7) /* ML control */
|
||||
#define B43_NPHY_WWISE_20NCYCDAT B43_PHY_N(0x0B8) /* WWiSE 20 N cyc data */
|
||||
#define B43_NPHY_WWISE_40NCYCDAT B43_PHY_N(0x0B9) /* WWiSE 40 N cyc data */
|
||||
#define B43_NPHY_TGNSYNC_20NCYCDAT B43_PHY_N(0x0BA) /* TGNsync 20 N cyc data */
|
||||
#define B43_NPHY_TGNSYNC_40NCYCDAT B43_PHY_N(0x0BB) /* TGNsync 40 N cyc data */
|
||||
#define B43_NPHY_INITSWIZP B43_PHY_N(0x0BC) /* Initial swizzle pattern */
|
||||
#define B43_NPHY_TXTAILCNT B43_PHY_N(0x0BD) /* TX tail count value */
|
||||
#define B43_NPHY_BPHY_CTL1 B43_PHY_N(0x0BE) /* B PHY control 1 */
|
||||
#define B43_NPHY_BPHY_CTL2 B43_PHY_N(0x0BF) /* B PHY control 2 */
|
||||
#define B43_NPHY_BPHY_CTL2_LUT 0x001F /* LUT index */
|
||||
#define B43_NPHY_BPHY_CTL2_LUT_SHIFT 0
|
||||
#define B43_NPHY_BPHY_CTL2_MACDEL 0x7FE0 /* MAC delay */
|
||||
#define B43_NPHY_BPHY_CTL2_MACDEL_SHIFT 5
|
||||
#define B43_NPHY_IQLOCAL_CMD B43_PHY_N(0x0C0) /* I/Q LO cal command */
|
||||
#define B43_NPHY_IQLOCAL_CMD_EN 0x8000
|
||||
#define B43_NPHY_IQLOCAL_CMDNNUM B43_PHY_N(0x0C1) /* I/Q LO cal command N num */
|
||||
#define B43_NPHY_IQLOCAL_CMDGCTL B43_PHY_N(0x0C2) /* I/Q LO cal command G control */
|
||||
#define B43_NPHY_SAMP_CMD B43_PHY_N(0x0C3) /* Sample command */
|
||||
#define B43_NPHY_SAMP_CMD_STOP 0x0002 /* Stop */
|
||||
#define B43_NPHY_SAMP_LOOPCNT B43_PHY_N(0x0C4) /* Sample loop count */
|
||||
#define B43_NPHY_SAMP_WAITCNT B43_PHY_N(0x0C5) /* Sample wait count */
|
||||
#define B43_NPHY_SAMP_DEPCNT B43_PHY_N(0x0C6) /* Sample depth count */
|
||||
#define B43_NPHY_SAMP_STAT B43_PHY_N(0x0C7) /* Sample status */
|
||||
#define B43_NPHY_GPIO_LOOEN B43_PHY_N(0x0C8) /* GPIO low out enable */
|
||||
#define B43_NPHY_GPIO_HIOEN B43_PHY_N(0x0C9) /* GPIO high out enable */
|
||||
#define B43_NPHY_GPIO_SEL B43_PHY_N(0x0CA) /* GPIO select */
|
||||
#define B43_NPHY_GPIO_CLKCTL B43_PHY_N(0x0CB) /* GPIO clock control */
|
||||
#define B43_NPHY_TXF_20CO_AS0 B43_PHY_N(0x0CC) /* TX filter 20 coeff A stage 0 */
|
||||
#define B43_NPHY_TXF_20CO_AS1 B43_PHY_N(0x0CD) /* TX filter 20 coeff A stage 1 */
|
||||
#define B43_NPHY_TXF_20CO_AS2 B43_PHY_N(0x0CE) /* TX filter 20 coeff A stage 2 */
|
||||
#define B43_NPHY_TXF_20CO_B32S0 B43_PHY_N(0x0CF) /* TX filter 20 coeff B32 stage 0 */
|
||||
#define B43_NPHY_TXF_20CO_B1S0 B43_PHY_N(0x0D0) /* TX filter 20 coeff B1 stage 0 */
|
||||
#define B43_NPHY_TXF_20CO_B32S1 B43_PHY_N(0x0D1) /* TX filter 20 coeff B32 stage 1 */
|
||||
#define B43_NPHY_TXF_20CO_B1S1 B43_PHY_N(0x0D2) /* TX filter 20 coeff B1 stage 1 */
|
||||
#define B43_NPHY_TXF_20CO_B32S2 B43_PHY_N(0x0D3) /* TX filter 20 coeff B32 stage 2 */
|
||||
#define B43_NPHY_TXF_20CO_B1S2 B43_PHY_N(0x0D4) /* TX filter 20 coeff B1 stage 2 */
|
||||
#define B43_NPHY_SIGFLDTOL B43_PHY_N(0x0D5) /* Signal fld tolerance */
|
||||
#define B43_NPHY_TXSERFLD B43_PHY_N(0x0D6) /* TX service field */
|
||||
#define B43_NPHY_AFESEQ_RX2TX_PUD B43_PHY_N(0x0D7) /* AFE seq RX2TX power up/down delay */
|
||||
#define B43_NPHY_AFESEQ_TX2RX_PUD B43_PHY_N(0x0D8) /* AFE seq TX2RX power up/down delay */
|
||||
#define B43_NPHY_TGNSYNC_SCRAMI0 B43_PHY_N(0x0D9) /* TGNsync scram init 0 */
|
||||
#define B43_NPHY_TGNSYNC_SCRAMI1 B43_PHY_N(0x0DA) /* TGNsync scram init 1 */
|
||||
#define B43_NPHY_INITSWIZPATTLEG B43_PHY_N(0x0DB) /* Initial swizzle pattern leg */
|
||||
#define B43_NPHY_BPHY_CTL3 B43_PHY_N(0x0DC) /* B PHY control 3 */
|
||||
#define B43_NPHY_BPHY_CTL3_SCALE 0x00FF /* Scale */
|
||||
#define B43_NPHY_BPHY_CTL3_SCALE_SHIFT 0
|
||||
#define B43_NPHY_BPHY_CTL3_FSC 0xFF00 /* Frame start count value */
|
||||
#define B43_NPHY_BPHY_CTL3_FSC_SHIFT 8
|
||||
#define B43_NPHY_BPHY_CTL4 B43_PHY_N(0x0DD) /* B PHY control 4 */
|
||||
#define B43_NPHY_C1_TXBBMULT B43_PHY_N(0x0DE) /* Core 1 TX BB multiplier */
|
||||
#define B43_NPHY_C2_TXBBMULT B43_PHY_N(0x0DF) /* Core 2 TX BB multiplier */
|
||||
#define B43_NPHY_TXF_40CO_AS0 B43_PHY_N(0x0E1) /* TX filter 40 coeff A stage 0 */
|
||||
#define B43_NPHY_TXF_40CO_AS1 B43_PHY_N(0x0E2) /* TX filter 40 coeff A stage 1 */
|
||||
#define B43_NPHY_TXF_40CO_AS2 B43_PHY_N(0x0E3) /* TX filter 40 coeff A stage 2 */
|
||||
#define B43_NPHY_TXF_40CO_B32S0 B43_PHY_N(0x0E4) /* TX filter 40 coeff B32 stage 0 */
|
||||
#define B43_NPHY_TXF_40CO_B1S0 B43_PHY_N(0x0E5) /* TX filter 40 coeff B1 stage 0 */
|
||||
#define B43_NPHY_TXF_40CO_B32S1 B43_PHY_N(0x0E6) /* TX filter 40 coeff B32 stage 1 */
|
||||
#define B43_NPHY_TXF_40CO_B1S1 B43_PHY_N(0x0E7) /* TX filter 40 coeff B1 stage 1 */
|
||||
#define B43_NPHY_TXF_40CO_B32S2 B43_PHY_N(0x0E8) /* TX filter 40 coeff B32 stage 2 */
|
||||
#define B43_NPHY_TXF_40CO_B1S2 B43_PHY_N(0x0E9) /* TX filter 40 coeff B1 stage 2 */
|
||||
#define B43_NPHY_BIST_STAT2 B43_PHY_N(0x0EA) /* BIST status 2 */
|
||||
#define B43_NPHY_BIST_STAT3 B43_PHY_N(0x0EB) /* BIST status 3 */
|
||||
#define B43_NPHY_RFCTL_OVER B43_PHY_N(0x0EC) /* RF control override */
|
||||
#define B43_NPHY_MIMOCFG B43_PHY_N(0x0ED) /* MIMO config */
|
||||
#define B43_NPHY_MIMOCFG_GFMIX 0x0004 /* Greenfield or mixed mode */
|
||||
#define B43_NPHY_MIMOCFG_AUTO 0x0100 /* Greenfield/mixed mode auto */
|
||||
#define B43_NPHY_RADAR_BLNKCTL B43_PHY_N(0x0EE) /* Radar blank control */
|
||||
#define B43_NPHY_A0RADAR_FIFOCTL B43_PHY_N(0x0EF) /* Antenna 0 radar FIFO control */
|
||||
#define B43_NPHY_A1RADAR_FIFOCTL B43_PHY_N(0x0F0) /* Antenna 1 radar FIFO control */
|
||||
#define B43_NPHY_A0RADAR_FIFODAT B43_PHY_N(0x0F1) /* Antenna 0 radar FIFO data */
|
||||
#define B43_NPHY_A1RADAR_FIFODAT B43_PHY_N(0x0F2) /* Antenna 1 radar FIFO data */
|
||||
#define B43_NPHY_RADAR_THRES0 B43_PHY_N(0x0F3) /* Radar threshold 0 */
|
||||
#define B43_NPHY_RADAR_THRES1 B43_PHY_N(0x0F4) /* Radar threshold 1 */
|
||||
#define B43_NPHY_RADAR_THRES0R B43_PHY_N(0x0F5) /* Radar threshold 0R */
|
||||
#define B43_NPHY_RADAR_THRES1R B43_PHY_N(0x0F6) /* Radar threshold 1R */
|
||||
#define B43_NPHY_CSEN_20IN40_DLEN B43_PHY_N(0x0F7) /* Carrier sense 20 in 40 dwell length */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_LO1 B43_PHY_N(0x0F8) /* RF control LUT TRSW lower 1 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_UP1 B43_PHY_N(0x0F9) /* RF control LUT TRSW upper 1 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_LO2 B43_PHY_N(0x0FA) /* RF control LUT TRSW lower 2 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_UP2 B43_PHY_N(0x0FB) /* RF control LUT TRSW upper 2 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_LO3 B43_PHY_N(0x0FC) /* RF control LUT TRSW lower 3 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_UP3 B43_PHY_N(0x0FD) /* RF control LUT TRSW upper 3 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_LO4 B43_PHY_N(0x0FE) /* RF control LUT TRSW lower 4 */
|
||||
#define B43_NPHY_RFCTL_LUT_TRSW_UP4 B43_PHY_N(0x0FF) /* RF control LUT TRSW upper 4 */
|
||||
#define B43_NPHY_RFCTL_LUT_LNAPA1 B43_PHY_N(0x100) /* RF control LUT LNA PA 1 */
|
||||
#define B43_NPHY_RFCTL_LUT_LNAPA2 B43_PHY_N(0x101) /* RF control LUT LNA PA 2 */
|
||||
#define B43_NPHY_RFCTL_LUT_LNAPA3 B43_PHY_N(0x102) /* RF control LUT LNA PA 3 */
|
||||
#define B43_NPHY_RFCTL_LUT_LNAPA4 B43_PHY_N(0x103) /* RF control LUT LNA PA 4 */
|
||||
#define B43_NPHY_TGNSYNC_CRCM0 B43_PHY_N(0x104) /* TGNsync CRC mask 0 */
|
||||
#define B43_NPHY_TGNSYNC_CRCM1 B43_PHY_N(0x105) /* TGNsync CRC mask 1 */
|
||||
#define B43_NPHY_TGNSYNC_CRCM2 B43_PHY_N(0x106) /* TGNsync CRC mask 2 */
|
||||
#define B43_NPHY_TGNSYNC_CRCM3 B43_PHY_N(0x107) /* TGNsync CRC mask 3 */
|
||||
#define B43_NPHY_TGNSYNC_CRCM4 B43_PHY_N(0x108) /* TGNsync CRC mask 4 */
|
||||
#define B43_NPHY_CRCPOLY B43_PHY_N(0x109) /* CRC polynomial */
|
||||
#define B43_NPHY_SIGCNT B43_PHY_N(0x10A) /* # sig count */
|
||||
#define B43_NPHY_SIGSTARTBIT_CTL B43_PHY_N(0x10B) /* Sig start bit control */
|
||||
#define B43_NPHY_CRCPOLY_ORDER B43_PHY_N(0x10C) /* CRC polynomial order */
|
||||
#define B43_NPHY_RFCTL_CST0 B43_PHY_N(0x10D) /* RF control core swap table 0 */
|
||||
#define B43_NPHY_RFCTL_CST1 B43_PHY_N(0x10E) /* RF control core swap table 1 */
|
||||
#define B43_NPHY_RFCTL_CST2O B43_PHY_N(0x10F) /* RF control core swap table 2 + others */
|
||||
#define B43_NPHY_BPHY_CTL5 B43_PHY_N(0x111) /* B PHY control 5 */
|
||||
#define B43_NPHY_RFSEQ_LPFBW B43_PHY_N(0x112) /* RF seq LPF bandwidth */
|
||||
#define B43_NPHY_TSSIBIAS1 B43_PHY_N(0x114) /* TSSI bias val 1 */
|
||||
#define B43_NPHY_TSSIBIAS2 B43_PHY_N(0x115) /* TSSI bias val 2 */
|
||||
#define B43_NPHY_TSSIBIAS_BIAS 0x00FF /* Bias */
|
||||
#define B43_NPHY_TSSIBIAS_BIAS_SHIFT 0
|
||||
#define B43_NPHY_TSSIBIAS_VAL 0xFF00 /* Value */
|
||||
#define B43_NPHY_TSSIBIAS_VAL_SHIFT 8
|
||||
#define B43_NPHY_ESTPWR1 B43_PHY_N(0x118) /* Estimated power 1 */
|
||||
#define B43_NPHY_ESTPWR2 B43_PHY_N(0x119) /* Estimated power 2 */
|
||||
#define B43_NPHY_ESTPWR_PWR 0x00FF /* Estimated power */
|
||||
#define B43_NPHY_ESTPWR_PWR_SHIFT 0
|
||||
#define B43_NPHY_ESTPWR_VALID 0x0100 /* Estimated power valid */
|
||||
#define B43_NPHY_TSSI_MAXTXFDT B43_PHY_N(0x11C) /* TSSI max TX frame delay time */
|
||||
#define B43_NPHY_TSSI_MAXTXFDT_VAL 0x00FF /* max TX frame delay time */
|
||||
#define B43_NPHY_TSSI_MAXTXFDT_VAL_SHIFT 0
|
||||
#define B43_NPHY_TSSI_MAXTDT B43_PHY_N(0x11D) /* TSSI max TSSI delay time */
|
||||
#define B43_NPHY_TSSI_MAXTDT_VAL 0x00FF /* max TSSI delay time */
|
||||
#define B43_NPHY_TSSI_MAXTDT_VAL_SHIFT 0
|
||||
#define B43_NPHY_ITSSI1 B43_PHY_N(0x11E) /* TSSI idle 1 */
|
||||
#define B43_NPHY_ITSSI2 B43_PHY_N(0x11F) /* TSSI idle 2 */
|
||||
#define B43_NPHY_ITSSI_VAL 0x00FF /* Idle TSSI */
|
||||
#define B43_NPHY_ITSSI_VAL_SHIFT 0
|
||||
#define B43_NPHY_TSSIMODE B43_PHY_N(0x122) /* TSSI mode */
|
||||
#define B43_NPHY_TSSIMODE_EN 0x0001 /* TSSI enable */
|
||||
#define B43_NPHY_TSSIMODE_PDEN 0x0002 /* Power det enable */
|
||||
#define B43_NPHY_RXMACIFM B43_PHY_N(0x123) /* RX Macif mode */
|
||||
#define B43_NPHY_CRSIT_COCNT_LO B43_PHY_N(0x124) /* CRS idle time CRS-on count (low) */
|
||||
#define B43_NPHY_CRSIT_COCNT_HI B43_PHY_N(0x125) /* CRS idle time CRS-on count (high) */
|
||||
#define B43_NPHY_CRSIT_MTCNT_LO B43_PHY_N(0x126) /* CRS idle time measure time count (low) */
|
||||
#define B43_NPHY_CRSIT_MTCNT_HI B43_PHY_N(0x127) /* CRS idle time measure time count (high) */
|
||||
#define B43_NPHY_SAMTWC B43_PHY_N(0x128) /* Sample tail wait count */
|
||||
#define B43_NPHY_IQEST_CMD B43_PHY_N(0x129) /* I/Q estimate command */
|
||||
#define B43_NPHY_IQEST_CMD_START 0x0001 /* Start */
|
||||
#define B43_NPHY_IQEST_CMD_MODE 0x0002 /* Mode */
|
||||
#define B43_NPHY_IQEST_WT B43_PHY_N(0x12A) /* I/Q estimate wait time */
|
||||
#define B43_NPHY_IQEST_WT_VAL 0x00FF /* Wait time */
|
||||
#define B43_NPHY_IQEST_WT_VAL_SHIFT 0
|
||||
#define B43_NPHY_IQEST_SAMCNT B43_PHY_N(0x12B) /* I/Q estimate sample count */
|
||||
#define B43_NPHY_IQEST_IQACC_LO0 B43_PHY_N(0x12C) /* I/Q estimate I/Q acc lo 0 */
|
||||
#define B43_NPHY_IQEST_IQACC_HI0 B43_PHY_N(0x12D) /* I/Q estimate I/Q acc hi 0 */
|
||||
#define B43_NPHY_IQEST_IPACC_LO0 B43_PHY_N(0x12E) /* I/Q estimate I power acc lo 0 */
|
||||
#define B43_NPHY_IQEST_IPACC_HI0 B43_PHY_N(0x12F) /* I/Q estimate I power acc hi 0 */
|
||||
#define B43_NPHY_IQEST_QPACC_LO0 B43_PHY_N(0x130) /* I/Q estimate Q power acc lo 0 */
|
||||
#define B43_NPHY_IQEST_QPACC_HI0 B43_PHY_N(0x131) /* I/Q estimate Q power acc hi 0 */
|
||||
#define B43_NPHY_IQEST_IQACC_LO1 B43_PHY_N(0x134) /* I/Q estimate I/Q acc lo 1 */
|
||||
#define B43_NPHY_IQEST_IQACC_HI1 B43_PHY_N(0x135) /* I/Q estimate I/Q acc hi 1 */
|
||||
#define B43_NPHY_IQEST_IPACC_LO1 B43_PHY_N(0x136) /* I/Q estimate I power acc lo 1 */
|
||||
#define B43_NPHY_IQEST_IPACC_HI1 B43_PHY_N(0x137) /* I/Q estimate I power acc hi 1 */
|
||||
#define B43_NPHY_IQEST_QPACC_LO1 B43_PHY_N(0x138) /* I/Q estimate Q power acc lo 1 */
|
||||
#define B43_NPHY_IQEST_QPACC_HI1 B43_PHY_N(0x139) /* I/Q estimate Q power acc hi 1 */
|
||||
#define B43_NPHY_MIMO_CRSTXEXT B43_PHY_N(0x13A) /* MIMO PHY CRS TX extension */
|
||||
#define B43_NPHY_PWRDET1 B43_PHY_N(0x13B) /* Power det 1 */
|
||||
#define B43_NPHY_PWRDET2 B43_PHY_N(0x13C) /* Power det 2 */
|
||||
#define B43_NPHY_MAXRSSI_DTIME B43_PHY_N(0x13F) /* RSSI max RSSI delay time */
|
||||
#define B43_NPHY_PIL_DW0 B43_PHY_N(0x141) /* Pilot data weight 0 */
|
||||
#define B43_NPHY_PIL_DW1 B43_PHY_N(0x142) /* Pilot data weight 1 */
|
||||
#define B43_NPHY_PIL_DW2 B43_PHY_N(0x143) /* Pilot data weight 2 */
|
||||
#define B43_NPHY_PIL_DW_BPSK 0x000F /* BPSK */
|
||||
#define B43_NPHY_PIL_DW_BPSK_SHIFT 0
|
||||
#define B43_NPHY_PIL_DW_QPSK 0x00F0 /* QPSK */
|
||||
#define B43_NPHY_PIL_DW_QPSK_SHIFT 4
|
||||
#define B43_NPHY_PIL_DW_16QAM 0x0F00 /* 16-QAM */
|
||||
#define B43_NPHY_PIL_DW_16QAM_SHIFT 8
|
||||
#define B43_NPHY_PIL_DW_64QAM 0xF000 /* 64-QAM */
|
||||
#define B43_NPHY_PIL_DW_64QAM_SHIFT 12
|
||||
#define B43_NPHY_FMDEM_CFG B43_PHY_N(0x144) /* FM demodulation config */
|
||||
#define B43_NPHY_PHASETR_A0 B43_PHY_N(0x145) /* Phase track alpha 0 */
|
||||
#define B43_NPHY_PHASETR_A1 B43_PHY_N(0x146) /* Phase track alpha 1 */
|
||||
#define B43_NPHY_PHASETR_A2 B43_PHY_N(0x147) /* Phase track alpha 2 */
|
||||
#define B43_NPHY_PHASETR_B0 B43_PHY_N(0x148) /* Phase track beta 0 */
|
||||
#define B43_NPHY_PHASETR_B1 B43_PHY_N(0x149) /* Phase track beta 1 */
|
||||
#define B43_NPHY_PHASETR_B2 B43_PHY_N(0x14A) /* Phase track beta 2 */
|
||||
#define B43_NPHY_PHASETR_CHG0 B43_PHY_N(0x14B) /* Phase track change 0 */
|
||||
#define B43_NPHY_PHASETR_CHG1 B43_PHY_N(0x14C) /* Phase track change 1 */
|
||||
#define B43_NPHY_PHASETW_OFF B43_PHY_N(0x14D) /* Phase track offset */
|
||||
#define B43_NPHY_RFCTL_DBG B43_PHY_N(0x14E) /* RF control debug */
|
||||
#define B43_NPHY_CCK_SHIFTB_REF B43_PHY_N(0x150) /* CCK shiftbits reference var */
|
||||
#define B43_NPHY_OVER_DGAIN0 B43_PHY_N(0x152) /* Override digital gain 0 */
|
||||
#define B43_NPHY_OVER_DGAIN1 B43_PHY_N(0x153) /* Override digital gain 1 */
|
||||
#define B43_NPHY_OVER_DGAIN_FDGV 0x0007 /* Force digital gain value */
|
||||
#define B43_NPHY_OVER_DGAIN_FDGV_SHIFT 0
|
||||
#define B43_NPHY_OVER_DGAIN_FDGEN 0x0008 /* Force digital gain enable */
|
||||
#define B43_NPHY_OVER_DGAIN_CCKDGECV 0xFF00 /* CCK digital gain enable count value */
|
||||
#define B43_NPHY_OVER_DGAIN_CCKDGECV_SHIFT 8
|
||||
#define B43_NPHY_BIST_STAT4 B43_PHY_N(0x156) /* BIST status 4 */
|
||||
#define B43_NPHY_RADAR_MAL B43_PHY_N(0x157) /* Radar MA length */
|
||||
#define B43_NPHY_RADAR_SRCCTL B43_PHY_N(0x158) /* Radar search control */
|
||||
#define B43_NPHY_VLD_DTSIG B43_PHY_N(0x159) /* VLD data tones sig */
|
||||
#define B43_NPHY_VLD_DTDAT B43_PHY_N(0x15A) /* VLD data tones data */
|
||||
#define B43_NPHY_C1_BPHY_RXIQCA0 B43_PHY_N(0x15B) /* Core 1 B PHY RX I/Q comp A0 */
|
||||
#define B43_NPHY_C1_BPHY_RXIQCB0 B43_PHY_N(0x15C) /* Core 1 B PHY RX I/Q comp B0 */
|
||||
#define B43_NPHY_C2_BPHY_RXIQCA1 B43_PHY_N(0x15D) /* Core 2 B PHY RX I/Q comp A1 */
|
||||
#define B43_NPHY_C2_BPHY_RXIQCB1 B43_PHY_N(0x15E) /* Core 2 B PHY RX I/Q comp B1 */
|
||||
#define B43_NPHY_FREQGAIN0 B43_PHY_N(0x160) /* Frequency gain 0 */
|
||||
#define B43_NPHY_FREQGAIN1 B43_PHY_N(0x161) /* Frequency gain 1 */
|
||||
#define B43_NPHY_FREQGAIN2 B43_PHY_N(0x162) /* Frequency gain 2 */
|
||||
#define B43_NPHY_FREQGAIN3 B43_PHY_N(0x163) /* Frequency gain 3 */
|
||||
#define B43_NPHY_FREQGAIN4 B43_PHY_N(0x164) /* Frequency gain 4 */
|
||||
#define B43_NPHY_FREQGAIN5 B43_PHY_N(0x165) /* Frequency gain 5 */
|
||||
#define B43_NPHY_FREQGAIN6 B43_PHY_N(0x166) /* Frequency gain 6 */
|
||||
#define B43_NPHY_FREQGAIN7 B43_PHY_N(0x167) /* Frequency gain 7 */
|
||||
#define B43_NPHY_FREQGAIN_BYPASS B43_PHY_N(0x168) /* Frequency gain bypass */
|
||||
#define B43_NPHY_TRLOSS B43_PHY_N(0x169) /* TR loss value */
|
||||
#define B43_NPHY_C1_ADCCLIP B43_PHY_N(0x16A) /* Core 1 ADC clip */
|
||||
#define B43_NPHY_C2_ADCCLIP B43_PHY_N(0x16B) /* Core 2 ADC clip */
|
||||
#define B43_NPHY_LTRN_OFFGAIN B43_PHY_N(0x16F) /* LTRN offset gain */
|
||||
#define B43_NPHY_LTRN_OFF B43_PHY_N(0x170) /* LTRN offset */
|
||||
#define B43_NPHY_NRDATAT_WWISE20SIG B43_PHY_N(0x171) /* # data tones WWiSE 20 sig */
|
||||
#define B43_NPHY_NRDATAT_WWISE40SIG B43_PHY_N(0x172) /* # data tones WWiSE 40 sig */
|
||||
#define B43_NPHY_NRDATAT_TGNSYNC20SIG B43_PHY_N(0x173) /* # data tones TGNsync 20 sig */
|
||||
#define B43_NPHY_NRDATAT_TGNSYNC40SIG B43_PHY_N(0x174) /* # data tones TGNsync 40 sig */
|
||||
#define B43_NPHY_WWISE_CRCM0 B43_PHY_N(0x175) /* WWiSE CRC mask 0 */
|
||||
#define B43_NPHY_WWISE_CRCM1 B43_PHY_N(0x176) /* WWiSE CRC mask 1 */
|
||||
#define B43_NPHY_WWISE_CRCM2 B43_PHY_N(0x177) /* WWiSE CRC mask 2 */
|
||||
#define B43_NPHY_WWISE_CRCM3 B43_PHY_N(0x178) /* WWiSE CRC mask 3 */
|
||||
#define B43_NPHY_WWISE_CRCM4 B43_PHY_N(0x179) /* WWiSE CRC mask 4 */
|
||||
#define B43_NPHY_CHANEST_CDDSH B43_PHY_N(0x17A) /* Channel estimate CDD shift */
|
||||
#define B43_NPHY_HTAGC_WCNT B43_PHY_N(0x17B) /* HT ADC wait counters */
|
||||
#define B43_NPHY_SQPARM B43_PHY_N(0x17C) /* SQ params */
|
||||
#define B43_NPHY_MCSDUP6M B43_PHY_N(0x17D) /* MCS dup 6M */
|
||||
#define B43_NPHY_NDATAT_DUP40 B43_PHY_N(0x17E) /* # data tones dup 40 */
|
||||
#define B43_NPHY_DUP40_TGNSYNC_CYCD B43_PHY_N(0x17F) /* Dup40 TGNsync cycle data */
|
||||
#define B43_NPHY_DUP40_GFBL B43_PHY_N(0x180) /* Dup40 GF format BL address */
|
||||
#define B43_NPHY_DUP40_BL B43_PHY_N(0x181) /* Dup40 format BL address */
|
||||
#define B43_NPHY_LEGDUP_FTA B43_PHY_N(0x182) /* Legacy dup frm table address */
|
||||
#define B43_NPHY_PACPROC_DBG B43_PHY_N(0x183) /* Packet processing debug */
|
||||
#define B43_NPHY_PIL_CYC1 B43_PHY_N(0x184) /* Pilot cycle counter 1 */
|
||||
#define B43_NPHY_PIL_CYC2 B43_PHY_N(0x185) /* Pilot cycle counter 2 */
|
||||
#define B43_NPHY_TXF_20CO_S0A1 B43_PHY_N(0x186) /* TX filter 20 coeff stage 0 A1 */
|
||||
#define B43_NPHY_TXF_20CO_S0A2 B43_PHY_N(0x187) /* TX filter 20 coeff stage 0 A2 */
|
||||
#define B43_NPHY_TXF_20CO_S1A1 B43_PHY_N(0x188) /* TX filter 20 coeff stage 1 A1 */
|
||||
#define B43_NPHY_TXF_20CO_S1A2 B43_PHY_N(0x189) /* TX filter 20 coeff stage 1 A2 */
|
||||
#define B43_NPHY_TXF_20CO_S2A1 B43_PHY_N(0x18A) /* TX filter 20 coeff stage 2 A1 */
|
||||
#define B43_NPHY_TXF_20CO_S2A2 B43_PHY_N(0x18B) /* TX filter 20 coeff stage 2 A2 */
|
||||
#define B43_NPHY_TXF_20CO_S0B1 B43_PHY_N(0x18C) /* TX filter 20 coeff stage 0 B1 */
|
||||
#define B43_NPHY_TXF_20CO_S0B2 B43_PHY_N(0x18D) /* TX filter 20 coeff stage 0 B2 */
|
||||
#define B43_NPHY_TXF_20CO_S0B3 B43_PHY_N(0x18E) /* TX filter 20 coeff stage 0 B3 */
|
||||
#define B43_NPHY_TXF_20CO_S1B1 B43_PHY_N(0x18F) /* TX filter 20 coeff stage 1 B1 */
|
||||
#define B43_NPHY_TXF_20CO_S1B2 B43_PHY_N(0x190) /* TX filter 20 coeff stage 1 B2 */
|
||||
#define B43_NPHY_TXF_20CO_S1B3 B43_PHY_N(0x191) /* TX filter 20 coeff stage 1 B3 */
|
||||
#define B43_NPHY_TXF_20CO_S2B1 B43_PHY_N(0x192) /* TX filter 20 coeff stage 2 B1 */
|
||||
#define B43_NPHY_TXF_20CO_S2B2 B43_PHY_N(0x193) /* TX filter 20 coeff stage 2 B2 */
|
||||
#define B43_NPHY_TXF_20CO_S2B3 B43_PHY_N(0x194) /* TX filter 20 coeff stage 2 B3 */
|
||||
#define B43_NPHY_TXF_40CO_S0A1 B43_PHY_N(0x195) /* TX filter 40 coeff stage 0 A1 */
|
||||
#define B43_NPHY_TXF_40CO_S0A2 B43_PHY_N(0x196) /* TX filter 40 coeff stage 0 A2 */
|
||||
#define B43_NPHY_TXF_40CO_S1A1 B43_PHY_N(0x197) /* TX filter 40 coeff stage 1 A1 */
|
||||
#define B43_NPHY_TXF_40CO_S1A2 B43_PHY_N(0x198) /* TX filter 40 coeff stage 1 A2 */
|
||||
#define B43_NPHY_TXF_40CO_S2A1 B43_PHY_N(0x199) /* TX filter 40 coeff stage 2 A1 */
|
||||
#define B43_NPHY_TXF_40CO_S2A2 B43_PHY_N(0x19A) /* TX filter 40 coeff stage 2 A2 */
|
||||
#define B43_NPHY_TXF_40CO_S0B1 B43_PHY_N(0x19B) /* TX filter 40 coeff stage 0 B1 */
|
||||
#define B43_NPHY_TXF_40CO_S0B2 B43_PHY_N(0x19C) /* TX filter 40 coeff stage 0 B2 */
|
||||
#define B43_NPHY_TXF_40CO_S0B3 B43_PHY_N(0x19D) /* TX filter 40 coeff stage 0 B3 */
|
||||
#define B43_NPHY_TXF_40CO_S1B1 B43_PHY_N(0x19E) /* TX filter 40 coeff stage 1 B1 */
|
||||
#define B43_NPHY_TXF_40CO_S1B2 B43_PHY_N(0x19F) /* TX filter 40 coeff stage 1 B2 */
|
||||
#define B43_NPHY_TXF_40CO_S1B3 B43_PHY_N(0x1A0) /* TX filter 40 coeff stage 1 B3 */
|
||||
#define B43_NPHY_TXF_40CO_S2B1 B43_PHY_N(0x1A1) /* TX filter 40 coeff stage 2 B1 */
|
||||
#define B43_NPHY_TXF_40CO_S2B2 B43_PHY_N(0x1A2) /* TX filter 40 coeff stage 2 B2 */
|
||||
#define B43_NPHY_TXF_40CO_S2B3 B43_PHY_N(0x1A3) /* TX filter 40 coeff stage 2 B3 */
|
||||
#define B43_NPHY_RSSIMC_0I_RSSI_X B43_PHY_N(0x1A4) /* RSSI multiplication coefficient 0 I RSSI X */
|
||||
#define B43_NPHY_RSSIMC_0I_RSSI_Y B43_PHY_N(0x1A5) /* RSSI multiplication coefficient 0 I RSSI Y */
|
||||
#define B43_NPHY_RSSIMC_0I_RSSI_Z B43_PHY_N(0x1A6) /* RSSI multiplication coefficient 0 I RSSI Z */
|
||||
#define B43_NPHY_RSSIMC_0I_TBD B43_PHY_N(0x1A7) /* RSSI multiplication coefficient 0 I TBD */
|
||||
#define B43_NPHY_RSSIMC_0I_PWRDET B43_PHY_N(0x1A8) /* RSSI multiplication coefficient 0 I power det */
|
||||
#define B43_NPHY_RSSIMC_0I_TSSI B43_PHY_N(0x1A9) /* RSSI multiplication coefficient 0 I TSSI */
|
||||
#define B43_NPHY_RSSIMC_0Q_RSSI_X B43_PHY_N(0x1AA) /* RSSI multiplication coefficient 0 Q RSSI X */
|
||||
#define B43_NPHY_RSSIMC_0Q_RSSI_Y B43_PHY_N(0x1AB) /* RSSI multiplication coefficient 0 Q RSSI Y */
|
||||
#define B43_NPHY_RSSIMC_0Q_RSSI_Z B43_PHY_N(0x1AC) /* RSSI multiplication coefficient 0 Q RSSI Z */
|
||||
#define B43_NPHY_RSSIMC_0Q_TBD B43_PHY_N(0x1AD) /* RSSI multiplication coefficient 0 Q TBD */
|
||||
#define B43_NPHY_RSSIMC_0Q_PWRDET B43_PHY_N(0x1AE) /* RSSI multiplication coefficient 0 Q power det */
|
||||
#define B43_NPHY_RSSIMC_0Q_TSSI B43_PHY_N(0x1AF) /* RSSI multiplication coefficient 0 Q TSSI */
|
||||
#define B43_NPHY_RSSIMC_1I_RSSI_X B43_PHY_N(0x1B0) /* RSSI multiplication coefficient 1 I RSSI X */
|
||||
#define B43_NPHY_RSSIMC_1I_RSSI_Y B43_PHY_N(0x1B1) /* RSSI multiplication coefficient 1 I RSSI Y */
|
||||
#define B43_NPHY_RSSIMC_1I_RSSI_Z B43_PHY_N(0x1B2) /* RSSI multiplication coefficient 1 I RSSI Z */
|
||||
#define B43_NPHY_RSSIMC_1I_TBD B43_PHY_N(0x1B3) /* RSSI multiplication coefficient 1 I TBD */
|
||||
#define B43_NPHY_RSSIMC_1I_PWRDET B43_PHY_N(0x1B4) /* RSSI multiplication coefficient 1 I power det */
|
||||
#define B43_NPHY_RSSIMC_1I_TSSI B43_PHY_N(0x1B5) /* RSSI multiplication coefficient 1 I TSSI */
|
||||
#define B43_NPHY_RSSIMC_1Q_RSSI_X B43_PHY_N(0x1B6) /* RSSI multiplication coefficient 1 Q RSSI X */
|
||||
#define B43_NPHY_RSSIMC_1Q_RSSI_Y B43_PHY_N(0x1B7) /* RSSI multiplication coefficient 1 Q RSSI Y */
|
||||
#define B43_NPHY_RSSIMC_1Q_RSSI_Z B43_PHY_N(0x1B8) /* RSSI multiplication coefficient 1 Q RSSI Z */
|
||||
#define B43_NPHY_RSSIMC_1Q_TBD B43_PHY_N(0x1B9) /* RSSI multiplication coefficient 1 Q TBD */
|
||||
#define B43_NPHY_RSSIMC_1Q_PWRDET B43_PHY_N(0x1BA) /* RSSI multiplication coefficient 1 Q power det */
|
||||
#define B43_NPHY_RSSIMC_1Q_TSSI B43_PHY_N(0x1BB) /* RSSI multiplication coefficient 1 Q TSSI */
|
||||
#define B43_NPHY_SAMC_WCNT B43_PHY_N(0x1BC) /* Sample collect wait counter */
|
||||
#define B43_NPHY_PTHROUGH_CNT B43_PHY_N(0x1BD) /* Pass-through counter */
|
||||
#define B43_NPHY_LTRN_OFF_G20L B43_PHY_N(0x1C4) /* LTRN offset gain 20L */
|
||||
#define B43_NPHY_LTRN_OFF_20L B43_PHY_N(0x1C5) /* LTRN offset 20L */
|
||||
#define B43_NPHY_LTRN_OFF_G20U B43_PHY_N(0x1C6) /* LTRN offset gain 20U */
|
||||
#define B43_NPHY_LTRN_OFF_20U B43_PHY_N(0x1C7) /* LTRN offset 20U */
|
||||
#define B43_NPHY_DSSSCCK_GAINSL B43_PHY_N(0x1C8) /* DSSS/CCK gain settle length */
|
||||
#define B43_NPHY_GPIO_LOOUT B43_PHY_N(0x1C9) /* GPIO low out */
|
||||
#define B43_NPHY_GPIO_HIOUT B43_PHY_N(0x1CA) /* GPIO high out */
|
||||
#define B43_NPHY_CRS_CHECK B43_PHY_N(0x1CB) /* CRS check */
|
||||
#define B43_NPHY_ML_LOGSS_RAT B43_PHY_N(0x1CC) /* ML/logss ratio */
|
||||
#define B43_NPHY_DUPSCALE B43_PHY_N(0x1CD) /* Dup scale */
|
||||
#define B43_NPHY_BW1A B43_PHY_N(0x1CE) /* BW 1A */
|
||||
#define B43_NPHY_BW2 B43_PHY_N(0x1CF) /* BW 2 */
|
||||
#define B43_NPHY_BW3 B43_PHY_N(0x1D0) /* BW 3 */
|
||||
#define B43_NPHY_BW4 B43_PHY_N(0x1D1) /* BW 4 */
|
||||
#define B43_NPHY_BW5 B43_PHY_N(0x1D2) /* BW 5 */
|
||||
#define B43_NPHY_BW6 B43_PHY_N(0x1D3) /* BW 6 */
|
||||
#define B43_NPHY_COALEN0 B43_PHY_N(0x1D4) /* Coarse length 0 */
|
||||
#define B43_NPHY_COALEN1 B43_PHY_N(0x1D5) /* Coarse length 1 */
|
||||
#define B43_NPHY_CRSTHRES_1U B43_PHY_N(0x1D6) /* CRS threshold 1 U */
|
||||
#define B43_NPHY_CRSTHRES_2U B43_PHY_N(0x1D7) /* CRS threshold 2 U */
|
||||
#define B43_NPHY_CRSTHRES_3U B43_PHY_N(0x1D8) /* CRS threshold 3 U */
|
||||
#define B43_NPHY_CRSCTL_U B43_PHY_N(0x1D9) /* CRS control U */
|
||||
#define B43_NPHY_CRSTHRES_1L B43_PHY_N(0x1DA) /* CRS threshold 1 L */
|
||||
#define B43_NPHY_CRSTHRES_2L B43_PHY_N(0x1DB) /* CRS threshold 2 L */
|
||||
#define B43_NPHY_CRSTHRES_3L B43_PHY_N(0x1DC) /* CRS threshold 3 L */
|
||||
#define B43_NPHY_CRSCTL_L B43_PHY_N(0x1DD) /* CRS control L */
|
||||
#define B43_NPHY_STRA_1U B43_PHY_N(0x1DE) /* STR address 1 U */
|
||||
#define B43_NPHY_STRA_2U B43_PHY_N(0x1DF) /* STR address 2 U */
|
||||
#define B43_NPHY_STRA_1L B43_PHY_N(0x1E0) /* STR address 1 L */
|
||||
#define B43_NPHY_STRA_2L B43_PHY_N(0x1E1) /* STR address 2 L */
|
||||
#define B43_NPHY_CRSCHECK1 B43_PHY_N(0x1E2) /* CRS check 1 */
|
||||
#define B43_NPHY_CRSCHECK2 B43_PHY_N(0x1E3) /* CRS check 2 */
|
||||
#define B43_NPHY_CRSCHECK3 B43_PHY_N(0x1E4) /* CRS check 3 */
|
||||
#define B43_NPHY_JMPSTP0 B43_PHY_N(0x1E5) /* Jump step 0 */
|
||||
#define B43_NPHY_JMPSTP1 B43_PHY_N(0x1E6) /* Jump step 1 */
|
||||
#define B43_NPHY_TXPCTL_CMD B43_PHY_N(0x1E7) /* TX power control command */
|
||||
#define B43_NPHY_TXPCTL_CMD_INIT 0x007F /* Init */
|
||||
#define B43_NPHY_TXPCTL_CMD_INIT_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_CMD_COEFF 0x2000 /* Power control coefficients */
|
||||
#define B43_NPHY_TXPCTL_CMD_HWPCTLEN 0x4000 /* Hardware TX power control enable */
|
||||
#define B43_NPHY_TXPCTL_CMD_PCTLEN 0x8000 /* TX power control enable */
|
||||
#define B43_NPHY_TXPCTL_N B43_PHY_N(0x1E8) /* TX power control N num */
|
||||
#define B43_NPHY_TXPCTL_N_TSSID 0x00FF /* N TSSI delay */
|
||||
#define B43_NPHY_TXPCTL_N_TSSID_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_N_NPTIL2 0x0700 /* N PT integer log2 */
|
||||
#define B43_NPHY_TXPCTL_N_NPTIL2_SHIFT 8
|
||||
#define B43_NPHY_TXPCTL_ITSSI B43_PHY_N(0x1E9) /* TX power control idle TSSI */
|
||||
#define B43_NPHY_TXPCTL_ITSSI_0 0x003F /* Idle TSSI 0 */
|
||||
#define B43_NPHY_TXPCTL_ITSSI_0_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_ITSSI_1 0x3F00 /* Idle TSSI 1 */
|
||||
#define B43_NPHY_TXPCTL_ITSSI_1_SHIFT 8
|
||||
#define B43_NPHY_TXPCTL_ITSSI_BINF 0x8000 /* Raw TSSI offset bin format */
|
||||
#define B43_NPHY_TXPCTL_TPWR B43_PHY_N(0x1EA) /* TX power control target power */
|
||||
#define B43_NPHY_TXPCTL_TPWR_0 0x00FF /* Power 0 */
|
||||
#define B43_NPHY_TXPCTL_TPWR_0_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_TPWR_1 0xFF00 /* Power 1 */
|
||||
#define B43_NPHY_TXPCTL_TPWR_1_SHIFT 8
|
||||
#define B43_NPHY_TXPCTL_BIDX B43_PHY_N(0x1EB) /* TX power control base index */
|
||||
#define B43_NPHY_TXPCTL_BIDX_0 0x007F /* uC base index 0 */
|
||||
#define B43_NPHY_TXPCTL_BIDX_0_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_BIDX_1 0x7F00 /* uC base index 1 */
|
||||
#define B43_NPHY_TXPCTL_BIDX_1_SHIFT 8
|
||||
#define B43_NPHY_TXPCTL_BIDX_LOAD 0x8000 /* Load base index */
|
||||
#define B43_NPHY_TXPCTL_PIDX B43_PHY_N(0x1EC) /* TX power control power index */
|
||||
#define B43_NPHY_TXPCTL_PIDX_0 0x007F /* uC power index 0 */
|
||||
#define B43_NPHY_TXPCTL_PIDX_0_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_PIDX_1 0x7F00 /* uC power index 1 */
|
||||
#define B43_NPHY_TXPCTL_PIDX_1_SHIFT 8
|
||||
#define B43_NPHY_C1_TXPCTL_STAT B43_PHY_N(0x1ED) /* Core 1 TX power control status */
|
||||
#define B43_NPHY_C2_TXPCTL_STAT B43_PHY_N(0x1EE) /* Core 2 TX power control status */
|
||||
#define B43_NPHY_TXPCTL_STAT_EST 0x00FF /* Estimated power */
|
||||
#define B43_NPHY_TXPCTL_STAT_EST_SHIFT 0
|
||||
#define B43_NPHY_TXPCTL_STAT_BIDX 0x7F00 /* Base index */
|
||||
#define B43_NPHY_TXPCTL_STAT_BIDX_SHIFT 8
|
||||
#define B43_NPHY_TXPCTL_STAT_ESTVALID 0x8000 /* Estimated power valid */
|
||||
#define B43_NPHY_SMALLSGS_LEN B43_PHY_N(0x1EF) /* Small sig gain settle length */
|
||||
#define B43_NPHY_PHYSTAT_GAIN0 B43_PHY_N(0x1F0) /* PHY stats gain info 0 */
|
||||
#define B43_NPHY_PHYSTAT_GAIN1 B43_PHY_N(0x1F1) /* PHY stats gain info 1 */
|
||||
#define B43_NPHY_PHYSTAT_FREQEST B43_PHY_N(0x1F2) /* PHY stats frequency estimate */
|
||||
#define B43_NPHY_PHYSTAT_ADVRET B43_PHY_N(0x1F3) /* PHY stats ADV retard */
|
||||
#define B43_NPHY_PHYLB_MODE B43_PHY_N(0x1F4) /* PHY loopback mode */
|
||||
#define B43_NPHY_TONE_MIDX20_1 B43_PHY_N(0x1F5) /* Tone map index 20/1 */
|
||||
#define B43_NPHY_TONE_MIDX20_2 B43_PHY_N(0x1F6) /* Tone map index 20/2 */
|
||||
#define B43_NPHY_TONE_MIDX20_3 B43_PHY_N(0x1F7) /* Tone map index 20/3 */
|
||||
#define B43_NPHY_TONE_MIDX40_1 B43_PHY_N(0x1F8) /* Tone map index 40/1 */
|
||||
#define B43_NPHY_TONE_MIDX40_2 B43_PHY_N(0x1F9) /* Tone map index 40/2 */
|
||||
#define B43_NPHY_TONE_MIDX40_3 B43_PHY_N(0x1FA) /* Tone map index 40/3 */
|
||||
#define B43_NPHY_TONE_MIDX40_4 B43_PHY_N(0x1FB) /* Tone map index 40/4 */
|
||||
#define B43_NPHY_PILTONE_MIDX1 B43_PHY_N(0x1FC) /* Pilot tone map index 1 */
|
||||
#define B43_NPHY_PILTONE_MIDX2 B43_PHY_N(0x1FD) /* Pilot tone map index 2 */
|
||||
#define B43_NPHY_PILTONE_MIDX3 B43_PHY_N(0x1FE) /* Pilot tone map index 3 */
|
||||
#define B43_NPHY_TXRIFS_FRDEL B43_PHY_N(0x1FF) /* TX RIFS frame delay */
|
||||
#define B43_NPHY_AFESEQ_RX2TX_PUD_40M B43_PHY_N(0x200) /* AFE seq rx2tx power up/down delay 40M */
|
||||
#define B43_NPHY_AFESEQ_TX2RX_PUD_40M B43_PHY_N(0x201) /* AFE seq tx2rx power up/down delay 40M */
|
||||
#define B43_NPHY_AFESEQ_RX2TX_PUD_20M B43_PHY_N(0x202) /* AFE seq rx2tx power up/down delay 20M */
|
||||
#define B43_NPHY_AFESEQ_TX2RX_PUD_20M B43_PHY_N(0x203) /* AFE seq tx2rx power up/down delay 20M */
|
||||
#define B43_NPHY_RX_SIGCTL B43_PHY_N(0x204) /* RX signal control */
|
||||
#define B43_NPHY_RXPIL_CYCNT0 B43_PHY_N(0x205) /* RX pilot cycle counter 0 */
|
||||
#define B43_NPHY_RXPIL_CYCNT1 B43_PHY_N(0x206) /* RX pilot cycle counter 1 */
|
||||
#define B43_NPHY_RXPIL_CYCNT2 B43_PHY_N(0x207) /* RX pilot cycle counter 2 */
|
||||
#define B43_NPHY_AFESEQ_RX2TX_PUD_10M B43_PHY_N(0x208) /* AFE seq rx2tx power up/down delay 10M */
|
||||
#define B43_NPHY_AFESEQ_TX2RX_PUD_10M B43_PHY_N(0x209) /* AFE seq tx2rx power up/down delay 10M */
|
||||
#define B43_NPHY_DSSSCCK_CRSEXTL B43_PHY_N(0x20A) /* DSSS/CCK CRS extension length */
|
||||
#define B43_NPHY_ML_LOGSS_RATSLOPE B43_PHY_N(0x20B) /* ML/logss ratio slope */
|
||||
#define B43_NPHY_RIFS_SRCTL B43_PHY_N(0x20C) /* RIFS search timeout length */
|
||||
#define B43_NPHY_TXREALFD B43_PHY_N(0x20D) /* TX real frame delay */
|
||||
#define B43_NPHY_HPANT_SWTHRES B43_PHY_N(0x20E) /* High power antenna switch threshold */
|
||||
#define B43_NPHY_EDCRS_ASSTHRES0 B43_PHY_N(0x210) /* ED CRS assert threshold 0 */
|
||||
#define B43_NPHY_EDCRS_ASSTHRES1 B43_PHY_N(0x211) /* ED CRS assert threshold 1 */
|
||||
#define B43_NPHY_EDCRS_DEASSTHRES0 B43_PHY_N(0x212) /* ED CRS deassert threshold 0 */
|
||||
#define B43_NPHY_EDCRS_DEASSTHRES1 B43_PHY_N(0x213) /* ED CRS deassert threshold 1 */
|
||||
#define B43_NPHY_STR_WTIME20U B43_PHY_N(0x214) /* STR wait time 20U */
|
||||
#define B43_NPHY_STR_WTIME20L B43_PHY_N(0x215) /* STR wait time 20L */
|
||||
#define B43_NPHY_TONE_MIDX657M B43_PHY_N(0x216) /* Tone map index 657M */
|
||||
#define B43_NPHY_HTSIGTONES B43_PHY_N(0x217) /* HT signal tones */
|
||||
#define B43_NPHY_RSSI1 B43_PHY_N(0x219) /* RSSI value 1 */
|
||||
#define B43_NPHY_RSSI2 B43_PHY_N(0x21A) /* RSSI value 2 */
|
||||
#define B43_NPHY_CHAN_ESTHANG B43_PHY_N(0x21D) /* Channel estimate hang */
|
||||
#define B43_NPHY_FINERX2_CGC B43_PHY_N(0x221) /* Fine RX 2 clock gate control */
|
||||
#define B43_NPHY_FINERX2_CGC_DECGC 0x0008 /* Decode gated clocks */
|
||||
#define B43_NPHY_TXPCTL_INIT B43_PHY_N(0x222) /* TX power controll init */
|
||||
#define B43_NPHY_TXPCTL_INIT_PIDXI1 0x00FF /* Power index init 1 */
|
||||
#define B43_NPHY_TXPCTL_INIT_PIDXI1_SHIFT 0
|
||||
|
||||
|
||||
|
||||
/* Broadcom 2055 radio registers */
|
||||
|
||||
#define B2055_GEN_SPARE 0x00 /* GEN spare */
|
||||
#define B2055_SP_PINPD 0x02 /* SP PIN PD */
|
||||
#define B2055_C1_SP_RSSI 0x03 /* SP RSSI Core 1 */
|
||||
#define B2055_C1_SP_PDMISC 0x04 /* SP PD MISC Core 1 */
|
||||
#define B2055_C2_SP_RSSI 0x05 /* SP RSSI Core 2 */
|
||||
#define B2055_C2_SP_PDMISC 0x06 /* SP PD MISC Core 2 */
|
||||
#define B2055_C1_SP_RXGC1 0x07 /* SP RX GC1 Core 1 */
|
||||
#define B2055_C1_SP_RXGC2 0x08 /* SP RX GC2 Core 1 */
|
||||
#define B2055_C2_SP_RXGC1 0x09 /* SP RX GC1 Core 2 */
|
||||
#define B2055_C2_SP_RXGC2 0x0A /* SP RX GC2 Core 2 */
|
||||
#define B2055_C1_SP_LPFBWSEL 0x0B /* SP LPF BW select Core 1 */
|
||||
#define B2055_C2_SP_LPFBWSEL 0x0C /* SP LPF BW select Core 2 */
|
||||
#define B2055_C1_SP_TXGC1 0x0D /* SP TX GC1 Core 1 */
|
||||
#define B2055_C1_SP_TXGC2 0x0E /* SP TX GC2 Core 1 */
|
||||
#define B2055_C2_SP_TXGC1 0x0F /* SP TX GC1 Core 2 */
|
||||
#define B2055_C2_SP_TXGC2 0x10 /* SP TX GC2 Core 2 */
|
||||
#define B2055_MASTER1 0x11 /* Master control 1 */
|
||||
#define B2055_MASTER2 0x12 /* Master control 2 */
|
||||
#define B2055_PD_LGEN 0x13 /* PD LGEN */
|
||||
#define B2055_PD_PLLTS 0x14 /* PD PLL TS */
|
||||
#define B2055_C1_PD_LGBUF 0x15 /* PD Core 1 LGBUF */
|
||||
#define B2055_C1_PD_TX 0x16 /* PD Core 1 TX */
|
||||
#define B2055_C1_PD_RXTX 0x17 /* PD Core 1 RXTX */
|
||||
#define B2055_C1_PD_RSSIMISC 0x18 /* PD Core 1 RSSI MISC */
|
||||
#define B2055_C2_PD_LGBUF 0x19 /* PD Core 2 LGBUF */
|
||||
#define B2055_C2_PD_TX 0x1A /* PD Core 2 TX */
|
||||
#define B2055_C2_PD_RXTX 0x1B /* PD Core 2 RXTX */
|
||||
#define B2055_C2_PD_RSSIMISC 0x1C /* PD Core 2 RSSI MISC */
|
||||
#define B2055_PWRDET_LGEN 0x1D /* PWRDET LGEN */
|
||||
#define B2055_C1_PWRDET_LGBUF 0x1E /* PWRDET LGBUF Core 1 */
|
||||
#define B2055_C1_PWRDET_RXTX 0x1F /* PWRDET RXTX Core 1 */
|
||||
#define B2055_C2_PWRDET_LGBUF 0x20 /* PWRDET LGBUF Core 2 */
|
||||
#define B2055_C2_PWRDET_RXTX 0x21 /* PWRDET RXTX Core 2 */
|
||||
#define B2055_RRCCAL_CS 0x22 /* RRCCAL Control spare */
|
||||
#define B2055_RRCCAL_NOPTSEL 0x23 /* RRCCAL N OPT SEL */
|
||||
#define B2055_CAL_MISC 0x24 /* CAL MISC */
|
||||
#define B2055_CAL_COUT 0x25 /* CAL Counter out */
|
||||
#define B2055_CAL_COUT2 0x26 /* CAL Counter out 2 */
|
||||
#define B2055_CAL_CVARCTL 0x27 /* CAL CVAR Control */
|
||||
#define B2055_CAL_RVARCTL 0x28 /* CAL RVAR Control */
|
||||
#define B2055_CAL_LPOCTL 0x29 /* CAL LPO Control */
|
||||
#define B2055_CAL_TS 0x2A /* CAL TS */
|
||||
#define B2055_CAL_RCCALRTS 0x2B /* CAL RCCAL READ TS */
|
||||
#define B2055_CAL_RCALRTS 0x2C /* CAL RCAL READ TS */
|
||||
#define B2055_PADDRV 0x2D /* PAD driver */
|
||||
#define B2055_XOCTL1 0x2E /* XO Control 1 */
|
||||
#define B2055_XOCTL2 0x2F /* XO Control 2 */
|
||||
#define B2055_XOREGUL 0x30 /* XO Regulator */
|
||||
#define B2055_XOMISC 0x31 /* XO misc */
|
||||
#define B2055_PLL_LFC1 0x32 /* PLL LF C1 */
|
||||
#define B2055_PLL_CALVTH 0x33 /* PLL CAL VTH */
|
||||
#define B2055_PLL_LFC2 0x34 /* PLL LF C2 */
|
||||
#define B2055_PLL_REF 0x35 /* PLL reference */
|
||||
#define B2055_PLL_LFR1 0x36 /* PLL LF R1 */
|
||||
#define B2055_PLL_PFDCP 0x37 /* PLL PFD CP */
|
||||
#define B2055_PLL_IDAC_CPOPAMP 0x38 /* PLL IDAC CPOPAMP */
|
||||
#define B2055_PLL_CPREG 0x39 /* PLL CP Regulator */
|
||||
#define B2055_PLL_RCAL 0x3A /* PLL RCAL */
|
||||
#define B2055_RF_PLLMOD0 0x3B /* RF PLL MOD0 */
|
||||
#define B2055_RF_PLLMOD1 0x3C /* RF PLL MOD1 */
|
||||
#define B2055_RF_MMDIDAC1 0x3D /* RF MMD IDAC 1 */
|
||||
#define B2055_RF_MMDIDAC0 0x3E /* RF MMD IDAC 0 */
|
||||
#define B2055_RF_MMDSP 0x3F /* RF MMD spare */
|
||||
#define B2055_VCO_CAL1 0x40 /* VCO cal 1 */
|
||||
#define B2055_VCO_CAL2 0x41 /* VCO cal 2 */
|
||||
#define B2055_VCO_CAL3 0x42 /* VCO cal 3 */
|
||||
#define B2055_VCO_CAL4 0x43 /* VCO cal 4 */
|
||||
#define B2055_VCO_CAL5 0x44 /* VCO cal 5 */
|
||||
#define B2055_VCO_CAL6 0x45 /* VCO cal 6 */
|
||||
#define B2055_VCO_CAL7 0x46 /* VCO cal 7 */
|
||||
#define B2055_VCO_CAL8 0x47 /* VCO cal 8 */
|
||||
#define B2055_VCO_CAL9 0x48 /* VCO cal 9 */
|
||||
#define B2055_VCO_CAL10 0x49 /* VCO cal 10 */
|
||||
#define B2055_VCO_CAL11 0x4A /* VCO cal 11 */
|
||||
#define B2055_VCO_CAL12 0x4B /* VCO cal 12 */
|
||||
#define B2055_VCO_CAL13 0x4C /* VCO cal 13 */
|
||||
#define B2055_VCO_CAL14 0x4D /* VCO cal 14 */
|
||||
#define B2055_VCO_CAL15 0x4E /* VCO cal 15 */
|
||||
#define B2055_VCO_CAL16 0x4F /* VCO cal 16 */
|
||||
#define B2055_VCO_KVCO 0x50 /* VCO KVCO */
|
||||
#define B2055_VCO_CAPTAIL 0x51 /* VCO CAP TAIL */
|
||||
#define B2055_VCO_IDACVCO 0x52 /* VCO IDAC VCO */
|
||||
#define B2055_VCO_REG 0x53 /* VCO Regulator */
|
||||
#define B2055_PLL_RFVTH 0x54 /* PLL RF VTH */
|
||||
#define B2055_LGBUF_CENBUF 0x55 /* LGBUF CEN BUF */
|
||||
#define B2055_LGEN_TUNE1 0x56 /* LGEN tune 1 */
|
||||
#define B2055_LGEN_TUNE2 0x57 /* LGEN tune 2 */
|
||||
#define B2055_LGEN_IDAC1 0x58 /* LGEN IDAC 1 */
|
||||
#define B2055_LGEN_IDAC2 0x59 /* LGEN IDAC 2 */
|
||||
#define B2055_LGEN_BIASC 0x5A /* LGEN BIAS counter */
|
||||
#define B2055_LGEN_BIASIDAC 0x5B /* LGEN BIAS IDAC */
|
||||
#define B2055_LGEN_RCAL 0x5C /* LGEN RCAL */
|
||||
#define B2055_LGEN_DIV 0x5D /* LGEN div */
|
||||
#define B2055_LGEN_SPARE2 0x5E /* LGEN spare 2 */
|
||||
#define B2055_C1_LGBUF_ATUNE 0x5F /* Core 1 LGBUF A tune */
|
||||
#define B2055_C1_LGBUF_GTUNE 0x60 /* Core 1 LGBUF G tune */
|
||||
#define B2055_C1_LGBUF_DIV 0x61 /* Core 1 LGBUF div */
|
||||
#define B2055_C1_LGBUF_AIDAC 0x62 /* Core 1 LGBUF A IDAC */
|
||||
#define B2055_C1_LGBUF_GIDAC 0x63 /* Core 1 LGBUF G IDAC */
|
||||
#define B2055_C1_LGBUF_IDACFO 0x64 /* Core 1 LGBUF IDAC filter override */
|
||||
#define B2055_C1_LGBUF_SPARE 0x65 /* Core 1 LGBUF spare */
|
||||
#define B2055_C1_RX_RFSPC1 0x66 /* Core 1 RX RF SPC1 */
|
||||
#define B2055_C1_RX_RFR1 0x67 /* Core 1 RX RF reg 1 */
|
||||
#define B2055_C1_RX_RFR2 0x68 /* Core 1 RX RF reg 2 */
|
||||
#define B2055_C1_RX_RFRCAL 0x69 /* Core 1 RX RF RCAL */
|
||||
#define B2055_C1_RX_BB_BLCMP 0x6A /* Core 1 RX Baseband BUFI LPF CMP */
|
||||
#define B2055_C1_RX_BB_LPF 0x6B /* Core 1 RX Baseband LPF */
|
||||
#define B2055_C1_RX_BB_MIDACHP 0x6C /* Core 1 RX Baseband MIDAC High-pass */
|
||||
#define B2055_C1_RX_BB_VGA1IDAC 0x6D /* Core 1 RX Baseband VGA1 IDAC */
|
||||
#define B2055_C1_RX_BB_VGA2IDAC 0x6E /* Core 1 RX Baseband VGA2 IDAC */
|
||||
#define B2055_C1_RX_BB_VGA3IDAC 0x6F /* Core 1 RX Baseband VGA3 IDAC */
|
||||
#define B2055_C1_RX_BB_BUFOCTL 0x70 /* Core 1 RX Baseband BUFO Control */
|
||||
#define B2055_C1_RX_BB_RCCALCTL 0x71 /* Core 1 RX Baseband RCCAL Control */
|
||||
#define B2055_C1_RX_BB_RSSICTL1 0x72 /* Core 1 RX Baseband RSSI Control 1 */
|
||||
#define B2055_C1_RX_BB_RSSICTL2 0x73 /* Core 1 RX Baseband RSSI Control 2 */
|
||||
#define B2055_C1_RX_BB_RSSICTL3 0x74 /* Core 1 RX Baseband RSSI Control 3 */
|
||||
#define B2055_C1_RX_BB_RSSICTL4 0x75 /* Core 1 RX Baseband RSSI Control 4 */
|
||||
#define B2055_C1_RX_BB_RSSICTL5 0x76 /* Core 1 RX Baseband RSSI Control 5 */
|
||||
#define B2055_C1_RX_BB_REG 0x77 /* Core 1 RX Baseband Regulator */
|
||||
#define B2055_C1_RX_BB_SPARE1 0x78 /* Core 1 RX Baseband spare 1 */
|
||||
#define B2055_C1_RX_TXBBRCAL 0x79 /* Core 1 RX TX BB RCAL */
|
||||
#define B2055_C1_TX_RF_SPGA 0x7A /* Core 1 TX RF SGM PGA */
|
||||
#define B2055_C1_TX_RF_SPAD 0x7B /* Core 1 TX RF SGM PAD */
|
||||
#define B2055_C1_TX_RF_CNTPGA1 0x7C /* Core 1 TX RF counter PGA 1 */
|
||||
#define B2055_C1_TX_RF_CNTPAD1 0x7D /* Core 1 TX RF counter PAD 1 */
|
||||
#define B2055_C1_TX_RF_PGAIDAC 0x7E /* Core 1 TX RF PGA IDAC */
|
||||
#define B2055_C1_TX_PGAPADTN 0x7F /* Core 1 TX PGA PAD TN */
|
||||
#define B2055_C1_TX_PADIDAC1 0x80 /* Core 1 TX PAD IDAC 1 */
|
||||
#define B2055_C1_TX_PADIDAC2 0x81 /* Core 1 TX PAD IDAC 2 */
|
||||
#define B2055_C1_TX_MXBGTRIM 0x82 /* Core 1 TX MX B/G TRIM */
|
||||
#define B2055_C1_TX_RF_RCAL 0x83 /* Core 1 TX RF RCAL */
|
||||
#define B2055_C1_TX_RF_PADTSSI1 0x84 /* Core 1 TX RF PAD TSSI1 */
|
||||
#define B2055_C1_TX_RF_PADTSSI2 0x85 /* Core 1 TX RF PAD TSSI2 */
|
||||
#define B2055_C1_TX_RF_SPARE 0x86 /* Core 1 TX RF spare */
|
||||
#define B2055_C1_TX_RF_IQCAL1 0x87 /* Core 1 TX RF I/Q CAL 1 */
|
||||
#define B2055_C1_TX_RF_IQCAL2 0x88 /* Core 1 TX RF I/Q CAL 2 */
|
||||
#define B2055_C1_TXBB_RCCAL 0x89 /* Core 1 TXBB RC CAL Control */
|
||||
#define B2055_C1_TXBB_LPF1 0x8A /* Core 1 TXBB LPF 1 */
|
||||
#define B2055_C1_TX_VOSCNCL 0x8B /* Core 1 TX VOS CNCL */
|
||||
#define B2055_C1_TX_LPF_MXGMIDAC 0x8C /* Core 1 TX LPF MXGM IDAC */
|
||||
#define B2055_C1_TX_BB_MXGM 0x8D /* Core 1 TX BB MXGM */
|
||||
#define B2055_C2_LGBUF_ATUNE 0x8E /* Core 2 LGBUF A tune */
|
||||
#define B2055_C2_LGBUF_GTUNE 0x8F /* Core 2 LGBUF G tune */
|
||||
#define B2055_C2_LGBUF_DIV 0x90 /* Core 2 LGBUF div */
|
||||
#define B2055_C2_LGBUF_AIDAC 0x91 /* Core 2 LGBUF A IDAC */
|
||||
#define B2055_C2_LGBUF_GIDAC 0x92 /* Core 2 LGBUF G IDAC */
|
||||
#define B2055_C2_LGBUF_IDACFO 0x93 /* Core 2 LGBUF IDAC filter override */
|
||||
#define B2055_C2_LGBUF_SPARE 0x94 /* Core 2 LGBUF spare */
|
||||
#define B2055_C2_RX_RFSPC1 0x95 /* Core 2 RX RF SPC1 */
|
||||
#define B2055_C2_RX_RFR1 0x96 /* Core 2 RX RF reg 1 */
|
||||
#define B2055_C2_RX_RFR2 0x97 /* Core 2 RX RF reg 2 */
|
||||
#define B2055_C2_RX_RFRCAL 0x98 /* Core 2 RX RF RCAL */
|
||||
#define B2055_C2_RX_BB_BLCMP 0x99 /* Core 2 RX Baseband BUFI LPF CMP */
|
||||
#define B2055_C2_RX_BB_LPF 0x9A /* Core 2 RX Baseband LPF */
|
||||
#define B2055_C2_RX_BB_MIDACHP 0x9B /* Core 2 RX Baseband MIDAC High-pass */
|
||||
#define B2055_C2_RX_BB_VGA1IDAC 0x9C /* Core 2 RX Baseband VGA1 IDAC */
|
||||
#define B2055_C2_RX_BB_VGA2IDAC 0x9D /* Core 2 RX Baseband VGA2 IDAC */
|
||||
#define B2055_C2_RX_BB_VGA3IDAC 0x9E /* Core 2 RX Baseband VGA3 IDAC */
|
||||
#define B2055_C2_RX_BB_BUFOCTL 0x9F /* Core 2 RX Baseband BUFO Control */
|
||||
#define B2055_C2_RX_BB_RCCALCTL 0xA0 /* Core 2 RX Baseband RCCAL Control */
|
||||
#define B2055_C2_RX_BB_RSSICTL1 0xA1 /* Core 2 RX Baseband RSSI Control 1 */
|
||||
#define B2055_C2_RX_BB_RSSICTL2 0xA2 /* Core 2 RX Baseband RSSI Control 2 */
|
||||
#define B2055_C2_RX_BB_RSSICTL3 0xA3 /* Core 2 RX Baseband RSSI Control 3 */
|
||||
#define B2055_C2_RX_BB_RSSICTL4 0xA4 /* Core 2 RX Baseband RSSI Control 4 */
|
||||
#define B2055_C2_RX_BB_RSSICTL5 0xA5 /* Core 2 RX Baseband RSSI Control 5 */
|
||||
#define B2055_C2_RX_BB_REG 0xA6 /* Core 2 RX Baseband Regulator */
|
||||
#define B2055_C2_RX_BB_SPARE1 0xA7 /* Core 2 RX Baseband spare 1 */
|
||||
#define B2055_C2_RX_TXBBRCAL 0xA8 /* Core 2 RX TX BB RCAL */
|
||||
#define B2055_C2_TX_RF_SPGA 0xA9 /* Core 2 TX RF SGM PGA */
|
||||
#define B2055_C2_TX_RF_SPAD 0xAA /* Core 2 TX RF SGM PAD */
|
||||
#define B2055_C2_TX_RF_CNTPGA1 0xAB /* Core 2 TX RF counter PGA 1 */
|
||||
#define B2055_C2_TX_RF_CNTPAD1 0xAC /* Core 2 TX RF counter PAD 1 */
|
||||
#define B2055_C2_TX_RF_PGAIDAC 0xAD /* Core 2 TX RF PGA IDAC */
|
||||
#define B2055_C2_TX_PGAPADTN 0xAE /* Core 2 TX PGA PAD TN */
|
||||
#define B2055_C2_TX_PADIDAC1 0xAF /* Core 2 TX PAD IDAC 1 */
|
||||
#define B2055_C2_TX_PADIDAC2 0xB0 /* Core 2 TX PAD IDAC 2 */
|
||||
#define B2055_C2_TX_MXBGTRIM 0xB1 /* Core 2 TX MX B/G TRIM */
|
||||
#define B2055_C2_TX_RF_RCAL 0xB2 /* Core 2 TX RF RCAL */
|
||||
#define B2055_C2_TX_RF_PADTSSI1 0xB3 /* Core 2 TX RF PAD TSSI1 */
|
||||
#define B2055_C2_TX_RF_PADTSSI2 0xB4 /* Core 2 TX RF PAD TSSI2 */
|
||||
#define B2055_C2_TX_RF_SPARE 0xB5 /* Core 2 TX RF spare */
|
||||
#define B2055_C2_TX_RF_IQCAL1 0xB6 /* Core 2 TX RF I/Q CAL 1 */
|
||||
#define B2055_C2_TX_RF_IQCAL2 0xB7 /* Core 2 TX RF I/Q CAL 2 */
|
||||
#define B2055_C2_TXBB_RCCAL 0xB8 /* Core 2 TXBB RC CAL Control */
|
||||
#define B2055_C2_TXBB_LPF1 0xB9 /* Core 2 TXBB LPF 1 */
|
||||
#define B2055_C2_TX_VOSCNCL 0xBA /* Core 2 TX VOS CNCL */
|
||||
#define B2055_C2_TX_LPF_MXGMIDAC 0xBB /* Core 2 TX LPF MXGM IDAC */
|
||||
#define B2055_C2_TX_BB_MXGM 0xBC /* Core 2 TX BB MXGM */
|
||||
#define B2055_PRG_GCHP21 0xBD /* PRG GC HPVGA23 21 */
|
||||
#define B2055_PRG_GCHP22 0xBE /* PRG GC HPVGA23 22 */
|
||||
#define B2055_PRG_GCHP23 0xBF /* PRG GC HPVGA23 23 */
|
||||
#define B2055_PRG_GCHP24 0xC0 /* PRG GC HPVGA23 24 */
|
||||
#define B2055_PRG_GCHP25 0xC1 /* PRG GC HPVGA23 25 */
|
||||
#define B2055_PRG_GCHP26 0xC2 /* PRG GC HPVGA23 26 */
|
||||
#define B2055_PRG_GCHP27 0xC3 /* PRG GC HPVGA23 27 */
|
||||
#define B2055_PRG_GCHP28 0xC4 /* PRG GC HPVGA23 28 */
|
||||
#define B2055_PRG_GCHP29 0xC5 /* PRG GC HPVGA23 29 */
|
||||
#define B2055_PRG_GCHP30 0xC6 /* PRG GC HPVGA23 30 */
|
||||
#define B2055_C1_LNA_GAINBST 0xCD /* Core 1 LNA GAINBST */
|
||||
#define B2055_C1_B0NB_RSSIVCM 0xD2 /* Core 1 B0 narrow-band RSSI VCM */
|
||||
#define B2055_C1_GENSPARE2 0xD6 /* Core 1 GEN spare 2 */
|
||||
#define B2055_C2_LNA_GAINBST 0xD9 /* Core 2 LNA GAINBST */
|
||||
#define B2055_C2_B0NB_RSSIVCM 0xDE /* Core 2 B0 narrow-band RSSI VCM */
|
||||
#define B2055_C2_GENSPARE2 0xE2 /* Core 2 GEN spare 2 */
|
||||
|
||||
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
|
||||
#ifdef CONFIG_B43_NPHY
|
||||
/* N-PHY support enabled */
|
||||
|
||||
int b43_phy_initn(struct b43_wldev *dev);
|
||||
|
||||
void b43_nphy_radio_turn_on(struct b43_wldev *dev);
|
||||
void b43_nphy_radio_turn_off(struct b43_wldev *dev);
|
||||
|
||||
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel);
|
||||
|
||||
void b43_nphy_xmitpower(struct b43_wldev *dev);
|
||||
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna);
|
||||
|
||||
|
||||
#else /* CONFIG_B43_NPHY */
|
||||
/* N-PHY support disabled */
|
||||
|
||||
|
||||
static inline
|
||||
int b43_phy_initn(struct b43_wldev *dev)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline
|
||||
void b43_nphy_radio_turn_on(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline
|
||||
void b43_nphy_radio_turn_off(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline
|
||||
void b43_nphy_xmitpower(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline
|
||||
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_NPHY */
|
||||
#endif /* B43_NPHY_H_ */
|
@ -1,178 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
Copyright (c) 2007 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "pcmcia.h"
|
||||
|
||||
#include <linux/ssb/ssb.h>
|
||||
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/cs.h>
|
||||
#include <pcmcia/cistpl.h>
|
||||
#include <pcmcia/ciscode.h>
|
||||
#include <pcmcia/ds.h>
|
||||
#include <pcmcia/cisreg.h>
|
||||
|
||||
|
||||
static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = {
|
||||
PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
|
||||
PCMCIA_DEVICE_NULL,
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pcmcia, b43_pcmcia_tbl);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int b43_pcmcia_suspend(struct pcmcia_device *dev)
|
||||
{
|
||||
struct ssb_bus *ssb = dev->priv;
|
||||
|
||||
return ssb_bus_suspend(ssb);
|
||||
}
|
||||
|
||||
static int b43_pcmcia_resume(struct pcmcia_device *dev)
|
||||
{
|
||||
struct ssb_bus *ssb = dev->priv;
|
||||
|
||||
return ssb_bus_resume(ssb);
|
||||
}
|
||||
#else /* CONFIG_PM */
|
||||
# define b43_pcmcia_suspend NULL
|
||||
# define b43_pcmcia_resume NULL
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
|
||||
{
|
||||
struct ssb_bus *ssb;
|
||||
win_req_t win;
|
||||
memreq_t mem;
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
int err = -ENOMEM;
|
||||
int res = 0;
|
||||
unsigned char buf[64];
|
||||
|
||||
ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
|
||||
if (!ssb)
|
||||
goto out_error;
|
||||
|
||||
err = -ENODEV;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
|
||||
res = pcmcia_get_first_tuple(dev, &tuple);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_kfree_ssb;
|
||||
res = pcmcia_get_tuple_data(dev, &tuple);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_kfree_ssb;
|
||||
res = pcmcia_parse_tuple(dev, &tuple, &parse);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_kfree_ssb;
|
||||
|
||||
dev->conf.ConfigBase = parse.config.base;
|
||||
dev->conf.Present = parse.config.rmask[0];
|
||||
dev->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
dev->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
dev->io.BasePort2 = 0;
|
||||
dev->io.NumPorts2 = 0;
|
||||
dev->io.Attributes2 = 0;
|
||||
|
||||
win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM |
|
||||
WIN_ENABLE | WIN_DATA_WIDTH_16 |
|
||||
WIN_USE_WAIT;
|
||||
win.Base = 0;
|
||||
win.Size = SSB_CORE_SIZE;
|
||||
win.AccessSpeed = 250;
|
||||
res = pcmcia_request_window(&dev, &win, &dev->win);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_kfree_ssb;
|
||||
|
||||
mem.CardOffset = 0;
|
||||
mem.Page = 0;
|
||||
res = pcmcia_map_mem_page(dev->win, &mem);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_disable;
|
||||
|
||||
dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
|
||||
dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
dev->irq.Handler = NULL; /* The handler is registered later. */
|
||||
dev->irq.Instance = NULL;
|
||||
res = pcmcia_request_irq(dev, &dev->irq);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_disable;
|
||||
|
||||
res = pcmcia_request_configuration(dev, &dev->conf);
|
||||
if (res != CS_SUCCESS)
|
||||
goto err_disable;
|
||||
|
||||
err = ssb_bus_pcmciabus_register(ssb, dev, win.Base);
|
||||
if (err)
|
||||
goto err_disable;
|
||||
dev->priv = ssb;
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable:
|
||||
pcmcia_disable_device(dev);
|
||||
err_kfree_ssb:
|
||||
kfree(ssb);
|
||||
out_error:
|
||||
printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n",
|
||||
res, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev)
|
||||
{
|
||||
struct ssb_bus *ssb = dev->priv;
|
||||
|
||||
ssb_bus_unregister(ssb);
|
||||
pcmcia_disable_device(dev);
|
||||
kfree(ssb);
|
||||
dev->priv = NULL;
|
||||
}
|
||||
|
||||
static struct pcmcia_driver b43_pcmcia_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.drv = {
|
||||
.name = "b43-pcmcia",
|
||||
},
|
||||
.id_table = b43_pcmcia_tbl,
|
||||
.probe = b43_pcmcia_probe,
|
||||
.remove = __devexit_p(b43_pcmcia_remove),
|
||||
.suspend = b43_pcmcia_suspend,
|
||||
.resume = b43_pcmcia_resume,
|
||||
};
|
||||
|
||||
int b43_pcmcia_init(void)
|
||||
{
|
||||
return pcmcia_register_driver(&b43_pcmcia_driver);
|
||||
}
|
||||
|
||||
void b43_pcmcia_exit(void)
|
||||
{
|
||||
pcmcia_unregister_driver(&b43_pcmcia_driver);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#ifndef B43_PCMCIA_H_
|
||||
#define B43_PCMCIA_H_
|
||||
|
||||
#ifdef CONFIG_B43_PCMCIA
|
||||
|
||||
int b43_pcmcia_init(void);
|
||||
void b43_pcmcia_exit(void);
|
||||
|
||||
#else /* CONFIG_B43_PCMCIA */
|
||||
|
||||
static inline int b43_pcmcia_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void b43_pcmcia_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_PCMCIA */
|
||||
#endif /* B43_PCMCIA_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,340 +0,0 @@
|
||||
#ifndef B43_PHY_H_
|
||||
#define B43_PHY_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct b43_wldev;
|
||||
struct b43_phy;
|
||||
|
||||
/*** PHY Registers ***/
|
||||
|
||||
/* Routing */
|
||||
#define B43_PHYROUTE 0x0C00 /* PHY register routing bits mask */
|
||||
#define B43_PHYROUTE_BASE 0x0000 /* Base registers */
|
||||
#define B43_PHYROUTE_OFDM_GPHY 0x0400 /* OFDM register routing for G-PHYs */
|
||||
#define B43_PHYROUTE_EXT_GPHY 0x0800 /* Extended G-PHY registers */
|
||||
#define B43_PHYROUTE_N_BMODE 0x0C00 /* N-PHY BMODE registers */
|
||||
|
||||
/* CCK (B-PHY) registers. */
|
||||
#define B43_PHY_CCK(reg) ((reg) | B43_PHYROUTE_BASE)
|
||||
/* N-PHY registers. */
|
||||
#define B43_PHY_N(reg) ((reg) | B43_PHYROUTE_BASE)
|
||||
/* N-PHY BMODE registers. */
|
||||
#define B43_PHY_N_BMODE(reg) ((reg) | B43_PHYROUTE_N_BMODE)
|
||||
/* OFDM (A-PHY) registers. */
|
||||
#define B43_PHY_OFDM(reg) ((reg) | B43_PHYROUTE_OFDM_GPHY)
|
||||
/* Extended G-PHY registers. */
|
||||
#define B43_PHY_EXTG(reg) ((reg) | B43_PHYROUTE_EXT_GPHY)
|
||||
|
||||
/* OFDM (A) PHY Registers */
|
||||
#define B43_PHY_VERSION_OFDM B43_PHY_OFDM(0x00) /* Versioning register for A-PHY */
|
||||
#define B43_PHY_BBANDCFG B43_PHY_OFDM(0x01) /* Baseband config */
|
||||
#define B43_PHY_BBANDCFG_RXANT 0x180 /* RX Antenna selection */
|
||||
#define B43_PHY_BBANDCFG_RXANT_SHIFT 7
|
||||
#define B43_PHY_PWRDOWN B43_PHY_OFDM(0x03) /* Powerdown */
|
||||
#define B43_PHY_CRSTHRES1_R1 B43_PHY_OFDM(0x06) /* CRS Threshold 1 (phy.rev 1 only) */
|
||||
#define B43_PHY_LNAHPFCTL B43_PHY_OFDM(0x1C) /* LNA/HPF control */
|
||||
#define B43_PHY_LPFGAINCTL B43_PHY_OFDM(0x20) /* LPF Gain control */
|
||||
#define B43_PHY_ADIVRELATED B43_PHY_OFDM(0x27) /* FIXME rename */
|
||||
#define B43_PHY_CRS0 B43_PHY_OFDM(0x29)
|
||||
#define B43_PHY_CRS0_EN 0x4000
|
||||
#define B43_PHY_PEAK_COUNT B43_PHY_OFDM(0x30)
|
||||
#define B43_PHY_ANTDWELL B43_PHY_OFDM(0x2B) /* Antenna dwell */
|
||||
#define B43_PHY_ANTDWELL_AUTODIV1 0x0100 /* Automatic RX diversity start antenna */
|
||||
#define B43_PHY_ENCORE B43_PHY_OFDM(0x49) /* "Encore" (RangeMax / BroadRange) */
|
||||
#define B43_PHY_ENCORE_EN 0x0200 /* Encore enable */
|
||||
#define B43_PHY_LMS B43_PHY_OFDM(0x55)
|
||||
#define B43_PHY_OFDM61 B43_PHY_OFDM(0x61) /* FIXME rename */
|
||||
#define B43_PHY_OFDM61_10 0x0010 /* FIXME rename */
|
||||
#define B43_PHY_IQBAL B43_PHY_OFDM(0x69) /* I/Q balance */
|
||||
#define B43_PHY_BBTXDC_BIAS B43_PHY_OFDM(0x6B) /* Baseband TX DC bias */
|
||||
#define B43_PHY_OTABLECTL B43_PHY_OFDM(0x72) /* OFDM table control (see below) */
|
||||
#define B43_PHY_OTABLEOFF 0x03FF /* OFDM table offset (see below) */
|
||||
#define B43_PHY_OTABLENR 0xFC00 /* OFDM table number (see below) */
|
||||
#define B43_PHY_OTABLENR_SHIFT 10
|
||||
#define B43_PHY_OTABLEI B43_PHY_OFDM(0x73) /* OFDM table data I */
|
||||
#define B43_PHY_OTABLEQ B43_PHY_OFDM(0x74) /* OFDM table data Q */
|
||||
#define B43_PHY_HPWR_TSSICTL B43_PHY_OFDM(0x78) /* Hardware power TSSI control */
|
||||
#define B43_PHY_ADCCTL B43_PHY_OFDM(0x7A) /* ADC control */
|
||||
#define B43_PHY_IDLE_TSSI B43_PHY_OFDM(0x7B)
|
||||
#define B43_PHY_A_TEMP_SENSE B43_PHY_OFDM(0x7C) /* A PHY temperature sense */
|
||||
#define B43_PHY_NRSSITHRES B43_PHY_OFDM(0x8A) /* NRSSI threshold */
|
||||
#define B43_PHY_ANTWRSETT B43_PHY_OFDM(0x8C) /* Antenna WR settle */
|
||||
#define B43_PHY_ANTWRSETT_ARXDIV 0x2000 /* Automatic RX diversity enabled */
|
||||
#define B43_PHY_CLIPPWRDOWNT B43_PHY_OFDM(0x93) /* Clip powerdown threshold */
|
||||
#define B43_PHY_OFDM9B B43_PHY_OFDM(0x9B) /* FIXME rename */
|
||||
#define B43_PHY_N1P1GAIN B43_PHY_OFDM(0xA0)
|
||||
#define B43_PHY_P1P2GAIN B43_PHY_OFDM(0xA1)
|
||||
#define B43_PHY_N1N2GAIN B43_PHY_OFDM(0xA2)
|
||||
#define B43_PHY_CLIPTHRES B43_PHY_OFDM(0xA3)
|
||||
#define B43_PHY_CLIPN1P2THRES B43_PHY_OFDM(0xA4)
|
||||
#define B43_PHY_CCKSHIFTBITS_WA B43_PHY_OFDM(0xA5) /* CCK shiftbits workaround, FIXME rename */
|
||||
#define B43_PHY_CCKSHIFTBITS B43_PHY_OFDM(0xA7) /* FIXME rename */
|
||||
#define B43_PHY_DIVSRCHIDX B43_PHY_OFDM(0xA8) /* Divider search gain/index */
|
||||
#define B43_PHY_CLIPP2THRES B43_PHY_OFDM(0xA9)
|
||||
#define B43_PHY_CLIPP3THRES B43_PHY_OFDM(0xAA)
|
||||
#define B43_PHY_DIVP1P2GAIN B43_PHY_OFDM(0xAB)
|
||||
#define B43_PHY_DIVSRCHGAINBACK B43_PHY_OFDM(0xAD) /* Divider search gain back */
|
||||
#define B43_PHY_DIVSRCHGAINCHNG B43_PHY_OFDM(0xAE) /* Divider search gain change */
|
||||
#define B43_PHY_CRSTHRES1 B43_PHY_OFDM(0xC0) /* CRS Threshold 1 (phy.rev >= 2 only) */
|
||||
#define B43_PHY_CRSTHRES2 B43_PHY_OFDM(0xC1) /* CRS Threshold 2 (phy.rev >= 2 only) */
|
||||
#define B43_PHY_TSSIP_LTBASE B43_PHY_OFDM(0x380) /* TSSI power lookup table base */
|
||||
#define B43_PHY_DC_LTBASE B43_PHY_OFDM(0x3A0) /* DC lookup table base */
|
||||
#define B43_PHY_GAIN_LTBASE B43_PHY_OFDM(0x3C0) /* Gain lookup table base */
|
||||
|
||||
/* CCK (B) PHY Registers */
|
||||
#define B43_PHY_VERSION_CCK B43_PHY_CCK(0x00) /* Versioning register for B-PHY */
|
||||
#define B43_PHY_CCKBBANDCFG B43_PHY_CCK(0x01) /* Contains antenna 0/1 control bit */
|
||||
#define B43_PHY_PGACTL B43_PHY_CCK(0x15) /* PGA control */
|
||||
#define B43_PHY_PGACTL_LPF 0x1000 /* Low pass filter (?) */
|
||||
#define B43_PHY_PGACTL_LOWBANDW 0x0040 /* Low bandwidth flag */
|
||||
#define B43_PHY_PGACTL_UNKNOWN 0xEFA0
|
||||
#define B43_PHY_FBCTL1 B43_PHY_CCK(0x18) /* Frequency bandwidth control 1 */
|
||||
#define B43_PHY_ITSSI B43_PHY_CCK(0x29) /* Idle TSSI */
|
||||
#define B43_PHY_LO_LEAKAGE B43_PHY_CCK(0x2D) /* Measured LO leakage */
|
||||
#define B43_PHY_ENERGY B43_PHY_CCK(0x33) /* Energy */
|
||||
#define B43_PHY_SYNCCTL B43_PHY_CCK(0x35)
|
||||
#define B43_PHY_FBCTL2 B43_PHY_CCK(0x38) /* Frequency bandwidth control 2 */
|
||||
#define B43_PHY_DACCTL B43_PHY_CCK(0x60) /* DAC control */
|
||||
#define B43_PHY_RCCALOVER B43_PHY_CCK(0x78) /* RC calibration override */
|
||||
|
||||
/* Extended G-PHY Registers */
|
||||
#define B43_PHY_CLASSCTL B43_PHY_EXTG(0x02) /* Classify control */
|
||||
#define B43_PHY_GTABCTL B43_PHY_EXTG(0x03) /* G-PHY table control (see below) */
|
||||
#define B43_PHY_GTABOFF 0x03FF /* G-PHY table offset (see below) */
|
||||
#define B43_PHY_GTABNR 0xFC00 /* G-PHY table number (see below) */
|
||||
#define B43_PHY_GTABNR_SHIFT 10
|
||||
#define B43_PHY_GTABDATA B43_PHY_EXTG(0x04) /* G-PHY table data */
|
||||
#define B43_PHY_LO_MASK B43_PHY_EXTG(0x0F) /* Local Oscillator control mask */
|
||||
#define B43_PHY_LO_CTL B43_PHY_EXTG(0x10) /* Local Oscillator control */
|
||||
#define B43_PHY_RFOVER B43_PHY_EXTG(0x11) /* RF override */
|
||||
#define B43_PHY_RFOVERVAL B43_PHY_EXTG(0x12) /* RF override value */
|
||||
#define B43_PHY_RFOVERVAL_EXTLNA 0x8000
|
||||
#define B43_PHY_RFOVERVAL_LNA 0x7000
|
||||
#define B43_PHY_RFOVERVAL_LNA_SHIFT 12
|
||||
#define B43_PHY_RFOVERVAL_PGA 0x0F00
|
||||
#define B43_PHY_RFOVERVAL_PGA_SHIFT 8
|
||||
#define B43_PHY_RFOVERVAL_UNK 0x0010 /* Unknown, always set. */
|
||||
#define B43_PHY_RFOVERVAL_TRSWRX 0x00E0
|
||||
#define B43_PHY_RFOVERVAL_BW 0x0003 /* Bandwidth flags */
|
||||
#define B43_PHY_RFOVERVAL_BW_LPF 0x0001 /* Low Pass Filter */
|
||||
#define B43_PHY_RFOVERVAL_BW_LBW 0x0002 /* Low Bandwidth (when set), high when unset */
|
||||
#define B43_PHY_ANALOGOVER B43_PHY_EXTG(0x14) /* Analog override */
|
||||
#define B43_PHY_ANALOGOVERVAL B43_PHY_EXTG(0x15) /* Analog override value */
|
||||
|
||||
/*** OFDM table numbers ***/
|
||||
#define B43_OFDMTAB(number, offset) (((number) << B43_PHY_OTABLENR_SHIFT) | (offset))
|
||||
#define B43_OFDMTAB_AGC1 B43_OFDMTAB(0x00, 0)
|
||||
#define B43_OFDMTAB_GAIN0 B43_OFDMTAB(0x00, 0)
|
||||
#define B43_OFDMTAB_GAINX B43_OFDMTAB(0x01, 0) //TODO rename
|
||||
#define B43_OFDMTAB_GAIN1 B43_OFDMTAB(0x01, 4)
|
||||
#define B43_OFDMTAB_AGC3 B43_OFDMTAB(0x02, 0)
|
||||
#define B43_OFDMTAB_GAIN2 B43_OFDMTAB(0x02, 3)
|
||||
#define B43_OFDMTAB_LNAHPFGAIN1 B43_OFDMTAB(0x03, 0)
|
||||
#define B43_OFDMTAB_WRSSI B43_OFDMTAB(0x04, 0)
|
||||
#define B43_OFDMTAB_LNAHPFGAIN2 B43_OFDMTAB(0x04, 0)
|
||||
#define B43_OFDMTAB_NOISESCALE B43_OFDMTAB(0x05, 0)
|
||||
#define B43_OFDMTAB_AGC2 B43_OFDMTAB(0x06, 0)
|
||||
#define B43_OFDMTAB_ROTOR B43_OFDMTAB(0x08, 0)
|
||||
#define B43_OFDMTAB_ADVRETARD B43_OFDMTAB(0x09, 0)
|
||||
#define B43_OFDMTAB_DAC B43_OFDMTAB(0x0C, 0)
|
||||
#define B43_OFDMTAB_DC B43_OFDMTAB(0x0E, 7)
|
||||
#define B43_OFDMTAB_PWRDYN2 B43_OFDMTAB(0x0E, 12)
|
||||
#define B43_OFDMTAB_LNAGAIN B43_OFDMTAB(0x0E, 13)
|
||||
#define B43_OFDMTAB_UNKNOWN_0F B43_OFDMTAB(0x0F, 0) //TODO rename
|
||||
#define B43_OFDMTAB_UNKNOWN_APHY B43_OFDMTAB(0x0F, 7) //TODO rename
|
||||
#define B43_OFDMTAB_LPFGAIN B43_OFDMTAB(0x0F, 12)
|
||||
#define B43_OFDMTAB_RSSI B43_OFDMTAB(0x10, 0)
|
||||
#define B43_OFDMTAB_UNKNOWN_11 B43_OFDMTAB(0x11, 4) //TODO rename
|
||||
#define B43_OFDMTAB_AGC1_R1 B43_OFDMTAB(0x13, 0)
|
||||
#define B43_OFDMTAB_GAINX_R1 B43_OFDMTAB(0x14, 0) //TODO remove!
|
||||
#define B43_OFDMTAB_MINSIGSQ B43_OFDMTAB(0x14, 0)
|
||||
#define B43_OFDMTAB_AGC3_R1 B43_OFDMTAB(0x15, 0)
|
||||
#define B43_OFDMTAB_WRSSI_R1 B43_OFDMTAB(0x15, 4)
|
||||
#define B43_OFDMTAB_TSSI B43_OFDMTAB(0x15, 0)
|
||||
#define B43_OFDMTAB_DACRFPABB B43_OFDMTAB(0x16, 0)
|
||||
#define B43_OFDMTAB_DACOFF B43_OFDMTAB(0x17, 0)
|
||||
#define B43_OFDMTAB_DCBIAS B43_OFDMTAB(0x18, 0)
|
||||
|
||||
u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset);
|
||||
void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table,
|
||||
u16 offset, u16 value);
|
||||
u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset);
|
||||
void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table,
|
||||
u16 offset, u32 value);
|
||||
|
||||
/*** G-PHY table numbers */
|
||||
#define B43_GTAB(number, offset) (((number) << B43_PHY_GTABNR_SHIFT) | (offset))
|
||||
#define B43_GTAB_NRSSI B43_GTAB(0x00, 0)
|
||||
#define B43_GTAB_TRFEMW B43_GTAB(0x0C, 0x120)
|
||||
#define B43_GTAB_ORIGTR B43_GTAB(0x2E, 0x298)
|
||||
|
||||
u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset); //TODO implement
|
||||
void b43_gtab_write(struct b43_wldev *dev, u16 table, u16 offset, u16 value); //TODO implement
|
||||
|
||||
#define B43_DEFAULT_CHANNEL_A 36
|
||||
#define B43_DEFAULT_CHANNEL_BG 6
|
||||
|
||||
enum {
|
||||
B43_ANTENNA0, /* Antenna 0 */
|
||||
B43_ANTENNA1, /* Antenna 0 */
|
||||
B43_ANTENNA_AUTO1, /* Automatic, starting with antenna 1 */
|
||||
B43_ANTENNA_AUTO0, /* Automatic, starting with antenna 0 */
|
||||
B43_ANTENNA2,
|
||||
B43_ANTENNA3 = 8,
|
||||
|
||||
B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
|
||||
B43_ANTENNA_DEFAULT = B43_ANTENNA_AUTO,
|
||||
};
|
||||
|
||||
enum {
|
||||
B43_INTERFMODE_NONE,
|
||||
B43_INTERFMODE_NONWLAN,
|
||||
B43_INTERFMODE_MANUALWLAN,
|
||||
B43_INTERFMODE_AUTOWLAN,
|
||||
};
|
||||
|
||||
/* Masks for the different PHY versioning registers. */
|
||||
#define B43_PHYVER_ANALOG 0xF000
|
||||
#define B43_PHYVER_ANALOG_SHIFT 12
|
||||
#define B43_PHYVER_TYPE 0x0F00
|
||||
#define B43_PHYVER_TYPE_SHIFT 8
|
||||
#define B43_PHYVER_VERSION 0x00FF
|
||||
|
||||
void b43_phy_lock(struct b43_wldev *dev);
|
||||
void b43_phy_unlock(struct b43_wldev *dev);
|
||||
|
||||
|
||||
/* Read a value from a PHY register */
|
||||
u16 b43_phy_read(struct b43_wldev *dev, u16 offset);
|
||||
/* Write a value to a PHY register */
|
||||
void b43_phy_write(struct b43_wldev *dev, u16 offset, u16 val);
|
||||
/* Mask a PHY register with a mask */
|
||||
void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask);
|
||||
/* OR a PHY register with a bitmap */
|
||||
void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set);
|
||||
/* Mask and OR a PHY register with a mask and bitmap */
|
||||
void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set);
|
||||
|
||||
|
||||
int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev);
|
||||
|
||||
void b43_phy_early_init(struct b43_wldev *dev);
|
||||
int b43_phy_init(struct b43_wldev *dev);
|
||||
|
||||
void b43_set_rx_antenna(struct b43_wldev *dev, int antenna);
|
||||
|
||||
void b43_phy_xmitpower(struct b43_wldev *dev);
|
||||
|
||||
/* Returns the boolean whether the board has HardwarePowerControl */
|
||||
bool b43_has_hardware_pctl(struct b43_phy *phy);
|
||||
/* Returns the boolean whether "TX Magnification" is enabled. */
|
||||
#define has_tx_magnification(phy) \
|
||||
(((phy)->rev >= 2) && \
|
||||
((phy)->radio_ver == 0x2050) && \
|
||||
((phy)->radio_rev == 8))
|
||||
/* Card uses the loopback gain stuff */
|
||||
#define has_loopback_gain(phy) \
|
||||
(((phy)->rev > 1) || ((phy)->gmode))
|
||||
|
||||
/* Radio Attenuation (RF Attenuation) */
|
||||
struct b43_rfatt {
|
||||
u8 att; /* Attenuation value */
|
||||
bool with_padmix; /* Flag, PAD Mixer enabled. */
|
||||
};
|
||||
struct b43_rfatt_list {
|
||||
/* Attenuation values list */
|
||||
const struct b43_rfatt *list;
|
||||
u8 len;
|
||||
/* Minimum/Maximum attenuation values */
|
||||
u8 min_val;
|
||||
u8 max_val;
|
||||
};
|
||||
|
||||
/* Returns true, if the values are the same. */
|
||||
static inline bool b43_compare_rfatt(const struct b43_rfatt *a,
|
||||
const struct b43_rfatt *b)
|
||||
{
|
||||
return ((a->att == b->att) &&
|
||||
(a->with_padmix == b->with_padmix));
|
||||
}
|
||||
|
||||
/* Baseband Attenuation */
|
||||
struct b43_bbatt {
|
||||
u8 att; /* Attenuation value */
|
||||
};
|
||||
struct b43_bbatt_list {
|
||||
/* Attenuation values list */
|
||||
const struct b43_bbatt *list;
|
||||
u8 len;
|
||||
/* Minimum/Maximum attenuation values */
|
||||
u8 min_val;
|
||||
u8 max_val;
|
||||
};
|
||||
|
||||
/* Returns true, if the values are the same. */
|
||||
static inline bool b43_compare_bbatt(const struct b43_bbatt *a,
|
||||
const struct b43_bbatt *b)
|
||||
{
|
||||
return (a->att == b->att);
|
||||
}
|
||||
|
||||
/* tx_control bits. */
|
||||
#define B43_TXCTL_PA3DB 0x40 /* PA Gain 3dB */
|
||||
#define B43_TXCTL_PA2DB 0x20 /* PA Gain 2dB */
|
||||
#define B43_TXCTL_TXMIX 0x10 /* TX Mixer Gain */
|
||||
|
||||
/* Write BasebandAttenuation value to the device. */
|
||||
void b43_phy_set_baseband_attenuation(struct b43_wldev *dev,
|
||||
u16 baseband_attenuation);
|
||||
|
||||
extern const u8 b43_radio_channel_codes_bg[];
|
||||
|
||||
void b43_radio_lock(struct b43_wldev *dev);
|
||||
void b43_radio_unlock(struct b43_wldev *dev);
|
||||
|
||||
|
||||
/* Read a value from a 16bit radio register */
|
||||
u16 b43_radio_read16(struct b43_wldev *dev, u16 offset);
|
||||
/* Write a value to a 16bit radio register */
|
||||
void b43_radio_write16(struct b43_wldev *dev, u16 offset, u16 val);
|
||||
/* Mask a 16bit radio register with a mask */
|
||||
void b43_radio_mask(struct b43_wldev *dev, u16 offset, u16 mask);
|
||||
/* OR a 16bit radio register with a bitmap */
|
||||
void b43_radio_set(struct b43_wldev *dev, u16 offset, u16 set);
|
||||
/* Mask and OR a PHY register with a mask and bitmap */
|
||||
void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set);
|
||||
|
||||
|
||||
u16 b43_radio_init2050(struct b43_wldev *dev);
|
||||
void b43_radio_init2060(struct b43_wldev *dev);
|
||||
|
||||
void b43_radio_turn_on(struct b43_wldev *dev);
|
||||
void b43_radio_turn_off(struct b43_wldev *dev, bool force);
|
||||
|
||||
int b43_radio_selectchannel(struct b43_wldev *dev, u8 channel,
|
||||
int synthetic_pu_workaround);
|
||||
|
||||
u8 b43_radio_aci_detect(struct b43_wldev *dev, u8 channel);
|
||||
u8 b43_radio_aci_scan(struct b43_wldev *dev);
|
||||
|
||||
int b43_radio_set_interference_mitigation(struct b43_wldev *dev, int mode);
|
||||
|
||||
void b43_calc_nrssi_slope(struct b43_wldev *dev);
|
||||
void b43_calc_nrssi_threshold(struct b43_wldev *dev);
|
||||
s16 b43_nrssi_hw_read(struct b43_wldev *dev, u16 offset);
|
||||
void b43_nrssi_hw_write(struct b43_wldev *dev, u16 offset, s16 val);
|
||||
void b43_nrssi_hw_update(struct b43_wldev *dev, u16 val);
|
||||
void b43_nrssi_mem_update(struct b43_wldev *dev);
|
||||
|
||||
void b43_radio_set_tx_iq(struct b43_wldev *dev);
|
||||
u16 b43_radio_calibrationvalue(struct b43_wldev *dev);
|
||||
|
||||
void b43_put_attenuation_into_ranges(struct b43_wldev *dev,
|
||||
int *_bbatt, int *_rfatt);
|
||||
|
||||
void b43_set_txpower_g(struct b43_wldev *dev,
|
||||
const struct b43_bbatt *bbatt,
|
||||
const struct b43_rfatt *rfatt, u8 tx_control);
|
||||
|
||||
#endif /* B43_PHY_H_ */
|
@ -1,842 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
PIO data transfer
|
||||
|
||||
Copyright (c) 2005-2008 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "b43.h"
|
||||
#include "pio.h"
|
||||
#include "dma.h"
|
||||
#include "main.h"
|
||||
#include "xmit.h"
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
||||
|
||||
static void b43_pio_rx_work(struct work_struct *work);
|
||||
|
||||
|
||||
static u16 generate_cookie(struct b43_pio_txqueue *q,
|
||||
struct b43_pio_txpacket *pack)
|
||||
{
|
||||
u16 cookie;
|
||||
|
||||
/* Use the upper 4 bits of the cookie as
|
||||
* PIO controller ID and store the packet index number
|
||||
* in the lower 12 bits.
|
||||
* Note that the cookie must never be 0, as this
|
||||
* is a special value used in RX path.
|
||||
* It can also not be 0xFFFF because that is special
|
||||
* for multicast frames.
|
||||
*/
|
||||
cookie = (((u16)q->index + 1) << 12);
|
||||
cookie |= pack->index;
|
||||
|
||||
return cookie;
|
||||
}
|
||||
|
||||
static
|
||||
struct b43_pio_txqueue * parse_cookie(struct b43_wldev *dev,
|
||||
u16 cookie,
|
||||
struct b43_pio_txpacket **pack)
|
||||
{
|
||||
struct b43_pio *pio = &dev->pio;
|
||||
struct b43_pio_txqueue *q = NULL;
|
||||
unsigned int pack_index;
|
||||
|
||||
switch (cookie & 0xF000) {
|
||||
case 0x1000:
|
||||
q = pio->tx_queue_AC_BK;
|
||||
break;
|
||||
case 0x2000:
|
||||
q = pio->tx_queue_AC_BE;
|
||||
break;
|
||||
case 0x3000:
|
||||
q = pio->tx_queue_AC_VI;
|
||||
break;
|
||||
case 0x4000:
|
||||
q = pio->tx_queue_AC_VO;
|
||||
break;
|
||||
case 0x5000:
|
||||
q = pio->tx_queue_mcast;
|
||||
break;
|
||||
}
|
||||
if (B43_WARN_ON(!q))
|
||||
return NULL;
|
||||
pack_index = (cookie & 0x0FFF);
|
||||
if (B43_WARN_ON(pack_index >= ARRAY_SIZE(q->packets)))
|
||||
return NULL;
|
||||
*pack = &q->packets[pack_index];
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static u16 index_to_pioqueue_base(struct b43_wldev *dev,
|
||||
unsigned int index)
|
||||
{
|
||||
static const u16 bases[] = {
|
||||
B43_MMIO_PIO_BASE0,
|
||||
B43_MMIO_PIO_BASE1,
|
||||
B43_MMIO_PIO_BASE2,
|
||||
B43_MMIO_PIO_BASE3,
|
||||
B43_MMIO_PIO_BASE4,
|
||||
B43_MMIO_PIO_BASE5,
|
||||
B43_MMIO_PIO_BASE6,
|
||||
B43_MMIO_PIO_BASE7,
|
||||
};
|
||||
static const u16 bases_rev11[] = {
|
||||
B43_MMIO_PIO11_BASE0,
|
||||
B43_MMIO_PIO11_BASE1,
|
||||
B43_MMIO_PIO11_BASE2,
|
||||
B43_MMIO_PIO11_BASE3,
|
||||
B43_MMIO_PIO11_BASE4,
|
||||
B43_MMIO_PIO11_BASE5,
|
||||
};
|
||||
|
||||
if (dev->dev->id.revision >= 11) {
|
||||
B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11));
|
||||
return bases_rev11[index];
|
||||
}
|
||||
B43_WARN_ON(index >= ARRAY_SIZE(bases));
|
||||
return bases[index];
|
||||
}
|
||||
|
||||
static u16 pio_txqueue_offset(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->dev->id.revision >= 11)
|
||||
return 0x18;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u16 pio_rxqueue_offset(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->dev->id.revision >= 11)
|
||||
return 0x38;
|
||||
return 8;
|
||||
}
|
||||
|
||||
static struct b43_pio_txqueue * b43_setup_pioqueue_tx(struct b43_wldev *dev,
|
||||
unsigned int index)
|
||||
{
|
||||
struct b43_pio_txqueue *q;
|
||||
struct b43_pio_txpacket *p;
|
||||
unsigned int i;
|
||||
|
||||
q = kzalloc(sizeof(*q), GFP_KERNEL);
|
||||
if (!q)
|
||||
return NULL;
|
||||
spin_lock_init(&q->lock);
|
||||
q->dev = dev;
|
||||
q->rev = dev->dev->id.revision;
|
||||
q->mmio_base = index_to_pioqueue_base(dev, index) +
|
||||
pio_txqueue_offset(dev);
|
||||
q->index = index;
|
||||
|
||||
q->free_packet_slots = B43_PIO_MAX_NR_TXPACKETS;
|
||||
if (q->rev >= 8) {
|
||||
q->buffer_size = 1920; //FIXME this constant is wrong.
|
||||
} else {
|
||||
q->buffer_size = b43_piotx_read16(q, B43_PIO_TXQBUFSIZE);
|
||||
q->buffer_size -= 80;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&q->packets_list);
|
||||
for (i = 0; i < ARRAY_SIZE(q->packets); i++) {
|
||||
p = &(q->packets[i]);
|
||||
INIT_LIST_HEAD(&p->list);
|
||||
p->index = i;
|
||||
p->queue = q;
|
||||
list_add(&p->list, &q->packets_list);
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static struct b43_pio_rxqueue * b43_setup_pioqueue_rx(struct b43_wldev *dev,
|
||||
unsigned int index)
|
||||
{
|
||||
struct b43_pio_rxqueue *q;
|
||||
|
||||
q = kzalloc(sizeof(*q), GFP_KERNEL);
|
||||
if (!q)
|
||||
return NULL;
|
||||
spin_lock_init(&q->lock);
|
||||
q->dev = dev;
|
||||
q->rev = dev->dev->id.revision;
|
||||
q->mmio_base = index_to_pioqueue_base(dev, index) +
|
||||
pio_rxqueue_offset(dev);
|
||||
INIT_WORK(&q->rx_work, b43_pio_rx_work);
|
||||
|
||||
/* Enable Direct FIFO RX (PIO) on the engine. */
|
||||
b43_dma_direct_fifo_rx(dev, index, 1);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static void b43_pio_cancel_tx_packets(struct b43_pio_txqueue *q)
|
||||
{
|
||||
struct b43_pio_txpacket *pack;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(q->packets); i++) {
|
||||
pack = &(q->packets[i]);
|
||||
if (pack->skb) {
|
||||
dev_kfree_skb_any(pack->skb);
|
||||
pack->skb = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_destroy_pioqueue_tx(struct b43_pio_txqueue *q,
|
||||
const char *name)
|
||||
{
|
||||
if (!q)
|
||||
return;
|
||||
b43_pio_cancel_tx_packets(q);
|
||||
kfree(q);
|
||||
}
|
||||
|
||||
static void b43_destroy_pioqueue_rx(struct b43_pio_rxqueue *q,
|
||||
const char *name)
|
||||
{
|
||||
if (!q)
|
||||
return;
|
||||
kfree(q);
|
||||
}
|
||||
|
||||
#define destroy_queue_tx(pio, queue) do { \
|
||||
b43_destroy_pioqueue_tx((pio)->queue, __stringify(queue)); \
|
||||
(pio)->queue = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define destroy_queue_rx(pio, queue) do { \
|
||||
b43_destroy_pioqueue_rx((pio)->queue, __stringify(queue)); \
|
||||
(pio)->queue = NULL; \
|
||||
} while (0)
|
||||
|
||||
void b43_pio_free(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_pio *pio;
|
||||
|
||||
if (!b43_using_pio_transfers(dev))
|
||||
return;
|
||||
pio = &dev->pio;
|
||||
|
||||
destroy_queue_rx(pio, rx_queue);
|
||||
destroy_queue_tx(pio, tx_queue_mcast);
|
||||
destroy_queue_tx(pio, tx_queue_AC_VO);
|
||||
destroy_queue_tx(pio, tx_queue_AC_VI);
|
||||
destroy_queue_tx(pio, tx_queue_AC_BE);
|
||||
destroy_queue_tx(pio, tx_queue_AC_BK);
|
||||
}
|
||||
|
||||
void b43_pio_stop(struct b43_wldev *dev)
|
||||
{
|
||||
if (!b43_using_pio_transfers(dev))
|
||||
return;
|
||||
cancel_work_sync(&dev->pio.rx_queue->rx_work);
|
||||
}
|
||||
|
||||
int b43_pio_init(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_pio *pio = &dev->pio;
|
||||
int err = -ENOMEM;
|
||||
|
||||
b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
|
||||
& ~B43_MACCTL_BE);
|
||||
b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_RXPADOFF, 0);
|
||||
|
||||
pio->tx_queue_AC_BK = b43_setup_pioqueue_tx(dev, 0);
|
||||
if (!pio->tx_queue_AC_BK)
|
||||
goto out;
|
||||
|
||||
pio->tx_queue_AC_BE = b43_setup_pioqueue_tx(dev, 1);
|
||||
if (!pio->tx_queue_AC_BE)
|
||||
goto err_destroy_bk;
|
||||
|
||||
pio->tx_queue_AC_VI = b43_setup_pioqueue_tx(dev, 2);
|
||||
if (!pio->tx_queue_AC_VI)
|
||||
goto err_destroy_be;
|
||||
|
||||
pio->tx_queue_AC_VO = b43_setup_pioqueue_tx(dev, 3);
|
||||
if (!pio->tx_queue_AC_VO)
|
||||
goto err_destroy_vi;
|
||||
|
||||
pio->tx_queue_mcast = b43_setup_pioqueue_tx(dev, 4);
|
||||
if (!pio->tx_queue_mcast)
|
||||
goto err_destroy_vo;
|
||||
|
||||
pio->rx_queue = b43_setup_pioqueue_rx(dev, 0);
|
||||
if (!pio->rx_queue)
|
||||
goto err_destroy_mcast;
|
||||
|
||||
b43dbg(dev->wl, "PIO initialized\n");
|
||||
err = 0;
|
||||
out:
|
||||
return err;
|
||||
|
||||
err_destroy_mcast:
|
||||
destroy_queue_tx(pio, tx_queue_mcast);
|
||||
err_destroy_vo:
|
||||
destroy_queue_tx(pio, tx_queue_AC_VO);
|
||||
err_destroy_vi:
|
||||
destroy_queue_tx(pio, tx_queue_AC_VI);
|
||||
err_destroy_be:
|
||||
destroy_queue_tx(pio, tx_queue_AC_BE);
|
||||
err_destroy_bk:
|
||||
destroy_queue_tx(pio, tx_queue_AC_BK);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Static mapping of mac80211's queues (priorities) to b43 PIO queues. */
|
||||
static struct b43_pio_txqueue * select_queue_by_priority(struct b43_wldev *dev,
|
||||
u8 queue_prio)
|
||||
{
|
||||
struct b43_pio_txqueue *q;
|
||||
|
||||
if (b43_modparam_qos) {
|
||||
/* 0 = highest priority */
|
||||
switch (queue_prio) {
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
/* fallthrough */
|
||||
case 0:
|
||||
q = dev->pio.tx_queue_AC_VO;
|
||||
break;
|
||||
case 1:
|
||||
q = dev->pio.tx_queue_AC_VI;
|
||||
break;
|
||||
case 2:
|
||||
q = dev->pio.tx_queue_AC_BE;
|
||||
break;
|
||||
case 3:
|
||||
q = dev->pio.tx_queue_AC_BK;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
q = dev->pio.tx_queue_AC_BE;
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
|
||||
u16 ctl,
|
||||
const void *_data,
|
||||
unsigned int data_len)
|
||||
{
|
||||
struct b43_wldev *dev = q->dev;
|
||||
const u8 *data = _data;
|
||||
|
||||
ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI;
|
||||
b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
|
||||
|
||||
ssb_block_write(dev->dev, data, (data_len & ~1),
|
||||
q->mmio_base + B43_PIO_TXDATA,
|
||||
sizeof(u16));
|
||||
if (data_len & 1) {
|
||||
/* Write the last byte. */
|
||||
ctl &= ~B43_PIO_TXCTL_WRITEHI;
|
||||
b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
|
||||
b43_piotx_write16(q, B43_PIO_TXDATA, data[data_len - 1]);
|
||||
}
|
||||
|
||||
return ctl;
|
||||
}
|
||||
|
||||
static void pio_tx_frame_2byte_queue(struct b43_pio_txpacket *pack,
|
||||
const u8 *hdr, unsigned int hdrlen)
|
||||
{
|
||||
struct b43_pio_txqueue *q = pack->queue;
|
||||
const char *frame = pack->skb->data;
|
||||
unsigned int frame_len = pack->skb->len;
|
||||
u16 ctl;
|
||||
|
||||
ctl = b43_piotx_read16(q, B43_PIO_TXCTL);
|
||||
ctl |= B43_PIO_TXCTL_FREADY;
|
||||
ctl &= ~B43_PIO_TXCTL_EOF;
|
||||
|
||||
/* Transfer the header data. */
|
||||
ctl = tx_write_2byte_queue(q, ctl, hdr, hdrlen);
|
||||
/* Transfer the frame data. */
|
||||
ctl = tx_write_2byte_queue(q, ctl, frame, frame_len);
|
||||
|
||||
ctl |= B43_PIO_TXCTL_EOF;
|
||||
b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
|
||||
}
|
||||
|
||||
static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
|
||||
u32 ctl,
|
||||
const void *_data,
|
||||
unsigned int data_len)
|
||||
{
|
||||
struct b43_wldev *dev = q->dev;
|
||||
const u8 *data = _data;
|
||||
|
||||
ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 |
|
||||
B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31;
|
||||
b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
|
||||
|
||||
ssb_block_write(dev->dev, data, (data_len & ~3),
|
||||
q->mmio_base + B43_PIO8_TXDATA,
|
||||
sizeof(u32));
|
||||
if (data_len & 3) {
|
||||
u32 value = 0;
|
||||
|
||||
/* Write the last few bytes. */
|
||||
ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 |
|
||||
B43_PIO8_TXCTL_24_31);
|
||||
data = &(data[data_len - 1]);
|
||||
switch (data_len & 3) {
|
||||
case 3:
|
||||
ctl |= B43_PIO8_TXCTL_16_23;
|
||||
value |= (u32)(*data) << 16;
|
||||
data--;
|
||||
case 2:
|
||||
ctl |= B43_PIO8_TXCTL_8_15;
|
||||
value |= (u32)(*data) << 8;
|
||||
data--;
|
||||
case 1:
|
||||
value |= (u32)(*data);
|
||||
}
|
||||
b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
|
||||
b43_piotx_write32(q, B43_PIO8_TXDATA, value);
|
||||
}
|
||||
|
||||
return ctl;
|
||||
}
|
||||
|
||||
static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack,
|
||||
const u8 *hdr, unsigned int hdrlen)
|
||||
{
|
||||
struct b43_pio_txqueue *q = pack->queue;
|
||||
const char *frame = pack->skb->data;
|
||||
unsigned int frame_len = pack->skb->len;
|
||||
u32 ctl;
|
||||
|
||||
ctl = b43_piotx_read32(q, B43_PIO8_TXCTL);
|
||||
ctl |= B43_PIO8_TXCTL_FREADY;
|
||||
ctl &= ~B43_PIO8_TXCTL_EOF;
|
||||
|
||||
/* Transfer the header data. */
|
||||
ctl = tx_write_4byte_queue(q, ctl, hdr, hdrlen);
|
||||
/* Transfer the frame data. */
|
||||
ctl = tx_write_4byte_queue(q, ctl, frame, frame_len);
|
||||
|
||||
ctl |= B43_PIO8_TXCTL_EOF;
|
||||
b43_piotx_write32(q, B43_PIO_TXCTL, ctl);
|
||||
}
|
||||
|
||||
static int pio_tx_frame(struct b43_pio_txqueue *q,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct b43_pio_txpacket *pack;
|
||||
struct b43_txhdr txhdr;
|
||||
u16 cookie;
|
||||
int err;
|
||||
unsigned int hdrlen;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
B43_WARN_ON(list_empty(&q->packets_list));
|
||||
pack = list_entry(q->packets_list.next,
|
||||
struct b43_pio_txpacket, list);
|
||||
|
||||
cookie = generate_cookie(q, pack);
|
||||
hdrlen = b43_txhdr_size(q->dev);
|
||||
err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb->data,
|
||||
skb->len, info, cookie);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
|
||||
/* Tell the firmware about the cookie of the last
|
||||
* mcast frame, so it can clear the more-data bit in it. */
|
||||
b43_shm_write16(q->dev, B43_SHM_SHARED,
|
||||
B43_SHM_SH_MCASTCOOKIE, cookie);
|
||||
}
|
||||
|
||||
pack->skb = skb;
|
||||
if (q->rev >= 8)
|
||||
pio_tx_frame_4byte_queue(pack, (const u8 *)&txhdr, hdrlen);
|
||||
else
|
||||
pio_tx_frame_2byte_queue(pack, (const u8 *)&txhdr, hdrlen);
|
||||
|
||||
/* Remove it from the list of available packet slots.
|
||||
* It will be put back when we receive the status report. */
|
||||
list_del(&pack->list);
|
||||
|
||||
/* Update the queue statistics. */
|
||||
q->buffer_used += roundup(skb->len + hdrlen, 4);
|
||||
q->free_packet_slots -= 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
|
||||
{
|
||||
struct b43_pio_txqueue *q;
|
||||
struct ieee80211_hdr *hdr;
|
||||
unsigned long flags;
|
||||
unsigned int hdrlen, total_len;
|
||||
int err = 0;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
|
||||
if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
|
||||
/* The multicast queue will be sent after the DTIM. */
|
||||
q = dev->pio.tx_queue_mcast;
|
||||
/* Set the frame More-Data bit. Ucode will clear it
|
||||
* for us on the last frame. */
|
||||
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
|
||||
} else {
|
||||
/* Decide by priority where to put this frame. */
|
||||
q = select_queue_by_priority(dev, skb_get_queue_mapping(skb));
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
|
||||
hdrlen = b43_txhdr_size(dev);
|
||||
total_len = roundup(skb->len + hdrlen, 4);
|
||||
|
||||
if (unlikely(total_len > q->buffer_size)) {
|
||||
err = -ENOBUFS;
|
||||
b43dbg(dev->wl, "PIO: TX packet longer than queue.\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
if (unlikely(q->free_packet_slots == 0)) {
|
||||
err = -ENOBUFS;
|
||||
b43warn(dev->wl, "PIO: TX packet overflow.\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
B43_WARN_ON(q->buffer_used > q->buffer_size);
|
||||
|
||||
if (total_len > (q->buffer_size - q->buffer_used)) {
|
||||
/* Not enough memory on the queue. */
|
||||
err = -EBUSY;
|
||||
ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
|
||||
q->stopped = 1;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Assign the queue number to the ring (if not already done before)
|
||||
* so TX status handling can use it. The mac80211-queue to b43-queue
|
||||
* mapping is static, so we don't need to store it per frame. */
|
||||
q->queue_prio = skb_get_queue_mapping(skb);
|
||||
|
||||
err = pio_tx_frame(q, skb);
|
||||
if (unlikely(err == -ENOKEY)) {
|
||||
/* Drop this packet, as we don't have the encryption key
|
||||
* anymore and must not transmit it unencrypted. */
|
||||
dev_kfree_skb_any(skb);
|
||||
err = 0;
|
||||
goto out_unlock;
|
||||
}
|
||||
if (unlikely(err)) {
|
||||
b43err(dev->wl, "PIO transmission failure\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
q->nr_tx_packets++;
|
||||
|
||||
B43_WARN_ON(q->buffer_used > q->buffer_size);
|
||||
if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) ||
|
||||
(q->free_packet_slots == 0)) {
|
||||
/* The queue is full. */
|
||||
ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
|
||||
q->stopped = 1;
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Called with IRQs disabled. */
|
||||
void b43_pio_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
struct b43_pio_txqueue *q;
|
||||
struct b43_pio_txpacket *pack = NULL;
|
||||
unsigned int total_len;
|
||||
struct ieee80211_tx_info *info;
|
||||
|
||||
q = parse_cookie(dev, status->cookie, &pack);
|
||||
if (unlikely(!q))
|
||||
return;
|
||||
B43_WARN_ON(!pack);
|
||||
|
||||
spin_lock(&q->lock); /* IRQs are already disabled. */
|
||||
|
||||
info = (void *)pack->skb;
|
||||
memset(&info->status, 0, sizeof(info->status));
|
||||
|
||||
b43_fill_txstatus_report(info, status);
|
||||
|
||||
total_len = pack->skb->len + b43_txhdr_size(dev);
|
||||
total_len = roundup(total_len, 4);
|
||||
q->buffer_used -= total_len;
|
||||
q->free_packet_slots += 1;
|
||||
|
||||
ieee80211_tx_status_irqsafe(dev->wl->hw, pack->skb);
|
||||
pack->skb = NULL;
|
||||
list_add(&pack->list, &q->packets_list);
|
||||
|
||||
if (q->stopped) {
|
||||
ieee80211_wake_queue(dev->wl->hw, q->queue_prio);
|
||||
q->stopped = 0;
|
||||
}
|
||||
|
||||
spin_unlock(&q->lock);
|
||||
}
|
||||
|
||||
void b43_pio_get_tx_stats(struct b43_wldev *dev,
|
||||
struct ieee80211_tx_queue_stats *stats)
|
||||
{
|
||||
const int nr_queues = dev->wl->hw->queues;
|
||||
struct b43_pio_txqueue *q;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nr_queues; i++) {
|
||||
q = select_queue_by_priority(dev, i);
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots;
|
||||
stats[i].limit = B43_PIO_MAX_NR_TXPACKETS;
|
||||
stats[i].count = q->nr_tx_packets;
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns whether we should fetch another frame. */
|
||||
static bool pio_rx_frame(struct b43_pio_rxqueue *q)
|
||||
{
|
||||
struct b43_wldev *dev = q->dev;
|
||||
struct b43_rxhdr_fw4 rxhdr;
|
||||
u16 len;
|
||||
u32 macstat;
|
||||
unsigned int i, padding;
|
||||
struct sk_buff *skb;
|
||||
const char *err_msg = NULL;
|
||||
|
||||
memset(&rxhdr, 0, sizeof(rxhdr));
|
||||
|
||||
/* Check if we have data and wait for it to get ready. */
|
||||
if (q->rev >= 8) {
|
||||
u32 ctl;
|
||||
|
||||
ctl = b43_piorx_read32(q, B43_PIO8_RXCTL);
|
||||
if (!(ctl & B43_PIO8_RXCTL_FRAMERDY))
|
||||
return 0;
|
||||
b43_piorx_write32(q, B43_PIO8_RXCTL,
|
||||
B43_PIO8_RXCTL_FRAMERDY);
|
||||
for (i = 0; i < 10; i++) {
|
||||
ctl = b43_piorx_read32(q, B43_PIO8_RXCTL);
|
||||
if (ctl & B43_PIO8_RXCTL_DATARDY)
|
||||
goto data_ready;
|
||||
udelay(10);
|
||||
}
|
||||
} else {
|
||||
u16 ctl;
|
||||
|
||||
ctl = b43_piorx_read16(q, B43_PIO_RXCTL);
|
||||
if (!(ctl & B43_PIO_RXCTL_FRAMERDY))
|
||||
return 0;
|
||||
b43_piorx_write16(q, B43_PIO_RXCTL,
|
||||
B43_PIO_RXCTL_FRAMERDY);
|
||||
for (i = 0; i < 10; i++) {
|
||||
ctl = b43_piorx_read16(q, B43_PIO_RXCTL);
|
||||
if (ctl & B43_PIO_RXCTL_DATARDY)
|
||||
goto data_ready;
|
||||
udelay(10);
|
||||
}
|
||||
}
|
||||
b43dbg(q->dev->wl, "PIO RX timed out\n");
|
||||
return 1;
|
||||
data_ready:
|
||||
|
||||
/* Get the preamble (RX header) */
|
||||
if (q->rev >= 8) {
|
||||
ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr),
|
||||
q->mmio_base + B43_PIO8_RXDATA,
|
||||
sizeof(u32));
|
||||
} else {
|
||||
ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr),
|
||||
q->mmio_base + B43_PIO_RXDATA,
|
||||
sizeof(u16));
|
||||
}
|
||||
/* Sanity checks. */
|
||||
len = le16_to_cpu(rxhdr.frame_len);
|
||||
if (unlikely(len > 0x700)) {
|
||||
err_msg = "len > 0x700";
|
||||
goto rx_error;
|
||||
}
|
||||
if (unlikely(len == 0)) {
|
||||
err_msg = "len == 0";
|
||||
goto rx_error;
|
||||
}
|
||||
|
||||
macstat = le32_to_cpu(rxhdr.mac_status);
|
||||
if (macstat & B43_RX_MAC_FCSERR) {
|
||||
if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
|
||||
/* Drop frames with failed FCS. */
|
||||
err_msg = "Frame FCS error";
|
||||
goto rx_error;
|
||||
}
|
||||
}
|
||||
|
||||
/* We always pad 2 bytes, as that's what upstream code expects
|
||||
* due to the RX-header being 30 bytes. In case the frame is
|
||||
* unaligned, we pad another 2 bytes. */
|
||||
padding = (macstat & B43_RX_MAC_PADDING) ? 2 : 0;
|
||||
skb = dev_alloc_skb(len + padding + 2);
|
||||
if (unlikely(!skb)) {
|
||||
err_msg = "Out of memory";
|
||||
goto rx_error;
|
||||
}
|
||||
skb_reserve(skb, 2);
|
||||
skb_put(skb, len + padding);
|
||||
if (q->rev >= 8) {
|
||||
ssb_block_read(dev->dev, skb->data + padding, (len & ~3),
|
||||
q->mmio_base + B43_PIO8_RXDATA,
|
||||
sizeof(u32));
|
||||
if (len & 3) {
|
||||
u32 value;
|
||||
char *data;
|
||||
|
||||
/* Read the last few bytes. */
|
||||
value = b43_piorx_read32(q, B43_PIO8_RXDATA);
|
||||
data = &(skb->data[len + padding - 1]);
|
||||
switch (len & 3) {
|
||||
case 3:
|
||||
*data = (value >> 16);
|
||||
data--;
|
||||
case 2:
|
||||
*data = (value >> 8);
|
||||
data--;
|
||||
case 1:
|
||||
*data = value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ssb_block_read(dev->dev, skb->data + padding, (len & ~1),
|
||||
q->mmio_base + B43_PIO_RXDATA,
|
||||
sizeof(u16));
|
||||
if (len & 1) {
|
||||
u16 value;
|
||||
|
||||
/* Read the last byte. */
|
||||
value = b43_piorx_read16(q, B43_PIO_RXDATA);
|
||||
skb->data[len + padding - 1] = value;
|
||||
}
|
||||
}
|
||||
|
||||
b43_rx(q->dev, skb, &rxhdr);
|
||||
|
||||
return 1;
|
||||
|
||||
rx_error:
|
||||
if (err_msg)
|
||||
b43dbg(q->dev->wl, "PIO RX error: %s\n", err_msg);
|
||||
b43_piorx_write16(q, B43_PIO_RXCTL, B43_PIO_RXCTL_DATARDY);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* RX workqueue. We can sleep, yay! */
|
||||
static void b43_pio_rx_work(struct work_struct *work)
|
||||
{
|
||||
struct b43_pio_rxqueue *q = container_of(work, struct b43_pio_rxqueue,
|
||||
rx_work);
|
||||
unsigned int budget = 50;
|
||||
bool stop;
|
||||
|
||||
do {
|
||||
spin_lock_irq(&q->lock);
|
||||
stop = (pio_rx_frame(q) == 0);
|
||||
spin_unlock_irq(&q->lock);
|
||||
cond_resched();
|
||||
if (stop)
|
||||
break;
|
||||
} while (--budget);
|
||||
}
|
||||
|
||||
/* Called with IRQs disabled. */
|
||||
void b43_pio_rx(struct b43_pio_rxqueue *q)
|
||||
{
|
||||
/* Due to latency issues we must run the RX path in
|
||||
* a workqueue to be able to schedule between packets. */
|
||||
queue_work(q->dev->wl->hw->workqueue, &q->rx_work);
|
||||
}
|
||||
|
||||
static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
if (q->rev >= 8) {
|
||||
b43_piotx_write32(q, B43_PIO8_TXCTL,
|
||||
b43_piotx_read32(q, B43_PIO8_TXCTL)
|
||||
| B43_PIO8_TXCTL_SUSPREQ);
|
||||
} else {
|
||||
b43_piotx_write16(q, B43_PIO_TXCTL,
|
||||
b43_piotx_read16(q, B43_PIO_TXCTL)
|
||||
| B43_PIO_TXCTL_SUSPREQ);
|
||||
}
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
}
|
||||
|
||||
static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
if (q->rev >= 8) {
|
||||
b43_piotx_write32(q, B43_PIO8_TXCTL,
|
||||
b43_piotx_read32(q, B43_PIO8_TXCTL)
|
||||
& ~B43_PIO8_TXCTL_SUSPREQ);
|
||||
} else {
|
||||
b43_piotx_write16(q, B43_PIO_TXCTL,
|
||||
b43_piotx_read16(q, B43_PIO_TXCTL)
|
||||
& ~B43_PIO_TXCTL_SUSPREQ);
|
||||
}
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
}
|
||||
|
||||
void b43_pio_tx_suspend(struct b43_wldev *dev)
|
||||
{
|
||||
b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
|
||||
b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_BK);
|
||||
b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_BE);
|
||||
b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_VI);
|
||||
b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_VO);
|
||||
b43_pio_tx_suspend_queue(dev->pio.tx_queue_mcast);
|
||||
}
|
||||
|
||||
void b43_pio_tx_resume(struct b43_wldev *dev)
|
||||
{
|
||||
b43_pio_tx_resume_queue(dev->pio.tx_queue_mcast);
|
||||
b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_VO);
|
||||
b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_VI);
|
||||
b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_BE);
|
||||
b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_BK);
|
||||
b43_power_saving_ctl_bits(dev, 0);
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
#ifndef B43_PIO_H_
|
||||
#define B43_PIO_H_
|
||||
|
||||
#include "b43.h"
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
|
||||
/*** Registers for PIO queues up to revision 7. ***/
|
||||
/* TX queue. */
|
||||
#define B43_PIO_TXCTL 0x00
|
||||
#define B43_PIO_TXCTL_WRITELO 0x0001
|
||||
#define B43_PIO_TXCTL_WRITEHI 0x0002
|
||||
#define B43_PIO_TXCTL_EOF 0x0004
|
||||
#define B43_PIO_TXCTL_FREADY 0x0008
|
||||
#define B43_PIO_TXCTL_FLUSHREQ 0x0020
|
||||
#define B43_PIO_TXCTL_FLUSHPEND 0x0040
|
||||
#define B43_PIO_TXCTL_SUSPREQ 0x0080
|
||||
#define B43_PIO_TXCTL_QSUSP 0x0100
|
||||
#define B43_PIO_TXCTL_COMMCNT 0xFC00
|
||||
#define B43_PIO_TXCTL_COMMCNT_SHIFT 10
|
||||
#define B43_PIO_TXDATA 0x02
|
||||
#define B43_PIO_TXQBUFSIZE 0x04
|
||||
/* RX queue. */
|
||||
#define B43_PIO_RXCTL 0x00
|
||||
#define B43_PIO_RXCTL_FRAMERDY 0x0001
|
||||
#define B43_PIO_RXCTL_DATARDY 0x0002
|
||||
#define B43_PIO_RXDATA 0x02
|
||||
|
||||
/*** Registers for PIO queues revision 8 and later. ***/
|
||||
/* TX queue */
|
||||
#define B43_PIO8_TXCTL 0x00
|
||||
#define B43_PIO8_TXCTL_0_7 0x00000001
|
||||
#define B43_PIO8_TXCTL_8_15 0x00000002
|
||||
#define B43_PIO8_TXCTL_16_23 0x00000004
|
||||
#define B43_PIO8_TXCTL_24_31 0x00000008
|
||||
#define B43_PIO8_TXCTL_EOF 0x00000010
|
||||
#define B43_PIO8_TXCTL_FREADY 0x00000080
|
||||
#define B43_PIO8_TXCTL_SUSPREQ 0x00000100
|
||||
#define B43_PIO8_TXCTL_QSUSP 0x00000200
|
||||
#define B43_PIO8_TXCTL_FLUSHREQ 0x00000400
|
||||
#define B43_PIO8_TXCTL_FLUSHPEND 0x00000800
|
||||
#define B43_PIO8_TXDATA 0x04
|
||||
/* RX queue */
|
||||
#define B43_PIO8_RXCTL 0x00
|
||||
#define B43_PIO8_RXCTL_FRAMERDY 0x00000001
|
||||
#define B43_PIO8_RXCTL_DATARDY 0x00000002
|
||||
#define B43_PIO8_RXDATA 0x04
|
||||
|
||||
|
||||
/* The maximum number of TX-packets the HW can handle. */
|
||||
#define B43_PIO_MAX_NR_TXPACKETS 32
|
||||
|
||||
|
||||
#ifdef CONFIG_B43_PIO
|
||||
|
||||
struct b43_pio_txpacket {
|
||||
/* Pointer to the TX queue we belong to. */
|
||||
struct b43_pio_txqueue *queue;
|
||||
/* The TX data packet. */
|
||||
struct sk_buff *skb;
|
||||
/* Index in the (struct b43_pio_txqueue)->packets array. */
|
||||
u8 index;
|
||||
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct b43_pio_txqueue {
|
||||
struct b43_wldev *dev;
|
||||
spinlock_t lock;
|
||||
u16 mmio_base;
|
||||
|
||||
/* The device queue buffer size in bytes. */
|
||||
u16 buffer_size;
|
||||
/* The number of used bytes in the device queue buffer. */
|
||||
u16 buffer_used;
|
||||
/* The number of packets that can still get queued.
|
||||
* This is decremented on queueing a packet and incremented
|
||||
* after receiving the transmit status. */
|
||||
u16 free_packet_slots;
|
||||
|
||||
/* True, if the mac80211 queue was stopped due to overflow at TX. */
|
||||
bool stopped;
|
||||
/* Our b43 queue index number */
|
||||
u8 index;
|
||||
/* The mac80211 QoS queue priority. */
|
||||
u8 queue_prio;
|
||||
|
||||
/* Buffer for TX packet meta data. */
|
||||
struct b43_pio_txpacket packets[B43_PIO_MAX_NR_TXPACKETS];
|
||||
struct list_head packets_list;
|
||||
|
||||
/* Total number of transmitted packets. */
|
||||
unsigned int nr_tx_packets;
|
||||
|
||||
/* Shortcut to the 802.11 core revision. This is to
|
||||
* avoid horrible pointer dereferencing in the fastpaths. */
|
||||
u8 rev;
|
||||
};
|
||||
|
||||
struct b43_pio_rxqueue {
|
||||
struct b43_wldev *dev;
|
||||
spinlock_t lock;
|
||||
u16 mmio_base;
|
||||
|
||||
/* Work to reduce latency issues on RX. */
|
||||
struct work_struct rx_work;
|
||||
|
||||
/* Shortcut to the 802.11 core revision. This is to
|
||||
* avoid horrible pointer dereferencing in the fastpaths. */
|
||||
u8 rev;
|
||||
};
|
||||
|
||||
|
||||
static inline u16 b43_piotx_read16(struct b43_pio_txqueue *q, u16 offset)
|
||||
{
|
||||
return b43_read16(q->dev, q->mmio_base + offset);
|
||||
}
|
||||
|
||||
static inline u32 b43_piotx_read32(struct b43_pio_txqueue *q, u16 offset)
|
||||
{
|
||||
return b43_read32(q->dev, q->mmio_base + offset);
|
||||
}
|
||||
|
||||
static inline void b43_piotx_write16(struct b43_pio_txqueue *q,
|
||||
u16 offset, u16 value)
|
||||
{
|
||||
b43_write16(q->dev, q->mmio_base + offset, value);
|
||||
}
|
||||
|
||||
static inline void b43_piotx_write32(struct b43_pio_txqueue *q,
|
||||
u16 offset, u32 value)
|
||||
{
|
||||
b43_write32(q->dev, q->mmio_base + offset, value);
|
||||
}
|
||||
|
||||
|
||||
static inline u16 b43_piorx_read16(struct b43_pio_rxqueue *q, u16 offset)
|
||||
{
|
||||
return b43_read16(q->dev, q->mmio_base + offset);
|
||||
}
|
||||
|
||||
static inline u32 b43_piorx_read32(struct b43_pio_rxqueue *q, u16 offset)
|
||||
{
|
||||
return b43_read32(q->dev, q->mmio_base + offset);
|
||||
}
|
||||
|
||||
static inline void b43_piorx_write16(struct b43_pio_rxqueue *q,
|
||||
u16 offset, u16 value)
|
||||
{
|
||||
b43_write16(q->dev, q->mmio_base + offset, value);
|
||||
}
|
||||
|
||||
static inline void b43_piorx_write32(struct b43_pio_rxqueue *q,
|
||||
u16 offset, u32 value)
|
||||
{
|
||||
b43_write32(q->dev, q->mmio_base + offset, value);
|
||||
}
|
||||
|
||||
|
||||
int b43_pio_init(struct b43_wldev *dev);
|
||||
void b43_pio_stop(struct b43_wldev *dev);
|
||||
void b43_pio_free(struct b43_wldev *dev);
|
||||
|
||||
int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb);
|
||||
void b43_pio_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status);
|
||||
void b43_pio_get_tx_stats(struct b43_wldev *dev,
|
||||
struct ieee80211_tx_queue_stats *stats);
|
||||
void b43_pio_rx(struct b43_pio_rxqueue *q);
|
||||
|
||||
void b43_pio_tx_suspend(struct b43_wldev *dev);
|
||||
void b43_pio_tx_resume(struct b43_wldev *dev);
|
||||
|
||||
|
||||
#else /* CONFIG_B43_PIO */
|
||||
|
||||
|
||||
static inline int b43_pio_init(struct b43_wldev *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void b43_pio_free(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_pio_stop(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline int b43_pio_tx(struct b43_wldev *dev,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void b43_pio_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
}
|
||||
static inline void b43_pio_get_tx_stats(struct b43_wldev *dev,
|
||||
struct ieee80211_tx_queue_stats *stats)
|
||||
{
|
||||
}
|
||||
static inline void b43_pio_rx(struct b43_pio_rxqueue *q)
|
||||
{
|
||||
}
|
||||
static inline void b43_pio_tx_suspend(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_pio_tx_resume(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_PIO */
|
||||
#endif /* B43_PIO_H_ */
|
@ -1,201 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
RFKILL support
|
||||
|
||||
Copyright (c) 2007 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "rfkill.h"
|
||||
#include "b43.h"
|
||||
|
||||
#include <linux/kmod.h>
|
||||
|
||||
|
||||
/* Returns TRUE, if the radio is enabled in hardware. */
|
||||
static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->phy.rev >= 3) {
|
||||
if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
|
||||
& B43_MMIO_RADIO_HWENABLED_HI_MASK))
|
||||
return 1;
|
||||
} else {
|
||||
if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
|
||||
& B43_MMIO_RADIO_HWENABLED_LO_MASK)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The poll callback for the hardware button. */
|
||||
static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
|
||||
{
|
||||
struct b43_wldev *dev = poll_dev->private;
|
||||
struct b43_wl *wl = dev->wl;
|
||||
bool enabled;
|
||||
bool report_change = 0;
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) {
|
||||
mutex_unlock(&wl->mutex);
|
||||
return;
|
||||
}
|
||||
enabled = b43_is_hw_radio_enabled(dev);
|
||||
if (unlikely(enabled != dev->radio_hw_enable)) {
|
||||
dev->radio_hw_enable = enabled;
|
||||
report_change = 1;
|
||||
b43info(wl, "Radio hardware status changed to %s\n",
|
||||
enabled ? "ENABLED" : "DISABLED");
|
||||
}
|
||||
mutex_unlock(&wl->mutex);
|
||||
|
||||
/* send the radio switch event to the system - note both a key press
|
||||
* and a release are required */
|
||||
if (unlikely(report_change)) {
|
||||
input_report_key(poll_dev->input, KEY_WLAN, 1);
|
||||
input_report_key(poll_dev->input, KEY_WLAN, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called when the RFKILL toggled in software. */
|
||||
static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
|
||||
{
|
||||
struct b43_wldev *dev = data;
|
||||
struct b43_wl *wl = dev->wl;
|
||||
int err = -EBUSY;
|
||||
|
||||
if (!wl->rfkill.registered)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
if (b43_status(dev) < B43_STAT_INITIALIZED)
|
||||
goto out_unlock;
|
||||
err = 0;
|
||||
switch (state) {
|
||||
case RFKILL_STATE_ON:
|
||||
if (!dev->radio_hw_enable) {
|
||||
/* No luck. We can't toggle the hardware RF-kill
|
||||
* button from software. */
|
||||
err = -EBUSY;
|
||||
goto out_unlock;
|
||||
}
|
||||
if (!dev->phy.radio_on)
|
||||
b43_radio_turn_on(dev);
|
||||
break;
|
||||
case RFKILL_STATE_OFF:
|
||||
if (dev->phy.radio_on)
|
||||
b43_radio_turn_off(dev, 0);
|
||||
break;
|
||||
}
|
||||
out_unlock:
|
||||
mutex_unlock(&wl->mutex);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
char * b43_rfkill_led_name(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_rfkill *rfk = &(dev->wl->rfkill);
|
||||
|
||||
if (!rfk->registered)
|
||||
return NULL;
|
||||
return rfkill_get_led_name(rfk->rfkill);
|
||||
}
|
||||
|
||||
void b43_rfkill_init(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_wl *wl = dev->wl;
|
||||
struct b43_rfkill *rfk = &(wl->rfkill);
|
||||
int err;
|
||||
|
||||
rfk->registered = 0;
|
||||
|
||||
rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN);
|
||||
if (!rfk->rfkill)
|
||||
goto out_error;
|
||||
snprintf(rfk->name, sizeof(rfk->name),
|
||||
"b43-%s", wiphy_name(wl->hw->wiphy));
|
||||
rfk->rfkill->name = rfk->name;
|
||||
rfk->rfkill->state = RFKILL_STATE_ON;
|
||||
rfk->rfkill->data = dev;
|
||||
rfk->rfkill->toggle_radio = b43_rfkill_soft_toggle;
|
||||
rfk->rfkill->user_claim_unsupported = 1;
|
||||
|
||||
rfk->poll_dev = input_allocate_polled_device();
|
||||
if (!rfk->poll_dev) {
|
||||
rfkill_free(rfk->rfkill);
|
||||
goto err_freed_rfk;
|
||||
}
|
||||
|
||||
rfk->poll_dev->private = dev;
|
||||
rfk->poll_dev->poll = b43_rfkill_poll;
|
||||
rfk->poll_dev->poll_interval = 1000; /* msecs */
|
||||
|
||||
rfk->poll_dev->input->name = rfk->name;
|
||||
rfk->poll_dev->input->id.bustype = BUS_HOST;
|
||||
rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor;
|
||||
rfk->poll_dev->input->evbit[0] = BIT(EV_KEY);
|
||||
set_bit(KEY_WLAN, rfk->poll_dev->input->keybit);
|
||||
|
||||
err = rfkill_register(rfk->rfkill);
|
||||
if (err)
|
||||
goto err_free_polldev;
|
||||
|
||||
#ifdef CONFIG_RFKILL_INPUT_MODULE
|
||||
/* B43 RF-kill isn't useful without the rfkill-input subsystem.
|
||||
* Try to load the module. */
|
||||
err = request_module("rfkill-input");
|
||||
if (err)
|
||||
b43warn(wl, "Failed to load the rfkill-input module. "
|
||||
"The built-in radio LED will not work.\n");
|
||||
#endif /* CONFIG_RFKILL_INPUT */
|
||||
|
||||
err = input_register_polled_device(rfk->poll_dev);
|
||||
if (err)
|
||||
goto err_unreg_rfk;
|
||||
|
||||
rfk->registered = 1;
|
||||
|
||||
return;
|
||||
err_unreg_rfk:
|
||||
rfkill_unregister(rfk->rfkill);
|
||||
err_free_polldev:
|
||||
input_free_polled_device(rfk->poll_dev);
|
||||
rfk->poll_dev = NULL;
|
||||
err_freed_rfk:
|
||||
rfk->rfkill = NULL;
|
||||
out_error:
|
||||
rfk->registered = 0;
|
||||
b43warn(wl, "RF-kill button init failed\n");
|
||||
}
|
||||
|
||||
void b43_rfkill_exit(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_rfkill *rfk = &(dev->wl->rfkill);
|
||||
|
||||
if (!rfk->registered)
|
||||
return;
|
||||
rfk->registered = 0;
|
||||
|
||||
input_unregister_polled_device(rfk->poll_dev);
|
||||
rfkill_unregister(rfk->rfkill);
|
||||
input_free_polled_device(rfk->poll_dev);
|
||||
rfk->poll_dev = NULL;
|
||||
rfk->rfkill = NULL;
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
#ifndef B43_RFKILL_H_
|
||||
#define B43_RFKILL_H_
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
|
||||
#ifdef CONFIG_B43_RFKILL
|
||||
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/input-polldev.h>
|
||||
|
||||
|
||||
struct b43_rfkill {
|
||||
/* The RFKILL subsystem data structure */
|
||||
struct rfkill *rfkill;
|
||||
/* The poll device for the RFKILL input button */
|
||||
struct input_polled_dev *poll_dev;
|
||||
/* Did initialization succeed? Used for freeing. */
|
||||
bool registered;
|
||||
/* The unique name of this rfkill switch */
|
||||
char name[sizeof("b43-phy4294967295")];
|
||||
};
|
||||
|
||||
/* The init function returns void, because we are not interested
|
||||
* in failing the b43 init process when rfkill init failed. */
|
||||
void b43_rfkill_init(struct b43_wldev *dev);
|
||||
void b43_rfkill_exit(struct b43_wldev *dev);
|
||||
|
||||
char * b43_rfkill_led_name(struct b43_wldev *dev);
|
||||
|
||||
|
||||
#else /* CONFIG_B43_RFKILL */
|
||||
/* No RFKILL support. */
|
||||
|
||||
struct b43_rfkill {
|
||||
/* empty */
|
||||
};
|
||||
|
||||
static inline void b43_rfkill_init(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline void b43_rfkill_exit(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline char * b43_rfkill_led_name(struct b43_wldev *dev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_RFKILL */
|
||||
|
||||
#endif /* B43_RFKILL_H_ */
|
@ -1,149 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
SYSFS support routines
|
||||
|
||||
Copyright (c) 2006 Michael Buesch <mb@bu3sch.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "b43.h"
|
||||
#include "sysfs.h"
|
||||
#include "main.h"
|
||||
#include "phy.h"
|
||||
|
||||
#define GENERIC_FILESIZE 64
|
||||
|
||||
static int get_integer(const char *buf, size_t count)
|
||||
{
|
||||
char tmp[10 + 1] = { 0 };
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (count == 0)
|
||||
goto out;
|
||||
count = min(count, (size_t) 10);
|
||||
memcpy(tmp, buf, count);
|
||||
ret = simple_strtol(tmp, NULL, 10);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t b43_attr_interfmode_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct b43_wldev *wldev = dev_to_b43_wldev(dev);
|
||||
ssize_t count = 0;
|
||||
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
mutex_lock(&wldev->wl->mutex);
|
||||
|
||||
switch (wldev->phy.interfmode) {
|
||||
case B43_INTERFMODE_NONE:
|
||||
count =
|
||||
snprintf(buf, PAGE_SIZE,
|
||||
"0 (No Interference Mitigation)\n");
|
||||
break;
|
||||
case B43_INTERFMODE_NONWLAN:
|
||||
count =
|
||||
snprintf(buf, PAGE_SIZE,
|
||||
"1 (Non-WLAN Interference Mitigation)\n");
|
||||
break;
|
||||
case B43_INTERFMODE_MANUALWLAN:
|
||||
count =
|
||||
snprintf(buf, PAGE_SIZE,
|
||||
"2 (WLAN Interference Mitigation)\n");
|
||||
break;
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
}
|
||||
|
||||
mutex_unlock(&wldev->wl->mutex);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t b43_attr_interfmode_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct b43_wldev *wldev = dev_to_b43_wldev(dev);
|
||||
unsigned long flags;
|
||||
int err;
|
||||
int mode;
|
||||
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
mode = get_integer(buf, count);
|
||||
switch (mode) {
|
||||
case 0:
|
||||
mode = B43_INTERFMODE_NONE;
|
||||
break;
|
||||
case 1:
|
||||
mode = B43_INTERFMODE_NONWLAN;
|
||||
break;
|
||||
case 2:
|
||||
mode = B43_INTERFMODE_MANUALWLAN;
|
||||
break;
|
||||
case 3:
|
||||
mode = B43_INTERFMODE_AUTOWLAN;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&wldev->wl->mutex);
|
||||
spin_lock_irqsave(&wldev->wl->irq_lock, flags);
|
||||
|
||||
err = b43_radio_set_interference_mitigation(wldev, mode);
|
||||
if (err) {
|
||||
b43err(wldev->wl, "Interference Mitigation not "
|
||||
"supported by device\n");
|
||||
}
|
||||
mmiowb();
|
||||
spin_unlock_irqrestore(&wldev->wl->irq_lock, flags);
|
||||
mutex_unlock(&wldev->wl->mutex);
|
||||
|
||||
return err ? err : count;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(interference, 0644,
|
||||
b43_attr_interfmode_show, b43_attr_interfmode_store);
|
||||
|
||||
int b43_sysfs_register(struct b43_wldev *wldev)
|
||||
{
|
||||
struct device *dev = wldev->dev->dev;
|
||||
|
||||
B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED);
|
||||
|
||||
return device_create_file(dev, &dev_attr_interference);
|
||||
}
|
||||
|
||||
void b43_sysfs_unregister(struct b43_wldev *wldev)
|
||||
{
|
||||
struct device *dev = wldev->dev->dev;
|
||||
|
||||
device_remove_file(dev, &dev_attr_interference);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#ifndef B43_SYSFS_H_
|
||||
#define B43_SYSFS_H_
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
int b43_sysfs_register(struct b43_wldev *dev);
|
||||
void b43_sysfs_unregister(struct b43_wldev *dev);
|
||||
|
||||
#endif /* B43_SYSFS_H_ */
|
@ -1,465 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
|
||||
Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
|
||||
Copyright (c) 2006, 2006 Michael Buesch <mb@bu3sch.de>
|
||||
Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
|
||||
Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "b43.h"
|
||||
#include "tables.h"
|
||||
#include "phy.h"
|
||||
|
||||
const u32 b43_tab_rotor[] = {
|
||||
0xFEB93FFD, 0xFEC63FFD, /* 0 */
|
||||
0xFED23FFD, 0xFEDF3FFD,
|
||||
0xFEEC3FFE, 0xFEF83FFE,
|
||||
0xFF053FFE, 0xFF113FFE,
|
||||
0xFF1E3FFE, 0xFF2A3FFF, /* 8 */
|
||||
0xFF373FFF, 0xFF443FFF,
|
||||
0xFF503FFF, 0xFF5D3FFF,
|
||||
0xFF693FFF, 0xFF763FFF,
|
||||
0xFF824000, 0xFF8F4000, /* 16 */
|
||||
0xFF9B4000, 0xFFA84000,
|
||||
0xFFB54000, 0xFFC14000,
|
||||
0xFFCE4000, 0xFFDA4000,
|
||||
0xFFE74000, 0xFFF34000, /* 24 */
|
||||
0x00004000, 0x000D4000,
|
||||
0x00194000, 0x00264000,
|
||||
0x00324000, 0x003F4000,
|
||||
0x004B4000, 0x00584000, /* 32 */
|
||||
0x00654000, 0x00714000,
|
||||
0x007E4000, 0x008A3FFF,
|
||||
0x00973FFF, 0x00A33FFF,
|
||||
0x00B03FFF, 0x00BC3FFF, /* 40 */
|
||||
0x00C93FFF, 0x00D63FFF,
|
||||
0x00E23FFE, 0x00EF3FFE,
|
||||
0x00FB3FFE, 0x01083FFE,
|
||||
0x01143FFE, 0x01213FFD, /* 48 */
|
||||
0x012E3FFD, 0x013A3FFD,
|
||||
0x01473FFD,
|
||||
};
|
||||
|
||||
const u32 b43_tab_retard[] = {
|
||||
0xDB93CB87, 0xD666CF64, /* 0 */
|
||||
0xD1FDD358, 0xCDA6D826,
|
||||
0xCA38DD9F, 0xC729E2B4,
|
||||
0xC469E88E, 0xC26AEE2B,
|
||||
0xC0DEF46C, 0xC073FA62, /* 8 */
|
||||
0xC01D00D5, 0xC0760743,
|
||||
0xC1560D1E, 0xC2E51369,
|
||||
0xC4ED18FF, 0xC7AC1ED7,
|
||||
0xCB2823B2, 0xCEFA28D9, /* 16 */
|
||||
0xD2F62D3F, 0xD7BB3197,
|
||||
0xDCE53568, 0xE1FE3875,
|
||||
0xE7D13B35, 0xED663D35,
|
||||
0xF39B3EC4, 0xF98E3FA7, /* 24 */
|
||||
0x00004000, 0x06723FA7,
|
||||
0x0C653EC4, 0x129A3D35,
|
||||
0x182F3B35, 0x1E023875,
|
||||
0x231B3568, 0x28453197, /* 32 */
|
||||
0x2D0A2D3F, 0x310628D9,
|
||||
0x34D823B2, 0x38541ED7,
|
||||
0x3B1318FF, 0x3D1B1369,
|
||||
0x3EAA0D1E, 0x3F8A0743, /* 40 */
|
||||
0x3FE300D5, 0x3F8DFA62,
|
||||
0x3F22F46C, 0x3D96EE2B,
|
||||
0x3B97E88E, 0x38D7E2B4,
|
||||
0x35C8DD9F, 0x325AD826, /* 48 */
|
||||
0x2E03D358, 0x299ACF64,
|
||||
0x246DCB87,
|
||||
};
|
||||
|
||||
const u16 b43_tab_finefreqa[] = {
|
||||
0x0082, 0x0082, 0x0102, 0x0182, /* 0 */
|
||||
0x0202, 0x0282, 0x0302, 0x0382,
|
||||
0x0402, 0x0482, 0x0502, 0x0582,
|
||||
0x05E2, 0x0662, 0x06E2, 0x0762,
|
||||
0x07E2, 0x0842, 0x08C2, 0x0942, /* 16 */
|
||||
0x09C2, 0x0A22, 0x0AA2, 0x0B02,
|
||||
0x0B82, 0x0BE2, 0x0C62, 0x0CC2,
|
||||
0x0D42, 0x0DA2, 0x0E02, 0x0E62,
|
||||
0x0EE2, 0x0F42, 0x0FA2, 0x1002, /* 32 */
|
||||
0x1062, 0x10C2, 0x1122, 0x1182,
|
||||
0x11E2, 0x1242, 0x12A2, 0x12E2,
|
||||
0x1342, 0x13A2, 0x1402, 0x1442,
|
||||
0x14A2, 0x14E2, 0x1542, 0x1582, /* 48 */
|
||||
0x15E2, 0x1622, 0x1662, 0x16C1,
|
||||
0x1701, 0x1741, 0x1781, 0x17E1,
|
||||
0x1821, 0x1861, 0x18A1, 0x18E1,
|
||||
0x1921, 0x1961, 0x19A1, 0x19E1, /* 64 */
|
||||
0x1A21, 0x1A61, 0x1AA1, 0x1AC1,
|
||||
0x1B01, 0x1B41, 0x1B81, 0x1BA1,
|
||||
0x1BE1, 0x1C21, 0x1C41, 0x1C81,
|
||||
0x1CA1, 0x1CE1, 0x1D01, 0x1D41, /* 80 */
|
||||
0x1D61, 0x1DA1, 0x1DC1, 0x1E01,
|
||||
0x1E21, 0x1E61, 0x1E81, 0x1EA1,
|
||||
0x1EE1, 0x1F01, 0x1F21, 0x1F41,
|
||||
0x1F81, 0x1FA1, 0x1FC1, 0x1FE1, /* 96 */
|
||||
0x2001, 0x2041, 0x2061, 0x2081,
|
||||
0x20A1, 0x20C1, 0x20E1, 0x2101,
|
||||
0x2121, 0x2141, 0x2161, 0x2181,
|
||||
0x21A1, 0x21C1, 0x21E1, 0x2201, /* 112 */
|
||||
0x2221, 0x2241, 0x2261, 0x2281,
|
||||
0x22A1, 0x22C1, 0x22C1, 0x22E1,
|
||||
0x2301, 0x2321, 0x2341, 0x2361,
|
||||
0x2361, 0x2381, 0x23A1, 0x23C1, /* 128 */
|
||||
0x23E1, 0x23E1, 0x2401, 0x2421,
|
||||
0x2441, 0x2441, 0x2461, 0x2481,
|
||||
0x2481, 0x24A1, 0x24C1, 0x24C1,
|
||||
0x24E1, 0x2501, 0x2501, 0x2521, /* 144 */
|
||||
0x2541, 0x2541, 0x2561, 0x2561,
|
||||
0x2581, 0x25A1, 0x25A1, 0x25C1,
|
||||
0x25C1, 0x25E1, 0x2601, 0x2601,
|
||||
0x2621, 0x2621, 0x2641, 0x2641, /* 160 */
|
||||
0x2661, 0x2661, 0x2681, 0x2681,
|
||||
0x26A1, 0x26A1, 0x26C1, 0x26C1,
|
||||
0x26E1, 0x26E1, 0x2701, 0x2701,
|
||||
0x2721, 0x2721, 0x2740, 0x2740, /* 176 */
|
||||
0x2760, 0x2760, 0x2780, 0x2780,
|
||||
0x2780, 0x27A0, 0x27A0, 0x27C0,
|
||||
0x27C0, 0x27E0, 0x27E0, 0x27E0,
|
||||
0x2800, 0x2800, 0x2820, 0x2820, /* 192 */
|
||||
0x2820, 0x2840, 0x2840, 0x2840,
|
||||
0x2860, 0x2860, 0x2880, 0x2880,
|
||||
0x2880, 0x28A0, 0x28A0, 0x28A0,
|
||||
0x28C0, 0x28C0, 0x28C0, 0x28E0, /* 208 */
|
||||
0x28E0, 0x28E0, 0x2900, 0x2900,
|
||||
0x2900, 0x2920, 0x2920, 0x2920,
|
||||
0x2940, 0x2940, 0x2940, 0x2960,
|
||||
0x2960, 0x2960, 0x2960, 0x2980, /* 224 */
|
||||
0x2980, 0x2980, 0x29A0, 0x29A0,
|
||||
0x29A0, 0x29A0, 0x29C0, 0x29C0,
|
||||
0x29C0, 0x29E0, 0x29E0, 0x29E0,
|
||||
0x29E0, 0x2A00, 0x2A00, 0x2A00, /* 240 */
|
||||
0x2A00, 0x2A20, 0x2A20, 0x2A20,
|
||||
0x2A20, 0x2A40, 0x2A40, 0x2A40,
|
||||
0x2A40, 0x2A60, 0x2A60, 0x2A60,
|
||||
};
|
||||
|
||||
const u16 b43_tab_finefreqg[] = {
|
||||
0x0089, 0x02E9, 0x0409, 0x04E9, /* 0 */
|
||||
0x05A9, 0x0669, 0x0709, 0x0789,
|
||||
0x0829, 0x08A9, 0x0929, 0x0989,
|
||||
0x0A09, 0x0A69, 0x0AC9, 0x0B29,
|
||||
0x0BA9, 0x0BE9, 0x0C49, 0x0CA9, /* 16 */
|
||||
0x0D09, 0x0D69, 0x0DA9, 0x0E09,
|
||||
0x0E69, 0x0EA9, 0x0F09, 0x0F49,
|
||||
0x0FA9, 0x0FE9, 0x1029, 0x1089,
|
||||
0x10C9, 0x1109, 0x1169, 0x11A9, /* 32 */
|
||||
0x11E9, 0x1229, 0x1289, 0x12C9,
|
||||
0x1309, 0x1349, 0x1389, 0x13C9,
|
||||
0x1409, 0x1449, 0x14A9, 0x14E9,
|
||||
0x1529, 0x1569, 0x15A9, 0x15E9, /* 48 */
|
||||
0x1629, 0x1669, 0x16A9, 0x16E8,
|
||||
0x1728, 0x1768, 0x17A8, 0x17E8,
|
||||
0x1828, 0x1868, 0x18A8, 0x18E8,
|
||||
0x1928, 0x1968, 0x19A8, 0x19E8, /* 64 */
|
||||
0x1A28, 0x1A68, 0x1AA8, 0x1AE8,
|
||||
0x1B28, 0x1B68, 0x1BA8, 0x1BE8,
|
||||
0x1C28, 0x1C68, 0x1CA8, 0x1CE8,
|
||||
0x1D28, 0x1D68, 0x1DC8, 0x1E08, /* 80 */
|
||||
0x1E48, 0x1E88, 0x1EC8, 0x1F08,
|
||||
0x1F48, 0x1F88, 0x1FE8, 0x2028,
|
||||
0x2068, 0x20A8, 0x2108, 0x2148,
|
||||
0x2188, 0x21C8, 0x2228, 0x2268, /* 96 */
|
||||
0x22C8, 0x2308, 0x2348, 0x23A8,
|
||||
0x23E8, 0x2448, 0x24A8, 0x24E8,
|
||||
0x2548, 0x25A8, 0x2608, 0x2668,
|
||||
0x26C8, 0x2728, 0x2787, 0x27E7, /* 112 */
|
||||
0x2847, 0x28C7, 0x2947, 0x29A7,
|
||||
0x2A27, 0x2AC7, 0x2B47, 0x2BE7,
|
||||
0x2CA7, 0x2D67, 0x2E47, 0x2F67,
|
||||
0x3247, 0x3526, 0x3646, 0x3726, /* 128 */
|
||||
0x3806, 0x38A6, 0x3946, 0x39E6,
|
||||
0x3A66, 0x3AE6, 0x3B66, 0x3BC6,
|
||||
0x3C45, 0x3CA5, 0x3D05, 0x3D85,
|
||||
0x3DE5, 0x3E45, 0x3EA5, 0x3EE5, /* 144 */
|
||||
0x3F45, 0x3FA5, 0x4005, 0x4045,
|
||||
0x40A5, 0x40E5, 0x4145, 0x4185,
|
||||
0x41E5, 0x4225, 0x4265, 0x42C5,
|
||||
0x4305, 0x4345, 0x43A5, 0x43E5, /* 160 */
|
||||
0x4424, 0x4464, 0x44C4, 0x4504,
|
||||
0x4544, 0x4584, 0x45C4, 0x4604,
|
||||
0x4644, 0x46A4, 0x46E4, 0x4724,
|
||||
0x4764, 0x47A4, 0x47E4, 0x4824, /* 176 */
|
||||
0x4864, 0x48A4, 0x48E4, 0x4924,
|
||||
0x4964, 0x49A4, 0x49E4, 0x4A24,
|
||||
0x4A64, 0x4AA4, 0x4AE4, 0x4B23,
|
||||
0x4B63, 0x4BA3, 0x4BE3, 0x4C23, /* 192 */
|
||||
0x4C63, 0x4CA3, 0x4CE3, 0x4D23,
|
||||
0x4D63, 0x4DA3, 0x4DE3, 0x4E23,
|
||||
0x4E63, 0x4EA3, 0x4EE3, 0x4F23,
|
||||
0x4F63, 0x4FC3, 0x5003, 0x5043, /* 208 */
|
||||
0x5083, 0x50C3, 0x5103, 0x5143,
|
||||
0x5183, 0x51E2, 0x5222, 0x5262,
|
||||
0x52A2, 0x52E2, 0x5342, 0x5382,
|
||||
0x53C2, 0x5402, 0x5462, 0x54A2, /* 224 */
|
||||
0x5502, 0x5542, 0x55A2, 0x55E2,
|
||||
0x5642, 0x5682, 0x56E2, 0x5722,
|
||||
0x5782, 0x57E1, 0x5841, 0x58A1,
|
||||
0x5901, 0x5961, 0x59C1, 0x5A21, /* 240 */
|
||||
0x5AA1, 0x5B01, 0x5B81, 0x5BE1,
|
||||
0x5C61, 0x5D01, 0x5D80, 0x5E20,
|
||||
0x5EE0, 0x5FA0, 0x6080, 0x61C0,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisea2[] = {
|
||||
0x0001, 0x0001, 0x0001, 0xFFFE,
|
||||
0xFFFE, 0x3FFF, 0x1000, 0x0393,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisea3[] = {
|
||||
0x5E5E, 0x5E5E, 0x5E5E, 0x3F48,
|
||||
0x4C4C, 0x4C4C, 0x4C4C, 0x2D36,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noiseg1[] = {
|
||||
0x013C, 0x01F5, 0x031A, 0x0631,
|
||||
0x0001, 0x0001, 0x0001, 0x0001,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noiseg2[] = {
|
||||
0x5484, 0x3C40, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisescalea2[] = {
|
||||
0x6767, 0x6767, 0x6767, 0x6767, /* 0 */
|
||||
0x6767, 0x6767, 0x6767, 0x6767,
|
||||
0x6767, 0x6767, 0x6767, 0x6767,
|
||||
0x6767, 0x6700, 0x6767, 0x6767,
|
||||
0x6767, 0x6767, 0x6767, 0x6767, /* 16 */
|
||||
0x6767, 0x6767, 0x6767, 0x6767,
|
||||
0x6767, 0x6767, 0x0067,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisescalea3[] = {
|
||||
0x2323, 0x2323, 0x2323, 0x2323, /* 0 */
|
||||
0x2323, 0x2323, 0x2323, 0x2323,
|
||||
0x2323, 0x2323, 0x2323, 0x2323,
|
||||
0x2323, 0x2300, 0x2323, 0x2323,
|
||||
0x2323, 0x2323, 0x2323, 0x2323, /* 16 */
|
||||
0x2323, 0x2323, 0x2323, 0x2323,
|
||||
0x2323, 0x2323, 0x0023,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisescaleg1[] = {
|
||||
0x6C77, 0x5162, 0x3B40, 0x3335, /* 0 */
|
||||
0x2F2D, 0x2A2A, 0x2527, 0x1F21,
|
||||
0x1A1D, 0x1719, 0x1616, 0x1414,
|
||||
0x1414, 0x1400, 0x1414, 0x1614,
|
||||
0x1716, 0x1A19, 0x1F1D, 0x2521, /* 16 */
|
||||
0x2A27, 0x2F2A, 0x332D, 0x3B35,
|
||||
0x5140, 0x6C62, 0x0077,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisescaleg2[] = {
|
||||
0xD8DD, 0xCBD4, 0xBCC0, 0xB6B7, /* 0 */
|
||||
0xB2B0, 0xADAD, 0xA7A9, 0x9FA1,
|
||||
0x969B, 0x9195, 0x8F8F, 0x8A8A,
|
||||
0x8A8A, 0x8A00, 0x8A8A, 0x8F8A,
|
||||
0x918F, 0x9695, 0x9F9B, 0xA7A1, /* 16 */
|
||||
0xADA9, 0xB2AD, 0xB6B0, 0xBCB7,
|
||||
0xCBC0, 0xD8D4, 0x00DD,
|
||||
};
|
||||
|
||||
const u16 b43_tab_noisescaleg3[] = {
|
||||
0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 0 */
|
||||
0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4,
|
||||
0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4,
|
||||
0xA4A4, 0xA400, 0xA4A4, 0xA4A4,
|
||||
0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 16 */
|
||||
0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4,
|
||||
0xA4A4, 0xA4A4, 0x00A4,
|
||||
};
|
||||
|
||||
const u16 b43_tab_sigmasqr1[] = {
|
||||
0x007A, 0x0075, 0x0071, 0x006C, /* 0 */
|
||||
0x0067, 0x0063, 0x005E, 0x0059,
|
||||
0x0054, 0x0050, 0x004B, 0x0046,
|
||||
0x0042, 0x003D, 0x003D, 0x003D,
|
||||
0x003D, 0x003D, 0x003D, 0x003D, /* 16 */
|
||||
0x003D, 0x003D, 0x003D, 0x003D,
|
||||
0x003D, 0x003D, 0x0000, 0x003D,
|
||||
0x003D, 0x003D, 0x003D, 0x003D,
|
||||
0x003D, 0x003D, 0x003D, 0x003D, /* 32 */
|
||||
0x003D, 0x003D, 0x003D, 0x003D,
|
||||
0x0042, 0x0046, 0x004B, 0x0050,
|
||||
0x0054, 0x0059, 0x005E, 0x0063,
|
||||
0x0067, 0x006C, 0x0071, 0x0075, /* 48 */
|
||||
0x007A,
|
||||
};
|
||||
|
||||
const u16 b43_tab_sigmasqr2[] = {
|
||||
0x00DE, 0x00DC, 0x00DA, 0x00D8, /* 0 */
|
||||
0x00D6, 0x00D4, 0x00D2, 0x00CF,
|
||||
0x00CD, 0x00CA, 0x00C7, 0x00C4,
|
||||
0x00C1, 0x00BE, 0x00BE, 0x00BE,
|
||||
0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 16 */
|
||||
0x00BE, 0x00BE, 0x00BE, 0x00BE,
|
||||
0x00BE, 0x00BE, 0x0000, 0x00BE,
|
||||
0x00BE, 0x00BE, 0x00BE, 0x00BE,
|
||||
0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 32 */
|
||||
0x00BE, 0x00BE, 0x00BE, 0x00BE,
|
||||
0x00C1, 0x00C4, 0x00C7, 0x00CA,
|
||||
0x00CD, 0x00CF, 0x00D2, 0x00D4,
|
||||
0x00D6, 0x00D8, 0x00DA, 0x00DC, /* 48 */
|
||||
0x00DE,
|
||||
};
|
||||
|
||||
const u16 b43_tab_rssiagc1[] = {
|
||||
0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8, /* 0 */
|
||||
0xFFF8, 0xFFF9, 0xFFFC, 0xFFFE,
|
||||
0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8,
|
||||
0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8,
|
||||
};
|
||||
|
||||
const u16 b43_tab_rssiagc2[] = {
|
||||
0x0820, 0x0820, 0x0920, 0x0C38, /* 0 */
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
0x0820, 0x0820, 0x0920, 0x0A38,
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
0x0820, 0x0820, 0x0920, 0x0A38, /* 16 */
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
0x0820, 0x0820, 0x0920, 0x0A38,
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
0x0820, 0x0820, 0x0920, 0x0A38, /* 32 */
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
0x0820, 0x0820, 0x0920, 0x0A38,
|
||||
0x0820, 0x0820, 0x0820, 0x0820,
|
||||
};
|
||||
|
||||
static inline void assert_sizes(void)
|
||||
{
|
||||
BUILD_BUG_ON(B43_TAB_ROTOR_SIZE != ARRAY_SIZE(b43_tab_rotor));
|
||||
BUILD_BUG_ON(B43_TAB_RETARD_SIZE != ARRAY_SIZE(b43_tab_retard));
|
||||
BUILD_BUG_ON(B43_TAB_FINEFREQA_SIZE != ARRAY_SIZE(b43_tab_finefreqa));
|
||||
BUILD_BUG_ON(B43_TAB_FINEFREQG_SIZE != ARRAY_SIZE(b43_tab_finefreqg));
|
||||
BUILD_BUG_ON(B43_TAB_NOISEA2_SIZE != ARRAY_SIZE(b43_tab_noisea2));
|
||||
BUILD_BUG_ON(B43_TAB_NOISEA3_SIZE != ARRAY_SIZE(b43_tab_noisea3));
|
||||
BUILD_BUG_ON(B43_TAB_NOISEG1_SIZE != ARRAY_SIZE(b43_tab_noiseg1));
|
||||
BUILD_BUG_ON(B43_TAB_NOISEG2_SIZE != ARRAY_SIZE(b43_tab_noiseg2));
|
||||
BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE !=
|
||||
ARRAY_SIZE(b43_tab_noisescalea2));
|
||||
BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE !=
|
||||
ARRAY_SIZE(b43_tab_noisescalea3));
|
||||
BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE !=
|
||||
ARRAY_SIZE(b43_tab_noisescaleg1));
|
||||
BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE !=
|
||||
ARRAY_SIZE(b43_tab_noisescaleg2));
|
||||
BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE !=
|
||||
ARRAY_SIZE(b43_tab_noisescaleg3));
|
||||
BUILD_BUG_ON(B43_TAB_SIGMASQR_SIZE != ARRAY_SIZE(b43_tab_sigmasqr1));
|
||||
BUILD_BUG_ON(B43_TAB_SIGMASQR_SIZE != ARRAY_SIZE(b43_tab_sigmasqr2));
|
||||
BUILD_BUG_ON(B43_TAB_RSSIAGC1_SIZE != ARRAY_SIZE(b43_tab_rssiagc1));
|
||||
BUILD_BUG_ON(B43_TAB_RSSIAGC2_SIZE != ARRAY_SIZE(b43_tab_rssiagc2));
|
||||
}
|
||||
|
||||
u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u16 addr;
|
||||
|
||||
addr = table + offset;
|
||||
if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) ||
|
||||
(addr - 1 != phy->ofdmtab_addr)) {
|
||||
/* The hardware has a different address in memory. Update it. */
|
||||
b43_phy_write(dev, B43_PHY_OTABLECTL, addr);
|
||||
phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ;
|
||||
}
|
||||
phy->ofdmtab_addr = addr;
|
||||
|
||||
return b43_phy_read(dev, B43_PHY_OTABLEI);
|
||||
|
||||
/* Some compiletime assertions... */
|
||||
assert_sizes();
|
||||
}
|
||||
|
||||
void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table,
|
||||
u16 offset, u16 value)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u16 addr;
|
||||
|
||||
addr = table + offset;
|
||||
if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) ||
|
||||
(addr - 1 != phy->ofdmtab_addr)) {
|
||||
/* The hardware has a different address in memory. Update it. */
|
||||
b43_phy_write(dev, B43_PHY_OTABLECTL, addr);
|
||||
phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE;
|
||||
}
|
||||
phy->ofdmtab_addr = addr;
|
||||
b43_phy_write(dev, B43_PHY_OTABLEI, value);
|
||||
}
|
||||
|
||||
u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u32 ret;
|
||||
u16 addr;
|
||||
|
||||
addr = table + offset;
|
||||
if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) ||
|
||||
(addr - 1 != phy->ofdmtab_addr)) {
|
||||
/* The hardware has a different address in memory. Update it. */
|
||||
b43_phy_write(dev, B43_PHY_OTABLECTL, addr);
|
||||
phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ;
|
||||
}
|
||||
phy->ofdmtab_addr = addr;
|
||||
ret = b43_phy_read(dev, B43_PHY_OTABLEQ);
|
||||
ret <<= 16;
|
||||
ret |= b43_phy_read(dev, B43_PHY_OTABLEI);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table,
|
||||
u16 offset, u32 value)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u16 addr;
|
||||
|
||||
addr = table + offset;
|
||||
if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) ||
|
||||
(addr - 1 != phy->ofdmtab_addr)) {
|
||||
/* The hardware has a different address in memory. Update it. */
|
||||
b43_phy_write(dev, B43_PHY_OTABLECTL, addr);
|
||||
phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE;
|
||||
}
|
||||
phy->ofdmtab_addr = addr;
|
||||
|
||||
b43_phy_write(dev, B43_PHY_OTABLEI, value);
|
||||
b43_phy_write(dev, B43_PHY_OTABLEQ, (value >> 16));
|
||||
}
|
||||
|
||||
u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_GTABCTL, table + offset);
|
||||
return b43_phy_read(dev, B43_PHY_GTABDATA);
|
||||
}
|
||||
|
||||
void b43_gtab_write(struct b43_wldev *dev, u16 table, u16 offset, u16 value)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_GTABCTL, table + offset);
|
||||
b43_phy_write(dev, B43_PHY_GTABDATA, value);
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
#ifndef B43_TABLES_H_
|
||||
#define B43_TABLES_H_
|
||||
|
||||
#define B43_TAB_ROTOR_SIZE 53
|
||||
extern const u32 b43_tab_rotor[];
|
||||
#define B43_TAB_RETARD_SIZE 53
|
||||
extern const u32 b43_tab_retard[];
|
||||
#define B43_TAB_FINEFREQA_SIZE 256
|
||||
extern const u16 b43_tab_finefreqa[];
|
||||
#define B43_TAB_FINEFREQG_SIZE 256
|
||||
extern const u16 b43_tab_finefreqg[];
|
||||
#define B43_TAB_NOISEA2_SIZE 8
|
||||
extern const u16 b43_tab_noisea2[];
|
||||
#define B43_TAB_NOISEA3_SIZE 8
|
||||
extern const u16 b43_tab_noisea3[];
|
||||
#define B43_TAB_NOISEG1_SIZE 8
|
||||
extern const u16 b43_tab_noiseg1[];
|
||||
#define B43_TAB_NOISEG2_SIZE 8
|
||||
extern const u16 b43_tab_noiseg2[];
|
||||
#define B43_TAB_NOISESCALE_SIZE 27
|
||||
extern const u16 b43_tab_noisescalea2[];
|
||||
extern const u16 b43_tab_noisescalea3[];
|
||||
extern const u16 b43_tab_noisescaleg1[];
|
||||
extern const u16 b43_tab_noisescaleg2[];
|
||||
extern const u16 b43_tab_noisescaleg3[];
|
||||
#define B43_TAB_SIGMASQR_SIZE 53
|
||||
extern const u16 b43_tab_sigmasqr1[];
|
||||
extern const u16 b43_tab_sigmasqr2[];
|
||||
#define B43_TAB_RSSIAGC1_SIZE 16
|
||||
extern const u16 b43_tab_rssiagc1[];
|
||||
#define B43_TAB_RSSIAGC2_SIZE 48
|
||||
extern const u16 b43_tab_rssiagc2[];
|
||||
|
||||
#endif /* B43_TABLES_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,159 +0,0 @@
|
||||
#ifndef B43_TABLES_NPHY_H_
|
||||
#define B43_TABLES_NPHY_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
|
||||
struct b43_nphy_channeltab_entry {
|
||||
/* The channel number */
|
||||
u8 channel;
|
||||
/* Radio register values on channelswitch */
|
||||
u8 radio_pll_ref;
|
||||
u8 radio_rf_pllmod0;
|
||||
u8 radio_rf_pllmod1;
|
||||
u8 radio_vco_captail;
|
||||
u8 radio_vco_cal1;
|
||||
u8 radio_vco_cal2;
|
||||
u8 radio_pll_lfc1;
|
||||
u8 radio_pll_lfr1;
|
||||
u8 radio_pll_lfc2;
|
||||
u8 radio_lgbuf_cenbuf;
|
||||
u8 radio_lgen_tune1;
|
||||
u8 radio_lgen_tune2;
|
||||
u8 radio_c1_lgbuf_atune;
|
||||
u8 radio_c1_lgbuf_gtune;
|
||||
u8 radio_c1_rx_rfr1;
|
||||
u8 radio_c1_tx_pgapadtn;
|
||||
u8 radio_c1_tx_mxbgtrim;
|
||||
u8 radio_c2_lgbuf_atune;
|
||||
u8 radio_c2_lgbuf_gtune;
|
||||
u8 radio_c2_rx_rfr1;
|
||||
u8 radio_c2_tx_pgapadtn;
|
||||
u8 radio_c2_tx_mxbgtrim;
|
||||
/* PHY register values on channelswitch */
|
||||
u16 phy_bw1a;
|
||||
u16 phy_bw2;
|
||||
u16 phy_bw3;
|
||||
u16 phy_bw4;
|
||||
u16 phy_bw5;
|
||||
u16 phy_bw6;
|
||||
/* The channel frequency in MHz */
|
||||
u16 freq;
|
||||
/* An unknown value */
|
||||
u16 unk2;
|
||||
};
|
||||
|
||||
|
||||
struct b43_wldev;
|
||||
|
||||
/* Upload the default register value table.
|
||||
* If "ghz5" is true, we upload the 5Ghz table. Otherwise the 2.4Ghz
|
||||
* table is uploaded. If "ignore_uploadflag" is true, we upload any value
|
||||
* and ignore the "UPLOAD" flag. */
|
||||
void b2055_upload_inittab(struct b43_wldev *dev,
|
||||
bool ghz5, bool ignore_uploadflag);
|
||||
|
||||
|
||||
/* Get the NPHY Channel Switch Table entry for a channel number.
|
||||
* Returns NULL on failure to find an entry. */
|
||||
const struct b43_nphy_channeltab_entry *
|
||||
b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel);
|
||||
|
||||
|
||||
/* The N-PHY tables. */
|
||||
|
||||
#define B43_NTAB_TYPEMASK 0xF0000000
|
||||
#define B43_NTAB_8BIT 0x10000000
|
||||
#define B43_NTAB_16BIT 0x20000000
|
||||
#define B43_NTAB_32BIT 0x30000000
|
||||
#define B43_NTAB8(table, offset) (((table) << 10) | (offset) | B43_NTAB_8BIT)
|
||||
#define B43_NTAB16(table, offset) (((table) << 10) | (offset) | B43_NTAB_16BIT)
|
||||
#define B43_NTAB32(table, offset) (((table) << 10) | (offset) | B43_NTAB_32BIT)
|
||||
|
||||
/* Static N-PHY tables */
|
||||
#define B43_NTAB_FRAMESTRUCT B43_NTAB32(0x0A, 0x000) /* Frame Struct Table */
|
||||
#define B43_NTAB_FRAMESTRUCT_SIZE 832
|
||||
#define B43_NTAB_FRAMELT B43_NTAB8 (0x18, 0x000) /* Frame Lookup Table */
|
||||
#define B43_NTAB_FRAMELT_SIZE 32
|
||||
#define B43_NTAB_TMAP B43_NTAB32(0x0C, 0x000) /* T Map Table */
|
||||
#define B43_NTAB_TMAP_SIZE 448
|
||||
#define B43_NTAB_TDTRN B43_NTAB32(0x0E, 0x000) /* TDTRN Table */
|
||||
#define B43_NTAB_TDTRN_SIZE 704
|
||||
#define B43_NTAB_INTLEVEL B43_NTAB32(0x0D, 0x000) /* Int Level Table */
|
||||
#define B43_NTAB_INTLEVEL_SIZE 7
|
||||
#define B43_NTAB_PILOT B43_NTAB16(0x0B, 0x000) /* Pilot Table */
|
||||
#define B43_NTAB_PILOT_SIZE 88
|
||||
#define B43_NTAB_PILOTLT B43_NTAB32(0x14, 0x000) /* Pilot Lookup Table */
|
||||
#define B43_NTAB_PILOTLT_SIZE 6
|
||||
#define B43_NTAB_TDI20A0 B43_NTAB32(0x13, 0x080) /* TDI Table 20 Antenna 0 */
|
||||
#define B43_NTAB_TDI20A0_SIZE 55
|
||||
#define B43_NTAB_TDI20A1 B43_NTAB32(0x13, 0x100) /* TDI Table 20 Antenna 1 */
|
||||
#define B43_NTAB_TDI20A1_SIZE 55
|
||||
#define B43_NTAB_TDI40A0 B43_NTAB32(0x13, 0x280) /* TDI Table 40 Antenna 0 */
|
||||
#define B43_NTAB_TDI40A0_SIZE 110
|
||||
#define B43_NTAB_TDI40A1 B43_NTAB32(0x13, 0x300) /* TDI Table 40 Antenna 1 */
|
||||
#define B43_NTAB_TDI40A1_SIZE 110
|
||||
#define B43_NTAB_BDI B43_NTAB16(0x15, 0x000) /* BDI Table */
|
||||
#define B43_NTAB_BDI_SIZE 6
|
||||
#define B43_NTAB_CHANEST B43_NTAB32(0x16, 0x000) /* Channel Estimate Table */
|
||||
#define B43_NTAB_CHANEST_SIZE 96
|
||||
#define B43_NTAB_MCS B43_NTAB8 (0x12, 0x000) /* MCS Table */
|
||||
#define B43_NTAB_MCS_SIZE 128
|
||||
|
||||
/* Volatile N-PHY tables */
|
||||
#define B43_NTAB_NOISEVAR10 B43_NTAB32(0x10, 0x000) /* Noise Var Table 10 */
|
||||
#define B43_NTAB_NOISEVAR10_SIZE 256
|
||||
#define B43_NTAB_NOISEVAR11 B43_NTAB32(0x10, 0x080) /* Noise Var Table 11 */
|
||||
#define B43_NTAB_NOISEVAR11_SIZE 256
|
||||
#define B43_NTAB_C0_ESTPLT B43_NTAB8 (0x1A, 0x000) /* Estimate Power Lookup Table Core 0 */
|
||||
#define B43_NTAB_C0_ESTPLT_SIZE 64
|
||||
#define B43_NTAB_C1_ESTPLT B43_NTAB8 (0x1B, 0x000) /* Estimate Power Lookup Table Core 1 */
|
||||
#define B43_NTAB_C1_ESTPLT_SIZE 64
|
||||
#define B43_NTAB_C0_ADJPLT B43_NTAB8 (0x1A, 0x040) /* Adjust Power Lookup Table Core 0 */
|
||||
#define B43_NTAB_C0_ADJPLT_SIZE 128
|
||||
#define B43_NTAB_C1_ADJPLT B43_NTAB8 (0x1B, 0x040) /* Adjust Power Lookup Table Core 1 */
|
||||
#define B43_NTAB_C1_ADJPLT_SIZE 128
|
||||
#define B43_NTAB_C0_GAINCTL B43_NTAB32(0x1A, 0x0C0) /* Gain Control Lookup Table Core 0 */
|
||||
#define B43_NTAB_C0_GAINCTL_SIZE 128
|
||||
#define B43_NTAB_C1_GAINCTL B43_NTAB32(0x1B, 0x0C0) /* Gain Control Lookup Table Core 1 */
|
||||
#define B43_NTAB_C1_GAINCTL_SIZE 128
|
||||
#define B43_NTAB_C0_IQLT B43_NTAB32(0x1A, 0x140) /* IQ Lookup Table Core 0 */
|
||||
#define B43_NTAB_C0_IQLT_SIZE 128
|
||||
#define B43_NTAB_C1_IQLT B43_NTAB32(0x1B, 0x140) /* IQ Lookup Table Core 1 */
|
||||
#define B43_NTAB_C1_IQLT_SIZE 128
|
||||
#define B43_NTAB_C0_LOFEEDTH B43_NTAB16(0x1A, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 0 */
|
||||
#define B43_NTAB_C0_LOFEEDTH_SIZE 128
|
||||
#define B43_NTAB_C1_LOFEEDTH B43_NTAB16(0x1B, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 1 */
|
||||
#define B43_NTAB_C1_LOFEEDTH_SIZE 128
|
||||
|
||||
void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
|
||||
|
||||
extern const u8 b43_ntab_adjustpower0[];
|
||||
extern const u8 b43_ntab_adjustpower1[];
|
||||
extern const u16 b43_ntab_bdi[];
|
||||
extern const u32 b43_ntab_channelest[];
|
||||
extern const u8 b43_ntab_estimatepowerlt0[];
|
||||
extern const u8 b43_ntab_estimatepowerlt1[];
|
||||
extern const u8 b43_ntab_framelookup[];
|
||||
extern const u32 b43_ntab_framestruct[];
|
||||
extern const u32 b43_ntab_gainctl0[];
|
||||
extern const u32 b43_ntab_gainctl1[];
|
||||
extern const u32 b43_ntab_intlevel[];
|
||||
extern const u32 b43_ntab_iqlt0[];
|
||||
extern const u32 b43_ntab_iqlt1[];
|
||||
extern const u16 b43_ntab_loftlt0[];
|
||||
extern const u16 b43_ntab_loftlt1[];
|
||||
extern const u8 b43_ntab_mcs[];
|
||||
extern const u32 b43_ntab_noisevar10[];
|
||||
extern const u32 b43_ntab_noisevar11[];
|
||||
extern const u16 b43_ntab_pilot[];
|
||||
extern const u32 b43_ntab_pilotlt[];
|
||||
extern const u32 b43_ntab_tdi20a0[];
|
||||
extern const u32 b43_ntab_tdi20a1[];
|
||||
extern const u32 b43_ntab_tdi40a0[];
|
||||
extern const u32 b43_ntab_tdi40a1[];
|
||||
extern const u32 b43_ntab_tdtrn[];
|
||||
extern const u32 b43_ntab_tmap[];
|
||||
|
||||
|
||||
#endif /* B43_TABLES_NPHY_H_ */
|
@ -1,675 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
PHY workarounds.
|
||||
|
||||
Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
|
||||
Copyright (c) 2005-2007 Michael Buesch <mbuesch@freenet.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "b43.h"
|
||||
#include "main.h"
|
||||
#include "tables.h"
|
||||
#include "phy.h"
|
||||
#include "wa.h"
|
||||
|
||||
static void b43_wa_papd(struct b43_wldev *dev)
|
||||
{
|
||||
u16 backup;
|
||||
|
||||
backup = b43_ofdmtab_read16(dev, B43_OFDMTAB_PWRDYN2, 0);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_PWRDYN2, 0, 7);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_APHY, 0, 0);
|
||||
b43_dummy_transmission(dev);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_PWRDYN2, 0, backup);
|
||||
}
|
||||
|
||||
static void b43_wa_auxclipthr(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x8E), 0x3800);
|
||||
}
|
||||
|
||||
static void b43_wa_afcdac(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, 0x0035, 0x03FF);
|
||||
b43_phy_write(dev, 0x0036, 0x0400);
|
||||
}
|
||||
|
||||
static void b43_wa_txdc_offset(struct b43_wldev *dev)
|
||||
{
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 0, 0x0051);
|
||||
}
|
||||
|
||||
void b43_wa_initgains(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
b43_phy_write(dev, B43_PHY_LNAHPFCTL, 0x1FF9);
|
||||
b43_phy_write(dev, B43_PHY_LPFGAINCTL,
|
||||
b43_phy_read(dev, B43_PHY_LPFGAINCTL) & 0xFF0F);
|
||||
if (phy->rev <= 2)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_LPFGAIN, 0, 0x1FBF);
|
||||
b43_radio_write16(dev, 0x0002, 0x1FBF);
|
||||
|
||||
b43_phy_write(dev, 0x0024, 0x4680);
|
||||
b43_phy_write(dev, 0x0020, 0x0003);
|
||||
b43_phy_write(dev, 0x001D, 0x0F40);
|
||||
b43_phy_write(dev, 0x001F, 0x1C00);
|
||||
if (phy->rev <= 3)
|
||||
b43_phy_write(dev, 0x002A,
|
||||
(b43_phy_read(dev, 0x002A) & 0x00FF) | 0x0400);
|
||||
else if (phy->rev == 5) {
|
||||
b43_phy_write(dev, 0x002A,
|
||||
(b43_phy_read(dev, 0x002A) & 0x00FF) | 0x1A00);
|
||||
b43_phy_write(dev, 0x00CC, 0x2121);
|
||||
}
|
||||
if (phy->rev >= 3)
|
||||
b43_phy_write(dev, 0x00BA, 0x3ED5);
|
||||
}
|
||||
|
||||
static void b43_wa_divider(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, 0x002B, b43_phy_read(dev, 0x002B) & ~0x0100);
|
||||
b43_phy_write(dev, 0x008E, 0x58C1);
|
||||
}
|
||||
|
||||
static void b43_wa_gt(struct b43_wldev *dev) /* Gain table. */
|
||||
{
|
||||
if (dev->phy.rev <= 2) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 0, 15);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 1, 31);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 2, 42);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 3, 48);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 4, 58);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 0, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 1, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 2, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 3, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 4, 21);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 5, 21);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 6, 25);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 0, 3);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 1, 3);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 2, 7);
|
||||
} else {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 0, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 1, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 2, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 3, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 4, 21);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 5, 21);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 6, 25);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_rssi_lt(struct b43_wldev *dev) /* RSSI lookup table */
|
||||
{
|
||||
int i;
|
||||
|
||||
if (0 /* FIXME: For APHY.rev=2 this might be needed */) {
|
||||
for (i = 0; i < 8; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i + 8);
|
||||
for (i = 8; i < 16; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i - 8);
|
||||
} else {
|
||||
for (i = 0; i < 64; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_analog(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
u16 ofdmrev;
|
||||
|
||||
ofdmrev = b43_phy_read(dev, B43_PHY_VERSION_OFDM) & B43_PHYVER_VERSION;
|
||||
if (ofdmrev > 2) {
|
||||
if (phy->type == B43_PHYTYPE_A)
|
||||
b43_phy_write(dev, B43_PHY_PWRDOWN, 0x1808);
|
||||
else
|
||||
b43_phy_write(dev, B43_PHY_PWRDOWN, 0x1000);
|
||||
} else {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 3, 0x1044);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 4, 0x7201);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 6, 0x0040);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_dac(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->phy.analog == 1)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1,
|
||||
(b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 1) & ~0x0034) | 0x0008);
|
||||
else
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1,
|
||||
(b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 1) & ~0x0078) | 0x0010);
|
||||
}
|
||||
|
||||
static void b43_wa_fft(struct b43_wldev *dev) /* Fine frequency table */
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dev->phy.type == B43_PHYTYPE_A)
|
||||
for (i = 0; i < B43_TAB_FINEFREQA_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DACRFPABB, i, b43_tab_finefreqa[i]);
|
||||
else
|
||||
for (i = 0; i < B43_TAB_FINEFREQG_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DACRFPABB, i, b43_tab_finefreqg[i]);
|
||||
}
|
||||
|
||||
static void b43_wa_nft(struct b43_wldev *dev) /* Noise figure table */
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
int i;
|
||||
|
||||
if (phy->type == B43_PHYTYPE_A) {
|
||||
if (phy->rev == 2)
|
||||
for (i = 0; i < B43_TAB_NOISEA2_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noisea2[i]);
|
||||
else
|
||||
for (i = 0; i < B43_TAB_NOISEA3_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noisea3[i]);
|
||||
} else {
|
||||
if (phy->rev == 1)
|
||||
for (i = 0; i < B43_TAB_NOISEG1_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noiseg1[i]);
|
||||
else
|
||||
for (i = 0; i < B43_TAB_NOISEG2_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noiseg2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_rt(struct b43_wldev *dev) /* Rotor table */
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < B43_TAB_ROTOR_SIZE; i++)
|
||||
b43_ofdmtab_write32(dev, B43_OFDMTAB_ROTOR, i, b43_tab_rotor[i]);
|
||||
}
|
||||
|
||||
static void b43_write_null_nst(struct b43_wldev *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, 0);
|
||||
}
|
||||
|
||||
static void b43_write_nst(struct b43_wldev *dev, const u16 *nst)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, nst[i]);
|
||||
}
|
||||
|
||||
static void b43_wa_nst(struct b43_wldev *dev) /* Noise scale table */
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (phy->type == B43_PHYTYPE_A) {
|
||||
if (phy->rev <= 1)
|
||||
b43_write_null_nst(dev);
|
||||
else if (phy->rev == 2)
|
||||
b43_write_nst(dev, b43_tab_noisescalea2);
|
||||
else if (phy->rev == 3)
|
||||
b43_write_nst(dev, b43_tab_noisescalea3);
|
||||
else
|
||||
b43_write_nst(dev, b43_tab_noisescaleg3);
|
||||
} else {
|
||||
if (phy->rev >= 6) {
|
||||
if (b43_phy_read(dev, B43_PHY_ENCORE) & B43_PHY_ENCORE_EN)
|
||||
b43_write_nst(dev, b43_tab_noisescaleg3);
|
||||
else
|
||||
b43_write_nst(dev, b43_tab_noisescaleg2);
|
||||
} else {
|
||||
b43_write_nst(dev, b43_tab_noisescaleg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_art(struct b43_wldev *dev) /* ADV retard table */
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < B43_TAB_RETARD_SIZE; i++)
|
||||
b43_ofdmtab_write32(dev, B43_OFDMTAB_ADVRETARD,
|
||||
i, b43_tab_retard[i]);
|
||||
}
|
||||
|
||||
static void b43_wa_txlna_gain(struct b43_wldev *dev)
|
||||
{
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 13, 0x0000);
|
||||
}
|
||||
|
||||
static void b43_wa_crs_reset(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, 0x002C, 0x0064);
|
||||
}
|
||||
|
||||
static void b43_wa_2060txlna_gain(struct b43_wldev *dev)
|
||||
{
|
||||
b43_hf_write(dev, b43_hf_read(dev) |
|
||||
B43_HF_2060W);
|
||||
}
|
||||
|
||||
static void b43_wa_lms(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, 0x0055,
|
||||
(b43_phy_read(dev, 0x0055) & 0xFFC0) | 0x0004);
|
||||
}
|
||||
|
||||
static void b43_wa_mixedsignal(struct b43_wldev *dev)
|
||||
{
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1, 3);
|
||||
}
|
||||
|
||||
static void b43_wa_msst(struct b43_wldev *dev) /* Min sigma square table */
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
int i;
|
||||
const u16 *tab;
|
||||
|
||||
if (phy->type == B43_PHYTYPE_A) {
|
||||
tab = b43_tab_sigmasqr1;
|
||||
} else if (phy->type == B43_PHYTYPE_G) {
|
||||
tab = b43_tab_sigmasqr2;
|
||||
} else {
|
||||
B43_WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < B43_TAB_SIGMASQR_SIZE; i++) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_MINSIGSQ,
|
||||
i, tab[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_iqadc(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->phy.analog == 4)
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 0,
|
||||
b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 0) & ~0xF000);
|
||||
}
|
||||
|
||||
static void b43_wa_crs_ed(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (phy->rev == 1) {
|
||||
b43_phy_write(dev, B43_PHY_CRSTHRES1_R1, 0x4F19);
|
||||
} else if (phy->rev == 2) {
|
||||
b43_phy_write(dev, B43_PHY_CRSTHRES1, 0x1861);
|
||||
b43_phy_write(dev, B43_PHY_CRSTHRES2, 0x0271);
|
||||
b43_phy_write(dev, B43_PHY_ANTDWELL,
|
||||
b43_phy_read(dev, B43_PHY_ANTDWELL)
|
||||
| 0x0800);
|
||||
} else {
|
||||
b43_phy_write(dev, B43_PHY_CRSTHRES1, 0x0098);
|
||||
b43_phy_write(dev, B43_PHY_CRSTHRES2, 0x0070);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0xC9), 0x0080);
|
||||
b43_phy_write(dev, B43_PHY_ANTDWELL,
|
||||
b43_phy_read(dev, B43_PHY_ANTDWELL)
|
||||
| 0x0800);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_crs_thr(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_CRS0,
|
||||
(b43_phy_read(dev, B43_PHY_CRS0) & ~0x03C0) | 0xD000);
|
||||
}
|
||||
|
||||
static void b43_wa_crs_blank(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x2C), 0x005A);
|
||||
}
|
||||
|
||||
static void b43_wa_cck_shiftbits(struct b43_wldev *dev)
|
||||
{
|
||||
b43_phy_write(dev, B43_PHY_CCKSHIFTBITS, 0x0026);
|
||||
}
|
||||
|
||||
static void b43_wa_wrssi_offset(struct b43_wldev *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dev->phy.rev == 1) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_WRSSI_R1,
|
||||
i, 0x0020);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 32; i++) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_WRSSI,
|
||||
i, 0x0820);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_txpuoff_rxpuon(struct b43_wldev *dev)
|
||||
{
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_0F, 2, 15);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_0F, 3, 20);
|
||||
}
|
||||
|
||||
static void b43_wa_altagc(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (phy->rev == 1) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 0, 254);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 1, 13);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 2, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 3, 25);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 0, 0x2710);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 1, 0x9B83);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 2, 0x9B83);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 3, 0x0F8D);
|
||||
b43_phy_write(dev, B43_PHY_LMS, 4);
|
||||
} else {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 0, 254);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 1, 13);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 2, 19);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 3, 25);
|
||||
}
|
||||
|
||||
b43_phy_write(dev, B43_PHY_CCKSHIFTBITS_WA,
|
||||
(b43_phy_read(dev, B43_PHY_CCKSHIFTBITS_WA) & ~0xFF00) | 0x5700);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x1A),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x1A)) & ~0x007F) | 0x000F);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x1A),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x1A)) & ~0x3F80) | 0x2B80);
|
||||
b43_phy_write(dev, B43_PHY_ANTWRSETT,
|
||||
(b43_phy_read(dev, B43_PHY_ANTWRSETT) & 0xF0FF) | 0x0300);
|
||||
b43_radio_write16(dev, 0x7A,
|
||||
b43_radio_read16(dev, 0x7A) | 0x0008);
|
||||
b43_phy_write(dev, B43_PHY_N1P1GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_N1P1GAIN) & ~0x000F) | 0x0008);
|
||||
b43_phy_write(dev, B43_PHY_P1P2GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_P1P2GAIN) & ~0x0F00) | 0x0600);
|
||||
b43_phy_write(dev, B43_PHY_N1N2GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_N1N2GAIN) & ~0x0F00) | 0x0700);
|
||||
b43_phy_write(dev, B43_PHY_N1P1GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_N1P1GAIN) & ~0x0F00) | 0x0100);
|
||||
if (phy->rev == 1) {
|
||||
b43_phy_write(dev, B43_PHY_N1N2GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_N1N2GAIN)
|
||||
& ~0x000F) | 0x0007);
|
||||
}
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x88),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x88)) & ~0x00FF) | 0x001C);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x88),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x88)) & ~0x3F00) | 0x0200);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x96),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x96)) & ~0x00FF) | 0x001C);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x89),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x89)) & ~0x00FF) | 0x0020);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x89),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x89)) & ~0x3F00) | 0x0200);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x82),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x82)) & ~0x00FF) | 0x002E);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x96),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x96)) & ~0xFF00) | 0x1A00);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x81),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x81)) & ~0x00FF) | 0x0028);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x81),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x81)) & ~0xFF00) | 0x2C00);
|
||||
if (phy->rev == 1) {
|
||||
b43_phy_write(dev, B43_PHY_PEAK_COUNT, 0x092B);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x1B),
|
||||
(b43_phy_read(dev, B43_PHY_OFDM(0x1B)) & ~0x001E) | 0x0002);
|
||||
} else {
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x1B),
|
||||
b43_phy_read(dev, B43_PHY_OFDM(0x1B)) & ~0x001E);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x1F), 0x287A);
|
||||
b43_phy_write(dev, B43_PHY_LPFGAINCTL,
|
||||
(b43_phy_read(dev, B43_PHY_LPFGAINCTL) & ~0x000F) | 0x0004);
|
||||
if (phy->rev >= 6) {
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x22), 0x287A);
|
||||
b43_phy_write(dev, B43_PHY_LPFGAINCTL,
|
||||
(b43_phy_read(dev, B43_PHY_LPFGAINCTL) & ~0xF000) | 0x3000);
|
||||
}
|
||||
}
|
||||
b43_phy_write(dev, B43_PHY_DIVSRCHIDX,
|
||||
(b43_phy_read(dev, B43_PHY_DIVSRCHIDX) & 0x8080) | 0x7874);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x8E), 0x1C00);
|
||||
if (phy->rev == 1) {
|
||||
b43_phy_write(dev, B43_PHY_DIVP1P2GAIN,
|
||||
(b43_phy_read(dev, B43_PHY_DIVP1P2GAIN) & ~0x0F00) | 0x0600);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x8B), 0x005E);
|
||||
b43_phy_write(dev, B43_PHY_ANTWRSETT,
|
||||
(b43_phy_read(dev, B43_PHY_ANTWRSETT) & ~0x00FF) | 0x001E);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x8D), 0x0002);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 0, 0);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 1, 7);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 2, 16);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 3, 28);
|
||||
} else {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 0, 0);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 1, 7);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 2, 16);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 3, 28);
|
||||
}
|
||||
if (phy->rev >= 6) {
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x26),
|
||||
b43_phy_read(dev, B43_PHY_OFDM(0x26)) & ~0x0003);
|
||||
b43_phy_write(dev, B43_PHY_OFDM(0x26),
|
||||
b43_phy_read(dev, B43_PHY_OFDM(0x26)) & ~0x1000);
|
||||
}
|
||||
b43_phy_read(dev, B43_PHY_VERSION_OFDM); /* Dummy read */
|
||||
}
|
||||
|
||||
static void b43_wa_tr_ltov(struct b43_wldev *dev) /* TR Lookup Table Original Values */
|
||||
{
|
||||
b43_gtab_write(dev, B43_GTAB_ORIGTR, 0, 0xC480);
|
||||
}
|
||||
|
||||
static void b43_wa_cpll_nonpilot(struct b43_wldev *dev)
|
||||
{
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_11, 0, 0);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_11, 1, 0);
|
||||
}
|
||||
|
||||
static void b43_wa_rssi_adc(struct b43_wldev *dev)
|
||||
{
|
||||
if (dev->phy.analog == 4)
|
||||
b43_phy_write(dev, 0x00DC, 0x7454);
|
||||
}
|
||||
|
||||
static void b43_wa_boards_a(struct b43_wldev *dev)
|
||||
{
|
||||
struct ssb_bus *bus = dev->dev->bus;
|
||||
|
||||
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM &&
|
||||
bus->boardinfo.type == SSB_BOARD_BU4306 &&
|
||||
bus->boardinfo.rev < 0x30) {
|
||||
b43_phy_write(dev, 0x0010, 0xE000);
|
||||
b43_phy_write(dev, 0x0013, 0x0140);
|
||||
b43_phy_write(dev, 0x0014, 0x0280);
|
||||
} else {
|
||||
if (bus->boardinfo.type == SSB_BOARD_MP4318 &&
|
||||
bus->boardinfo.rev < 0x20) {
|
||||
b43_phy_write(dev, 0x0013, 0x0210);
|
||||
b43_phy_write(dev, 0x0014, 0x0840);
|
||||
} else {
|
||||
b43_phy_write(dev, 0x0013, 0x0140);
|
||||
b43_phy_write(dev, 0x0014, 0x0280);
|
||||
}
|
||||
if (dev->phy.rev <= 4)
|
||||
b43_phy_write(dev, 0x0010, 0xE000);
|
||||
else
|
||||
b43_phy_write(dev, 0x0010, 0x2000);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 1, 0x0039);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_APHY, 7, 0x0040);
|
||||
}
|
||||
}
|
||||
|
||||
static void b43_wa_boards_g(struct b43_wldev *dev)
|
||||
{
|
||||
struct ssb_bus *bus = dev->dev->bus;
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM ||
|
||||
bus->boardinfo.type != SSB_BOARD_BU4306 ||
|
||||
bus->boardinfo.rev != 0x17) {
|
||||
if (phy->rev < 2) {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 1, 0x0002);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 2, 0x0001);
|
||||
} else {
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 1, 0x0002);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 2, 0x0001);
|
||||
if ((bus->sprom.boardflags_lo & B43_BFL_EXTLNA) &&
|
||||
(phy->rev >= 7)) {
|
||||
b43_phy_write(dev, B43_PHY_EXTG(0x11),
|
||||
b43_phy_read(dev, B43_PHY_EXTG(0x11)) & 0xF7FF);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0020, 0x0001);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0021, 0x0001);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0022, 0x0001);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0023, 0x0000);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0000, 0x0000);
|
||||
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0003, 0x0002);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bus->sprom.boardflags_lo & B43_BFL_FEM) {
|
||||
b43_phy_write(dev, B43_PHY_GTABCTL, 0x3120);
|
||||
b43_phy_write(dev, B43_PHY_GTABDATA, 0xC480);
|
||||
}
|
||||
}
|
||||
|
||||
void b43_wa_all(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
|
||||
if (phy->type == B43_PHYTYPE_A) {
|
||||
switch (phy->rev) {
|
||||
case 2:
|
||||
b43_wa_papd(dev);
|
||||
b43_wa_auxclipthr(dev);
|
||||
b43_wa_afcdac(dev);
|
||||
b43_wa_txdc_offset(dev);
|
||||
b43_wa_initgains(dev);
|
||||
b43_wa_divider(dev);
|
||||
b43_wa_gt(dev);
|
||||
b43_wa_rssi_lt(dev);
|
||||
b43_wa_analog(dev);
|
||||
b43_wa_dac(dev);
|
||||
b43_wa_fft(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_rt(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_art(dev);
|
||||
b43_wa_txlna_gain(dev);
|
||||
b43_wa_crs_reset(dev);
|
||||
b43_wa_2060txlna_gain(dev);
|
||||
b43_wa_lms(dev);
|
||||
break;
|
||||
case 3:
|
||||
b43_wa_papd(dev);
|
||||
b43_wa_mixedsignal(dev);
|
||||
b43_wa_rssi_lt(dev);
|
||||
b43_wa_txdc_offset(dev);
|
||||
b43_wa_initgains(dev);
|
||||
b43_wa_dac(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_msst(dev);
|
||||
b43_wa_analog(dev);
|
||||
b43_wa_gt(dev);
|
||||
b43_wa_txpuoff_rxpuon(dev);
|
||||
b43_wa_txlna_gain(dev);
|
||||
break;
|
||||
case 5:
|
||||
b43_wa_iqadc(dev);
|
||||
case 6:
|
||||
b43_wa_papd(dev);
|
||||
b43_wa_rssi_lt(dev);
|
||||
b43_wa_txdc_offset(dev);
|
||||
b43_wa_initgains(dev);
|
||||
b43_wa_dac(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_msst(dev);
|
||||
b43_wa_analog(dev);
|
||||
b43_wa_gt(dev);
|
||||
b43_wa_txpuoff_rxpuon(dev);
|
||||
b43_wa_txlna_gain(dev);
|
||||
break;
|
||||
case 7:
|
||||
b43_wa_iqadc(dev);
|
||||
b43_wa_papd(dev);
|
||||
b43_wa_rssi_lt(dev);
|
||||
b43_wa_txdc_offset(dev);
|
||||
b43_wa_initgains(dev);
|
||||
b43_wa_dac(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_msst(dev);
|
||||
b43_wa_analog(dev);
|
||||
b43_wa_gt(dev);
|
||||
b43_wa_txpuoff_rxpuon(dev);
|
||||
b43_wa_txlna_gain(dev);
|
||||
b43_wa_rssi_adc(dev);
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
}
|
||||
b43_wa_boards_a(dev);
|
||||
} else if (phy->type == B43_PHYTYPE_G) {
|
||||
switch (phy->rev) {
|
||||
case 1://XXX review rev1
|
||||
b43_wa_crs_ed(dev);
|
||||
b43_wa_crs_thr(dev);
|
||||
b43_wa_crs_blank(dev);
|
||||
b43_wa_cck_shiftbits(dev);
|
||||
b43_wa_fft(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_rt(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_art(dev);
|
||||
b43_wa_wrssi_offset(dev);
|
||||
b43_wa_altagc(dev);
|
||||
break;
|
||||
case 2:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
b43_wa_tr_ltov(dev);
|
||||
b43_wa_crs_ed(dev);
|
||||
b43_wa_rssi_lt(dev);
|
||||
b43_wa_nft(dev);
|
||||
b43_wa_nst(dev);
|
||||
b43_wa_msst(dev);
|
||||
b43_wa_wrssi_offset(dev);
|
||||
b43_wa_altagc(dev);
|
||||
b43_wa_analog(dev);
|
||||
b43_wa_txpuoff_rxpuon(dev);
|
||||
break;
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
}
|
||||
b43_wa_boards_g(dev);
|
||||
} else { /* No N PHY support so far */
|
||||
B43_WARN_ON(1);
|
||||
}
|
||||
|
||||
b43_wa_cpll_nonpilot(dev);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#ifndef B43_WA_H_
|
||||
#define B43_WA_H_
|
||||
|
||||
void b43_wa_initgains(struct b43_wldev *dev);
|
||||
void b43_wa_all(struct b43_wldev *dev);
|
||||
|
||||
#endif /* B43_WA_H_ */
|
@ -1,729 +0,0 @@
|
||||
/*
|
||||
|
||||
Broadcom B43 wireless driver
|
||||
|
||||
Transmission (TX/RX) related functions.
|
||||
|
||||
Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
|
||||
Copyright (C) 2005 Stefano Brivio <stefano.brivio@polimi.it>
|
||||
Copyright (C) 2005, 2006 Michael Buesch <mb@bu3sch.de>
|
||||
Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
|
||||
Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "xmit.h"
|
||||
#include "phy.h"
|
||||
#include "dma.h"
|
||||
#include "pio.h"
|
||||
|
||||
|
||||
/* Extract the bitrate index out of a CCK PLCP header. */
|
||||
static int b43_plcp_get_bitrate_idx_cck(struct b43_plcp_hdr6 *plcp)
|
||||
{
|
||||
switch (plcp->raw[0]) {
|
||||
case 0x0A:
|
||||
return 0;
|
||||
case 0x14:
|
||||
return 1;
|
||||
case 0x37:
|
||||
return 2;
|
||||
case 0x6E:
|
||||
return 3;
|
||||
}
|
||||
B43_WARN_ON(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Extract the bitrate index out of an OFDM PLCP header. */
|
||||
static u8 b43_plcp_get_bitrate_idx_ofdm(struct b43_plcp_hdr6 *plcp, bool aphy)
|
||||
{
|
||||
int base = aphy ? 0 : 4;
|
||||
|
||||
switch (plcp->raw[0] & 0xF) {
|
||||
case 0xB:
|
||||
return base + 0;
|
||||
case 0xF:
|
||||
return base + 1;
|
||||
case 0xA:
|
||||
return base + 2;
|
||||
case 0xE:
|
||||
return base + 3;
|
||||
case 0x9:
|
||||
return base + 4;
|
||||
case 0xD:
|
||||
return base + 5;
|
||||
case 0x8:
|
||||
return base + 6;
|
||||
case 0xC:
|
||||
return base + 7;
|
||||
}
|
||||
B43_WARN_ON(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
u8 b43_plcp_get_ratecode_cck(const u8 bitrate)
|
||||
{
|
||||
switch (bitrate) {
|
||||
case B43_CCK_RATE_1MB:
|
||||
return 0x0A;
|
||||
case B43_CCK_RATE_2MB:
|
||||
return 0x14;
|
||||
case B43_CCK_RATE_5MB:
|
||||
return 0x37;
|
||||
case B43_CCK_RATE_11MB:
|
||||
return 0x6E;
|
||||
}
|
||||
B43_WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate)
|
||||
{
|
||||
switch (bitrate) {
|
||||
case B43_OFDM_RATE_6MB:
|
||||
return 0xB;
|
||||
case B43_OFDM_RATE_9MB:
|
||||
return 0xF;
|
||||
case B43_OFDM_RATE_12MB:
|
||||
return 0xA;
|
||||
case B43_OFDM_RATE_18MB:
|
||||
return 0xE;
|
||||
case B43_OFDM_RATE_24MB:
|
||||
return 0x9;
|
||||
case B43_OFDM_RATE_36MB:
|
||||
return 0xD;
|
||||
case B43_OFDM_RATE_48MB:
|
||||
return 0x8;
|
||||
case B43_OFDM_RATE_54MB:
|
||||
return 0xC;
|
||||
}
|
||||
B43_WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
||||
const u16 octets, const u8 bitrate)
|
||||
{
|
||||
__le32 *data = &(plcp->data);
|
||||
__u8 *raw = plcp->raw;
|
||||
|
||||
if (b43_is_ofdm_rate(bitrate)) {
|
||||
u32 d;
|
||||
|
||||
d = b43_plcp_get_ratecode_ofdm(bitrate);
|
||||
B43_WARN_ON(octets & 0xF000);
|
||||
d |= (octets << 5);
|
||||
*data = cpu_to_le32(d);
|
||||
} else {
|
||||
u32 plen;
|
||||
|
||||
plen = octets * 16 / bitrate;
|
||||
if ((octets * 16 % bitrate) > 0) {
|
||||
plen++;
|
||||
if ((bitrate == B43_CCK_RATE_11MB)
|
||||
&& ((octets * 8 % 11) < 4)) {
|
||||
raw[1] = 0x84;
|
||||
} else
|
||||
raw[1] = 0x04;
|
||||
} else
|
||||
raw[1] = 0x04;
|
||||
*data |= cpu_to_le32(plen << 16);
|
||||
raw[0] = b43_plcp_get_ratecode_cck(bitrate);
|
||||
}
|
||||
}
|
||||
|
||||
static u8 b43_calc_fallback_rate(u8 bitrate)
|
||||
{
|
||||
switch (bitrate) {
|
||||
case B43_CCK_RATE_1MB:
|
||||
return B43_CCK_RATE_1MB;
|
||||
case B43_CCK_RATE_2MB:
|
||||
return B43_CCK_RATE_1MB;
|
||||
case B43_CCK_RATE_5MB:
|
||||
return B43_CCK_RATE_2MB;
|
||||
case B43_CCK_RATE_11MB:
|
||||
return B43_CCK_RATE_5MB;
|
||||
case B43_OFDM_RATE_6MB:
|
||||
return B43_CCK_RATE_5MB;
|
||||
case B43_OFDM_RATE_9MB:
|
||||
return B43_OFDM_RATE_6MB;
|
||||
case B43_OFDM_RATE_12MB:
|
||||
return B43_OFDM_RATE_9MB;
|
||||
case B43_OFDM_RATE_18MB:
|
||||
return B43_OFDM_RATE_12MB;
|
||||
case B43_OFDM_RATE_24MB:
|
||||
return B43_OFDM_RATE_18MB;
|
||||
case B43_OFDM_RATE_36MB:
|
||||
return B43_OFDM_RATE_24MB;
|
||||
case B43_OFDM_RATE_48MB:
|
||||
return B43_OFDM_RATE_36MB;
|
||||
case B43_OFDM_RATE_54MB:
|
||||
return B43_OFDM_RATE_48MB;
|
||||
}
|
||||
B43_WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Generate a TX data header. */
|
||||
int b43_generate_txhdr(struct b43_wldev *dev,
|
||||
u8 *_txhdr,
|
||||
const unsigned char *fragment_data,
|
||||
unsigned int fragment_len,
|
||||
const struct ieee80211_tx_info *info,
|
||||
u16 cookie)
|
||||
{
|
||||
struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr;
|
||||
const struct b43_phy *phy = &dev->phy;
|
||||
const struct ieee80211_hdr *wlhdr =
|
||||
(const struct ieee80211_hdr *)fragment_data;
|
||||
int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
|
||||
u16 fctl = le16_to_cpu(wlhdr->frame_control);
|
||||
struct ieee80211_rate *fbrate;
|
||||
u8 rate, rate_fb;
|
||||
int rate_ofdm, rate_fb_ofdm;
|
||||
unsigned int plcp_fragment_len;
|
||||
u32 mac_ctl = 0;
|
||||
u16 phy_ctl = 0;
|
||||
u8 extra_ft = 0;
|
||||
struct ieee80211_rate *txrate;
|
||||
|
||||
memset(txhdr, 0, sizeof(*txhdr));
|
||||
|
||||
txrate = ieee80211_get_tx_rate(dev->wl->hw, info);
|
||||
rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB;
|
||||
rate_ofdm = b43_is_ofdm_rate(rate);
|
||||
fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, info) ? : txrate;
|
||||
rate_fb = fbrate->hw_value;
|
||||
rate_fb_ofdm = b43_is_ofdm_rate(rate_fb);
|
||||
|
||||
if (rate_ofdm)
|
||||
txhdr->phy_rate = b43_plcp_get_ratecode_ofdm(rate);
|
||||
else
|
||||
txhdr->phy_rate = b43_plcp_get_ratecode_cck(rate);
|
||||
txhdr->mac_frame_ctl = wlhdr->frame_control;
|
||||
memcpy(txhdr->tx_receiver, wlhdr->addr1, 6);
|
||||
|
||||
/* Calculate duration for fallback rate */
|
||||
if ((rate_fb == rate) ||
|
||||
(wlhdr->duration_id & cpu_to_le16(0x8000)) ||
|
||||
(wlhdr->duration_id == cpu_to_le16(0))) {
|
||||
/* If the fallback rate equals the normal rate or the
|
||||
* dur_id field contains an AID, CFP magic or 0,
|
||||
* use the original dur_id field. */
|
||||
txhdr->dur_fb = wlhdr->duration_id;
|
||||
} else {
|
||||
txhdr->dur_fb = ieee80211_generic_frame_duration(
|
||||
dev->wl->hw, info->control.vif, fragment_len, fbrate);
|
||||
}
|
||||
|
||||
plcp_fragment_len = fragment_len + FCS_LEN;
|
||||
if (use_encryption) {
|
||||
u8 key_idx = info->control.hw_key->hw_key_idx;
|
||||
struct b43_key *key;
|
||||
int wlhdr_len;
|
||||
size_t iv_len;
|
||||
|
||||
B43_WARN_ON(key_idx >= dev->max_nr_keys);
|
||||
key = &(dev->key[key_idx]);
|
||||
|
||||
if (unlikely(!key->keyconf)) {
|
||||
/* This key is invalid. This might only happen
|
||||
* in a short timeframe after machine resume before
|
||||
* we were able to reconfigure keys.
|
||||
* Drop this packet completely. Do not transmit it
|
||||
* unencrypted to avoid leaking information. */
|
||||
return -ENOKEY;
|
||||
}
|
||||
|
||||
/* Hardware appends ICV. */
|
||||
plcp_fragment_len += info->control.icv_len;
|
||||
|
||||
key_idx = b43_kidx_to_fw(dev, key_idx);
|
||||
mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
|
||||
B43_TXH_MAC_KEYIDX;
|
||||
mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
|
||||
B43_TXH_MAC_KEYALG;
|
||||
wlhdr_len = ieee80211_get_hdrlen(fctl);
|
||||
iv_len = min((size_t) info->control.iv_len,
|
||||
ARRAY_SIZE(txhdr->iv));
|
||||
memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
|
||||
}
|
||||
if (b43_is_old_txhdr_format(dev)) {
|
||||
b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->old_format.plcp),
|
||||
plcp_fragment_len, rate);
|
||||
} else {
|
||||
b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->new_format.plcp),
|
||||
plcp_fragment_len, rate);
|
||||
}
|
||||
b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->plcp_fb),
|
||||
plcp_fragment_len, rate_fb);
|
||||
|
||||
/* Extra Frame Types */
|
||||
if (rate_fb_ofdm)
|
||||
extra_ft |= B43_TXH_EFT_FB_OFDM;
|
||||
else
|
||||
extra_ft |= B43_TXH_EFT_FB_CCK;
|
||||
|
||||
/* Set channel radio code. Note that the micrcode ORs 0x100 to
|
||||
* this value before comparing it to the value in SHM, if this
|
||||
* is a 5Ghz packet.
|
||||
*/
|
||||
txhdr->chan_radio_code = phy->channel;
|
||||
|
||||
/* PHY TX Control word */
|
||||
if (rate_ofdm)
|
||||
phy_ctl |= B43_TXH_PHY_ENC_OFDM;
|
||||
else
|
||||
phy_ctl |= B43_TXH_PHY_ENC_CCK;
|
||||
if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE)
|
||||
phy_ctl |= B43_TXH_PHY_SHORTPRMBL;
|
||||
|
||||
switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) {
|
||||
case 0: /* Default */
|
||||
phy_ctl |= B43_TXH_PHY_ANT01AUTO;
|
||||
break;
|
||||
case 1: /* Antenna 0 */
|
||||
phy_ctl |= B43_TXH_PHY_ANT0;
|
||||
break;
|
||||
case 2: /* Antenna 1 */
|
||||
phy_ctl |= B43_TXH_PHY_ANT1;
|
||||
break;
|
||||
case 3: /* Antenna 2 */
|
||||
phy_ctl |= B43_TXH_PHY_ANT2;
|
||||
break;
|
||||
case 4: /* Antenna 3 */
|
||||
phy_ctl |= B43_TXH_PHY_ANT3;
|
||||
break;
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
}
|
||||
|
||||
/* MAC control */
|
||||
if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
|
||||
mac_ctl |= B43_TXH_MAC_ACK;
|
||||
if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
|
||||
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
|
||||
mac_ctl |= B43_TXH_MAC_HWSEQ;
|
||||
if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
|
||||
mac_ctl |= B43_TXH_MAC_STMSDU;
|
||||
if (phy->type == B43_PHYTYPE_A)
|
||||
mac_ctl |= B43_TXH_MAC_5GHZ;
|
||||
if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT)
|
||||
mac_ctl |= B43_TXH_MAC_LONGFRAME;
|
||||
|
||||
/* Generate the RTS or CTS-to-self frame */
|
||||
if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
|
||||
(info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
|
||||
unsigned int len;
|
||||
struct ieee80211_hdr *hdr;
|
||||
int rts_rate, rts_rate_fb;
|
||||
int rts_rate_ofdm, rts_rate_fb_ofdm;
|
||||
struct b43_plcp_hdr6 *plcp;
|
||||
struct ieee80211_rate *rts_cts_rate;
|
||||
|
||||
rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info);
|
||||
|
||||
rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB;
|
||||
rts_rate_ofdm = b43_is_ofdm_rate(rts_rate);
|
||||
rts_rate_fb = b43_calc_fallback_rate(rts_rate);
|
||||
rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
|
||||
|
||||
if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
|
||||
struct ieee80211_cts *cts;
|
||||
|
||||
if (b43_is_old_txhdr_format(dev)) {
|
||||
cts = (struct ieee80211_cts *)
|
||||
(txhdr->old_format.rts_frame);
|
||||
} else {
|
||||
cts = (struct ieee80211_cts *)
|
||||
(txhdr->new_format.rts_frame);
|
||||
}
|
||||
ieee80211_ctstoself_get(dev->wl->hw, info->control.vif,
|
||||
fragment_data, fragment_len,
|
||||
info, cts);
|
||||
mac_ctl |= B43_TXH_MAC_SENDCTS;
|
||||
len = sizeof(struct ieee80211_cts);
|
||||
} else {
|
||||
struct ieee80211_rts *rts;
|
||||
|
||||
if (b43_is_old_txhdr_format(dev)) {
|
||||
rts = (struct ieee80211_rts *)
|
||||
(txhdr->old_format.rts_frame);
|
||||
} else {
|
||||
rts = (struct ieee80211_rts *)
|
||||
(txhdr->new_format.rts_frame);
|
||||
}
|
||||
ieee80211_rts_get(dev->wl->hw, info->control.vif,
|
||||
fragment_data, fragment_len,
|
||||
info, rts);
|
||||
mac_ctl |= B43_TXH_MAC_SENDRTS;
|
||||
len = sizeof(struct ieee80211_rts);
|
||||
}
|
||||
len += FCS_LEN;
|
||||
|
||||
/* Generate the PLCP headers for the RTS/CTS frame */
|
||||
if (b43_is_old_txhdr_format(dev))
|
||||
plcp = &txhdr->old_format.rts_plcp;
|
||||
else
|
||||
plcp = &txhdr->new_format.rts_plcp;
|
||||
b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)plcp,
|
||||
len, rts_rate);
|
||||
plcp = &txhdr->rts_plcp_fb;
|
||||
b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)plcp,
|
||||
len, rts_rate_fb);
|
||||
|
||||
if (b43_is_old_txhdr_format(dev)) {
|
||||
hdr = (struct ieee80211_hdr *)
|
||||
(&txhdr->old_format.rts_frame);
|
||||
} else {
|
||||
hdr = (struct ieee80211_hdr *)
|
||||
(&txhdr->new_format.rts_frame);
|
||||
}
|
||||
txhdr->rts_dur_fb = hdr->duration_id;
|
||||
|
||||
if (rts_rate_ofdm) {
|
||||
extra_ft |= B43_TXH_EFT_RTS_OFDM;
|
||||
txhdr->phy_rate_rts =
|
||||
b43_plcp_get_ratecode_ofdm(rts_rate);
|
||||
} else {
|
||||
extra_ft |= B43_TXH_EFT_RTS_CCK;
|
||||
txhdr->phy_rate_rts =
|
||||
b43_plcp_get_ratecode_cck(rts_rate);
|
||||
}
|
||||
if (rts_rate_fb_ofdm)
|
||||
extra_ft |= B43_TXH_EFT_RTSFB_OFDM;
|
||||
else
|
||||
extra_ft |= B43_TXH_EFT_RTSFB_CCK;
|
||||
}
|
||||
|
||||
/* Magic cookie */
|
||||
if (b43_is_old_txhdr_format(dev))
|
||||
txhdr->old_format.cookie = cpu_to_le16(cookie);
|
||||
else
|
||||
txhdr->new_format.cookie = cpu_to_le16(cookie);
|
||||
|
||||
/* Apply the bitfields */
|
||||
txhdr->mac_ctl = cpu_to_le32(mac_ctl);
|
||||
txhdr->phy_ctl = cpu_to_le16(phy_ctl);
|
||||
txhdr->extra_ft = extra_ft;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s8 b43_rssi_postprocess(struct b43_wldev *dev,
|
||||
u8 in_rssi, int ofdm,
|
||||
int adjust_2053, int adjust_2050)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
s32 tmp;
|
||||
|
||||
switch (phy->radio_ver) {
|
||||
case 0x2050:
|
||||
if (ofdm) {
|
||||
tmp = in_rssi;
|
||||
if (tmp > 127)
|
||||
tmp -= 256;
|
||||
tmp *= 73;
|
||||
tmp /= 64;
|
||||
if (adjust_2050)
|
||||
tmp += 25;
|
||||
else
|
||||
tmp -= 3;
|
||||
} else {
|
||||
if (dev->dev->bus->sprom.
|
||||
boardflags_lo & B43_BFL_RSSI) {
|
||||
if (in_rssi > 63)
|
||||
in_rssi = 63;
|
||||
tmp = phy->nrssi_lt[in_rssi];
|
||||
tmp = 31 - tmp;
|
||||
tmp *= -131;
|
||||
tmp /= 128;
|
||||
tmp -= 57;
|
||||
} else {
|
||||
tmp = in_rssi;
|
||||
tmp = 31 - tmp;
|
||||
tmp *= -149;
|
||||
tmp /= 128;
|
||||
tmp -= 68;
|
||||
}
|
||||
if (phy->type == B43_PHYTYPE_G && adjust_2050)
|
||||
tmp += 25;
|
||||
}
|
||||
break;
|
||||
case 0x2060:
|
||||
if (in_rssi > 127)
|
||||
tmp = in_rssi - 256;
|
||||
else
|
||||
tmp = in_rssi;
|
||||
break;
|
||||
default:
|
||||
tmp = in_rssi;
|
||||
tmp -= 11;
|
||||
tmp *= 103;
|
||||
tmp /= 64;
|
||||
if (adjust_2053)
|
||||
tmp -= 109;
|
||||
else
|
||||
tmp -= 83;
|
||||
}
|
||||
|
||||
return (s8) tmp;
|
||||
}
|
||||
|
||||
//TODO
|
||||
#if 0
|
||||
static s8 b43_rssinoise_postprocess(struct b43_wldev *dev, u8 in_rssi)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
s8 ret;
|
||||
|
||||
if (phy->type == B43_PHYTYPE_A) {
|
||||
//TODO: Incomplete specs.
|
||||
ret = 0;
|
||||
} else
|
||||
ret = b43_rssi_postprocess(dev, in_rssi, 0, 1, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
|
||||
{
|
||||
struct ieee80211_rx_status status;
|
||||
struct b43_plcp_hdr6 *plcp;
|
||||
struct ieee80211_hdr *wlhdr;
|
||||
const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
|
||||
u16 fctl;
|
||||
u16 phystat0, phystat3, chanstat, mactime;
|
||||
u32 macstat;
|
||||
u16 chanid;
|
||||
u16 phytype;
|
||||
int padding;
|
||||
|
||||
memset(&status, 0, sizeof(status));
|
||||
|
||||
/* Get metadata about the frame from the header. */
|
||||
phystat0 = le16_to_cpu(rxhdr->phy_status0);
|
||||
phystat3 = le16_to_cpu(rxhdr->phy_status3);
|
||||
macstat = le32_to_cpu(rxhdr->mac_status);
|
||||
mactime = le16_to_cpu(rxhdr->mac_time);
|
||||
chanstat = le16_to_cpu(rxhdr->channel);
|
||||
phytype = chanstat & B43_RX_CHAN_PHYTYPE;
|
||||
|
||||
if (macstat & B43_RX_MAC_FCSERR)
|
||||
dev->wl->ieee_stats.dot11FCSErrorCount++;
|
||||
if (macstat & B43_RX_MAC_DECERR) {
|
||||
/* Decryption with the given key failed.
|
||||
* Drop the packet. We also won't be able to decrypt it with
|
||||
* the key in software. */
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/* Skip PLCP and padding */
|
||||
padding = (macstat & B43_RX_MAC_PADDING) ? 2 : 0;
|
||||
if (unlikely(skb->len < (sizeof(struct b43_plcp_hdr6) + padding))) {
|
||||
b43dbg(dev->wl, "RX: Packet size underrun (1)\n");
|
||||
goto drop;
|
||||
}
|
||||
plcp = (struct b43_plcp_hdr6 *)(skb->data + padding);
|
||||
skb_pull(skb, sizeof(struct b43_plcp_hdr6) + padding);
|
||||
/* The skb contains the Wireless Header + payload data now */
|
||||
if (unlikely(skb->len < (2 + 2 + 6 /*minimum hdr */ + FCS_LEN))) {
|
||||
b43dbg(dev->wl, "RX: Packet size underrun (2)\n");
|
||||
goto drop;
|
||||
}
|
||||
wlhdr = (struct ieee80211_hdr *)(skb->data);
|
||||
fctl = le16_to_cpu(wlhdr->frame_control);
|
||||
|
||||
if (macstat & B43_RX_MAC_DEC) {
|
||||
unsigned int keyidx;
|
||||
int wlhdr_len;
|
||||
|
||||
keyidx = ((macstat & B43_RX_MAC_KEYIDX)
|
||||
>> B43_RX_MAC_KEYIDX_SHIFT);
|
||||
/* We must adjust the key index here. We want the "physical"
|
||||
* key index, but the ucode passed it slightly different.
|
||||
*/
|
||||
keyidx = b43_kidx_to_raw(dev, keyidx);
|
||||
B43_WARN_ON(keyidx >= dev->max_nr_keys);
|
||||
|
||||
if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) {
|
||||
wlhdr_len = ieee80211_get_hdrlen(fctl);
|
||||
if (unlikely(skb->len < (wlhdr_len + 3))) {
|
||||
b43dbg(dev->wl,
|
||||
"RX: Packet size underrun (3)\n");
|
||||
goto drop;
|
||||
}
|
||||
status.flag |= RX_FLAG_DECRYPTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Link quality statistics */
|
||||
status.noise = dev->stats.link_noise;
|
||||
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.signal = b43_rssi_postprocess(dev, rxhdr->jssi,
|
||||
(phystat0 & B43_RX_PHYST0_OFDM),
|
||||
(phystat0 & B43_RX_PHYST0_GAINCTL),
|
||||
(phystat3 & B43_RX_PHYST3_TRSTATE));
|
||||
status.qual = (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);
|
||||
else
|
||||
status.rate_idx = b43_plcp_get_bitrate_idx_cck(plcp);
|
||||
status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT);
|
||||
|
||||
/*
|
||||
* All frames on monitor interfaces and beacons always need a full
|
||||
* 64-bit timestamp. Monitor interfaces need it for diagnostic
|
||||
* purposes and beacons for IBSS merging.
|
||||
* This code assumes we get to process the packet within 16 bits
|
||||
* of timestamp, i.e. about 65 milliseconds after the PHY received
|
||||
* the first symbol.
|
||||
*/
|
||||
if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE))
|
||||
== (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) ||
|
||||
dev->wl->radiotap_enabled) {
|
||||
u16 low_mactime_now;
|
||||
|
||||
b43_tsf_read(dev, &status.mactime);
|
||||
low_mactime_now = status.mactime;
|
||||
status.mactime = status.mactime & ~0xFFFFULL;
|
||||
status.mactime += mactime;
|
||||
if (low_mactime_now <= mactime)
|
||||
status.mactime -= 0x10000;
|
||||
status.flag |= RX_FLAG_TSFT;
|
||||
}
|
||||
|
||||
chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT;
|
||||
switch (chanstat & B43_RX_CHAN_PHYTYPE) {
|
||||
case B43_PHYTYPE_A:
|
||||
status.band = IEEE80211_BAND_5GHZ;
|
||||
B43_WARN_ON(1);
|
||||
/* FIXME: We don't really know which value the "chanid" contains.
|
||||
* So the following assignment might be wrong. */
|
||||
status.freq = b43_channel_to_freq_5ghz(chanid);
|
||||
break;
|
||||
case B43_PHYTYPE_G:
|
||||
status.band = IEEE80211_BAND_2GHZ;
|
||||
/* chanid is the radio channel cookie value as used
|
||||
* to tune the radio. */
|
||||
status.freq = chanid + 2400;
|
||||
break;
|
||||
case B43_PHYTYPE_N:
|
||||
/* chanid is the SHM channel cookie. Which is the plain
|
||||
* channel number in b43. */
|
||||
if (chanstat & B43_RX_CHAN_5GHZ) {
|
||||
status.band = IEEE80211_BAND_5GHZ;
|
||||
status.freq = b43_freq_to_channel_5ghz(chanid);
|
||||
} else {
|
||||
status.band = IEEE80211_BAND_2GHZ;
|
||||
status.freq = b43_freq_to_channel_2ghz(chanid);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
B43_WARN_ON(1);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
dev->stats.last_rx = jiffies;
|
||||
ieee80211_rx_irqsafe(dev->wl->hw, skb, &status);
|
||||
|
||||
return;
|
||||
drop:
|
||||
b43dbg(dev->wl, "RX: Packet dropped\n");
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
|
||||
void b43_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
b43_debugfs_log_txstat(dev, status);
|
||||
|
||||
if (status->intermediate)
|
||||
return;
|
||||
if (status->for_ampdu)
|
||||
return;
|
||||
if (!status->acked)
|
||||
dev->wl->ieee_stats.dot11ACKFailureCount++;
|
||||
if (status->rts_count) {
|
||||
if (status->rts_count == 0xF) //FIXME
|
||||
dev->wl->ieee_stats.dot11RTSFailureCount++;
|
||||
else
|
||||
dev->wl->ieee_stats.dot11RTSSuccessCount++;
|
||||
}
|
||||
|
||||
if (b43_using_pio_transfers(dev))
|
||||
b43_pio_handle_txstatus(dev, status);
|
||||
else
|
||||
b43_dma_handle_txstatus(dev, status);
|
||||
}
|
||||
|
||||
/* Fill out the mac80211 TXstatus report based on the b43-specific
|
||||
* txstatus report data. This returns a boolean whether the frame was
|
||||
* successfully transmitted. */
|
||||
bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
|
||||
const struct b43_txstatus *status)
|
||||
{
|
||||
bool frame_success = 1;
|
||||
|
||||
if (status->acked) {
|
||||
/* The frame was ACKed. */
|
||||
report->flags |= IEEE80211_TX_STAT_ACK;
|
||||
} else {
|
||||
/* The frame was not ACKed... */
|
||||
if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) {
|
||||
/* ...but we expected an ACK. */
|
||||
frame_success = 0;
|
||||
report->status.excessive_retries = 1;
|
||||
}
|
||||
}
|
||||
if (status->frame_count == 0) {
|
||||
/* The frame was not transmitted at all. */
|
||||
report->status.retry_count = 0;
|
||||
} else
|
||||
report->status.retry_count = status->frame_count - 1;
|
||||
|
||||
return frame_success;
|
||||
}
|
||||
|
||||
/* Stop any TX operation on the device (suspend the hardware queues) */
|
||||
void b43_tx_suspend(struct b43_wldev *dev)
|
||||
{
|
||||
if (b43_using_pio_transfers(dev))
|
||||
b43_pio_tx_suspend(dev);
|
||||
else
|
||||
b43_dma_tx_suspend(dev);
|
||||
}
|
||||
|
||||
/* Resume any TX operation on the device (resume the hardware queues) */
|
||||
void b43_tx_resume(struct b43_wldev *dev)
|
||||
{
|
||||
if (b43_using_pio_transfers(dev))
|
||||
b43_pio_tx_resume(dev);
|
||||
else
|
||||
b43_dma_tx_resume(dev);
|
||||
}
|
@ -1,335 +0,0 @@
|
||||
#ifndef B43_XMIT_H_
|
||||
#define B43_XMIT_H_
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#define _b43_declare_plcp_hdr(size) \
|
||||
struct b43_plcp_hdr##size { \
|
||||
union { \
|
||||
__le32 data; \
|
||||
__u8 raw[size]; \
|
||||
} __attribute__((__packed__)); \
|
||||
} __attribute__((__packed__))
|
||||
|
||||
/* struct b43_plcp_hdr4 */
|
||||
_b43_declare_plcp_hdr(4);
|
||||
/* struct b43_plcp_hdr6 */
|
||||
_b43_declare_plcp_hdr(6);
|
||||
|
||||
#undef _b43_declare_plcp_hdr
|
||||
|
||||
/* TX header for v4 firmware */
|
||||
struct b43_txhdr {
|
||||
__le32 mac_ctl; /* MAC TX control */
|
||||
__le16 mac_frame_ctl; /* Copy of the FrameControl field */
|
||||
__le16 tx_fes_time_norm; /* TX FES Time Normal */
|
||||
__le16 phy_ctl; /* PHY TX control */
|
||||
__le16 phy_ctl1; /* PHY TX control word 1 */
|
||||
__le16 phy_ctl1_fb; /* PHY TX control word 1 for fallback rates */
|
||||
__le16 phy_ctl1_rts; /* PHY TX control word 1 RTS */
|
||||
__le16 phy_ctl1_rts_fb; /* PHY TX control word 1 RTS for fallback rates */
|
||||
__u8 phy_rate; /* PHY rate */
|
||||
__u8 phy_rate_rts; /* PHY rate for RTS/CTS */
|
||||
__u8 extra_ft; /* Extra Frame Types */
|
||||
__u8 chan_radio_code; /* Channel Radio Code */
|
||||
__u8 iv[16]; /* Encryption IV */
|
||||
__u8 tx_receiver[6]; /* TX Frame Receiver address */
|
||||
__le16 tx_fes_time_fb; /* TX FES Time Fallback */
|
||||
struct b43_plcp_hdr6 rts_plcp_fb; /* RTS fallback PLCP header */
|
||||
__le16 rts_dur_fb; /* RTS fallback duration */
|
||||
struct b43_plcp_hdr6 plcp_fb; /* Fallback PLCP header */
|
||||
__le16 dur_fb; /* Fallback duration */
|
||||
__le16 mimo_modelen; /* MIMO mode length */
|
||||
__le16 mimo_ratelen_fb; /* MIMO fallback rate length */
|
||||
__le32 timeout; /* Timeout */
|
||||
|
||||
union {
|
||||
/* The new r410 format. */
|
||||
struct {
|
||||
__le16 mimo_antenna; /* MIMO antenna select */
|
||||
__le16 preload_size; /* Preload size */
|
||||
PAD_BYTES(2);
|
||||
__le16 cookie; /* TX frame cookie */
|
||||
__le16 tx_status; /* TX status */
|
||||
struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */
|
||||
__u8 rts_frame[16]; /* The RTS frame (if used) */
|
||||
PAD_BYTES(2);
|
||||
struct b43_plcp_hdr6 plcp; /* Main PLCP header */
|
||||
} new_format __attribute__ ((__packed__));
|
||||
|
||||
/* The old r351 format. */
|
||||
struct {
|
||||
PAD_BYTES(2);
|
||||
__le16 cookie; /* TX frame cookie */
|
||||
__le16 tx_status; /* TX status */
|
||||
struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */
|
||||
__u8 rts_frame[16]; /* The RTS frame (if used) */
|
||||
PAD_BYTES(2);
|
||||
struct b43_plcp_hdr6 plcp; /* Main PLCP header */
|
||||
} old_format __attribute__ ((__packed__));
|
||||
|
||||
} __attribute__ ((__packed__));
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
/* MAC TX control */
|
||||
#define B43_TXH_MAC_USEFBR 0x10000000 /* Use fallback rate for this AMPDU */
|
||||
#define B43_TXH_MAC_KEYIDX 0x0FF00000 /* Security key index */
|
||||
#define B43_TXH_MAC_KEYIDX_SHIFT 20
|
||||
#define B43_TXH_MAC_KEYALG 0x00070000 /* Security key algorithm */
|
||||
#define B43_TXH_MAC_KEYALG_SHIFT 16
|
||||
#define B43_TXH_MAC_AMIC 0x00008000 /* AMIC */
|
||||
#define B43_TXH_MAC_RIFS 0x00004000 /* Use RIFS */
|
||||
#define B43_TXH_MAC_LIFETIME 0x00002000 /* Lifetime */
|
||||
#define B43_TXH_MAC_FRAMEBURST 0x00001000 /* Frameburst */
|
||||
#define B43_TXH_MAC_SENDCTS 0x00000800 /* Send CTS-to-self */
|
||||
#define B43_TXH_MAC_AMPDU 0x00000600 /* AMPDU status */
|
||||
#define B43_TXH_MAC_AMPDU_MPDU 0x00000000 /* Regular MPDU, not an AMPDU */
|
||||
#define B43_TXH_MAC_AMPDU_FIRST 0x00000200 /* First MPDU or AMPDU */
|
||||
#define B43_TXH_MAC_AMPDU_INTER 0x00000400 /* Intermediate MPDU or AMPDU */
|
||||
#define B43_TXH_MAC_AMPDU_LAST 0x00000600 /* Last (or only) MPDU of AMPDU */
|
||||
#define B43_TXH_MAC_40MHZ 0x00000100 /* Use 40 MHz bandwidth */
|
||||
#define B43_TXH_MAC_5GHZ 0x00000080 /* 5GHz band */
|
||||
#define B43_TXH_MAC_DFCS 0x00000040 /* DFCS */
|
||||
#define B43_TXH_MAC_IGNPMQ 0x00000020 /* Ignore PMQ */
|
||||
#define B43_TXH_MAC_HWSEQ 0x00000010 /* Use Hardware Sequence Number */
|
||||
#define B43_TXH_MAC_STMSDU 0x00000008 /* Start MSDU */
|
||||
#define B43_TXH_MAC_SENDRTS 0x00000004 /* Send RTS */
|
||||
#define B43_TXH_MAC_LONGFRAME 0x00000002 /* Long frame */
|
||||
#define B43_TXH_MAC_ACK 0x00000001 /* Immediate ACK */
|
||||
|
||||
/* Extra Frame Types */
|
||||
#define B43_TXH_EFT_FB 0x03 /* Data frame fallback encoding */
|
||||
#define B43_TXH_EFT_FB_CCK 0x00 /* CCK */
|
||||
#define B43_TXH_EFT_FB_OFDM 0x01 /* OFDM */
|
||||
#define B43_TXH_EFT_FB_EWC 0x02 /* EWC */
|
||||
#define B43_TXH_EFT_FB_N 0x03 /* N */
|
||||
#define B43_TXH_EFT_RTS 0x0C /* RTS/CTS encoding */
|
||||
#define B43_TXH_EFT_RTS_CCK 0x00 /* CCK */
|
||||
#define B43_TXH_EFT_RTS_OFDM 0x04 /* OFDM */
|
||||
#define B43_TXH_EFT_RTS_EWC 0x08 /* EWC */
|
||||
#define B43_TXH_EFT_RTS_N 0x0C /* N */
|
||||
#define B43_TXH_EFT_RTSFB 0x30 /* RTS/CTS fallback encoding */
|
||||
#define B43_TXH_EFT_RTSFB_CCK 0x00 /* CCK */
|
||||
#define B43_TXH_EFT_RTSFB_OFDM 0x10 /* OFDM */
|
||||
#define B43_TXH_EFT_RTSFB_EWC 0x20 /* EWC */
|
||||
#define B43_TXH_EFT_RTSFB_N 0x30 /* N */
|
||||
|
||||
/* PHY TX control word */
|
||||
#define B43_TXH_PHY_ENC 0x0003 /* Data frame encoding */
|
||||
#define B43_TXH_PHY_ENC_CCK 0x0000 /* CCK */
|
||||
#define B43_TXH_PHY_ENC_OFDM 0x0001 /* OFDM */
|
||||
#define B43_TXH_PHY_ENC_EWC 0x0002 /* EWC */
|
||||
#define B43_TXH_PHY_ENC_N 0x0003 /* N */
|
||||
#define B43_TXH_PHY_SHORTPRMBL 0x0010 /* Use short preamble */
|
||||
#define B43_TXH_PHY_ANT 0x03C0 /* Antenna selection */
|
||||
#define B43_TXH_PHY_ANT0 0x0000 /* Use antenna 0 */
|
||||
#define B43_TXH_PHY_ANT1 0x0040 /* Use antenna 1 */
|
||||
#define B43_TXH_PHY_ANT01AUTO 0x00C0 /* Use antenna 0/1 auto */
|
||||
#define B43_TXH_PHY_ANT2 0x0100 /* Use antenna 2 */
|
||||
#define B43_TXH_PHY_ANT3 0x0200 /* Use antenna 3 */
|
||||
#define B43_TXH_PHY_TXPWR 0xFC00 /* TX power */
|
||||
#define B43_TXH_PHY_TXPWR_SHIFT 10
|
||||
|
||||
/* PHY TX control word 1 */
|
||||
#define B43_TXH_PHY1_BW 0x0007 /* Bandwidth */
|
||||
#define B43_TXH_PHY1_BW_10 0x0000 /* 10 MHz */
|
||||
#define B43_TXH_PHY1_BW_10U 0x0001 /* 10 MHz upper */
|
||||
#define B43_TXH_PHY1_BW_20 0x0002 /* 20 MHz */
|
||||
#define B43_TXH_PHY1_BW_20U 0x0003 /* 20 MHz upper */
|
||||
#define B43_TXH_PHY1_BW_40 0x0004 /* 40 MHz */
|
||||
#define B43_TXH_PHY1_BW_40DUP 0x0005 /* 50 MHz duplicate */
|
||||
#define B43_TXH_PHY1_MODE 0x0038 /* Mode */
|
||||
#define B43_TXH_PHY1_MODE_SISO 0x0000 /* SISO */
|
||||
#define B43_TXH_PHY1_MODE_CDD 0x0008 /* CDD */
|
||||
#define B43_TXH_PHY1_MODE_STBC 0x0010 /* STBC */
|
||||
#define B43_TXH_PHY1_MODE_SDM 0x0018 /* SDM */
|
||||
#define B43_TXH_PHY1_CRATE 0x0700 /* Coding rate */
|
||||
#define B43_TXH_PHY1_CRATE_1_2 0x0000 /* 1/2 */
|
||||
#define B43_TXH_PHY1_CRATE_2_3 0x0100 /* 2/3 */
|
||||
#define B43_TXH_PHY1_CRATE_3_4 0x0200 /* 3/4 */
|
||||
#define B43_TXH_PHY1_CRATE_4_5 0x0300 /* 4/5 */
|
||||
#define B43_TXH_PHY1_CRATE_5_6 0x0400 /* 5/6 */
|
||||
#define B43_TXH_PHY1_CRATE_7_8 0x0600 /* 7/8 */
|
||||
#define B43_TXH_PHY1_MODUL 0x3800 /* Modulation scheme */
|
||||
#define B43_TXH_PHY1_MODUL_BPSK 0x0000 /* BPSK */
|
||||
#define B43_TXH_PHY1_MODUL_QPSK 0x0800 /* QPSK */
|
||||
#define B43_TXH_PHY1_MODUL_QAM16 0x1000 /* QAM16 */
|
||||
#define B43_TXH_PHY1_MODUL_QAM64 0x1800 /* QAM64 */
|
||||
#define B43_TXH_PHY1_MODUL_QAM256 0x2000 /* QAM256 */
|
||||
|
||||
|
||||
/* r351 firmware compatibility stuff. */
|
||||
static inline
|
||||
bool b43_is_old_txhdr_format(struct b43_wldev *dev)
|
||||
{
|
||||
return (dev->fw.rev <= 351);
|
||||
}
|
||||
|
||||
static inline
|
||||
size_t b43_txhdr_size(struct b43_wldev *dev)
|
||||
{
|
||||
if (b43_is_old_txhdr_format(dev))
|
||||
return 100 + sizeof(struct b43_plcp_hdr6);
|
||||
return 104 + sizeof(struct b43_plcp_hdr6);
|
||||
}
|
||||
|
||||
|
||||
int b43_generate_txhdr(struct b43_wldev *dev,
|
||||
u8 * txhdr,
|
||||
const unsigned char *fragment_data,
|
||||
unsigned int fragment_len,
|
||||
const struct ieee80211_tx_info *txctl, u16 cookie);
|
||||
|
||||
/* Transmit Status */
|
||||
struct b43_txstatus {
|
||||
u16 cookie; /* The cookie from the txhdr */
|
||||
u16 seq; /* Sequence number */
|
||||
u8 phy_stat; /* PHY TX status */
|
||||
u8 frame_count; /* Frame transmit count */
|
||||
u8 rts_count; /* RTS transmit count */
|
||||
u8 supp_reason; /* Suppression reason */
|
||||
/* flags */
|
||||
u8 pm_indicated; /* PM mode indicated to AP */
|
||||
u8 intermediate; /* Intermediate status notification (not final) */
|
||||
u8 for_ampdu; /* Status is for an AMPDU (afterburner) */
|
||||
u8 acked; /* Wireless ACK received */
|
||||
};
|
||||
|
||||
/* txstatus supp_reason values */
|
||||
enum {
|
||||
B43_TXST_SUPP_NONE, /* Not suppressed */
|
||||
B43_TXST_SUPP_PMQ, /* Suppressed due to PMQ entry */
|
||||
B43_TXST_SUPP_FLUSH, /* Suppressed due to flush request */
|
||||
B43_TXST_SUPP_PREV, /* Previous fragment failed */
|
||||
B43_TXST_SUPP_CHAN, /* Channel mismatch */
|
||||
B43_TXST_SUPP_LIFE, /* Lifetime expired */
|
||||
B43_TXST_SUPP_UNDER, /* Buffer underflow */
|
||||
B43_TXST_SUPP_ABNACK, /* Afterburner NACK */
|
||||
};
|
||||
|
||||
/* Receive header for v4 firmware. */
|
||||
struct b43_rxhdr_fw4 {
|
||||
__le16 frame_len; /* Frame length */
|
||||
PAD_BYTES(2);
|
||||
__le16 phy_status0; /* PHY RX Status 0 */
|
||||
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 */
|
||||
__le16 mac_time;
|
||||
__le16 channel;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
/* PHY RX Status 0 */
|
||||
#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */
|
||||
#define B43_RX_PHYST0_PLCPHCF 0x0200
|
||||
#define B43_RX_PHYST0_PLCPFV 0x0100
|
||||
#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */
|
||||
#define B43_RX_PHYST0_LCRS 0x0040
|
||||
#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */
|
||||
#define B43_RX_PHYST0_UNSRATE 0x0010
|
||||
#define B43_RX_PHYST0_CLIP 0x000C
|
||||
#define B43_RX_PHYST0_CLIP_SHIFT 2
|
||||
#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */
|
||||
#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */
|
||||
#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */
|
||||
#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */
|
||||
#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */
|
||||
|
||||
/* PHY RX Status 2 */
|
||||
#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */
|
||||
#define B43_RX_PHYST2_LNAG_SHIFT 14
|
||||
#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */
|
||||
#define B43_RX_PHYST2_PNAG_SHIFT 10
|
||||
#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */
|
||||
|
||||
/* PHY RX Status 3 */
|
||||
#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */
|
||||
#define B43_RX_PHYST3_DIGG_SHIFT 11
|
||||
#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */
|
||||
|
||||
/* MAC RX Status */
|
||||
#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */
|
||||
#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */
|
||||
#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */
|
||||
#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */
|
||||
#define B43_RX_MAC_AGGTYPE_SHIFT 17
|
||||
#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */
|
||||
#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */
|
||||
#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */
|
||||
#define B43_RX_MAC_KEYIDX_SHIFT 5
|
||||
#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */
|
||||
#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */
|
||||
#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */
|
||||
#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */
|
||||
#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */
|
||||
|
||||
/* RX channel */
|
||||
#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */
|
||||
#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */
|
||||
#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */
|
||||
#define B43_RX_CHAN_ID_SHIFT 3
|
||||
#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */
|
||||
|
||||
|
||||
u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
|
||||
u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
|
||||
|
||||
void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
||||
const u16 octets, const u8 bitrate);
|
||||
|
||||
void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr);
|
||||
|
||||
void b43_handle_txstatus(struct b43_wldev *dev,
|
||||
const struct b43_txstatus *status);
|
||||
bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
|
||||
const struct b43_txstatus *status);
|
||||
|
||||
void b43_tx_suspend(struct b43_wldev *dev);
|
||||
void b43_tx_resume(struct b43_wldev *dev);
|
||||
|
||||
|
||||
/* Helper functions for converting the key-table index from "firmware-format"
|
||||
* to "raw-format" and back. The firmware API changed for this at some revision.
|
||||
* We need to account for that here. */
|
||||
static inline int b43_new_kidx_api(struct b43_wldev *dev)
|
||||
{
|
||||
/* FIXME: Not sure the change was at rev 351 */
|
||||
return (dev->fw.rev >= 351);
|
||||
}
|
||||
static inline u8 b43_kidx_to_fw(struct b43_wldev *dev, u8 raw_kidx)
|
||||
{
|
||||
u8 firmware_kidx;
|
||||
if (b43_new_kidx_api(dev)) {
|
||||
firmware_kidx = raw_kidx;
|
||||
} else {
|
||||
if (raw_kidx >= 4) /* Is per STA key? */
|
||||
firmware_kidx = raw_kidx - 4;
|
||||
else
|
||||
firmware_kidx = raw_kidx; /* TX default key */
|
||||
}
|
||||
return firmware_kidx;
|
||||
}
|
||||
static inline u8 b43_kidx_to_raw(struct b43_wldev *dev, u8 firmware_kidx)
|
||||
{
|
||||
u8 raw_kidx;
|
||||
if (b43_new_kidx_api(dev))
|
||||
raw_kidx = firmware_kidx;
|
||||
else
|
||||
raw_kidx = firmware_kidx + 4; /* RX default keys or per STA keys */
|
||||
return raw_kidx;
|
||||
}
|
||||
|
||||
#endif /* B43_XMIT_H_ */
|
Loading…
Reference in New Issue
Block a user