提交 c0c33add 编写于 作者: J John W. Linville

Merge branch 'master' of...

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
...@@ -13,6 +13,11 @@ config BCMA ...@@ -13,6 +13,11 @@ config BCMA
Bus driver for Broadcom specific Advanced Microcontroller Bus Bus driver for Broadcom specific Advanced Microcontroller Bus
Architecture. Architecture.
# Support for Block-I/O. SELECT this from the driver that needs it.
config BCMA_BLOCKIO
bool
depends on BCMA
config BCMA_HOST_PCI_POSSIBLE config BCMA_HOST_PCI_POSSIBLE
bool bool
depends on BCMA && PCI = y depends on BCMA && PCI = y
......
bcma-y += main.o scan.o core.o bcma-y += main.o scan.o core.o sprom.o
bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
bcma-y += driver_pci.o bcma-y += driver_pci.o
bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
......
...@@ -19,6 +19,9 @@ extern void bcma_bus_unregister(struct bcma_bus *bus); ...@@ -19,6 +19,9 @@ extern void bcma_bus_unregister(struct bcma_bus *bus);
/* scan.c */ /* scan.c */
int bcma_bus_scan(struct bcma_bus *bus); int bcma_bus_scan(struct bcma_bus *bus);
/* sprom.c */
int bcma_sprom_get(struct bcma_bus *bus);
#ifdef CONFIG_BCMA_HOST_PCI #ifdef CONFIG_BCMA_HOST_PCI
/* host_pci.c */ /* host_pci.c */
extern int __init bcma_host_pci_init(void); extern int __init bcma_host_pci_init(void);
......
...@@ -161,3 +161,26 @@ void bcma_core_pci_init(struct bcma_drv_pci *pc) ...@@ -161,3 +161,26 @@ void bcma_core_pci_init(struct bcma_drv_pci *pc)
{ {
bcma_pcicore_serdes_workaround(pc); bcma_pcicore_serdes_workaround(pc);
} }
int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
bool enable)
{
struct pci_dev *pdev = pc->core->bus->host_pci;
u32 coremask, tmp;
int err;
err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
if (err)
goto out;
coremask = BIT(core->core_index) << 8;
if (enable)
tmp |= coremask;
else
tmp &= ~coremask;
err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
out:
return err;
}
...@@ -65,6 +65,54 @@ static void bcma_host_pci_write32(struct bcma_device *core, u16 offset, ...@@ -65,6 +65,54 @@ static void bcma_host_pci_write32(struct bcma_device *core, u16 offset,
iowrite32(value, core->bus->mmio + offset); iowrite32(value, core->bus->mmio + offset);
} }
#ifdef CONFIG_BCMA_BLOCKIO
void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
size_t count, u16 offset, u8 reg_width)
{
void __iomem *addr = core->bus->mmio + offset;
if (core->bus->mapped_core != core)
bcma_host_pci_switch_core(core);
switch (reg_width) {
case sizeof(u8):
ioread8_rep(addr, buffer, count);
break;
case sizeof(u16):
WARN_ON(count & 1);
ioread16_rep(addr, buffer, count >> 1);
break;
case sizeof(u32):
WARN_ON(count & 3);
ioread32_rep(addr, buffer, count >> 2);
break;
default:
WARN_ON(1);
}
}
void bcma_host_pci_block_write(struct bcma_device *core, const void *buffer,
size_t count, u16 offset, u8 reg_width)
{
void __iomem *addr = core->bus->mmio + offset;
if (core->bus->mapped_core != core)
bcma_host_pci_switch_core(core);
switch (reg_width) {
case sizeof(u8):
iowrite8_rep(addr, buffer, count);
break;
case sizeof(u16):
WARN_ON(count & 1);
iowrite16_rep(addr, buffer, count >> 1);
break;
case sizeof(u32):
WARN_ON(count & 3);
iowrite32_rep(addr, buffer, count >> 2);
break;
default:
WARN_ON(1);
}
}
#endif
static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset) static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset)
{ {
if (core->bus->mapped_core != core) if (core->bus->mapped_core != core)
...@@ -87,6 +135,10 @@ const struct bcma_host_ops bcma_host_pci_ops = { ...@@ -87,6 +135,10 @@ const struct bcma_host_ops bcma_host_pci_ops = {
.write8 = bcma_host_pci_write8, .write8 = bcma_host_pci_write8,
.write16 = bcma_host_pci_write16, .write16 = bcma_host_pci_write16,
.write32 = bcma_host_pci_write32, .write32 = bcma_host_pci_write32,
#ifdef CONFIG_BCMA_BLOCKIO
.block_read = bcma_host_pci_block_read,
.block_write = bcma_host_pci_block_write,
#endif
.aread32 = bcma_host_pci_aread32, .aread32 = bcma_host_pci_aread32,
.awrite32 = bcma_host_pci_awrite32, .awrite32 = bcma_host_pci_awrite32,
}; };
......
...@@ -89,6 +89,8 @@ static int bcma_register_cores(struct bcma_bus *bus) ...@@ -89,6 +89,8 @@ static int bcma_register_cores(struct bcma_bus *bus)
switch (bus->hosttype) { switch (bus->hosttype) {
case BCMA_HOSTTYPE_PCI: case BCMA_HOSTTYPE_PCI:
core->dev.parent = &bus->host_pci->dev; core->dev.parent = &bus->host_pci->dev;
core->dma_dev = &bus->host_pci->dev;
core->irq = bus->host_pci->irq;
break; break;
case BCMA_HOSTTYPE_NONE: case BCMA_HOSTTYPE_NONE:
case BCMA_HOSTTYPE_SDIO: case BCMA_HOSTTYPE_SDIO:
...@@ -144,6 +146,13 @@ int bcma_bus_register(struct bcma_bus *bus) ...@@ -144,6 +146,13 @@ int bcma_bus_register(struct bcma_bus *bus)
bcma_core_pci_init(&bus->drv_pci); bcma_core_pci_init(&bus->drv_pci);
} }
/* Try to get SPROM */
err = bcma_sprom_get(bus);
if (err) {
pr_err("Failed to get SPROM: %d\n", err);
return -ENOENT;
}
/* Register found cores */ /* Register found cores */
bcma_register_cores(bus); bcma_register_cores(bus);
......
/*
* Broadcom specific AMBA
* SPROM reading
*
* Licensed under the GNU/GPL. See COPYING for details.
*/
#include "bcma_private.h"
#include <linux/bcma/bcma.h>
#include <linux/bcma/bcma_regs.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#define SPOFF(offset) ((offset) / sizeof(u16))
/**************************************************
* R/W ops.
**************************************************/
static void bcma_sprom_read(struct bcma_bus *bus, u16 *sprom)
{
int i;
for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++)
sprom[i] = bcma_read16(bus->drv_cc.core,
BCMA_CC_SPROM + (i * 2));
}
/**************************************************
* Validation.
**************************************************/
static inline u8 bcma_crc8(u8 crc, u8 data)
{
/* Polynomial: x^8 + x^7 + x^6 + x^4 + x^2 + 1 */
static const u8 t[] = {
0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F,
};
return t[crc ^ data];
}
static u8 bcma_sprom_crc(const u16 *sprom)
{
int word;
u8 crc = 0xFF;
for (word = 0; word < SSB_SPROMSIZE_WORDS_R4 - 1; word++) {
crc = bcma_crc8(crc, sprom[word] & 0x00FF);
crc = bcma_crc8(crc, (sprom[word] & 0xFF00) >> 8);
}
crc = bcma_crc8(crc, sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & 0x00FF);
crc ^= 0xFF;
return crc;
}
static int bcma_sprom_check_crc(const u16 *sprom)
{
u8 crc;
u8 expected_crc;
u16 tmp;
crc = bcma_sprom_crc(sprom);
tmp = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_CRC;
expected_crc = tmp >> SSB_SPROM_REVISION_CRC_SHIFT;
if (crc != expected_crc)
return -EPROTO;
return 0;
}
static int bcma_sprom_valid(const u16 *sprom)
{
u16 revision;
int err;
err = bcma_sprom_check_crc(sprom);
if (err)
return err;
revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV;
if (revision != 8) {
pr_err("Unsupported SPROM revision: %d\n", revision);
return -ENOENT;
}
return 0;
}
/**************************************************
* SPROM extraction.
**************************************************/
static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
{
u16 v;
int i;
for (i = 0; i < 3; i++) {
v = sprom[SPOFF(SSB_SPROM8_IL0MAC) + i];
*(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v);
}
}
int bcma_sprom_get(struct bcma_bus *bus)
{
u16 *sprom;
int err = 0;
if (!bus->drv_cc.core)
return -EOPNOTSUPP;
sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
GFP_KERNEL);
if (!sprom)
return -ENOMEM;
bcma_sprom_read(bus, sprom);
err = bcma_sprom_valid(sprom);
if (err)
goto out;
bcma_sprom_extract_r8(bus, sprom);
out:
kfree(sprom);
return err;
}
...@@ -161,6 +161,7 @@ struct ath_common { ...@@ -161,6 +161,7 @@ struct ath_common {
const struct ath_bus_ops *bus_ops; const struct ath_bus_ops *bus_ops;
bool btcoex_enabled; bool btcoex_enabled;
bool disable_ani;
}; };
struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
......
...@@ -72,6 +72,11 @@ static int modparam_all_channels; ...@@ -72,6 +72,11 @@ static int modparam_all_channels;
module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO); module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO);
MODULE_PARM_DESC(all_channels, "Expose all channels the device can use."); MODULE_PARM_DESC(all_channels, "Expose all channels the device can use.");
static int modparam_fastchanswitch;
module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO);
MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios.");
/* Module info */ /* Module info */
MODULE_AUTHOR("Jiri Slaby"); MODULE_AUTHOR("Jiri Slaby");
MODULE_AUTHOR("Nick Kossifidis"); MODULE_AUTHOR("Nick Kossifidis");
...@@ -2686,6 +2691,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, ...@@ -2686,6 +2691,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah); struct ath_common *common = ath5k_hw_common(ah);
int ret, ani_mode; int ret, ani_mode;
bool fast;
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
...@@ -2705,7 +2711,10 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, ...@@ -2705,7 +2711,10 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
ath5k_drain_tx_buffs(sc); ath5k_drain_tx_buffs(sc);
if (chan) if (chan)
sc->curchan = chan; sc->curchan = chan;
ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL,
fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, fast,
skip_pcu); skip_pcu);
if (ret) { if (ret) {
ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
......
...@@ -1124,8 +1124,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, ...@@ -1124,8 +1124,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
/* Non fatal, can happen eg. /* Non fatal, can happen eg.
* on mode change */ * on mode change */
ret = 0; ret = 0;
} else } else {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
"fast chan change successful\n");
return 0; return 0;
}
} }
/* /*
......
...@@ -28,11 +28,6 @@ static void ar9002_hw_set_desc_link(void *ds, u32 ds_link) ...@@ -28,11 +28,6 @@ static void ar9002_hw_set_desc_link(void *ds, u32 ds_link)
((struct ath_desc*) ds)->ds_link = ds_link; ((struct ath_desc*) ds)->ds_link = ds_link;
} }
static void ar9002_hw_get_desc_link(void *ds, u32 **ds_link)
{
*ds_link = &((struct ath_desc *)ds)->ds_link;
}
static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
{ {
u32 isr = 0; u32 isr = 0;
...@@ -437,7 +432,6 @@ void ar9002_hw_attach_mac_ops(struct ath_hw *ah) ...@@ -437,7 +432,6 @@ void ar9002_hw_attach_mac_ops(struct ath_hw *ah)
ops->rx_enable = ar9002_hw_rx_enable; ops->rx_enable = ar9002_hw_rx_enable;
ops->set_desc_link = ar9002_hw_set_desc_link; ops->set_desc_link = ar9002_hw_set_desc_link;
ops->get_desc_link = ar9002_hw_get_desc_link;
ops->get_isr = ar9002_hw_get_isr; ops->get_isr = ar9002_hw_get_isr;
ops->fill_txdesc = ar9002_hw_fill_txdesc; ops->fill_txdesc = ar9002_hw_fill_txdesc;
ops->proc_txdesc = ar9002_hw_proc_txdesc; ops->proc_txdesc = ar9002_hw_proc_txdesc;
......
...@@ -43,13 +43,6 @@ static void ar9003_hw_set_desc_link(void *ds, u32 ds_link) ...@@ -43,13 +43,6 @@ static void ar9003_hw_set_desc_link(void *ds, u32 ds_link)
ads->ctl10 |= ar9003_calc_ptr_chksum(ads); ads->ctl10 |= ar9003_calc_ptr_chksum(ads);
} }
static void ar9003_hw_get_desc_link(void *ds, u32 **ds_link)
{
struct ar9003_txc *ads = ds;
*ds_link = &ads->link;
}
static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
{ {
u32 isr = 0; u32 isr = 0;
...@@ -498,7 +491,6 @@ void ar9003_hw_attach_mac_ops(struct ath_hw *hw) ...@@ -498,7 +491,6 @@ void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
ops->rx_enable = ar9003_hw_rx_enable; ops->rx_enable = ar9003_hw_rx_enable;
ops->set_desc_link = ar9003_hw_set_desc_link; ops->set_desc_link = ar9003_hw_set_desc_link;
ops->get_desc_link = ar9003_hw_get_desc_link;
ops->get_isr = ar9003_hw_get_isr; ops->get_isr = ar9003_hw_get_isr;
ops->fill_txdesc = ar9003_hw_fill_txdesc; ops->fill_txdesc = ar9003_hw_fill_txdesc;
ops->proc_txdesc = ar9003_hw_proc_txdesc; ops->proc_txdesc = ar9003_hw_proc_txdesc;
......
...@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable); ...@@ -46,11 +46,10 @@ EXPORT_SYMBOL(ar9003_paprd_enable);
static int ar9003_get_training_power_2g(struct ath_hw *ah) static int ar9003_get_training_power_2g(struct ath_hw *ah)
{ {
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; struct ath9k_channel *chan = ah->curchan;
struct ar9300_modal_eep_header *hdr = &eep->modalHeader2G;
unsigned int power, scale, delta; unsigned int power, scale, delta;
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20), AR9300_PAPRD_SCALE_1); scale = ar9003_get_paprd_scale_factor(ah, chan);
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5, power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
AR_PHY_POWERTX_RATE5_POWERTXHT20_0); AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
...@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah) ...@@ -67,20 +66,10 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah)
static int ar9003_get_training_power_5g(struct ath_hw *ah) static int ar9003_get_training_power_5g(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
struct ar9300_modal_eep_header *hdr = &eep->modalHeader5G;
struct ath9k_channel *chan = ah->curchan; struct ath9k_channel *chan = ah->curchan;
unsigned int power, scale, delta; unsigned int power, scale, delta;
if (chan->channel >= 5700) scale = ar9003_get_paprd_scale_factor(ah, chan);
scale = MS(le32_to_cpu(hdr->papdRateMaskHt20),
AR9300_PAPRD_SCALE_1);
else if (chan->channel >= 5400)
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
AR9300_PAPRD_SCALE_2);
else
scale = MS(le32_to_cpu(hdr->papdRateMaskHt40),
AR9300_PAPRD_SCALE_1);
if (IS_CHAN_HT40(chan)) if (IS_CHAN_HT40(chan))
power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8, power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8,
...@@ -119,15 +108,16 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah) ...@@ -119,15 +108,16 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
else else
training_power = ar9003_get_training_power_5g(ah); training_power = ar9003_get_training_power_5g(ah);
ath_dbg(common, ATH_DBG_CALIBRATE,
"Training power: %d, Target power: %d\n",
training_power, ah->paprd_target_power);
if (training_power < 0) { if (training_power < 0) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, ATH_DBG_CALIBRATE,
"PAPRD target power delta out of range"); "PAPRD target power delta out of range");
return -ERANGE; return -ERANGE;
} }
ah->paprd_training_power = training_power; ah->paprd_training_power = training_power;
ath_dbg(common, ATH_DBG_CALIBRATE,
"Training power: %d, Target power: %d\n",
ah->paprd_training_power, ah->paprd_target_power);
REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK, REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK,
ah->paprd_ratemask); ah->paprd_ratemask);
......
...@@ -180,7 +180,7 @@ enum ATH_AGGR_STATUS { ...@@ -180,7 +180,7 @@ enum ATH_AGGR_STATUS {
struct ath_txq { struct ath_txq {
int mac80211_qnum; /* mac80211 queue number, -1 means not mac80211 Q */ int mac80211_qnum; /* mac80211 queue number, -1 means not mac80211 Q */
u32 axq_qnum; /* ath9k hardware queue number */ u32 axq_qnum; /* ath9k hardware queue number */
u32 *axq_link; void *axq_link;
struct list_head axq_q; struct list_head axq_q;
spinlock_t axq_lock; spinlock_t axq_lock;
u32 axq_depth; u32 axq_depth;
...@@ -189,7 +189,6 @@ struct ath_txq { ...@@ -189,7 +189,6 @@ struct ath_txq {
bool axq_tx_inprogress; bool axq_tx_inprogress;
struct list_head axq_acq; struct list_head axq_acq;
struct list_head txq_fifo[ATH_TXFIFO_DEPTH]; struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
struct list_head txq_fifo_pending;
u8 txq_headidx; u8 txq_headidx;
u8 txq_tailidx; u8 txq_tailidx;
int pending_frames; int pending_frames;
...@@ -429,6 +428,7 @@ void ath_hw_check(struct work_struct *work); ...@@ -429,6 +428,7 @@ void ath_hw_check(struct work_struct *work);
void ath_hw_pll_work(struct work_struct *work); void ath_hw_pll_work(struct work_struct *work);
void ath_paprd_calibrate(struct work_struct *work); void ath_paprd_calibrate(struct work_struct *work);
void ath_ani_calibrate(unsigned long data); void ath_ani_calibrate(unsigned long data);
void ath_start_ani(struct ath_common *common);
/**********/ /**********/
/* BTCOEX */ /* BTCOEX */
...@@ -670,12 +670,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, ...@@ -670,12 +670,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
const struct ath_bus_ops *bus_ops); const struct ath_bus_ops *bus_ops);
void ath9k_deinit_device(struct ath_softc *sc); void ath9k_deinit_device(struct ath_softc *sc);
void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw); void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw);
int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
struct ath9k_channel *hchan);
void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw);
void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw); void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw);
bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode);
bool ath9k_uses_beacons(int type); bool ath9k_uses_beacons(int type);
#ifdef CONFIG_ATH9K_PCI #ifdef CONFIG_ATH9K_PCI
......
...@@ -496,7 +496,7 @@ static void ath_beacon_config_ap(struct ath_softc *sc, ...@@ -496,7 +496,7 @@ static void ath_beacon_config_ap(struct ath_softc *sc,
u32 nexttbtt, intval; u32 nexttbtt, intval;
/* NB: the beacon interval is kept internally in TU's */ /* NB: the beacon interval is kept internally in TU's */
intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD); intval = TU_TO_USEC(conf->beacon_interval);
intval /= ATH_BCBUF; /* for staggered beacons */ intval /= ATH_BCBUF; /* for staggered beacons */
nexttbtt = intval; nexttbtt = intval;
...@@ -543,7 +543,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc, ...@@ -543,7 +543,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
} }
memset(&bs, 0, sizeof(bs)); memset(&bs, 0, sizeof(bs));
intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; intval = conf->beacon_interval;
/* /*
* Setup dtim and cfp parameters according to * Setup dtim and cfp parameters according to
...@@ -652,22 +652,13 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, ...@@ -652,22 +652,13 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc,
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
u32 tsf, delta, intval, nexttbtt; u32 tsf, intval, nexttbtt;
ath9k_reset_beacon_status(sc); ath9k_reset_beacon_status(sc);
tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE); intval = TU_TO_USEC(conf->beacon_interval);
intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD); tsf = roundup(ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE), intval);
nexttbtt = tsf + intval;
if (!sc->beacon.bc_tstamp)
nexttbtt = tsf + intval;
else {
if (tsf > sc->beacon.bc_tstamp)
delta = (tsf - sc->beacon.bc_tstamp);
else
delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));
nexttbtt = tsf + intval - (delta % intval);
}
ath_dbg(common, ATH_DBG_BEACON, ath_dbg(common, ATH_DBG_BEACON,
"IBSS nexttbtt %u intval %u (%u)\n", "IBSS nexttbtt %u intval %u (%u)\n",
......
...@@ -176,6 +176,56 @@ static const struct file_operations fops_rx_chainmask = { ...@@ -176,6 +176,56 @@ static const struct file_operations fops_rx_chainmask = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
static ssize_t read_file_disable_ani(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
char buf[32];
unsigned int len;
len = sprintf(buf, "%d\n", common->disable_ani);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
static ssize_t write_file_disable_ani(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
unsigned long disable_ani;
char buf[32];
ssize_t len;
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, &disable_ani))
return -EINVAL;
common->disable_ani = !!disable_ani;
if (disable_ani) {
sc->sc_flags &= ~SC_OP_ANI_RUN;
del_timer_sync(&common->ani.timer);
} else {
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common);
}
return count;
}
static const struct file_operations fops_disable_ani = {
.read = read_file_disable_ani,
.write = write_file_disable_ani,
.open = ath9k_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t read_file_dma(struct file *file, char __user *user_buf, static ssize_t read_file_dma(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
...@@ -550,6 +600,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, ...@@ -550,6 +600,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
PR("MPDUs Queued: ", queued); PR("MPDUs Queued: ", queued);
PR("MPDUs Completed: ", completed); PR("MPDUs Completed: ", completed);
PR("MPDUs XRetried: ", xretries);
PR("Aggregates: ", a_aggr); PR("Aggregates: ", a_aggr);
PR("AMPDUs Queued HW:", a_queued_hw); PR("AMPDUs Queued HW:", a_queued_hw);
PR("AMPDUs Queued SW:", a_queued_sw); PR("AMPDUs Queued SW:", a_queued_sw);
...@@ -587,7 +638,6 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, ...@@ -587,7 +638,6 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
PRQLE("axq_q empty: ", axq_q); PRQLE("axq_q empty: ", axq_q);
PRQLE("axq_acq empty: ", axq_acq); PRQLE("axq_acq empty: ", axq_acq);
PRQLE("txq_fifo_pending: ", txq_fifo_pending);
for (i = 0; i < ATH_TXFIFO_DEPTH; i++) { for (i = 0; i < ATH_TXFIFO_DEPTH; i++) {
snprintf(tmp, sizeof(tmp) - 1, "txq_fifo[%i] empty: ", i); snprintf(tmp, sizeof(tmp) - 1, "txq_fifo[%i] empty: ", i);
PRQLE(tmp, txq_fifo[i]); PRQLE(tmp, txq_fifo[i]);
...@@ -807,7 +857,10 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, ...@@ -807,7 +857,10 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
else else
TX_STAT_INC(qnum, a_completed); TX_STAT_INC(qnum, a_completed);
} else { } else {
TX_STAT_INC(qnum, completed); if (bf_isxretried(bf))
TX_STAT_INC(qnum, xretries);
else
TX_STAT_INC(qnum, completed);
} }
if (ts->ts_status & ATH9K_TXERR_FIFO) if (ts->ts_status & ATH9K_TXERR_FIFO)
...@@ -1160,6 +1213,8 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1160,6 +1213,8 @@ int ath9k_init_debug(struct ath_hw *ah)
sc->debug.debugfs_phy, sc, &fops_rx_chainmask); sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_tx_chainmask); sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_disable_ani);
debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_regidx); sc, &fops_regidx);
debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
......
...@@ -116,6 +116,7 @@ struct ath_tx_stats { ...@@ -116,6 +116,7 @@ struct ath_tx_stats {
u32 tx_bytes_all; u32 tx_bytes_all;
u32 queued; u32 queued;
u32 completed; u32 completed;
u32 xretries;
u32 a_aggr; u32 a_aggr;
u32 a_queued_hw; u32 a_queued_hw;
u32 a_queued_sw; u32 a_queued_sw;
......
...@@ -79,7 +79,7 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv, ...@@ -79,7 +79,7 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
memset(&bs, 0, sizeof(bs)); memset(&bs, 0, sizeof(bs));
intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD; intval = bss_conf->beacon_interval;
bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval); bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval);
/* /*
...@@ -194,7 +194,7 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv, ...@@ -194,7 +194,7 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
u8 cmd_rsp; u8 cmd_rsp;
u64 tsf; u64 tsf;
intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD; intval = bss_conf->beacon_interval;
intval /= ATH9K_HTC_MAX_BCN_VIF; intval /= ATH9K_HTC_MAX_BCN_VIF;
nexttbtt = intval; nexttbtt = intval;
...@@ -250,7 +250,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv, ...@@ -250,7 +250,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
u8 cmd_rsp; u8 cmd_rsp;
u64 tsf; u64 tsf;
intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD; intval = bss_conf->beacon_interval;
nexttbtt = intval; nexttbtt = intval;
/* /*
...@@ -427,7 +427,7 @@ static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv, ...@@ -427,7 +427,7 @@ static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv,
u16 intval; u16 intval;
int slot; int slot;
intval = priv->cur_beacon_conf.beacon_interval & ATH9K_BEACON_PERIOD; intval = priv->cur_beacon_conf.beacon_interval;
tsf = be64_to_cpu(swba->tsf); tsf = be64_to_cpu(swba->tsf);
tsftu = TSF_TO_TU(tsf >> 32, tsf); tsftu = TSF_TO_TU(tsf >> 32, tsf);
......
...@@ -39,11 +39,6 @@ static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds, ...@@ -39,11 +39,6 @@ static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,
ath9k_hw_ops(ah)->set_desc_link(ds, link); ath9k_hw_ops(ah)->set_desc_link(ds, link);
} }
static inline void ath9k_hw_get_desc_link(struct ath_hw *ah, void *ds,
u32 **link)
{
ath9k_hw_ops(ah)->get_desc_link(ds, link);
}
static inline bool ath9k_hw_calibrate(struct ath_hw *ah, static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
u8 rxchainmask, u8 rxchainmask,
......
...@@ -1785,16 +1785,16 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, ...@@ -1785,16 +1785,16 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt));
REG_WRITE(ah, AR_BEACON_PERIOD, REG_WRITE(ah, AR_BEACON_PERIOD,
TU_TO_USEC(bs->bs_intval & ATH9K_BEACON_PERIOD)); TU_TO_USEC(bs->bs_intval));
REG_WRITE(ah, AR_DMA_BEACON_PERIOD, REG_WRITE(ah, AR_DMA_BEACON_PERIOD,
TU_TO_USEC(bs->bs_intval & ATH9K_BEACON_PERIOD)); TU_TO_USEC(bs->bs_intval));
REGWRITE_BUFFER_FLUSH(ah); REGWRITE_BUFFER_FLUSH(ah);
REG_RMW_FIELD(ah, AR_RSSI_THR, REG_RMW_FIELD(ah, AR_RSSI_THR,
AR_RSSI_THR_BM_THR, bs->bs_bmissthreshold); AR_RSSI_THR_BM_THR, bs->bs_bmissthreshold);
beaconintval = bs->bs_intval & ATH9K_BEACON_PERIOD; beaconintval = bs->bs_intval;
if (bs->bs_sleepduration > beaconintval) if (bs->bs_sleepduration > beaconintval)
beaconintval = bs->bs_sleepduration; beaconintval = bs->bs_sleepduration;
......
...@@ -403,7 +403,6 @@ struct ath9k_beacon_state { ...@@ -403,7 +403,6 @@ struct ath9k_beacon_state {
u32 bs_nexttbtt; u32 bs_nexttbtt;
u32 bs_nextdtim; u32 bs_nextdtim;
u32 bs_intval; u32 bs_intval;
#define ATH9K_BEACON_PERIOD 0x0000ffff
#define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */
u32 bs_dtimperiod; u32 bs_dtimperiod;
u16 bs_cfpperiod; u16 bs_cfpperiod;
...@@ -603,7 +602,6 @@ struct ath_hw_ops { ...@@ -603,7 +602,6 @@ struct ath_hw_ops {
int power_off); int power_off);
void (*rx_enable)(struct ath_hw *ah); void (*rx_enable)(struct ath_hw *ah);
void (*set_desc_link)(void *ds, u32 link); void (*set_desc_link)(void *ds, u32 link);
void (*get_desc_link)(void *ds, u32 **link);
bool (*calibrate)(struct ath_hw *ah, bool (*calibrate)(struct ath_hw *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
u8 rxchainmask, u8 rxchainmask,
......
...@@ -519,7 +519,6 @@ static void ath9k_init_misc(struct ath_softc *sc) ...@@ -519,7 +519,6 @@ static void ath9k_init_misc(struct ath_softc *sc)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
int i = 0; int i = 0;
setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc); setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
sc->config.txpowlimit = ATH_TXPOWER_MAX; sc->config.txpowlimit = ATH_TXPOWER_MAX;
...@@ -585,6 +584,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, ...@@ -585,6 +584,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
common->priv = sc; common->priv = sc;
common->debug_mask = ath9k_debug; common->debug_mask = ath9k_debug;
common->btcoex_enabled = ath9k_btcoex_enable == 1; common->btcoex_enabled = ath9k_btcoex_enable == 1;
common->disable_ani = false;
spin_lock_init(&common->cc_lock); spin_lock_init(&common->cc_lock);
spin_lock_init(&sc->sc_serial_rw); spin_lock_init(&sc->sc_serial_rw);
......
...@@ -62,14 +62,12 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq) ...@@ -62,14 +62,12 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq)
if (txq->axq_depth || !list_empty(&txq->axq_acq)) if (txq->axq_depth || !list_empty(&txq->axq_acq))
pending = true; pending = true;
else if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
pending = !list_empty(&txq->txq_fifo_pending);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
return pending; return pending;
} }
bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode) static bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode)
{ {
unsigned long flags; unsigned long flags;
bool ret; bool ret;
...@@ -136,7 +134,7 @@ void ath9k_ps_restore(struct ath_softc *sc) ...@@ -136,7 +134,7 @@ void ath9k_ps_restore(struct ath_softc *sc)
spin_unlock_irqrestore(&sc->sc_pm_lock, flags); spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
} }
static void ath_start_ani(struct ath_common *common) void ath_start_ani(struct ath_common *common)
{ {
struct ath_hw *ah = common->ah; struct ath_hw *ah = common->ah;
unsigned long timestamp = jiffies_to_msecs(jiffies); unsigned long timestamp = jiffies_to_msecs(jiffies);
...@@ -219,7 +217,7 @@ static int ath_update_survey_stats(struct ath_softc *sc) ...@@ -219,7 +217,7 @@ static int ath_update_survey_stats(struct ath_softc *sc)
* by reseting the chip. To accomplish this we must first cleanup any pending * by reseting the chip. To accomplish this we must first cleanup any pending
* DMA, then restart stuff. * DMA, then restart stuff.
*/ */
int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, static int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
struct ath9k_channel *hchan) struct ath9k_channel *hchan)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
...@@ -302,7 +300,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -302,7 +300,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
ath_set_beacon(sc); ath_set_beacon(sc);
ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/2); ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, HZ/2);
ath_start_ani(common); if (!common->disable_ani)
ath_start_ani(common);
} }
ps_restore: ps_restore:
...@@ -394,12 +393,14 @@ void ath_paprd_calibrate(struct work_struct *work) ...@@ -394,12 +393,14 @@ void ath_paprd_calibrate(struct work_struct *work)
if (!caldata) if (!caldata)
return; return;
ath9k_ps_wakeup(sc);
if (ar9003_paprd_init_table(ah) < 0) if (ar9003_paprd_init_table(ah) < 0)
return; goto fail_paprd;
skb = alloc_skb(len, GFP_KERNEL); skb = alloc_skb(len, GFP_KERNEL);
if (!skb) if (!skb)
return; goto fail_paprd;
skb_put(skb, len); skb_put(skb, len);
memset(skb->data, 0, len); memset(skb->data, 0, len);
...@@ -411,7 +412,6 @@ void ath_paprd_calibrate(struct work_struct *work) ...@@ -411,7 +412,6 @@ void ath_paprd_calibrate(struct work_struct *work)
memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
ath9k_ps_wakeup(sc);
for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
if (!(common->tx_chainmask & BIT(chain))) if (!(common->tx_chainmask & BIT(chain)))
continue; continue;
...@@ -515,24 +515,19 @@ void ath_ani_calibrate(unsigned long data) ...@@ -515,24 +515,19 @@ void ath_ani_calibrate(unsigned long data)
common->ani.checkani_timer = timestamp; common->ani.checkani_timer = timestamp;
} }
/* Skip all processing if there's nothing to do. */ /* Call ANI routine if necessary */
if (longcal || shortcal || aniflag) { if (aniflag) {
/* Call ANI routine if necessary */ spin_lock_irqsave(&common->cc_lock, flags);
if (aniflag) { ath9k_hw_ani_monitor(ah, ah->curchan);
spin_lock_irqsave(&common->cc_lock, flags); ath_update_survey_stats(sc);
ath9k_hw_ani_monitor(ah, ah->curchan); spin_unlock_irqrestore(&common->cc_lock, flags);
ath_update_survey_stats(sc); }
spin_unlock_irqrestore(&common->cc_lock, flags);
}
/* Perform calibration if necessary */ /* Perform calibration if necessary */
if (longcal || shortcal) { if (longcal || shortcal) {
common->ani.caldone = common->ani.caldone =
ath9k_hw_calibrate(ah, ath9k_hw_calibrate(ah, ah->curchan,
ah->curchan, common->rx_chainmask, longcal);
common->rx_chainmask,
longcal);
}
} }
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
...@@ -868,7 +863,7 @@ irqreturn_t ath_isr(int irq, void *dev) ...@@ -868,7 +863,7 @@ irqreturn_t ath_isr(int irq, void *dev)
#undef SCHED_INTR #undef SCHED_INTR
} }
void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) static void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
...@@ -974,6 +969,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -974,6 +969,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
sc->hw_busy_count = 0; sc->hw_busy_count = 0;
/* Stop ANI */ /* Stop ANI */
del_timer_sync(&common->ani.timer); del_timer_sync(&common->ani.timer);
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
...@@ -1023,7 +1019,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -1023,7 +1019,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
spin_unlock_bh(&sc->sc_pcu_lock); spin_unlock_bh(&sc->sc_pcu_lock);
/* Start ANI */ /* Start ANI */
ath_start_ani(common); if (!common->disable_ani)
ath_start_ani(common);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
return r; return r;
...@@ -1412,10 +1410,14 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, ...@@ -1412,10 +1410,14 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
ath9k_hw_set_interrupts(ah, ah->imask); ath9k_hw_set_interrupts(ah, ah->imask);
/* Set up ANI */ /* Set up ANI */
if ((iter_data.naps + iter_data.nadhocs) > 0) { if (iter_data.naps > 0) {
sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common); if (!common->disable_ani) {
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common);
}
} else { } else {
sc->sc_flags &= ~SC_OP_ANI_RUN; sc->sc_flags &= ~SC_OP_ANI_RUN;
del_timer_sync(&common->ani.timer); del_timer_sync(&common->ani.timer);
...@@ -1952,50 +1954,38 @@ static void ath9k_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) ...@@ -1952,50 +1954,38 @@ static void ath9k_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
switch (sc->sc_ah->opmode) { /*
case NL80211_IFTYPE_ADHOC: * Skip iteration if primary station vif's bss info
/* There can be only one vif available */ * was not changed
*/
if (sc->sc_flags & SC_OP_PRIM_STA_VIF)
return;
if (bss_conf->assoc) {
sc->sc_flags |= SC_OP_PRIM_STA_VIF;
avp->primary_sta_vif = true;
memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
common->curaid = bss_conf->aid; common->curaid = bss_conf->aid;
ath9k_hw_write_associd(sc->sc_ah); ath9k_hw_write_associd(sc->sc_ah);
/* configure beacon */ ath_dbg(common, ATH_DBG_CONFIG,
if (bss_conf->enable_beacon)
ath_beacon_config(sc, vif);
break;
case NL80211_IFTYPE_STATION:
/*
* Skip iteration if primary station vif's bss info
* was not changed
*/
if (sc->sc_flags & SC_OP_PRIM_STA_VIF)
break;
if (bss_conf->assoc) {
sc->sc_flags |= SC_OP_PRIM_STA_VIF;
avp->primary_sta_vif = true;
memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
common->curaid = bss_conf->aid;
ath9k_hw_write_associd(sc->sc_ah);
ath_dbg(common, ATH_DBG_CONFIG,
"Bss Info ASSOC %d, bssid: %pM\n", "Bss Info ASSOC %d, bssid: %pM\n",
bss_conf->aid, common->curbssid); bss_conf->aid, common->curbssid);
ath_beacon_config(sc, vif); ath_beacon_config(sc, vif);
/* /*
* Request a re-configuration of Beacon related timers * Request a re-configuration of Beacon related timers
* on the receipt of the first Beacon frame (i.e., * on the receipt of the first Beacon frame (i.e.,
* after time sync with the AP). * after time sync with the AP).
*/ */
sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
/* Reset rssi stats */ /* Reset rssi stats */
sc->last_rssi = ATH_RSSI_DUMMY_MARKER; sc->last_rssi = ATH_RSSI_DUMMY_MARKER;
sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
if (!common->disable_ani) {
sc->sc_flags |= SC_OP_ANI_RUN; sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common); ath_start_ani(common);
} }
break;
default:
break;
} }
} }
...@@ -2005,6 +1995,9 @@ static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif) ...@@ -2005,6 +1995,9 @@ static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif)
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
return;
/* Reconfigure bss info */ /* Reconfigure bss info */
if (avp->primary_sta_vif && !bss_conf->assoc) { if (avp->primary_sta_vif && !bss_conf->assoc) {
ath_dbg(common, ATH_DBG_CONFIG, ath_dbg(common, ATH_DBG_CONFIG,
...@@ -2023,8 +2016,7 @@ static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif) ...@@ -2023,8 +2016,7 @@ static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif)
* None of station vifs are associated. * None of station vifs are associated.
* Clear bssid & aid * Clear bssid & aid
*/ */
if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) && if (!(sc->sc_flags & SC_OP_PRIM_STA_VIF)) {
!(sc->sc_flags & SC_OP_PRIM_STA_VIF)) {
ath9k_hw_write_associd(sc->sc_ah); ath9k_hw_write_associd(sc->sc_ah);
/* Stop ANI */ /* Stop ANI */
sc->sc_flags &= ~SC_OP_ANI_RUN; sc->sc_flags &= ~SC_OP_ANI_RUN;
...@@ -2054,6 +2046,26 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2054,6 +2046,26 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
common->curbssid, common->curaid); common->curbssid, common->curaid);
} }
if (changed & BSS_CHANGED_IBSS) {
/* There can be only one vif available */
memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
common->curaid = bss_conf->aid;
ath9k_hw_write_associd(sc->sc_ah);
if (bss_conf->ibss_joined) {
sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
if (!common->disable_ani) {
sc->sc_flags |= SC_OP_ANI_RUN;
ath_start_ani(common);
}
} else {
sc->sc_flags &= ~SC_OP_ANI_RUN;
del_timer_sync(&common->ani.timer);
}
}
/* Enable transmission of beacons (AP, IBSS, MESH) */ /* Enable transmission of beacons (AP, IBSS, MESH) */
if ((changed & BSS_CHANGED_BEACON) || if ((changed & BSS_CHANGED_BEACON) ||
((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) {
...@@ -2334,7 +2346,7 @@ static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) ...@@ -2334,7 +2346,7 @@ static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw)
return false; return false;
} }
int ath9k_tx_last_beacon(struct ieee80211_hw *hw) static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
......
...@@ -53,7 +53,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, ...@@ -53,7 +53,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
struct ath_txq *txq, struct list_head *bf_q, struct ath_txq *txq, struct list_head *bf_q,
struct ath_tx_status *ts, int txok, int sendbar); struct ath_tx_status *ts, int txok, int sendbar);
static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
struct list_head *head); struct list_head *head, bool internal);
static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len); static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len);
static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
struct ath_tx_status *ts, int nframes, int nbad, struct ath_tx_status *ts, int nframes, int nbad,
...@@ -377,8 +377,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -377,8 +377,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
bf_next = bf->bf_next; bf_next = bf->bf_next;
bf->bf_state.bf_type |= BUF_XRETRY; bf->bf_state.bf_type |= BUF_XRETRY;
if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) || if (!bf->bf_stale || bf_next != NULL)
!bf->bf_stale || bf_next != NULL)
list_move_tail(&bf->list, &bf_head); list_move_tail(&bf->list, &bf_head);
ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false); ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false);
...@@ -463,20 +462,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -463,20 +462,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
} }
} }
if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && /*
bf_next == NULL) { * Make sure the last desc is reclaimed if it
/* * not a holding desc.
* Make sure the last desc is reclaimed if it */
* not a holding desc. if (!bf_last->bf_stale || bf_next != NULL)
*/
if (!bf_last->bf_stale)
list_move_tail(&bf->list, &bf_head);
else
INIT_LIST_HEAD(&bf_head);
} else {
BUG_ON(list_empty(bf_q));
list_move_tail(&bf->list, &bf_head); list_move_tail(&bf->list, &bf_head);
} else
INIT_LIST_HEAD(&bf_head);
if (!txpending || (tid->state & AGGR_CLEANUP)) { if (!txpending || (tid->state & AGGR_CLEANUP)) {
/* /*
...@@ -837,7 +830,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -837,7 +830,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
bf->bf_state.bf_type &= ~BUF_AGGR; bf->bf_state.bf_type &= ~BUF_AGGR;
ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc); ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc);
ath_buf_set_rate(sc, bf, fi->framelen); ath_buf_set_rate(sc, bf, fi->framelen);
ath_tx_txqaddbuf(sc, txq, &bf_q); ath_tx_txqaddbuf(sc, txq, &bf_q, false);
continue; continue;
} }
...@@ -849,7 +842,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -849,7 +842,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
/* anchor last desc of aggregate */ /* anchor last desc of aggregate */
ath9k_hw_set11n_aggr_last(sc->sc_ah, bf->bf_lastbf->bf_desc); ath9k_hw_set11n_aggr_last(sc->sc_ah, bf->bf_lastbf->bf_desc);
ath_tx_txqaddbuf(sc, txq, &bf_q); ath_tx_txqaddbuf(sc, txq, &bf_q, false);
TX_STAT_INC(txq->axq_qnum, a_aggr); TX_STAT_INC(txq->axq_qnum, a_aggr);
} while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH && } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH &&
...@@ -1085,7 +1078,6 @@ struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) ...@@ -1085,7 +1078,6 @@ struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
txq->txq_headidx = txq->txq_tailidx = 0; txq->txq_headidx = txq->txq_tailidx = 0;
for (i = 0; i < ATH_TXFIFO_DEPTH; i++) for (i = 0; i < ATH_TXFIFO_DEPTH; i++)
INIT_LIST_HEAD(&txq->txq_fifo[i]); INIT_LIST_HEAD(&txq->txq_fifo[i]);
INIT_LIST_HEAD(&txq->txq_fifo_pending);
} }
return &sc->tx.txq[axq_qnum]; return &sc->tx.txq[axq_qnum];
} }
...@@ -1155,13 +1147,8 @@ static bool bf_is_ampdu_not_probing(struct ath_buf *bf) ...@@ -1155,13 +1147,8 @@ static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE); return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
} }
/* static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq,
* Drain a given TX queue (could be Beacon or Data) struct list_head *list, bool retry_tx)
*
* This assumes output has been stopped and
* we do not need to block ath_tx_tasklet.
*/
void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
{ {
struct ath_buf *bf, *lastbf; struct ath_buf *bf, *lastbf;
struct list_head bf_head; struct list_head bf_head;
...@@ -1170,93 +1157,63 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) ...@@ -1170,93 +1157,63 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
memset(&ts, 0, sizeof(ts)); memset(&ts, 0, sizeof(ts));
INIT_LIST_HEAD(&bf_head); INIT_LIST_HEAD(&bf_head);
for (;;) { while (!list_empty(list)) {
spin_lock_bh(&txq->axq_lock); bf = list_first_entry(list, struct ath_buf, list);
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { if (bf->bf_stale) {
if (list_empty(&txq->txq_fifo[txq->txq_tailidx])) { list_del(&bf->list);
txq->txq_headidx = txq->txq_tailidx = 0;
spin_unlock_bh(&txq->axq_lock);
break;
} else {
bf = list_first_entry(&txq->txq_fifo[txq->txq_tailidx],
struct ath_buf, list);
}
} else {
if (list_empty(&txq->axq_q)) {
txq->axq_link = NULL;
spin_unlock_bh(&txq->axq_lock);
break;
}
bf = list_first_entry(&txq->axq_q, struct ath_buf,
list);
if (bf->bf_stale) {
list_del(&bf->list);
spin_unlock_bh(&txq->axq_lock);
ath_tx_return_buffer(sc, bf); ath_tx_return_buffer(sc, bf);
continue; continue;
}
} }
lastbf = bf->bf_lastbf; lastbf = bf->bf_lastbf;
list_cut_position(&bf_head, list, &lastbf->list);
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
list_cut_position(&bf_head,
&txq->txq_fifo[txq->txq_tailidx],
&lastbf->list);
INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
} else {
/* remove ath_buf's of the same mpdu from txq */
list_cut_position(&bf_head, &txq->axq_q, &lastbf->list);
}
txq->axq_depth--; txq->axq_depth--;
if (bf_is_ampdu_not_probing(bf)) if (bf_is_ampdu_not_probing(bf))
txq->axq_ampdu_depth--; txq->axq_ampdu_depth--;
spin_unlock_bh(&txq->axq_lock);
spin_unlock_bh(&txq->axq_lock);
if (bf_isampdu(bf)) if (bf_isampdu(bf))
ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0, ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0,
retry_tx); retry_tx);
else else
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
spin_lock_bh(&txq->axq_lock);
} }
}
/*
* Drain a given TX queue (could be Beacon or Data)
*
* This assumes output has been stopped and
* we do not need to block ath_tx_tasklet.
*/
void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
{
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
txq->axq_tx_inprogress = false;
spin_unlock_bh(&txq->axq_lock);
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
spin_lock_bh(&txq->axq_lock); int idx = txq->txq_tailidx;
while (!list_empty(&txq->txq_fifo_pending)) {
bf = list_first_entry(&txq->txq_fifo_pending,
struct ath_buf, list);
list_cut_position(&bf_head,
&txq->txq_fifo_pending,
&bf->bf_lastbf->list);
spin_unlock_bh(&txq->axq_lock);
if (bf_isampdu(bf)) while (!list_empty(&txq->txq_fifo[idx])) {
ath_tx_complete_aggr(sc, txq, bf, &bf_head, ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx],
&ts, 0, retry_tx); retry_tx);
else
ath_tx_complete_buf(sc, bf, txq, &bf_head, INCR(idx, ATH_TXFIFO_DEPTH);
&ts, 0, 0);
spin_lock_bh(&txq->axq_lock);
} }
spin_unlock_bh(&txq->axq_lock); txq->txq_tailidx = idx;
} }
txq->axq_link = NULL;
txq->axq_tx_inprogress = false;
ath_drain_txq_list(sc, txq, &txq->axq_q, retry_tx);
/* flush any pending frames if aggregation is enabled */ /* flush any pending frames if aggregation is enabled */
if (sc->sc_flags & SC_OP_TXAGGR) { if ((sc->sc_flags & SC_OP_TXAGGR) && !retry_tx)
if (!retry_tx) { ath_txq_drain_pending_buffers(sc, txq);
spin_lock_bh(&txq->axq_lock);
ath_txq_drain_pending_buffers(sc, txq); spin_unlock_bh(&txq->axq_lock);
spin_unlock_bh(&txq->axq_lock);
}
}
} }
bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
...@@ -1370,11 +1327,13 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) ...@@ -1370,11 +1327,13 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
* assume the descriptors are already chained together by caller. * assume the descriptors are already chained together by caller.
*/ */
static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
struct list_head *head) struct list_head *head, bool internal)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_buf *bf; struct ath_buf *bf, *bf_last;
bool puttxbuf = false;
bool edma;
/* /*
* Insert the frame on the outbound list and * Insert the frame on the outbound list and
...@@ -1384,51 +1343,49 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1384,51 +1343,49 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
if (list_empty(head)) if (list_empty(head))
return; return;
edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
bf = list_first_entry(head, struct ath_buf, list); bf = list_first_entry(head, struct ath_buf, list);
bf_last = list_entry(head->prev, struct ath_buf, list);
ath_dbg(common, ATH_DBG_QUEUE, ath_dbg(common, ATH_DBG_QUEUE,
"qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth); "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth);
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { if (edma && list_empty(&txq->txq_fifo[txq->txq_headidx])) {
if (txq->axq_depth >= ATH_TXFIFO_DEPTH) { list_splice_tail_init(head, &txq->txq_fifo[txq->txq_headidx]);
list_splice_tail_init(head, &txq->txq_fifo_pending);
return;
}
if (!list_empty(&txq->txq_fifo[txq->txq_headidx]))
ath_dbg(common, ATH_DBG_XMIT,
"Initializing tx fifo %d which is non-empty\n",
txq->txq_headidx);
INIT_LIST_HEAD(&txq->txq_fifo[txq->txq_headidx]);
list_splice_init(head, &txq->txq_fifo[txq->txq_headidx]);
INCR(txq->txq_headidx, ATH_TXFIFO_DEPTH); INCR(txq->txq_headidx, ATH_TXFIFO_DEPTH);
TX_STAT_INC(txq->axq_qnum, puttxbuf); puttxbuf = true;
ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n",
txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
} else { } else {
list_splice_tail_init(head, &txq->axq_q); list_splice_tail_init(head, &txq->axq_q);
if (txq->axq_link == NULL) { if (txq->axq_link) {
TX_STAT_INC(txq->axq_qnum, puttxbuf); ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr);
ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n",
txq->axq_qnum, ito64(bf->bf_daddr),
bf->bf_desc);
} else {
*txq->axq_link = bf->bf_daddr;
ath_dbg(common, ATH_DBG_XMIT, ath_dbg(common, ATH_DBG_XMIT,
"link[%u] (%p)=%llx (%p)\n", "link[%u] (%p)=%llx (%p)\n",
txq->axq_qnum, txq->axq_link, txq->axq_qnum, txq->axq_link,
ito64(bf->bf_daddr), bf->bf_desc); ito64(bf->bf_daddr), bf->bf_desc);
} } else if (!edma)
ath9k_hw_get_desc_link(ah, bf->bf_lastbf->bf_desc, puttxbuf = true;
&txq->axq_link);
txq->axq_link = bf_last->bf_desc;
}
if (puttxbuf) {
TX_STAT_INC(txq->axq_qnum, puttxbuf);
ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n",
txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
}
if (!edma) {
TX_STAT_INC(txq->axq_qnum, txstart); TX_STAT_INC(txq->axq_qnum, txstart);
ath9k_hw_txstart(ah, txq->axq_qnum); ath9k_hw_txstart(ah, txq->axq_qnum);
} }
txq->axq_depth++;
if (bf_is_ampdu_not_probing(bf)) if (!internal) {
txq->axq_ampdu_depth++; txq->axq_depth++;
if (bf_is_ampdu_not_probing(bf))
txq->axq_ampdu_depth++;
}
} }
static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
...@@ -1470,7 +1427,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, ...@@ -1470,7 +1427,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw); TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
bf->bf_lastbf = bf; bf->bf_lastbf = bf;
ath_buf_set_rate(sc, bf, fi->framelen); ath_buf_set_rate(sc, bf, fi->framelen);
ath_tx_txqaddbuf(sc, txctl->txq, &bf_head); ath_tx_txqaddbuf(sc, txctl->txq, &bf_head, false);
} }
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
...@@ -1490,7 +1447,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1490,7 +1447,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
bf->bf_lastbf = bf; bf->bf_lastbf = bf;
fi = get_frame_info(bf->bf_mpdu); fi = get_frame_info(bf->bf_mpdu);
ath_buf_set_rate(sc, bf, fi->framelen); ath_buf_set_rate(sc, bf, fi->framelen);
ath_tx_txqaddbuf(sc, txq, bf_head); ath_tx_txqaddbuf(sc, txq, bf_head, false);
TX_STAT_INC(txq->axq_qnum, queued); TX_STAT_INC(txq->axq_qnum, queued);
} }
...@@ -2077,6 +2034,38 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, ...@@ -2077,6 +2034,38 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
} }
static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
struct ath_tx_status *ts, struct ath_buf *bf,
struct list_head *bf_head)
{
int txok;
txq->axq_depth--;
txok = !(ts->ts_status & ATH9K_TXERR_MASK);
txq->axq_tx_inprogress = false;
if (bf_is_ampdu_not_probing(bf))
txq->axq_ampdu_depth--;
spin_unlock_bh(&txq->axq_lock);
if (!bf_isampdu(bf)) {
/*
* This frame is sent out as a single frame.
* Use hardware retry status for this frame.
*/
if (ts->ts_status & ATH9K_TXERR_XRETRY)
bf->bf_state.bf_type |= BUF_XRETRY;
ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok, true);
ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0);
} else
ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
spin_lock_bh(&txq->axq_lock);
if (sc->sc_flags & SC_OP_TXAGGR)
ath_txq_schedule(sc, txq);
}
static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
...@@ -2085,20 +2074,18 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -2085,20 +2074,18 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
struct list_head bf_head; struct list_head bf_head;
struct ath_desc *ds; struct ath_desc *ds;
struct ath_tx_status ts; struct ath_tx_status ts;
int txok;
int status; int status;
ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n", ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
txq->axq_link); txq->axq_link);
spin_lock_bh(&txq->axq_lock);
for (;;) { for (;;) {
spin_lock_bh(&txq->axq_lock);
if (list_empty(&txq->axq_q)) { if (list_empty(&txq->axq_q)) {
txq->axq_link = NULL; txq->axq_link = NULL;
if (sc->sc_flags & SC_OP_TXAGGR) if (sc->sc_flags & SC_OP_TXAGGR)
ath_txq_schedule(sc, txq); ath_txq_schedule(sc, txq);
spin_unlock_bh(&txq->axq_lock);
break; break;
} }
bf = list_first_entry(&txq->axq_q, struct ath_buf, list); bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
...@@ -2114,13 +2101,11 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -2114,13 +2101,11 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
bf_held = NULL; bf_held = NULL;
if (bf->bf_stale) { if (bf->bf_stale) {
bf_held = bf; bf_held = bf;
if (list_is_last(&bf_held->list, &txq->axq_q)) { if (list_is_last(&bf_held->list, &txq->axq_q))
spin_unlock_bh(&txq->axq_lock);
break; break;
} else {
bf = list_entry(bf_held->list.next, bf = list_entry(bf_held->list.next, struct ath_buf,
struct ath_buf, list); list);
}
} }
lastbf = bf->bf_lastbf; lastbf = bf->bf_lastbf;
...@@ -2128,10 +2113,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -2128,10 +2113,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
memset(&ts, 0, sizeof(ts)); memset(&ts, 0, sizeof(ts));
status = ath9k_hw_txprocdesc(ah, ds, &ts); status = ath9k_hw_txprocdesc(ah, ds, &ts);
if (status == -EINPROGRESS) { if (status == -EINPROGRESS)
spin_unlock_bh(&txq->axq_lock);
break; break;
}
TX_STAT_INC(txq->axq_qnum, txprocdesc); TX_STAT_INC(txq->axq_qnum, txprocdesc);
/* /*
...@@ -2145,42 +2129,14 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -2145,42 +2129,14 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
list_cut_position(&bf_head, list_cut_position(&bf_head,
&txq->axq_q, lastbf->list.prev); &txq->axq_q, lastbf->list.prev);
txq->axq_depth--; if (bf_held) {
txok = !(ts.ts_status & ATH9K_TXERR_MASK);
txq->axq_tx_inprogress = false;
if (bf_held)
list_del(&bf_held->list); list_del(&bf_held->list);
if (bf_is_ampdu_not_probing(bf))
txq->axq_ampdu_depth--;
spin_unlock_bh(&txq->axq_lock);
if (bf_held)
ath_tx_return_buffer(sc, bf_held); ath_tx_return_buffer(sc, bf_held);
if (!bf_isampdu(bf)) {
/*
* This frame is sent out as a single frame.
* Use hardware retry status for this frame.
*/
if (ts.ts_status & ATH9K_TXERR_XRETRY)
bf->bf_state.bf_type |= BUF_XRETRY;
ath_tx_rc_status(sc, bf, &ts, 1, txok ? 0 : 1, txok, true);
} }
if (bf_isampdu(bf)) ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok,
true);
else
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
spin_lock_bh(&txq->axq_lock);
if (sc->sc_flags & SC_OP_TXAGGR)
ath_txq_schedule(sc, txq);
spin_unlock_bh(&txq->axq_lock);
} }
spin_unlock_bh(&txq->axq_lock);
} }
static void ath_tx_complete_poll_work(struct work_struct *work) static void ath_tx_complete_poll_work(struct work_struct *work)
...@@ -2237,17 +2193,16 @@ void ath_tx_tasklet(struct ath_softc *sc) ...@@ -2237,17 +2193,16 @@ void ath_tx_tasklet(struct ath_softc *sc)
void ath_tx_edma_tasklet(struct ath_softc *sc) void ath_tx_edma_tasklet(struct ath_softc *sc)
{ {
struct ath_tx_status txs; struct ath_tx_status ts;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_txq *txq; struct ath_txq *txq;
struct ath_buf *bf, *lastbf; struct ath_buf *bf, *lastbf;
struct list_head bf_head; struct list_head bf_head;
int status; int status;
int txok;
for (;;) { for (;;) {
status = ath9k_hw_txprocdesc(ah, NULL, (void *)&txs); status = ath9k_hw_txprocdesc(ah, NULL, (void *)&ts);
if (status == -EINPROGRESS) if (status == -EINPROGRESS)
break; break;
if (status == -EIO) { if (status == -EIO) {
...@@ -2257,12 +2212,13 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) ...@@ -2257,12 +2212,13 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
} }
/* Skip beacon completions */ /* Skip beacon completions */
if (txs.qid == sc->beacon.beaconq) if (ts.qid == sc->beacon.beaconq)
continue; continue;
txq = &sc->tx.txq[txs.qid]; txq = &sc->tx.txq[ts.qid];
spin_lock_bh(&txq->axq_lock); spin_lock_bh(&txq->axq_lock);
if (list_empty(&txq->txq_fifo[txq->txq_tailidx])) { if (list_empty(&txq->txq_fifo[txq->txq_tailidx])) {
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
return; return;
...@@ -2275,41 +2231,21 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) ...@@ -2275,41 +2231,21 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
INIT_LIST_HEAD(&bf_head); INIT_LIST_HEAD(&bf_head);
list_cut_position(&bf_head, &txq->txq_fifo[txq->txq_tailidx], list_cut_position(&bf_head, &txq->txq_fifo[txq->txq_tailidx],
&lastbf->list); &lastbf->list);
INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
txq->axq_depth--;
txq->axq_tx_inprogress = false;
if (bf_is_ampdu_not_probing(bf))
txq->axq_ampdu_depth--;
spin_unlock_bh(&txq->axq_lock);
txok = !(txs.ts_status & ATH9K_TXERR_MASK); if (list_empty(&txq->txq_fifo[txq->txq_tailidx])) {
INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH);
if (!bf_isampdu(bf)) {
if (txs.ts_status & ATH9K_TXERR_XRETRY)
bf->bf_state.bf_type |= BUF_XRETRY;
ath_tx_rc_status(sc, bf, &txs, 1, txok ? 0 : 1, txok, true);
}
if (bf_isampdu(bf))
ath_tx_complete_aggr(sc, txq, bf, &bf_head, &txs,
txok, true);
else
ath_tx_complete_buf(sc, bf, txq, &bf_head,
&txs, txok, 0);
spin_lock_bh(&txq->axq_lock); if (!list_empty(&txq->axq_q)) {
struct list_head bf_q;
if (!list_empty(&txq->txq_fifo_pending)) { INIT_LIST_HEAD(&bf_q);
INIT_LIST_HEAD(&bf_head); txq->axq_link = NULL;
bf = list_first_entry(&txq->txq_fifo_pending, list_splice_tail_init(&txq->axq_q, &bf_q);
struct ath_buf, list); ath_tx_txqaddbuf(sc, txq, &bf_q, true);
list_cut_position(&bf_head, }
&txq->txq_fifo_pending, }
&bf->bf_lastbf->list);
ath_tx_txqaddbuf(sc, txq, &bf_head);
} else if (sc->sc_flags & SC_OP_TXAGGR)
ath_txq_schedule(sc, txq);
ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
} }
} }
......
...@@ -26,6 +26,11 @@ config B43 ...@@ -26,6 +26,11 @@ config B43
This driver can be built as a module (recommended) that will be called "b43". This driver can be built as a module (recommended) that will be called "b43".
If unsure, say M. If unsure, say M.
config B43_BCMA
bool "Support for BCMA bus"
depends on B43 && BCMA && BROKEN
default y
# Auto-select SSB PCI-HOST support, if possible # Auto-select SSB PCI-HOST support, if possible
config B43_PCI_AUTOSELECT config B43_PCI_AUTOSELECT
bool bool
......
b43-y += main.o b43-y += main.o
b43-y += bus.o
b43-y += tables.o b43-y += tables.o
b43-$(CONFIG_B43_PHY_N) += tables_nphy.o b43-$(CONFIG_B43_PHY_N) += tables_nphy.o
b43-$(CONFIG_B43_PHY_N) += radio_2055.o b43-$(CONFIG_B43_PHY_N) += radio_2055.o
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/hw_random.h> #include <linux/hw_random.h>
#include <linux/bcma/bcma.h>
#include <linux/ssb/ssb.h> #include <linux/ssb/ssb.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "debugfs.h" #include "debugfs.h"
#include "leds.h" #include "leds.h"
#include "rfkill.h" #include "rfkill.h"
#include "bus.h"
#include "lo.h" #include "lo.h"
#include "phy_common.h" #include "phy_common.h"
...@@ -414,6 +416,17 @@ enum { ...@@ -414,6 +416,17 @@ enum {
#define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */ #define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */
#define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */ #define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */
/* BCMA 802.11 core specific IO Control (BCMA_IOCTL) flags */
#define B43_BCMA_IOCTL_PHY_CLKEN 0x00000004 /* PHY Clock Enable */
#define B43_BCMA_IOCTL_PHY_RESET 0x00000008 /* PHY Reset */
#define B43_BCMA_IOCTL_MACPHYCLKEN 0x00000010 /* MAC PHY Clock Control Enable */
#define B43_BCMA_IOCTL_PLLREFSEL 0x00000020 /* PLL Frequency Reference Select */
#define B43_BCMA_IOCTL_PHY_BW 0x000000C0 /* PHY band width and clock speed mask (N-PHY+ only?) */
#define B43_BCMA_IOCTL_PHY_BW_10MHZ 0x00000000 /* 10 MHz bandwidth, 40 MHz PHY */
#define B43_BCMA_IOCTL_PHY_BW_20MHZ 0x00000040 /* 20 MHz bandwidth, 80 MHz PHY */
#define B43_BCMA_IOCTL_PHY_BW_40MHZ 0x00000080 /* 40 MHz bandwidth, 160 MHz PHY */
#define B43_BCMA_IOCTL_GMODE 0x00002000 /* G Mode Enable */
/* 802.11 core specific TM State Low (SSB_TMSLOW) flags */ /* 802.11 core specific TM State Low (SSB_TMSLOW) flags */
#define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */ #define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */
#define B43_TMSLOW_PHY_BANDWIDTH 0x00C00000 /* PHY band width and clock speed mask (N-PHY only) */ #define B43_TMSLOW_PHY_BANDWIDTH 0x00C00000 /* PHY band width and clock speed mask (N-PHY only) */
...@@ -707,7 +720,8 @@ enum { ...@@ -707,7 +720,8 @@ enum {
/* Data structure for one wireless device (802.11 core) */ /* Data structure for one wireless device (802.11 core) */
struct b43_wldev { struct b43_wldev {
struct ssb_device *sdev; struct ssb_device *sdev; /* TODO: remove when b43_bus_dev is ready */
struct b43_bus_dev *dev;
struct b43_wl *wl; struct b43_wl *wl;
/* The device initialization status. /* The device initialization status.
...@@ -879,36 +893,59 @@ static inline enum ieee80211_band b43_current_band(struct b43_wl *wl) ...@@ -879,36 +893,59 @@ static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
return wl->hw->conf.channel->band; return wl->hw->conf.channel->band;
} }
static inline int b43_bus_may_powerdown(struct b43_wldev *wldev)
{
return wldev->dev->bus_may_powerdown(wldev->dev);
}
static inline int b43_bus_powerup(struct b43_wldev *wldev, bool dynamic_pctl)
{
return wldev->dev->bus_powerup(wldev->dev, dynamic_pctl);
}
static inline int b43_device_is_enabled(struct b43_wldev *wldev)
{
return wldev->dev->device_is_enabled(wldev->dev);
}
static inline void b43_device_enable(struct b43_wldev *wldev,
u32 core_specific_flags)
{
wldev->dev->device_enable(wldev->dev, core_specific_flags);
}
static inline void b43_device_disable(struct b43_wldev *wldev,
u32 core_specific_flags)
{
wldev->dev->device_disable(wldev->dev, core_specific_flags);
}
static inline u16 b43_read16(struct b43_wldev *dev, u16 offset) static inline u16 b43_read16(struct b43_wldev *dev, u16 offset)
{ {
return ssb_read16(dev->sdev, offset); return dev->dev->read16(dev->dev, offset);
} }
static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value) static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
{ {
ssb_write16(dev->sdev, offset, value); dev->dev->write16(dev->dev, offset, value);
} }
static inline u32 b43_read32(struct b43_wldev *dev, u16 offset) static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
{ {
return ssb_read32(dev->sdev, offset); return dev->dev->read32(dev->dev, offset);
} }
static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value) static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
{ {
ssb_write32(dev->sdev, offset, value); dev->dev->write32(dev->dev, offset, value);
} }
static inline void b43_block_read(struct b43_wldev *dev, void *buffer, static inline void b43_block_read(struct b43_wldev *dev, void *buffer,
size_t count, u16 offset, u8 reg_width) size_t count, u16 offset, u8 reg_width)
{ {
ssb_block_read(dev->sdev, buffer, count, offset, reg_width); dev->dev->block_read(dev->dev, buffer, count, offset, reg_width);
} }
static inline void b43_block_write(struct b43_wldev *dev, const void *buffer, static inline void b43_block_write(struct b43_wldev *dev, const void *buffer,
size_t count, u16 offset, u8 reg_width) size_t count, u16 offset, u8 reg_width)
{ {
ssb_block_write(dev->sdev, buffer, count, offset, reg_width); dev->dev->block_write(dev->dev, buffer, count, offset, reg_width);
} }
static inline bool b43_using_pio_transfers(struct b43_wldev *dev) static inline bool b43_using_pio_transfers(struct b43_wldev *dev)
......
/*
Broadcom B43 wireless driver
Bus abstraction layer
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 "bus.h"
/* SSB */
static inline int b43_bus_ssb_bus_may_powerdown(struct b43_bus_dev *dev)
{
return ssb_bus_may_powerdown(dev->sdev->bus);
}
static inline int b43_bus_ssb_bus_powerup(struct b43_bus_dev *dev,
bool dynamic_pctl)
{
return ssb_bus_powerup(dev->sdev->bus, dynamic_pctl);
}
static inline int b43_bus_ssb_device_is_enabled(struct b43_bus_dev *dev)
{
return ssb_device_is_enabled(dev->sdev);
}
static inline void b43_bus_ssb_device_enable(struct b43_bus_dev *dev,
u32 core_specific_flags)
{
ssb_device_enable(dev->sdev, core_specific_flags);
}
static inline void b43_bus_ssb_device_disable(struct b43_bus_dev *dev,
u32 core_specific_flags)
{
ssb_device_disable(dev->sdev, core_specific_flags);
}
static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset)
{
return ssb_read16(dev->sdev, offset);
}
static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset)
{
return ssb_read32(dev->sdev, offset);
}
static inline
void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
{
ssb_write16(dev->sdev, offset, value);
}
static inline
void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
{
ssb_write32(dev->sdev, offset, value);
}
static inline
void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer,
size_t count, u16 offset, u8 reg_width)
{
ssb_block_read(dev->sdev, buffer, count, offset, reg_width);
}
static inline
void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer,
size_t count, u16 offset, u8 reg_width)
{
ssb_block_write(dev->sdev, buffer, count, offset, reg_width);
}
struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
{
struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
dev->bus_type = B43_BUS_SSB;
dev->sdev = sdev;
dev->bus_may_powerdown = b43_bus_ssb_bus_may_powerdown;
dev->bus_powerup = b43_bus_ssb_bus_powerup;
dev->device_is_enabled = b43_bus_ssb_device_is_enabled;
dev->device_enable = b43_bus_ssb_device_enable;
dev->device_disable = b43_bus_ssb_device_disable;
dev->read16 = b43_bus_ssb_read16;
dev->read32 = b43_bus_ssb_read32;
dev->write16 = b43_bus_ssb_write16;
dev->write32 = b43_bus_ssb_write32;
dev->block_read = b43_bus_ssb_block_read;
dev->block_write = b43_bus_ssb_block_write;
dev->dev = sdev->dev;
dev->dma_dev = sdev->dma_dev;
dev->irq = sdev->irq;
dev->board_vendor = sdev->bus->boardinfo.vendor;
dev->board_type = sdev->bus->boardinfo.type;
dev->board_rev = sdev->bus->boardinfo.rev;
dev->chip_id = sdev->bus->chip_id;
dev->chip_rev = sdev->bus->chip_rev;
dev->chip_pkg = sdev->bus->chip_package;
dev->bus_sprom = &sdev->bus->sprom;
dev->core_id = sdev->id.coreid;
dev->core_rev = sdev->id.revision;
return dev;
}
#ifndef B43_BUS_H_
#define B43_BUS_H_
enum b43_bus_type {
B43_BUS_SSB,
};
struct b43_bus_dev {
enum b43_bus_type bus_type;
union {
struct ssb_device *sdev;
};
int (*bus_may_powerdown)(struct b43_bus_dev *dev);
int (*bus_powerup)(struct b43_bus_dev *dev, bool dynamic_pctl);
int (*device_is_enabled)(struct b43_bus_dev *dev);
void (*device_enable)(struct b43_bus_dev *dev,
u32 core_specific_flags);
void (*device_disable)(struct b43_bus_dev *dev,
u32 core_specific_flags);
u16 (*read16)(struct b43_bus_dev *dev, u16 offset);
u32 (*read32)(struct b43_bus_dev *dev, u16 offset);
void (*write16)(struct b43_bus_dev *dev, u16 offset, u16 value);
void (*write32)(struct b43_bus_dev *dev, u16 offset, u32 value);
void (*block_read)(struct b43_bus_dev *dev, void *buffer,
size_t count, u16 offset, u8 reg_width);
void (*block_write)(struct b43_bus_dev *dev, const void *buffer,
size_t count, u16 offset, u8 reg_width);
struct device *dev;
struct device *dma_dev;
unsigned int irq;
u16 board_vendor;
u16 board_type;
u16 board_rev;
u16 chip_id;
u8 chip_rev;
u8 chip_pkg;
struct ssb_sprom *bus_sprom;
u16 core_id;
u8 core_rev;
};
static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev)
{
return (dev->bus_type == B43_BUS_SSB &&
dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA);
}
static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
{
return (dev->bus_type == B43_BUS_SSB &&
dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
}
struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
#endif /* B43_BUS_H_ */
...@@ -333,10 +333,10 @@ static inline ...@@ -333,10 +333,10 @@ static inline
dma_addr_t dmaaddr; dma_addr_t dmaaddr;
if (tx) { if (tx) {
dmaaddr = dma_map_single(ring->dev->sdev->dma_dev, dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
buf, len, DMA_TO_DEVICE); buf, len, DMA_TO_DEVICE);
} else { } else {
dmaaddr = dma_map_single(ring->dev->sdev->dma_dev, dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
buf, len, DMA_FROM_DEVICE); buf, len, DMA_FROM_DEVICE);
} }
...@@ -348,10 +348,10 @@ static inline ...@@ -348,10 +348,10 @@ static inline
dma_addr_t addr, size_t len, int tx) dma_addr_t addr, size_t len, int tx)
{ {
if (tx) { if (tx) {
dma_unmap_single(ring->dev->sdev->dma_dev, dma_unmap_single(ring->dev->dev->dma_dev,
addr, len, DMA_TO_DEVICE); addr, len, DMA_TO_DEVICE);
} else { } else {
dma_unmap_single(ring->dev->sdev->dma_dev, dma_unmap_single(ring->dev->dev->dma_dev,
addr, len, DMA_FROM_DEVICE); addr, len, DMA_FROM_DEVICE);
} }
} }
...@@ -361,7 +361,7 @@ static inline ...@@ -361,7 +361,7 @@ static inline
dma_addr_t addr, size_t len) dma_addr_t addr, size_t len)
{ {
B43_WARN_ON(ring->tx); B43_WARN_ON(ring->tx);
dma_sync_single_for_cpu(ring->dev->sdev->dma_dev, dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
addr, len, DMA_FROM_DEVICE); addr, len, DMA_FROM_DEVICE);
} }
...@@ -370,7 +370,7 @@ static inline ...@@ -370,7 +370,7 @@ static inline
dma_addr_t addr, size_t len) dma_addr_t addr, size_t len)
{ {
B43_WARN_ON(ring->tx); B43_WARN_ON(ring->tx);
dma_sync_single_for_device(ring->dev->sdev->dma_dev, dma_sync_single_for_device(ring->dev->dev->dma_dev,
addr, len, DMA_FROM_DEVICE); addr, len, DMA_FROM_DEVICE);
} }
...@@ -401,7 +401,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring) ...@@ -401,7 +401,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
*/ */
if (ring->type == B43_DMA_64BIT) if (ring->type == B43_DMA_64BIT)
flags |= GFP_DMA; flags |= GFP_DMA;
ring->descbase = dma_alloc_coherent(ring->dev->sdev->dma_dev, ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
B43_DMA_RINGMEMSIZE, B43_DMA_RINGMEMSIZE,
&(ring->dmabase), flags); &(ring->dmabase), flags);
if (!ring->descbase) { if (!ring->descbase) {
...@@ -415,7 +415,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring) ...@@ -415,7 +415,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
static void free_ringmemory(struct b43_dmaring *ring) static void free_ringmemory(struct b43_dmaring *ring)
{ {
dma_free_coherent(ring->dev->sdev->dma_dev, B43_DMA_RINGMEMSIZE, dma_free_coherent(ring->dev->dev->dma_dev, B43_DMA_RINGMEMSIZE,
ring->descbase, ring->dmabase); ring->descbase, ring->dmabase);
} }
...@@ -523,7 +523,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, ...@@ -523,7 +523,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring,
dma_addr_t addr, dma_addr_t addr,
size_t buffersize, bool dma_to_device) size_t buffersize, bool dma_to_device)
{ {
if (unlikely(dma_mapping_error(ring->dev->sdev->dma_dev, addr))) if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr)))
return 1; return 1;
switch (ring->type) { switch (ring->type) {
...@@ -757,14 +757,14 @@ static void dmacontroller_cleanup(struct b43_dmaring *ring) ...@@ -757,14 +757,14 @@ static void dmacontroller_cleanup(struct b43_dmaring *ring)
static void free_all_descbuffers(struct b43_dmaring *ring) static void free_all_descbuffers(struct b43_dmaring *ring)
{ {
struct b43_dmadesc_generic *desc;
struct b43_dmadesc_meta *meta; struct b43_dmadesc_meta *meta;
int i; int i;
if (!ring->used_slots) if (!ring->used_slots)
return; return;
for (i = 0; i < ring->nr_slots; i++) { for (i = 0; i < ring->nr_slots; i++) {
desc = ring->ops->idx2desc(ring, i, &meta); /* get meta - ignore returned value */
ring->ops->idx2desc(ring, i, &meta);
if (!meta->skb || b43_dma_ptr_is_poisoned(meta->skb)) { if (!meta->skb || b43_dma_ptr_is_poisoned(meta->skb)) {
B43_WARN_ON(!ring->tx); B43_WARN_ON(!ring->tx);
...@@ -869,7 +869,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, ...@@ -869,7 +869,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
goto err_kfree_meta; goto err_kfree_meta;
/* test for ability to dma to txhdr_cache */ /* test for ability to dma to txhdr_cache */
dma_test = dma_map_single(dev->sdev->dma_dev, dma_test = dma_map_single(dev->dev->dma_dev,
ring->txhdr_cache, ring->txhdr_cache,
b43_txhdr_size(dev), b43_txhdr_size(dev),
DMA_TO_DEVICE); DMA_TO_DEVICE);
...@@ -884,7 +884,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, ...@@ -884,7 +884,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
if (!ring->txhdr_cache) if (!ring->txhdr_cache)
goto err_kfree_meta; goto err_kfree_meta;
dma_test = dma_map_single(dev->sdev->dma_dev, dma_test = dma_map_single(dev->dev->dma_dev,
ring->txhdr_cache, ring->txhdr_cache,
b43_txhdr_size(dev), b43_txhdr_size(dev),
DMA_TO_DEVICE); DMA_TO_DEVICE);
...@@ -898,7 +898,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, ...@@ -898,7 +898,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
} }
} }
dma_unmap_single(dev->sdev->dma_dev, dma_unmap_single(dev->dev->dma_dev,
dma_test, b43_txhdr_size(dev), dma_test, b43_txhdr_size(dev),
DMA_TO_DEVICE); DMA_TO_DEVICE);
} }
...@@ -1013,9 +1013,9 @@ static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask) ...@@ -1013,9 +1013,9 @@ static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask)
/* Try to set the DMA mask. If it fails, try falling back to a /* Try to set the DMA mask. If it fails, try falling back to a
* lower mask, as we can always also support a lower one. */ * lower mask, as we can always also support a lower one. */
while (1) { while (1) {
err = dma_set_mask(dev->sdev->dma_dev, mask); err = dma_set_mask(dev->dev->dma_dev, mask);
if (!err) { if (!err) {
err = dma_set_coherent_mask(dev->sdev->dma_dev, mask); err = dma_set_coherent_mask(dev->dev->dma_dev, mask);
if (!err) if (!err)
break; break;
} }
...@@ -1085,7 +1085,7 @@ int b43_dma_init(struct b43_wldev *dev) ...@@ -1085,7 +1085,7 @@ int b43_dma_init(struct b43_wldev *dev)
goto err_destroy_mcast; goto err_destroy_mcast;
/* No support for the TX status DMA ring. */ /* No support for the TX status DMA ring. */
B43_WARN_ON(dev->sdev->id.revision < 5); B43_WARN_ON(dev->dev->core_rev < 5);
b43dbg(dev->wl, "%u-bit DMA initialized\n", b43dbg(dev->wl, "%u-bit DMA initialized\n",
(unsigned int)type); (unsigned int)type);
...@@ -1388,7 +1388,6 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, ...@@ -1388,7 +1388,6 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
{ {
const struct b43_dma_ops *ops; const struct b43_dma_ops *ops;
struct b43_dmaring *ring; struct b43_dmaring *ring;
struct b43_dmadesc_generic *desc;
struct b43_dmadesc_meta *meta; struct b43_dmadesc_meta *meta;
int slot, firstused; int slot, firstused;
bool frame_succeed; bool frame_succeed;
...@@ -1416,7 +1415,8 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, ...@@ -1416,7 +1415,8 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
ops = ring->ops; ops = ring->ops;
while (1) { while (1) {
B43_WARN_ON(slot < 0 || slot >= ring->nr_slots); B43_WARN_ON(slot < 0 || slot >= ring->nr_slots);
desc = ops->idx2desc(ring, slot, &meta); /* get meta - ignore returned value */
ops->idx2desc(ring, slot, &meta);
if (b43_dma_ptr_is_poisoned(meta->skb)) { if (b43_dma_ptr_is_poisoned(meta->skb)) {
b43dbg(dev->wl, "Poisoned TX slot %d (first=%d) " b43dbg(dev->wl, "Poisoned TX slot %d (first=%d) "
......
...@@ -138,7 +138,7 @@ static int b43_register_led(struct b43_wldev *dev, struct b43_led *led, ...@@ -138,7 +138,7 @@ static int b43_register_led(struct b43_wldev *dev, struct b43_led *led,
led->led_dev.default_trigger = default_trigger; led->led_dev.default_trigger = default_trigger;
led->led_dev.brightness_set = b43_led_brightness_set; led->led_dev.brightness_set = b43_led_brightness_set;
err = led_classdev_register(dev->sdev->dev, &led->led_dev); err = led_classdev_register(dev->dev->dev, &led->led_dev);
if (err) { if (err) {
b43warn(dev->wl, "LEDs: Failed to register %s\n", name); b43warn(dev->wl, "LEDs: Failed to register %s\n", name);
led->wl = NULL; led->wl = NULL;
...@@ -215,13 +215,12 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev, ...@@ -215,13 +215,12 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
enum b43_led_behaviour *behaviour, enum b43_led_behaviour *behaviour,
bool *activelow) bool *activelow)
{ {
struct ssb_bus *bus = dev->sdev->bus;
u8 sprom[4]; u8 sprom[4];
sprom[0] = bus->sprom.gpio0; sprom[0] = dev->dev->bus_sprom->gpio0;
sprom[1] = bus->sprom.gpio1; sprom[1] = dev->dev->bus_sprom->gpio1;
sprom[2] = bus->sprom.gpio2; sprom[2] = dev->dev->bus_sprom->gpio2;
sprom[3] = bus->sprom.gpio3; sprom[3] = dev->dev->bus_sprom->gpio3;
if (sprom[led_index] == 0xFF) { if (sprom[led_index] == 0xFF) {
/* There is no LED information in the SPROM /* There is no LED information in the SPROM
...@@ -231,12 +230,12 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev, ...@@ -231,12 +230,12 @@ static void b43_led_get_sprominfo(struct b43_wldev *dev,
case 0: case 0:
*behaviour = B43_LED_ACTIVITY; *behaviour = B43_LED_ACTIVITY;
*activelow = 1; *activelow = 1;
if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) if (dev->dev->board_vendor == PCI_VENDOR_ID_COMPAQ)
*behaviour = B43_LED_RADIO_ALL; *behaviour = B43_LED_RADIO_ALL;
break; break;
case 1: case 1:
*behaviour = B43_LED_RADIO_B; *behaviour = B43_LED_RADIO_B;
if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) if (dev->dev->board_vendor == PCI_VENDOR_ID_ASUSTEK)
*behaviour = B43_LED_ASSOC; *behaviour = B43_LED_ASSOC;
break; break;
case 2: case 2:
......
...@@ -98,7 +98,7 @@ static u16 lo_measure_feedthrough(struct b43_wldev *dev, ...@@ -98,7 +98,7 @@ static u16 lo_measure_feedthrough(struct b43_wldev *dev,
rfover |= pga; rfover |= pga;
rfover |= lna; rfover |= lna;
rfover |= trsw_rx; rfover |= trsw_rx;
if ((dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) if ((dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA)
&& phy->rev > 6) && phy->rev > 6)
rfover |= B43_PHY_RFOVERVAL_EXTLNA; rfover |= B43_PHY_RFOVERVAL_EXTLNA;
...@@ -301,14 +301,12 @@ static void lo_measure_gain_values(struct b43_wldev *dev, ...@@ -301,14 +301,12 @@ static void lo_measure_gain_values(struct b43_wldev *dev,
max_rx_gain = 0; max_rx_gain = 0;
if (has_loopback_gain(phy)) { if (has_loopback_gain(phy)) {
int trsw_rx = 0;
int trsw_rx_gain; int trsw_rx_gain;
if (use_trsw_rx) { if (use_trsw_rx) {
trsw_rx_gain = gphy->trsw_rx_gain / 2; trsw_rx_gain = gphy->trsw_rx_gain / 2;
if (max_rx_gain >= trsw_rx_gain) { if (max_rx_gain >= trsw_rx_gain) {
trsw_rx_gain = max_rx_gain - trsw_rx_gain; trsw_rx_gain = max_rx_gain - trsw_rx_gain;
trsw_rx = 0x20;
} }
} else } else
trsw_rx_gain = max_rx_gain; trsw_rx_gain = max_rx_gain;
...@@ -387,7 +385,7 @@ struct lo_g_saved_values { ...@@ -387,7 +385,7 @@ struct lo_g_saved_values {
static void lo_measure_setup(struct b43_wldev *dev, static void lo_measure_setup(struct b43_wldev *dev,
struct lo_g_saved_values *sav) struct lo_g_saved_values *sav)
{ {
struct ssb_sprom *sprom = &dev->sdev->bus->sprom; struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_g *gphy = phy->g; struct b43_phy_g *gphy = phy->g;
struct b43_txpower_lo_control *lo = gphy->lo_control; struct b43_txpower_lo_control *lo = gphy->lo_control;
......
此差异已折叠。
...@@ -121,7 +121,7 @@ void b43_hf_write(struct b43_wldev *dev, u64 value); ...@@ -121,7 +121,7 @@ void b43_hf_write(struct b43_wldev *dev, u64 value);
void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on); void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on);
void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags); void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode);
void b43_controller_restart(struct b43_wldev *dev, const char *reason); void b43_controller_restart(struct b43_wldev *dev, const char *reason);
......
...@@ -265,7 +265,6 @@ static void hardware_pctl_init_aphy(struct b43_wldev *dev) ...@@ -265,7 +265,6 @@ static void hardware_pctl_init_aphy(struct b43_wldev *dev)
void b43_phy_inita(struct b43_wldev *dev) void b43_phy_inita(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
/* This lowlevel A-PHY init is also called from G-PHY init. /* This lowlevel A-PHY init is also called from G-PHY init.
...@@ -296,9 +295,9 @@ void b43_phy_inita(struct b43_wldev *dev) ...@@ -296,9 +295,9 @@ void b43_phy_inita(struct b43_wldev *dev)
b43_radio_init2060(dev); b43_radio_init2060(dev);
if ((bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) &&
((bus->boardinfo.type == SSB_BOARD_BU4306) || ((dev->dev->board_type == SSB_BOARD_BU4306) ||
(bus->boardinfo.type == SSB_BOARD_BU4309))) { (dev->dev->board_type == SSB_BOARD_BU4309))) {
; //TODO: A PHY LO ; //TODO: A PHY LO
} }
...@@ -311,7 +310,7 @@ void b43_phy_inita(struct b43_wldev *dev) ...@@ -311,7 +310,7 @@ void b43_phy_inita(struct b43_wldev *dev)
} }
if ((phy->type == B43_PHYTYPE_G) && if ((phy->type == B43_PHYTYPE_G) &&
(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL)) { (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL)) {
b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF); b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF);
} }
} }
...@@ -323,17 +322,17 @@ static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev) ...@@ -323,17 +322,17 @@ static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev)
struct b43_phy_a *aphy = phy->a; struct b43_phy_a *aphy = phy->a;
s16 pab0, pab1, pab2; s16 pab0, pab1, pab2;
pab0 = (s16) (dev->sdev->bus->sprom.pa1b0); pab0 = (s16) (dev->dev->bus_sprom->pa1b0);
pab1 = (s16) (dev->sdev->bus->sprom.pa1b1); pab1 = (s16) (dev->dev->bus_sprom->pa1b1);
pab2 = (s16) (dev->sdev->bus->sprom.pa1b2); pab2 = (s16) (dev->dev->bus_sprom->pa1b2);
if (pab0 != 0 && pab1 != 0 && pab2 != 0 && if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
pab0 != -1 && pab1 != -1 && pab2 != -1) { pab0 != -1 && pab1 != -1 && pab2 != -1) {
/* The pabX values are set in SPROM. Use them. */ /* The pabX values are set in SPROM. Use them. */
if ((s8) dev->sdev->bus->sprom.itssi_a != 0 && if ((s8) dev->dev->bus_sprom->itssi_a != 0 &&
(s8) dev->sdev->bus->sprom.itssi_a != -1) (s8) dev->dev->bus_sprom->itssi_a != -1)
aphy->tgt_idle_tssi = aphy->tgt_idle_tssi =
(s8) (dev->sdev->bus->sprom.itssi_a); (s8) (dev->dev->bus_sprom->itssi_a);
else else
aphy->tgt_idle_tssi = 62; aphy->tgt_idle_tssi = 62;
aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
......
...@@ -168,7 +168,7 @@ void b43_phy_lock(struct b43_wldev *dev) ...@@ -168,7 +168,7 @@ void b43_phy_lock(struct b43_wldev *dev)
B43_WARN_ON(dev->phy.phy_locked); B43_WARN_ON(dev->phy.phy_locked);
dev->phy.phy_locked = 1; dev->phy.phy_locked = 1;
#endif #endif
B43_WARN_ON(dev->sdev->id.revision < 3); B43_WARN_ON(dev->dev->core_rev < 3);
if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
...@@ -180,7 +180,7 @@ void b43_phy_unlock(struct b43_wldev *dev) ...@@ -180,7 +180,7 @@ void b43_phy_unlock(struct b43_wldev *dev)
B43_WARN_ON(!dev->phy.phy_locked); B43_WARN_ON(!dev->phy.phy_locked);
dev->phy.phy_locked = 0; dev->phy.phy_locked = 0;
#endif #endif
B43_WARN_ON(dev->sdev->id.revision < 3); B43_WARN_ON(dev->dev->core_rev < 3);
if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
b43_power_saving_ctl_bits(dev, 0); b43_power_saving_ctl_bits(dev, 0);
...@@ -368,8 +368,8 @@ void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags) ...@@ -368,8 +368,8 @@ void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags)
/* The next check will be needed in two seconds, or later. */ /* The next check will be needed in two seconds, or later. */
phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2)); phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2));
if ((dev->sdev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) &&
(dev->sdev->bus->boardinfo.type == SSB_BOARD_BU4306)) (dev->dev->board_type == SSB_BOARD_BU4306))
return; /* No software txpower adjustment needed */ return; /* No software txpower adjustment needed */
result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI)); result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI));
......
...@@ -718,7 +718,7 @@ static void b43_calc_nrssi_threshold(struct b43_wldev *dev) ...@@ -718,7 +718,7 @@ static void b43_calc_nrssi_threshold(struct b43_wldev *dev)
B43_WARN_ON(phy->type != B43_PHYTYPE_G); B43_WARN_ON(phy->type != B43_PHYTYPE_G);
if (!phy->gmode || if (!phy->gmode ||
!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { !(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) {
tmp16 = b43_nrssi_hw_read(dev, 0x20); tmp16 = b43_nrssi_hw_read(dev, 0x20);
if (tmp16 >= 0x20) if (tmp16 >= 0x20)
tmp16 -= 0x40; tmp16 -= 0x40;
...@@ -1114,7 +1114,7 @@ static u16 radio2050_rfover_val(struct b43_wldev *dev, ...@@ -1114,7 +1114,7 @@ static u16 radio2050_rfover_val(struct b43_wldev *dev,
{ {
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_g *gphy = phy->g; struct b43_phy_g *gphy = phy->g;
struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); struct ssb_sprom *sprom = dev->dev->bus_sprom;
if (!phy->gmode) if (!phy->gmode)
return 0; return 0;
...@@ -1491,7 +1491,6 @@ static u16 b43_radio_init2050(struct b43_wldev *dev) ...@@ -1491,7 +1491,6 @@ static u16 b43_radio_init2050(struct b43_wldev *dev)
static void b43_phy_initb5(struct b43_wldev *dev) static void b43_phy_initb5(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_g *gphy = phy->g; struct b43_phy_g *gphy = phy->g;
u16 offset, value; u16 offset, value;
...@@ -1500,8 +1499,8 @@ static void b43_phy_initb5(struct b43_wldev *dev) ...@@ -1500,8 +1499,8 @@ static void b43_phy_initb5(struct b43_wldev *dev)
if (phy->analog == 1) { if (phy->analog == 1) {
b43_radio_set(dev, 0x007A, 0x0050); b43_radio_set(dev, 0x007A, 0x0050);
} }
if ((bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM) && if ((dev->dev->board_vendor != SSB_BOARDVENDOR_BCM) &&
(bus->boardinfo.type != SSB_BOARD_BU4306)) { (dev->dev->board_type != SSB_BOARD_BU4306)) {
value = 0x2120; value = 0x2120;
for (offset = 0x00A8; offset < 0x00C7; offset++) { for (offset = 0x00A8; offset < 0x00C7; offset++) {
b43_phy_write(dev, offset, value); b43_phy_write(dev, offset, value);
...@@ -1620,7 +1619,7 @@ static void b43_phy_initb6(struct b43_wldev *dev) ...@@ -1620,7 +1619,7 @@ static void b43_phy_initb6(struct b43_wldev *dev)
b43_radio_write16(dev, 0x5A, 0x88); b43_radio_write16(dev, 0x5A, 0x88);
b43_radio_write16(dev, 0x5B, 0x6B); b43_radio_write16(dev, 0x5B, 0x6B);
b43_radio_write16(dev, 0x5C, 0x0F); b43_radio_write16(dev, 0x5C, 0x0F);
if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_ALTIQ) { if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_ALTIQ) {
b43_radio_write16(dev, 0x5D, 0xFA); b43_radio_write16(dev, 0x5D, 0xFA);
b43_radio_write16(dev, 0x5E, 0xD8); b43_radio_write16(dev, 0x5E, 0xD8);
} else { } else {
...@@ -1787,7 +1786,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev) ...@@ -1787,7 +1786,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev)
b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); b43_phy_set(dev, B43_PHY_RFOVER, 0x0100);
b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF);
if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_EXTLNA) { if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA) {
if (phy->rev >= 7) { if (phy->rev >= 7) {
b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); b43_phy_set(dev, B43_PHY_RFOVER, 0x0800);
b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000);
...@@ -1922,7 +1921,6 @@ static void b43_hardware_pctl_init_gphy(struct b43_wldev *dev) ...@@ -1922,7 +1921,6 @@ static void b43_hardware_pctl_init_gphy(struct b43_wldev *dev)
/* Initialize B/G PHY power control */ /* Initialize B/G PHY power control */
static void b43_phy_init_pctl(struct b43_wldev *dev) static void b43_phy_init_pctl(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_g *gphy = phy->g; struct b43_phy_g *gphy = phy->g;
struct b43_rfatt old_rfatt; struct b43_rfatt old_rfatt;
...@@ -1931,8 +1929,8 @@ static void b43_phy_init_pctl(struct b43_wldev *dev) ...@@ -1931,8 +1929,8 @@ static void b43_phy_init_pctl(struct b43_wldev *dev)
B43_WARN_ON(phy->type != B43_PHYTYPE_G); B43_WARN_ON(phy->type != B43_PHYTYPE_G);
if ((bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) &&
(bus->boardinfo.type == SSB_BOARD_BU4306)) (dev->dev->board_type == SSB_BOARD_BU4306))
return; return;
b43_phy_write(dev, 0x0028, 0x8018); b43_phy_write(dev, 0x0028, 0x8018);
...@@ -2053,7 +2051,7 @@ static void b43_phy_initg(struct b43_wldev *dev) ...@@ -2053,7 +2051,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
if (phy->rev >= 6) { if (phy->rev >= 6) {
b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12));
} }
if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL)
b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075);
else else
b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F);
...@@ -2066,7 +2064,7 @@ static void b43_phy_initg(struct b43_wldev *dev) ...@@ -2066,7 +2064,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078);
} }
if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) { if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) {
/* The specs state to update the NRSSI LT with /* The specs state to update the NRSSI LT with
* the value 0x7FFFFFFF here. I think that is some weird * the value 0x7FFFFFFF here. I think that is some weird
* compiler optimization in the original driver. * compiler optimization in the original driver.
...@@ -2088,8 +2086,8 @@ static void b43_phy_initg(struct b43_wldev *dev) ...@@ -2088,8 +2086,8 @@ static void b43_phy_initg(struct b43_wldev *dev)
/* FIXME: The spec says in the following if, the 0 should be replaced /* FIXME: The spec says in the following if, the 0 should be replaced
'if OFDM may not be used in the current locale' 'if OFDM may not be used in the current locale'
but OFDM is legal everywhere */ but OFDM is legal everywhere */
if ((dev->sdev->bus->chip_id == 0x4306 if ((dev->dev->chip_id == 0x4306
&& dev->sdev->bus->chip_package == 2) || 0) { && dev->dev->chip_pkg == 2) || 0) {
b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF);
b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF);
} }
...@@ -2105,7 +2103,7 @@ void b43_gphy_channel_switch(struct b43_wldev *dev, ...@@ -2105,7 +2103,7 @@ void b43_gphy_channel_switch(struct b43_wldev *dev,
b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel));
if (channel == 14) { if (channel == 14) {
if (dev->sdev->bus->sprom.country_code == if (dev->dev->bus_sprom->country_code ==
SSB_SPROM1CCODE_JAPAN) SSB_SPROM1CCODE_JAPAN)
b43_hf_write(dev, b43_hf_write(dev,
b43_hf_read(dev) & ~B43_HF_ACPR); b43_hf_read(dev) & ~B43_HF_ACPR);
...@@ -2136,17 +2134,17 @@ static void default_baseband_attenuation(struct b43_wldev *dev, ...@@ -2136,17 +2134,17 @@ static void default_baseband_attenuation(struct b43_wldev *dev,
static void default_radio_attenuation(struct b43_wldev *dev, static void default_radio_attenuation(struct b43_wldev *dev,
struct b43_rfatt *rf) struct b43_rfatt *rf)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct b43_bus_dev *bdev = dev->dev;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
rf->with_padmix = 0; rf->with_padmix = 0;
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM && if (dev->dev->board_vendor == SSB_BOARDVENDOR_BCM &&
bus->boardinfo.type == SSB_BOARD_BCM4309G) { dev->dev->board_type == SSB_BOARD_BCM4309G) {
if (bus->boardinfo.rev < 0x43) { if (dev->dev->board_rev < 0x43) {
rf->att = 2; rf->att = 2;
return; return;
} else if (bus->boardinfo.rev < 0x51) { } else if (dev->dev->board_rev < 0x51) {
rf->att = 3; rf->att = 3;
return; return;
} }
...@@ -2172,21 +2170,21 @@ static void default_radio_attenuation(struct b43_wldev *dev, ...@@ -2172,21 +2170,21 @@ static void default_radio_attenuation(struct b43_wldev *dev,
return; return;
case 1: case 1:
if (phy->type == B43_PHYTYPE_G) { if (phy->type == B43_PHYTYPE_G) {
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM if (bdev->board_vendor == SSB_BOARDVENDOR_BCM
&& bus->boardinfo.type == SSB_BOARD_BCM4309G && bdev->board_type == SSB_BOARD_BCM4309G
&& bus->boardinfo.rev >= 30) && bdev->board_rev >= 30)
rf->att = 3; rf->att = 3;
else if (bus->boardinfo.vendor == else if (bdev->board_vendor ==
SSB_BOARDVENDOR_BCM SSB_BOARDVENDOR_BCM
&& bus->boardinfo.type == && bdev->board_type ==
SSB_BOARD_BU4306) SSB_BOARD_BU4306)
rf->att = 3; rf->att = 3;
else else
rf->att = 1; rf->att = 1;
} else { } else {
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM if (bdev->board_vendor == SSB_BOARDVENDOR_BCM
&& bus->boardinfo.type == SSB_BOARD_BCM4309G && bdev->board_type == SSB_BOARD_BCM4309G
&& bus->boardinfo.rev >= 30) && bdev->board_rev >= 30)
rf->att = 7; rf->att = 7;
else else
rf->att = 6; rf->att = 6;
...@@ -2194,16 +2192,16 @@ static void default_radio_attenuation(struct b43_wldev *dev, ...@@ -2194,16 +2192,16 @@ static void default_radio_attenuation(struct b43_wldev *dev,
return; return;
case 2: case 2:
if (phy->type == B43_PHYTYPE_G) { if (phy->type == B43_PHYTYPE_G) {
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM if (bdev->board_vendor == SSB_BOARDVENDOR_BCM
&& bus->boardinfo.type == SSB_BOARD_BCM4309G && bdev->board_type == SSB_BOARD_BCM4309G
&& bus->boardinfo.rev >= 30) && bdev->board_rev >= 30)
rf->att = 3; rf->att = 3;
else if (bus->boardinfo.vendor == else if (bdev->board_vendor ==
SSB_BOARDVENDOR_BCM SSB_BOARDVENDOR_BCM
&& bus->boardinfo.type == && bdev->board_type ==
SSB_BOARD_BU4306) SSB_BOARD_BU4306)
rf->att = 5; rf->att = 5;
else if (bus->chip_id == 0x4320) else if (bdev->chip_id == 0x4320)
rf->att = 4; rf->att = 4;
else else
rf->att = 3; rf->att = 3;
...@@ -2384,11 +2382,11 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) ...@@ -2384,11 +2382,11 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev)
struct b43_phy_g *gphy = phy->g; struct b43_phy_g *gphy = phy->g;
s16 pab0, pab1, pab2; s16 pab0, pab1, pab2;
pab0 = (s16) (dev->sdev->bus->sprom.pa0b0); pab0 = (s16) (dev->dev->bus_sprom->pa0b0);
pab1 = (s16) (dev->sdev->bus->sprom.pa0b1); pab1 = (s16) (dev->dev->bus_sprom->pa0b1);
pab2 = (s16) (dev->sdev->bus->sprom.pa0b2); pab2 = (s16) (dev->dev->bus_sprom->pa0b2);
B43_WARN_ON((dev->sdev->bus->chip_id == 0x4301) && B43_WARN_ON((dev->dev->chip_id == 0x4301) &&
(phy->radio_ver != 0x2050)); /* Not supported anymore */ (phy->radio_ver != 0x2050)); /* Not supported anymore */
gphy->dyn_tssi_tbl = 0; gphy->dyn_tssi_tbl = 0;
...@@ -2396,10 +2394,10 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) ...@@ -2396,10 +2394,10 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev)
if (pab0 != 0 && pab1 != 0 && pab2 != 0 && if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
pab0 != -1 && pab1 != -1 && pab2 != -1) { pab0 != -1 && pab1 != -1 && pab2 != -1) {
/* The pabX values are set in SPROM. Use them. */ /* The pabX values are set in SPROM. Use them. */
if ((s8) dev->sdev->bus->sprom.itssi_bg != 0 && if ((s8) dev->dev->bus_sprom->itssi_bg != 0 &&
(s8) dev->sdev->bus->sprom.itssi_bg != -1) { (s8) dev->dev->bus_sprom->itssi_bg != -1) {
gphy->tgt_idle_tssi = gphy->tgt_idle_tssi =
(s8) (dev->sdev->bus->sprom.itssi_bg); (s8) (dev->dev->bus_sprom->itssi_bg);
} else } else
gphy->tgt_idle_tssi = 62; gphy->tgt_idle_tssi = 62;
gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
...@@ -2537,7 +2535,7 @@ static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev) ...@@ -2537,7 +2535,7 @@ static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev)
b43_wireless_core_reset(dev, 0); b43_wireless_core_reset(dev, 0);
b43_phy_initg(dev); b43_phy_initg(dev);
phy->gmode = 1; phy->gmode = 1;
b43_wireless_core_reset(dev, B43_TMSLOW_GMODE); b43_wireless_core_reset(dev, 1);
} }
return 0; return 0;
...@@ -2840,7 +2838,7 @@ static void b43_gphy_op_adjust_txpower(struct b43_wldev *dev) ...@@ -2840,7 +2838,7 @@ static void b43_gphy_op_adjust_txpower(struct b43_wldev *dev)
B43_TXCTL_TXMIX; B43_TXCTL_TXMIX;
rfatt += 2; rfatt += 2;
bbatt += 2; bbatt += 2;
} else if (dev->sdev->bus->sprom. } else if (dev->dev->bus_sprom->
boardflags_lo & boardflags_lo &
B43_BFL_PACTRL) { B43_BFL_PACTRL) {
bbatt += 4 * (rfatt - 2); bbatt += 4 * (rfatt - 2);
...@@ -2914,14 +2912,14 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev, ...@@ -2914,14 +2912,14 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev,
estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi);
B43_WARN_ON(phy->type != B43_PHYTYPE_G); B43_WARN_ON(phy->type != B43_PHYTYPE_G);
max_pwr = dev->sdev->bus->sprom.maxpwr_bg; max_pwr = dev->dev->bus_sprom->maxpwr_bg;
if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL)
max_pwr -= 3; /* minus 0.75 */ max_pwr -= 3; /* minus 0.75 */
if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) {
b43warn(dev->wl, b43warn(dev->wl,
"Invalid max-TX-power value in SPROM.\n"); "Invalid max-TX-power value in SPROM.\n");
max_pwr = INT_TO_Q52(20); /* fake it */ max_pwr = INT_TO_Q52(20); /* fake it */
dev->sdev->bus->sprom.maxpwr_bg = max_pwr; dev->dev->bus_sprom->maxpwr_bg = max_pwr;
} }
/* Get desired power (in Q5.2) */ /* Get desired power (in Q5.2) */
...@@ -3014,7 +3012,7 @@ static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev) ...@@ -3014,7 +3012,7 @@ static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev)
{ {
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
if (!(dev->sdev->bus->sprom.boardflags_lo & B43_BFL_RSSI)) if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI))
return; return;
b43_mac_suspend(dev); b43_mac_suspend(dev);
......
...@@ -85,39 +85,39 @@ static void b43_lpphy_op_free(struct b43_wldev *dev) ...@@ -85,39 +85,39 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
/* http://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */
static void lpphy_read_band_sprom(struct b43_wldev *dev) static void lpphy_read_band_sprom(struct b43_wldev *dev)
{ {
struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->sdev->bus;
u16 cckpo, maxpwr; u16 cckpo, maxpwr;
u32 ofdmpo; u32 ofdmpo;
int i; int i;
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
lpphy->tx_isolation_med_band = bus->sprom.tri2g; lpphy->tx_isolation_med_band = sprom->tri2g;
lpphy->bx_arch = bus->sprom.bxa2g; lpphy->bx_arch = sprom->bxa2g;
lpphy->rx_pwr_offset = bus->sprom.rxpo2g; lpphy->rx_pwr_offset = sprom->rxpo2g;
lpphy->rssi_vf = bus->sprom.rssismf2g; lpphy->rssi_vf = sprom->rssismf2g;
lpphy->rssi_vc = bus->sprom.rssismc2g; lpphy->rssi_vc = sprom->rssismc2g;
lpphy->rssi_gs = bus->sprom.rssisav2g; lpphy->rssi_gs = sprom->rssisav2g;
lpphy->txpa[0] = bus->sprom.pa0b0; lpphy->txpa[0] = sprom->pa0b0;
lpphy->txpa[1] = bus->sprom.pa0b1; lpphy->txpa[1] = sprom->pa0b1;
lpphy->txpa[2] = bus->sprom.pa0b2; lpphy->txpa[2] = sprom->pa0b2;
maxpwr = bus->sprom.maxpwr_bg; maxpwr = sprom->maxpwr_bg;
lpphy->max_tx_pwr_med_band = maxpwr; lpphy->max_tx_pwr_med_band = maxpwr;
cckpo = bus->sprom.cck2gpo; cckpo = sprom->cck2gpo;
/* /*
* We don't read SPROM's opo as specs say. On rev8 SPROMs * We don't read SPROM's opo as specs say. On rev8 SPROMs
* opo == ofdm2gpo and we don't know any SSB with LP-PHY * opo == ofdm2gpo and we don't know any SSB with LP-PHY
* and SPROM rev below 8. * and SPROM rev below 8.
*/ */
B43_WARN_ON(bus->sprom.revision < 8); B43_WARN_ON(sprom->revision < 8);
ofdmpo = bus->sprom.ofdm2gpo; ofdmpo = sprom->ofdm2gpo;
if (cckpo) { if (cckpo) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
lpphy->tx_max_rate[i] = lpphy->tx_max_rate[i] =
maxpwr - (ofdmpo & 0xF) * 2; maxpwr - (ofdmpo & 0xF) * 2;
ofdmpo >>= 4; ofdmpo >>= 4;
} }
ofdmpo = bus->sprom.ofdm2gpo; ofdmpo = sprom->ofdm2gpo;
for (i = 4; i < 15; i++) { for (i = 4; i < 15; i++) {
lpphy->tx_max_rate[i] = lpphy->tx_max_rate[i] =
maxpwr - (ofdmpo & 0xF) * 2; maxpwr - (ofdmpo & 0xF) * 2;
...@@ -131,39 +131,39 @@ static void lpphy_read_band_sprom(struct b43_wldev *dev) ...@@ -131,39 +131,39 @@ static void lpphy_read_band_sprom(struct b43_wldev *dev)
lpphy->tx_max_rate[i] = maxpwr - ofdmpo; lpphy->tx_max_rate[i] = maxpwr - ofdmpo;
} }
} else { /* 5GHz */ } else { /* 5GHz */
lpphy->tx_isolation_low_band = bus->sprom.tri5gl; lpphy->tx_isolation_low_band = sprom->tri5gl;
lpphy->tx_isolation_med_band = bus->sprom.tri5g; lpphy->tx_isolation_med_band = sprom->tri5g;
lpphy->tx_isolation_hi_band = bus->sprom.tri5gh; lpphy->tx_isolation_hi_band = sprom->tri5gh;
lpphy->bx_arch = bus->sprom.bxa5g; lpphy->bx_arch = sprom->bxa5g;
lpphy->rx_pwr_offset = bus->sprom.rxpo5g; lpphy->rx_pwr_offset = sprom->rxpo5g;
lpphy->rssi_vf = bus->sprom.rssismf5g; lpphy->rssi_vf = sprom->rssismf5g;
lpphy->rssi_vc = bus->sprom.rssismc5g; lpphy->rssi_vc = sprom->rssismc5g;
lpphy->rssi_gs = bus->sprom.rssisav5g; lpphy->rssi_gs = sprom->rssisav5g;
lpphy->txpa[0] = bus->sprom.pa1b0; lpphy->txpa[0] = sprom->pa1b0;
lpphy->txpa[1] = bus->sprom.pa1b1; lpphy->txpa[1] = sprom->pa1b1;
lpphy->txpa[2] = bus->sprom.pa1b2; lpphy->txpa[2] = sprom->pa1b2;
lpphy->txpal[0] = bus->sprom.pa1lob0; lpphy->txpal[0] = sprom->pa1lob0;
lpphy->txpal[1] = bus->sprom.pa1lob1; lpphy->txpal[1] = sprom->pa1lob1;
lpphy->txpal[2] = bus->sprom.pa1lob2; lpphy->txpal[2] = sprom->pa1lob2;
lpphy->txpah[0] = bus->sprom.pa1hib0; lpphy->txpah[0] = sprom->pa1hib0;
lpphy->txpah[1] = bus->sprom.pa1hib1; lpphy->txpah[1] = sprom->pa1hib1;
lpphy->txpah[2] = bus->sprom.pa1hib2; lpphy->txpah[2] = sprom->pa1hib2;
maxpwr = bus->sprom.maxpwr_al; maxpwr = sprom->maxpwr_al;
ofdmpo = bus->sprom.ofdm5glpo; ofdmpo = sprom->ofdm5glpo;
lpphy->max_tx_pwr_low_band = maxpwr; lpphy->max_tx_pwr_low_band = maxpwr;
for (i = 4; i < 12; i++) { for (i = 4; i < 12; i++) {
lpphy->tx_max_ratel[i] = maxpwr - (ofdmpo & 0xF) * 2; lpphy->tx_max_ratel[i] = maxpwr - (ofdmpo & 0xF) * 2;
ofdmpo >>= 4; ofdmpo >>= 4;
} }
maxpwr = bus->sprom.maxpwr_a; maxpwr = sprom->maxpwr_a;
ofdmpo = bus->sprom.ofdm5gpo; ofdmpo = sprom->ofdm5gpo;
lpphy->max_tx_pwr_med_band = maxpwr; lpphy->max_tx_pwr_med_band = maxpwr;
for (i = 4; i < 12; i++) { for (i = 4; i < 12; i++) {
lpphy->tx_max_rate[i] = maxpwr - (ofdmpo & 0xF) * 2; lpphy->tx_max_rate[i] = maxpwr - (ofdmpo & 0xF) * 2;
ofdmpo >>= 4; ofdmpo >>= 4;
} }
maxpwr = bus->sprom.maxpwr_ah; maxpwr = sprom->maxpwr_ah;
ofdmpo = bus->sprom.ofdm5ghpo; ofdmpo = sprom->ofdm5ghpo;
lpphy->max_tx_pwr_hi_band = maxpwr; lpphy->max_tx_pwr_hi_band = maxpwr;
for (i = 4; i < 12; i++) { for (i = 4; i < 12; i++) {
lpphy->tx_max_rateh[i] = maxpwr - (ofdmpo & 0xF) * 2; lpphy->tx_max_rateh[i] = maxpwr - (ofdmpo & 0xF) * 2;
...@@ -214,7 +214,8 @@ static void lpphy_table_init(struct b43_wldev *dev) ...@@ -214,7 +214,8 @@ static void lpphy_table_init(struct b43_wldev *dev)
static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
u16 tmp, tmp2; u16 tmp, tmp2;
...@@ -242,9 +243,9 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -242,9 +243,9 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00); b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
0xFF00, lpphy->rx_pwr_offset); 0xFF00, lpphy->rx_pwr_offset);
if ((bus->sprom.boardflags_lo & B43_BFL_FEM) && if ((sprom->boardflags_lo & B43_BFL_FEM) &&
((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) || ((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
(bus->sprom.boardflags_hi & B43_BFH_PAREF))) { (sprom->boardflags_hi & B43_BFH_PAREF))) {
ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28); ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28);
ssb_pmu_set_ldo_paref(&bus->chipco, true); ssb_pmu_set_ldo_paref(&bus->chipco, true);
if (dev->phy.rev == 0) { if (dev->phy.rev == 0) {
...@@ -260,7 +261,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -260,7 +261,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
} }
tmp = lpphy->rssi_vf | lpphy->rssi_vc << 4 | 0xA000; tmp = lpphy->rssi_vf | lpphy->rssi_vc << 4 | 0xA000;
b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp); b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp);
if (bus->sprom.boardflags_hi & B43_BFH_RSSIINV) if (sprom->boardflags_hi & B43_BFH_RSSIINV)
b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA); b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA);
else else
b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA); b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA);
...@@ -268,7 +269,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -268,7 +269,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL, b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL,
0xFFF9, (lpphy->bx_arch << 1)); 0xFFF9, (lpphy->bx_arch << 1));
if (dev->phy.rev == 1 && if (dev->phy.rev == 1 &&
(bus->sprom.boardflags_hi & B43_BFH_FEM_BT)) { (sprom->boardflags_hi & B43_BFH_FEM_BT)) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A);
...@@ -286,8 +287,8 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -286,8 +287,8 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00);
} else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ || } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ ||
(bus->boardinfo.type == 0x048A) || ((dev->phy.rev == 0) && (dev->dev->board_type == 0x048A) || ((dev->phy.rev == 0) &&
(bus->sprom.boardflags_lo & B43_BFL_FEM))) { (sprom->boardflags_lo & B43_BFL_FEM))) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001);
...@@ -297,7 +298,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -297,7 +298,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0A00); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0A00);
} else if (dev->phy.rev == 1 || } else if (dev->phy.rev == 1 ||
(bus->sprom.boardflags_lo & B43_BFL_FEM)) { (sprom->boardflags_lo & B43_BFL_FEM)) {
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0004); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0004);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0800); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0800);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0004); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0004);
...@@ -316,15 +317,15 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) ...@@ -316,15 +317,15 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006);
b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700); b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700);
} }
if (dev->phy.rev == 1 && (bus->sprom.boardflags_hi & B43_BFH_PAREF)) { if (dev->phy.rev == 1 && (sprom->boardflags_hi & B43_BFH_PAREF)) {
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1); b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2); b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3); b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3);
b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_8, B43_LPPHY_TR_LOOKUP_4); b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_8, B43_LPPHY_TR_LOOKUP_4);
} }
if ((bus->sprom.boardflags_hi & B43_BFH_FEM_BT) && if ((sprom->boardflags_hi & B43_BFH_FEM_BT) &&
(bus->chip_id == 0x5354) && (dev->dev->chip_id == 0x5354) &&
(bus->chip_package == SSB_CHIPPACK_BCM4712S)) { (dev->dev->chip_pkg == SSB_CHIPPACK_BCM4712S)) {
b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006); b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005); b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF); b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF);
...@@ -412,7 +413,6 @@ static void lpphy_restore_dig_flt_state(struct b43_wldev *dev) ...@@ -412,7 +413,6 @@ static void lpphy_restore_dig_flt_state(struct b43_wldev *dev)
static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50); b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50);
...@@ -432,7 +432,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) ...@@ -432,7 +432,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000); b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000);
b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000); b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000);
b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1); b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1);
if (bus->boardinfo.rev >= 0x18) { if (dev->dev->board_rev >= 0x18) {
b43_lptab_write(dev, B43_LPTAB32(17, 65), 0xEC); b43_lptab_write(dev, B43_LPTAB32(17, 65), 0xEC);
b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x14); b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x14);
} else { } else {
...@@ -449,7 +449,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) ...@@ -449,7 +449,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0); b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0);
b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300); b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300);
b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00); b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00);
if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) {
b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100); b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA); b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA);
} else { } else {
...@@ -467,7 +467,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) ...@@ -467,7 +467,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12);
b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000);
if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) {
b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0);
b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
} }
...@@ -492,7 +492,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) ...@@ -492,7 +492,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
0x2000 | ((u16)lpphy->rssi_gs << 10) | 0x2000 | ((u16)lpphy->rssi_gs << 10) |
((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf);
if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) {
b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C); b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C);
b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800); b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800);
b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400); b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400);
...@@ -519,7 +519,7 @@ struct b2062_freqdata { ...@@ -519,7 +519,7 @@ struct b2062_freqdata {
static void lpphy_2062_init(struct b43_wldev *dev) static void lpphy_2062_init(struct b43_wldev *dev)
{ {
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
u32 crystalfreq, tmp, ref; u32 crystalfreq, tmp, ref;
unsigned int i; unsigned int i;
const struct b2062_freqdata *fd = NULL; const struct b2062_freqdata *fd = NULL;
...@@ -697,7 +697,7 @@ static void lpphy_radio_init(struct b43_wldev *dev) ...@@ -697,7 +697,7 @@ static void lpphy_radio_init(struct b43_wldev *dev)
lpphy_sync_stx(dev); lpphy_sync_stx(dev);
b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80);
b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0);
if (dev->sdev->bus->chip_id == 0x4325) { if (dev->dev->chip_id == 0x4325) {
// TODO SSB PMU recalibration // TODO SSB PMU recalibration
} }
} }
...@@ -1289,7 +1289,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev) ...@@ -1289,7 +1289,7 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev)
static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev) static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF; u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF;
int i; int i;
...@@ -1840,7 +1840,6 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, ...@@ -1840,7 +1840,6 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains,
static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) static void lpphy_papd_cal_txpwr(struct b43_wldev *dev)
{ {
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->sdev->bus;
struct lpphy_tx_gains gains, oldgains; struct lpphy_tx_gains gains, oldgains;
int old_txpctl, old_afe_ovr, old_rf, old_bbmult; int old_txpctl, old_afe_ovr, old_rf, old_bbmult;
...@@ -1854,7 +1853,7 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) ...@@ -1854,7 +1853,7 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev)
lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
if (bus->chip_id == 0x4325 && bus->chip_rev == 0) if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0)
lpphy_papd_cal(dev, gains, 0, 1, 30); lpphy_papd_cal(dev, gains, 0, 1, 30);
else else
lpphy_papd_cal(dev, gains, 0, 1, 65); lpphy_papd_cal(dev, gains, 0, 1, 65);
...@@ -1870,7 +1869,6 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx, ...@@ -1870,7 +1869,6 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx,
bool rx, bool pa, struct lpphy_tx_gains *gains) bool rx, bool pa, struct lpphy_tx_gains *gains)
{ {
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->sdev->bus;
const struct lpphy_rx_iq_comp *iqcomp = NULL; const struct lpphy_rx_iq_comp *iqcomp = NULL;
struct lpphy_tx_gains nogains, oldgains; struct lpphy_tx_gains nogains, oldgains;
u16 tmp; u16 tmp;
...@@ -1879,7 +1877,7 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx, ...@@ -1879,7 +1877,7 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx,
memset(&nogains, 0, sizeof(nogains)); memset(&nogains, 0, sizeof(nogains));
memset(&oldgains, 0, sizeof(oldgains)); memset(&oldgains, 0, sizeof(oldgains));
if (bus->chip_id == 0x5354) { if (dev->dev->chip_id == 0x5354) {
for (i = 0; i < ARRAY_SIZE(lpphy_5354_iq_table); i++) { for (i = 0; i < ARRAY_SIZE(lpphy_5354_iq_table); i++) {
if (lpphy_5354_iq_table[i].chan == lpphy->channel) { if (lpphy_5354_iq_table[i].chan == lpphy->channel) {
iqcomp = &lpphy_5354_iq_table[i]; iqcomp = &lpphy_5354_iq_table[i];
...@@ -2408,11 +2406,9 @@ static const struct b206x_channel b2063_chantbl[] = { ...@@ -2408,11 +2406,9 @@ static const struct b206x_channel b2063_chantbl[] = {
static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF);
udelay(20); udelay(20);
if (bus->chip_id == 0x5354) { if (dev->dev->chip_id == 0x5354) {
b43_radio_write(dev, B2062_N_COMM1, 4); b43_radio_write(dev, B2062_N_COMM1, 4);
b43_radio_write(dev, B2062_S_RFPLL_CTL2, 4); b43_radio_write(dev, B2062_S_RFPLL_CTL2, 4);
} else { } else {
...@@ -2432,7 +2428,7 @@ static int lpphy_b2062_tune(struct b43_wldev *dev, ...@@ -2432,7 +2428,7 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
unsigned int channel) unsigned int channel)
{ {
struct b43_phy_lp *lpphy = dev->phy.lp; struct b43_phy_lp *lpphy = dev->phy.lp;
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
const struct b206x_channel *chandata = NULL; const struct b206x_channel *chandata = NULL;
u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9;
...@@ -2522,7 +2518,7 @@ static void lpphy_b2063_vco_calib(struct b43_wldev *dev) ...@@ -2522,7 +2518,7 @@ static void lpphy_b2063_vco_calib(struct b43_wldev *dev)
static int lpphy_b2063_tune(struct b43_wldev *dev, static int lpphy_b2063_tune(struct b43_wldev *dev,
unsigned int channel) unsigned int channel)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
static const struct b206x_channel *chandata = NULL; static const struct b206x_channel *chandata = NULL;
u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
...@@ -2670,6 +2666,11 @@ static int b43_lpphy_op_init(struct b43_wldev *dev) ...@@ -2670,6 +2666,11 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
{ {
int err; int err;
if (dev->dev->bus_type != B43_BUS_SSB) {
b43err(dev->wl, "LP-PHY is supported only on SSB!\n");
return -EOPNOTSUPP;
}
lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs? lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs?
lpphy_baseband_init(dev); lpphy_baseband_init(dev);
lpphy_radio_init(dev); lpphy_radio_init(dev);
......
...@@ -299,7 +299,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable) ...@@ -299,7 +299,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
static void b43_nphy_tx_power_fix(struct b43_wldev *dev) static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
{ {
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); struct ssb_sprom *sprom = dev->dev->bus_sprom;
u8 txpi[2], bbmult, i; u8 txpi[2], bbmult, i;
u16 tmp, radio_gain, dac_gain; u16 tmp, radio_gain, dac_gain;
...@@ -423,16 +423,15 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev) ...@@ -423,16 +423,15 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev)
static void b43_radio_init2055_post(struct b43_wldev *dev) static void b43_radio_init2055_post(struct b43_wldev *dev)
{ {
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct ssb_boardinfo *binfo = &(dev->sdev->bus->boardinfo);
int i; int i;
u16 val; u16 val;
bool workaround = false; bool workaround = false;
if (sprom->revision < 4) if (sprom->revision < 4)
workaround = (binfo->vendor != PCI_VENDOR_ID_BROADCOM && workaround = (dev->dev->board_vendor != PCI_VENDOR_ID_BROADCOM
binfo->type == 0x46D && && dev->dev->board_type == 0x46D
binfo->rev >= 0x41); && dev->dev->board_rev >= 0x41);
else else
workaround = workaround =
!(sprom->boardflags2_lo & B43_BFL2_RXBB_INT_REG_DIS); !(sprom->boardflags2_lo & B43_BFL2_RXBB_INT_REG_DIS);
...@@ -983,7 +982,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val) ...@@ -983,7 +982,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
{ {
u16 tmp; u16 tmp;
if (dev->sdev->id.revision == 16) if (dev->dev->core_rev == 16)
b43_mac_suspend(dev); b43_mac_suspend(dev);
tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL); tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
...@@ -993,7 +992,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val) ...@@ -993,7 +992,7 @@ static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
tmp |= (val & mask); tmp |= (val & mask);
b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp); b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
if (dev->sdev->id.revision == 16) if (dev->dev->core_rev == 16)
b43_mac_enable(dev); b43_mac_enable(dev);
return tmp; return tmp;
...@@ -1168,7 +1167,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev) ...@@ -1168,7 +1167,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev) static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev)
{ {
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = &(dev->sdev->bus->sprom); struct ssb_sprom *sprom = dev->dev->bus_sprom;
/* PHY rev 0, 1, 2 */ /* PHY rev 0, 1, 2 */
u8 i, j; u8 i, j;
...@@ -1373,7 +1372,7 @@ static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev) ...@@ -1373,7 +1372,7 @@ static void b43_nphy_gain_ctrl_workarounds(struct b43_wldev *dev)
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
static void b43_nphy_workarounds(struct b43_wldev *dev) static void b43_nphy_workarounds(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = phy->n; struct b43_phy_n *nphy = phy->n;
...@@ -1443,9 +1442,9 @@ static void b43_nphy_workarounds(struct b43_wldev *dev) ...@@ -1443,9 +1442,9 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
/* N PHY WAR TX Chain Update with hw_phytxchain as argument */ /* N PHY WAR TX Chain Update with hw_phytxchain as argument */
if ((bus->sprom.boardflags2_lo & B43_BFL2_APLL_WAR && if ((sprom->boardflags2_lo & B43_BFL2_APLL_WAR &&
b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) || b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
(bus->sprom.boardflags2_lo & B43_BFL2_GPLL_WAR && (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR &&
b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ))
tmp32 = 0x00088888; tmp32 = 0x00088888;
else else
...@@ -1503,8 +1502,8 @@ static void b43_nphy_workarounds(struct b43_wldev *dev) ...@@ -1503,8 +1502,8 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8); b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8);
b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301); b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301);
if (bus->sprom.boardflags2_lo & 0x100 && if (sprom->boardflags2_lo & 0x100 &&
bus->boardinfo.type == 0x8B) { dev->dev->board_type == 0x8B) {
delays1[0] = 0x1; delays1[0] = 0x1;
delays1[5] = 0x14; delays1[5] = 0x14;
} }
...@@ -3586,7 +3585,7 @@ static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask) ...@@ -3586,7 +3585,7 @@ static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
*/ */
int b43_phy_initn(struct b43_wldev *dev) int b43_phy_initn(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = phy->n; struct b43_phy_n *nphy = phy->n;
u8 tx_pwr_state; u8 tx_pwr_state;
...@@ -3599,7 +3598,7 @@ int b43_phy_initn(struct b43_wldev *dev) ...@@ -3599,7 +3598,7 @@ int b43_phy_initn(struct b43_wldev *dev)
bool do_cal = false; bool do_cal = false;
if ((dev->phy.rev >= 3) && if ((dev->phy.rev >= 3) &&
(bus->sprom.boardflags_lo & B43_BFL_EXTLNA) && (sprom->boardflags_lo & B43_BFL_EXTLNA) &&
(b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) { (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) {
chipco_set32(&dev->sdev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40); chipco_set32(&dev->sdev->bus->chipco, SSB_CHIPCO_CHIPCTL, 0x40);
} }
...@@ -3639,9 +3638,9 @@ int b43_phy_initn(struct b43_wldev *dev) ...@@ -3639,9 +3638,9 @@ int b43_phy_initn(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_AFESEQ_TX2RX_PUD_20M, 0x20); 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_AFESEQ_TX2RX_PUD_40M, 0x20);
if (bus->sprom.boardflags2_lo & 0x100 || if (sprom->boardflags2_lo & 0x100 ||
(bus->boardinfo.vendor == PCI_VENDOR_ID_APPLE && (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE &&
bus->boardinfo.type == 0x8B)) dev->dev->board_type == 0x8B))
b43_phy_write(dev, B43_NPHY_TXREALFD, 0xA0); b43_phy_write(dev, B43_NPHY_TXREALFD, 0xA0);
else else
b43_phy_write(dev, B43_NPHY_TXREALFD, 0xB8); b43_phy_write(dev, B43_NPHY_TXREALFD, 0xB8);
......
...@@ -111,7 +111,7 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev, ...@@ -111,7 +111,7 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev,
B43_MMIO_PIO11_BASE5, B43_MMIO_PIO11_BASE5,
}; };
if (dev->sdev->id.revision >= 11) { if (dev->dev->core_rev >= 11) {
B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11)); B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11));
return bases_rev11[index]; return bases_rev11[index];
} }
...@@ -121,14 +121,14 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev, ...@@ -121,14 +121,14 @@ static u16 index_to_pioqueue_base(struct b43_wldev *dev,
static u16 pio_txqueue_offset(struct b43_wldev *dev) static u16 pio_txqueue_offset(struct b43_wldev *dev)
{ {
if (dev->sdev->id.revision >= 11) if (dev->dev->core_rev >= 11)
return 0x18; return 0x18;
return 0; return 0;
} }
static u16 pio_rxqueue_offset(struct b43_wldev *dev) static u16 pio_rxqueue_offset(struct b43_wldev *dev)
{ {
if (dev->sdev->id.revision >= 11) if (dev->dev->core_rev >= 11)
return 0x38; return 0x38;
return 8; return 8;
} }
...@@ -144,7 +144,7 @@ static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev, ...@@ -144,7 +144,7 @@ static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev,
if (!q) if (!q)
return NULL; return NULL;
q->dev = dev; q->dev = dev;
q->rev = dev->sdev->id.revision; q->rev = dev->dev->core_rev;
q->mmio_base = index_to_pioqueue_base(dev, index) + q->mmio_base = index_to_pioqueue_base(dev, index) +
pio_txqueue_offset(dev); pio_txqueue_offset(dev);
q->index = index; q->index = index;
...@@ -178,7 +178,7 @@ static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev, ...@@ -178,7 +178,7 @@ static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev,
if (!q) if (!q)
return NULL; return NULL;
q->dev = dev; q->dev = dev;
q->rev = dev->sdev->id.revision; q->rev = dev->dev->core_rev;
q->mmio_base = index_to_pioqueue_base(dev, index) + q->mmio_base = index_to_pioqueue_base(dev, index) +
pio_rxqueue_offset(dev); pio_rxqueue_offset(dev);
......
...@@ -37,17 +37,16 @@ void b43_rfkill_poll(struct ieee80211_hw *hw) ...@@ -37,17 +37,16 @@ void b43_rfkill_poll(struct ieee80211_hw *hw)
{ {
struct b43_wl *wl = hw_to_b43_wl(hw); struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev = wl->current_dev; struct b43_wldev *dev = wl->current_dev;
struct ssb_bus *bus = dev->sdev->bus;
bool enabled; bool enabled;
bool brought_up = false; bool brought_up = false;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) { if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) {
if (ssb_bus_powerup(bus, 0)) { if (b43_bus_powerup(dev, 0)) {
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
return; return;
} }
ssb_device_enable(dev->sdev, 0); b43_device_enable(dev, 0);
brought_up = true; brought_up = true;
} }
...@@ -63,8 +62,8 @@ void b43_rfkill_poll(struct ieee80211_hw *hw) ...@@ -63,8 +62,8 @@ void b43_rfkill_poll(struct ieee80211_hw *hw)
} }
if (brought_up) { if (brought_up) {
ssb_device_disable(dev->sdev, 0); b43_device_disable(dev, 0);
ssb_bus_may_powerdown(bus); b43_bus_may_powerdown(dev);
} }
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
......
...@@ -66,7 +66,7 @@ static void b43_sdio_interrupt_dispatcher(struct sdio_func *func) ...@@ -66,7 +66,7 @@ static void b43_sdio_interrupt_dispatcher(struct sdio_func *func)
int b43_sdio_request_irq(struct b43_wldev *dev, int b43_sdio_request_irq(struct b43_wldev *dev,
void (*handler)(struct b43_wldev *dev)) void (*handler)(struct b43_wldev *dev))
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
struct sdio_func *func = bus->host_sdio; struct sdio_func *func = bus->host_sdio;
struct b43_sdio *sdio = sdio_get_drvdata(func); struct b43_sdio *sdio = sdio_get_drvdata(func);
int err; int err;
...@@ -82,7 +82,7 @@ int b43_sdio_request_irq(struct b43_wldev *dev, ...@@ -82,7 +82,7 @@ int b43_sdio_request_irq(struct b43_wldev *dev,
void b43_sdio_free_irq(struct b43_wldev *dev) void b43_sdio_free_irq(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_bus *bus = dev->dev->sdev->bus;
struct sdio_func *func = bus->host_sdio; struct sdio_func *func = bus->host_sdio;
struct b43_sdio *sdio = sdio_get_drvdata(func); struct b43_sdio *sdio = sdio_get_drvdata(func);
......
...@@ -140,7 +140,7 @@ static DEVICE_ATTR(interference, 0644, ...@@ -140,7 +140,7 @@ static DEVICE_ATTR(interference, 0644,
int b43_sysfs_register(struct b43_wldev *wldev) int b43_sysfs_register(struct b43_wldev *wldev)
{ {
struct device *dev = wldev->sdev->dev; struct device *dev = wldev->dev->dev;
B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED); B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED);
...@@ -149,7 +149,7 @@ int b43_sysfs_register(struct b43_wldev *wldev) ...@@ -149,7 +149,7 @@ int b43_sysfs_register(struct b43_wldev *wldev)
void b43_sysfs_unregister(struct b43_wldev *wldev) void b43_sysfs_unregister(struct b43_wldev *wldev)
{ {
struct device *dev = wldev->sdev->dev; struct device *dev = wldev->dev->dev;
device_remove_file(dev, &dev_attr_interference); device_remove_file(dev, &dev_attr_interference);
} }
...@@ -2304,7 +2304,6 @@ void lpphy_rev0_1_table_init(struct b43_wldev *dev) ...@@ -2304,7 +2304,6 @@ void lpphy_rev0_1_table_init(struct b43_wldev *dev)
void lpphy_rev2plus_table_init(struct b43_wldev *dev) void lpphy_rev2plus_table_init(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus;
int i; int i;
B43_WARN_ON(dev->phy.rev < 2); B43_WARN_ON(dev->phy.rev < 2);
...@@ -2341,7 +2340,7 @@ void lpphy_rev2plus_table_init(struct b43_wldev *dev) ...@@ -2341,7 +2340,7 @@ void lpphy_rev2plus_table_init(struct b43_wldev *dev)
b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0), b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0),
ARRAY_SIZE(lpphy_papd_mult_table), lpphy_papd_mult_table); ARRAY_SIZE(lpphy_papd_mult_table), lpphy_papd_mult_table);
if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) {
b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0), b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0),
ARRAY_SIZE(lpphy_a0_gain_idx_table), lpphy_a0_gain_idx_table); ARRAY_SIZE(lpphy_a0_gain_idx_table), lpphy_a0_gain_idx_table);
b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0),
...@@ -2416,12 +2415,12 @@ void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count, ...@@ -2416,12 +2415,12 @@ void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count,
void lpphy_init_tx_gain_table(struct b43_wldev *dev) void lpphy_init_tx_gain_table(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_sprom *sprom = dev->dev->bus_sprom;
switch (dev->phy.rev) { switch (dev->phy.rev) {
case 0: case 0:
if ((bus->sprom.boardflags_hi & B43_BFH_NOPA) || if ((sprom->boardflags_hi & B43_BFH_NOPA) ||
(bus->sprom.boardflags_lo & B43_BFL_HGPA)) (sprom->boardflags_lo & B43_BFL_HGPA))
lpphy_write_gain_table_bulk(dev, 0, 128, lpphy_write_gain_table_bulk(dev, 0, 128,
lpphy_rev0_nopa_tx_gain_table); lpphy_rev0_nopa_tx_gain_table);
else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
...@@ -2432,8 +2431,8 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev) ...@@ -2432,8 +2431,8 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev)
lpphy_rev0_5ghz_tx_gain_table); lpphy_rev0_5ghz_tx_gain_table);
break; break;
case 1: case 1:
if ((bus->sprom.boardflags_hi & B43_BFH_NOPA) || if ((sprom->boardflags_hi & B43_BFH_NOPA) ||
(bus->sprom.boardflags_lo & B43_BFL_HGPA)) (sprom->boardflags_lo & B43_BFL_HGPA))
lpphy_write_gain_table_bulk(dev, 0, 128, lpphy_write_gain_table_bulk(dev, 0, 128,
lpphy_rev1_nopa_tx_gain_table); lpphy_rev1_nopa_tx_gain_table);
else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
...@@ -2444,7 +2443,7 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev) ...@@ -2444,7 +2443,7 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev)
lpphy_rev1_5ghz_tx_gain_table); lpphy_rev1_5ghz_tx_gain_table);
break; break;
default: default:
if (bus->sprom.boardflags_hi & B43_BFH_NOPA) if (sprom->boardflags_hi & B43_BFH_NOPA)
lpphy_write_gain_table_bulk(dev, 0, 128, lpphy_write_gain_table_bulk(dev, 0, 128,
lpphy_rev2_nopa_tx_gain_table); lpphy_rev2_nopa_tx_gain_table);
else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
......
...@@ -458,17 +458,15 @@ static void b43_wa_rssi_adc(struct b43_wldev *dev) ...@@ -458,17 +458,15 @@ static void b43_wa_rssi_adc(struct b43_wldev *dev)
static void b43_wa_boards_a(struct b43_wldev *dev) static void b43_wa_boards_a(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; if (dev->dev->board_vendor == SSB_BOARDVENDOR_BCM &&
dev->dev->board_type == SSB_BOARD_BU4306 &&
if (bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM && dev->dev->board_rev < 0x30) {
bus->boardinfo.type == SSB_BOARD_BU4306 &&
bus->boardinfo.rev < 0x30) {
b43_phy_write(dev, 0x0010, 0xE000); b43_phy_write(dev, 0x0010, 0xE000);
b43_phy_write(dev, 0x0013, 0x0140); b43_phy_write(dev, 0x0013, 0x0140);
b43_phy_write(dev, 0x0014, 0x0280); b43_phy_write(dev, 0x0014, 0x0280);
} else { } else {
if (bus->boardinfo.type == SSB_BOARD_MP4318 && if (dev->dev->board_type == SSB_BOARD_MP4318 &&
bus->boardinfo.rev < 0x20) { dev->dev->board_rev < 0x20) {
b43_phy_write(dev, 0x0013, 0x0210); b43_phy_write(dev, 0x0013, 0x0210);
b43_phy_write(dev, 0x0014, 0x0840); b43_phy_write(dev, 0x0014, 0x0840);
} else { } else {
...@@ -486,19 +484,19 @@ static void b43_wa_boards_a(struct b43_wldev *dev) ...@@ -486,19 +484,19 @@ static void b43_wa_boards_a(struct b43_wldev *dev)
static void b43_wa_boards_g(struct b43_wldev *dev) static void b43_wa_boards_g(struct b43_wldev *dev)
{ {
struct ssb_bus *bus = dev->sdev->bus; struct ssb_sprom *sprom = dev->dev->bus_sprom;
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
if (bus->boardinfo.vendor != SSB_BOARDVENDOR_BCM || if (dev->dev->board_vendor != SSB_BOARDVENDOR_BCM ||
bus->boardinfo.type != SSB_BOARD_BU4306 || dev->dev->board_type != SSB_BOARD_BU4306 ||
bus->boardinfo.rev != 0x17) { dev->dev->board_rev != 0x17) {
if (phy->rev < 2) { if (phy->rev < 2) {
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 1, 0x0002); b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 1, 0x0002);
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 2, 0x0001); b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 2, 0x0001);
} else { } else {
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 1, 0x0002); b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 1, 0x0002);
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 2, 0x0001); b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 2, 0x0001);
if ((bus->sprom.boardflags_lo & B43_BFL_EXTLNA) && if ((sprom->boardflags_lo & B43_BFL_EXTLNA) &&
(phy->rev >= 7)) { (phy->rev >= 7)) {
b43_phy_mask(dev, B43_PHY_EXTG(0x11), 0xF7FF); b43_phy_mask(dev, B43_PHY_EXTG(0x11), 0xF7FF);
b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0020, 0x0001); b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0020, 0x0001);
...@@ -510,7 +508,7 @@ static void b43_wa_boards_g(struct b43_wldev *dev) ...@@ -510,7 +508,7 @@ static void b43_wa_boards_g(struct b43_wldev *dev)
} }
} }
} }
if (bus->sprom.boardflags_lo & B43_BFL_FEM) { if (sprom->boardflags_lo & B43_BFL_FEM) {
b43_phy_write(dev, B43_PHY_GTABCTL, 0x3120); b43_phy_write(dev, B43_PHY_GTABCTL, 0x3120);
b43_phy_write(dev, B43_PHY_GTABDATA, 0xC480); b43_phy_write(dev, B43_PHY_GTABDATA, 0xC480);
} }
......
...@@ -547,7 +547,7 @@ static s8 b43_rssi_postprocess(struct b43_wldev *dev, ...@@ -547,7 +547,7 @@ static s8 b43_rssi_postprocess(struct b43_wldev *dev,
else else
tmp -= 3; tmp -= 3;
} else { } else {
if (dev->sdev->bus->sprom. if (dev->dev->bus_sprom->
boardflags_lo & B43_BFL_RSSI) { boardflags_lo & B43_BFL_RSSI) {
if (in_rssi > 63) if (in_rssi > 63)
in_rssi = 63; in_rssi = 63;
......
...@@ -817,14 +817,13 @@ static void dmacontroller_cleanup(struct b43legacy_dmaring *ring) ...@@ -817,14 +817,13 @@ static void dmacontroller_cleanup(struct b43legacy_dmaring *ring)
static void free_all_descbuffers(struct b43legacy_dmaring *ring) static void free_all_descbuffers(struct b43legacy_dmaring *ring)
{ {
struct b43legacy_dmadesc_generic *desc;
struct b43legacy_dmadesc_meta *meta; struct b43legacy_dmadesc_meta *meta;
int i; int i;
if (!ring->used_slots) if (!ring->used_slots)
return; return;
for (i = 0; i < ring->nr_slots; i++) { for (i = 0; i < ring->nr_slots; i++) {
desc = ring->ops->idx2desc(ring, i, &meta); ring->ops->idx2desc(ring, i, &meta);
if (!meta->skb) { if (!meta->skb) {
B43legacy_WARN_ON(!ring->tx); B43legacy_WARN_ON(!ring->tx);
...@@ -1371,10 +1370,8 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev, ...@@ -1371,10 +1370,8 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct b43legacy_dmaring *ring; struct b43legacy_dmaring *ring;
struct ieee80211_hdr *hdr;
int err = 0; int err = 0;
unsigned long flags; unsigned long flags;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
ring = priority_to_txring(dev, skb_get_queue_mapping(skb)); ring = priority_to_txring(dev, skb_get_queue_mapping(skb));
spin_lock_irqsave(&ring->lock, flags); spin_lock_irqsave(&ring->lock, flags);
...@@ -1401,8 +1398,6 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev, ...@@ -1401,8 +1398,6 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev,
/* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing /* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing
* into the skb data or cb now. */ * into the skb data or cb now. */
hdr = NULL;
info = NULL;
err = dma_tx_fragment(ring, &skb); err = dma_tx_fragment(ring, &skb);
if (unlikely(err == -ENOKEY)) { if (unlikely(err == -ENOKEY)) {
/* Drop this packet, as we don't have the encryption key /* Drop this packet, as we don't have the encryption key
...@@ -1435,7 +1430,6 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, ...@@ -1435,7 +1430,6 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
{ {
const struct b43legacy_dma_ops *ops; const struct b43legacy_dma_ops *ops;
struct b43legacy_dmaring *ring; struct b43legacy_dmaring *ring;
struct b43legacy_dmadesc_generic *desc;
struct b43legacy_dmadesc_meta *meta; struct b43legacy_dmadesc_meta *meta;
int retry_limit; int retry_limit;
int slot; int slot;
...@@ -1450,7 +1444,7 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, ...@@ -1450,7 +1444,7 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
ops = ring->ops; ops = ring->ops;
while (1) { while (1) {
B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots));
desc = ops->idx2desc(ring, slot, &meta); ops->idx2desc(ring, slot, &meta);
if (meta->skb) if (meta->skb)
unmap_descbuffer(ring, meta->dmaaddr, unmap_descbuffer(ring, meta->dmaaddr,
......
...@@ -1564,10 +1564,10 @@ static int b43legacy_request_firmware(struct b43legacy_wldev *dev) ...@@ -1564,10 +1564,10 @@ static int b43legacy_request_firmware(struct b43legacy_wldev *dev)
struct b43legacy_firmware *fw = &dev->fw; struct b43legacy_firmware *fw = &dev->fw;
const u8 rev = dev->dev->id.revision; const u8 rev = dev->dev->id.revision;
const char *filename; const char *filename;
u32 tmshigh;
int err; int err;
tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); /* do dummy read */
ssb_read32(dev->dev, SSB_TMSHIGH);
if (!fw->ucode) { if (!fw->ucode) {
if (rev == 2) if (rev == 2)
filename = "ucode2"; filename = "ucode2";
...@@ -2634,11 +2634,9 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, ...@@ -2634,11 +2634,9 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
unsigned long flags; unsigned long flags;
unsigned int new_phymode = 0xFFFF; unsigned int new_phymode = 0xFFFF;
int antenna_tx; int antenna_tx;
int antenna_rx;
int err = 0; int err = 0;
antenna_tx = B43legacy_ANTENNA_DEFAULT; antenna_tx = B43legacy_ANTENNA_DEFAULT;
antenna_rx = B43legacy_ANTENNA_DEFAULT;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
dev = wl->current_dev; dev = wl->current_dev;
...@@ -2775,14 +2773,12 @@ static void b43legacy_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2775,14 +2773,12 @@ static void b43legacy_op_bss_info_changed(struct ieee80211_hw *hw,
{ {
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
struct b43legacy_wldev *dev; struct b43legacy_wldev *dev;
struct b43legacy_phy *phy;
unsigned long flags; unsigned long flags;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
B43legacy_WARN_ON(wl->vif != vif); B43legacy_WARN_ON(wl->vif != vif);
dev = wl->current_dev; dev = wl->current_dev;
phy = &dev->phy;
/* Disable IRQs while reconfiguring the device. /* Disable IRQs while reconfiguring the device.
* This makes it possible to drop the spinlock throughout * This makes it possible to drop the spinlock throughout
......
...@@ -321,11 +321,9 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev, ...@@ -321,11 +321,9 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
int rts_rate; int rts_rate;
int rts_rate_fb; int rts_rate_fb;
int rts_rate_ofdm;
int rts_rate_fb_ofdm; int rts_rate_fb_ofdm;
rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info)->hw_value; rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info)->hw_value;
rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate);
rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate);
rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb);
if (rts_rate_fb_ofdm) if (rts_rate_fb_ofdm)
......
...@@ -2275,6 +2275,9 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, ...@@ -2275,6 +2275,9 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
if (rate_control_send_low(sta, priv_sta, txrc)) if (rate_control_send_low(sta, priv_sta, txrc))
return; return;
if (!lq_sta)
return;
rate_idx = lq_sta->last_txrate_idx; rate_idx = lq_sta->last_txrate_idx;
if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
......
...@@ -496,7 +496,7 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel) ...@@ -496,7 +496,7 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
channel <= CALIB_IWL_TX_ATTEN_GR4_LCH) channel <= CALIB_IWL_TX_ATTEN_GR4_LCH)
return CALIB_CH_GROUP_4; return CALIB_CH_GROUP_4;
return -1; return -EINVAL;
} }
static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel)
...@@ -915,7 +915,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, ...@@ -915,7 +915,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
if (txatten_grp < 0) { if (txatten_grp < 0) {
IWL_ERR(priv, "Can't find txatten group for channel %d.\n", IWL_ERR(priv, "Can't find txatten group for channel %d.\n",
channel); channel);
return -EINVAL; return txatten_grp;
} }
IWL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", IWL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n",
...@@ -1185,8 +1185,6 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv, ...@@ -1185,8 +1185,6 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv,
ret = iwl_legacy_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, ret = iwl_legacy_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
sizeof(rxon_assoc), &rxon_assoc, NULL); sizeof(rxon_assoc), &rxon_assoc, NULL);
if (ret)
return ret;
return ret; return ret;
} }
...@@ -1237,7 +1235,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c ...@@ -1237,7 +1235,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
iwl_legacy_print_rx_config_cmd(priv, ctx); iwl_legacy_print_rx_config_cmd(priv, ctx);
return 0; goto set_tx_power;
} }
/* If we are currently associated and the new config requires /* If we are currently associated and the new config requires
...@@ -1317,6 +1315,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c ...@@ -1317,6 +1315,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
iwl4965_init_sensitivity(priv); iwl4965_init_sensitivity(priv);
set_tx_power:
/* If we issue a new RXON command which required a tune then we must /* If we issue a new RXON command which required a tune then we must
* send a new TXPOWER command or we won't be able to Tx any frames */ * send a new TXPOWER command or we won't be able to Tx any frames */
ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true);
......
...@@ -316,7 +316,6 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv, ...@@ -316,7 +316,6 @@ static void iwl_legacy_init_band_reference(const struct iwl_priv *priv,
break; break;
default: default:
BUG(); BUG();
return;
} }
} }
......
...@@ -174,7 +174,6 @@ static struct iwl_lib_ops iwl1000_lib = { ...@@ -174,7 +174,6 @@ static struct iwl_lib_ops iwl1000_lib = {
.rx_handler_setup = iwlagn_rx_handler_setup, .rx_handler_setup = iwlagn_rx_handler_setup,
.setup_deferred_work = iwlagn_setup_deferred_work, .setup_deferred_work = iwlagn_setup_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.apm_ops = { .apm_ops = {
.init = iwl_apm_init, .init = iwl_apm_init,
...@@ -223,6 +222,7 @@ static struct iwl_base_params iwl1000_base_params = { ...@@ -223,6 +222,7 @@ static struct iwl_base_params iwl1000_base_params = {
static struct iwl_ht_params iwl1000_ht_params = { static struct iwl_ht_params iwl1000_ht_params = {
.ht_greenfield_support = true, .ht_greenfield_support = true,
.use_rts_for_aggregation = true, /* use rts/cts protection */ .use_rts_for_aggregation = true, /* use rts/cts protection */
.smps_mode = IEEE80211_SMPS_STATIC,
}; };
#define IWL_DEVICE_1000 \ #define IWL_DEVICE_1000 \
......
...@@ -177,88 +177,13 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -177,88 +177,13 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
return 0; return 0;
} }
static int iwl2030_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_channel_switch *ch_switch)
{
/*
* MULTI-FIXME
* See iwl_mac_channel_switch.
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl6000_channel_switch_cmd cmd;
const struct iwl_channel_info *ch_info;
u32 switch_time_in_usec, ucode_switch_time;
u16 ch;
u32 tsf_low;
u8 switch_count;
u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
struct ieee80211_vif *vif = ctx->vif;
struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH,
.len = { sizeof(cmd), },
.flags = CMD_SYNC,
.data = { &cmd, },
};
cmd.band = priv->band == IEEE80211_BAND_2GHZ;
ch = ch_switch->channel->hw_value;
IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
ctx->active.channel, ch);
cmd.channel = cpu_to_le16(ch);
cmd.rxon_flags = ctx->staging.flags;
cmd.rxon_filter_flags = ctx->staging.filter_flags;
switch_count = ch_switch->count;
tsf_low = ch_switch->timestamp & 0x0ffffffff;
/*
* calculate the ucode channel switch time
* adding TSF as one of the factor for when to switch
*/
if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
beacon_interval)) {
switch_count -= (priv->ucode_beacon_time -
tsf_low) / beacon_interval;
} else
switch_count = 0;
}
if (switch_count <= 1)
cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
else {
switch_time_in_usec =
vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
ucode_switch_time = iwl_usecs_to_beacons(priv,
switch_time_in_usec,
beacon_interval);
cmd.switch_time = iwl_add_beacon_time(priv,
priv->ucode_beacon_time,
ucode_switch_time,
beacon_interval);
}
IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
cmd.switch_time);
ch_info = iwl_get_channel_info(priv, priv->band, ch);
if (ch_info)
cmd.expect_beacon = is_channel_radar(ch_info);
else {
IWL_ERR(priv, "invalid channel switch from %u to %u\n",
ctx->active.channel, ch);
return -EFAULT;
}
priv->switch_rxon.channel = cmd.channel;
priv->switch_rxon.switch_in_progress = true;
return iwl_send_cmd_sync(priv, &hcmd);
}
static struct iwl_lib_ops iwl2000_lib = { static struct iwl_lib_ops iwl2000_lib = {
.set_hw_params = iwl2000_hw_set_hw_params, .set_hw_params = iwl2000_hw_set_hw_params,
.rx_handler_setup = iwlagn_rx_handler_setup, .rx_handler_setup = iwlagn_rx_handler_setup,
.setup_deferred_work = iwlagn_bt_setup_deferred_work, .setup_deferred_work = iwlagn_bt_setup_deferred_work,
.cancel_deferred_work = iwlagn_bt_cancel_deferred_work, .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.set_channel_switch = iwl2030_hw_channel_switch,
.apm_ops = { .apm_ops = {
.init = iwl_apm_init, .init = iwl_apm_init,
.config = iwl2000_nic_config, .config = iwl2000_nic_config,
......
...@@ -331,8 +331,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, ...@@ -331,8 +331,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
ctx->active.channel, ch); ctx->active.channel, ch);
return -EFAULT; return -EFAULT;
} }
priv->switch_rxon.channel = cmd.channel;
priv->switch_rxon.switch_in_progress = true;
return iwl_send_cmd_sync(priv, &hcmd); return iwl_send_cmd_sync(priv, &hcmd);
} }
...@@ -342,7 +340,6 @@ static struct iwl_lib_ops iwl5000_lib = { ...@@ -342,7 +340,6 @@ static struct iwl_lib_ops iwl5000_lib = {
.rx_handler_setup = iwlagn_rx_handler_setup, .rx_handler_setup = iwlagn_rx_handler_setup,
.setup_deferred_work = iwlagn_setup_deferred_work, .setup_deferred_work = iwlagn_setup_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.set_channel_switch = iwl5000_hw_channel_switch, .set_channel_switch = iwl5000_hw_channel_switch,
.apm_ops = { .apm_ops = {
...@@ -373,7 +370,6 @@ static struct iwl_lib_ops iwl5150_lib = { ...@@ -373,7 +370,6 @@ static struct iwl_lib_ops iwl5150_lib = {
.rx_handler_setup = iwlagn_rx_handler_setup, .rx_handler_setup = iwlagn_rx_handler_setup,
.setup_deferred_work = iwlagn_setup_deferred_work, .setup_deferred_work = iwlagn_setup_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.set_channel_switch = iwl5000_hw_channel_switch, .set_channel_switch = iwl5000_hw_channel_switch,
.apm_ops = { .apm_ops = {
...@@ -425,7 +421,6 @@ static struct iwl_base_params iwl5000_base_params = { ...@@ -425,7 +421,6 @@ static struct iwl_base_params iwl5000_base_params = {
}; };
static struct iwl_ht_params iwl5000_ht_params = { static struct iwl_ht_params iwl5000_ht_params = {
.ht_greenfield_support = true, .ht_greenfield_support = true,
.use_rts_for_aggregation = true, /* use rts/cts protection */
}; };
#define IWL_DEVICE_5000 \ #define IWL_DEVICE_5000 \
......
...@@ -270,8 +270,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, ...@@ -270,8 +270,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
ctx->active.channel, ch); ctx->active.channel, ch);
return -EFAULT; return -EFAULT;
} }
priv->switch_rxon.channel = cmd.channel;
priv->switch_rxon.switch_in_progress = true;
return iwl_send_cmd_sync(priv, &hcmd); return iwl_send_cmd_sync(priv, &hcmd);
} }
...@@ -281,7 +279,6 @@ static struct iwl_lib_ops iwl6000_lib = { ...@@ -281,7 +279,6 @@ static struct iwl_lib_ops iwl6000_lib = {
.rx_handler_setup = iwlagn_rx_handler_setup, .rx_handler_setup = iwlagn_rx_handler_setup,
.setup_deferred_work = iwlagn_setup_deferred_work, .setup_deferred_work = iwlagn_setup_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.set_channel_switch = iwl6000_hw_channel_switch, .set_channel_switch = iwl6000_hw_channel_switch,
.apm_ops = { .apm_ops = {
...@@ -314,7 +311,6 @@ static struct iwl_lib_ops iwl6030_lib = { ...@@ -314,7 +311,6 @@ static struct iwl_lib_ops iwl6030_lib = {
.setup_deferred_work = iwlagn_bt_setup_deferred_work, .setup_deferred_work = iwlagn_bt_setup_deferred_work,
.cancel_deferred_work = iwlagn_bt_cancel_deferred_work, .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
.is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
.send_tx_power = iwlagn_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.set_channel_switch = iwl6000_hw_channel_switch, .set_channel_switch = iwl6000_hw_channel_switch,
.apm_ops = { .apm_ops = {
......
...@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv, ...@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
__le16 fc, __le32 *tx_flags) __le16 fc, __le32 *tx_flags)
{ {
if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS || if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
info->flags & IEEE80211_TX_CTL_AMPDU)
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
return;
}
if (priv->cfg->ht_params &&
priv->cfg->ht_params->use_rts_for_aggregation &&
info->flags & IEEE80211_TX_CTL_AMPDU) {
*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
return;
}
} }
/* Calc max signal level (dBm) among 3 possible receivers */ /* Calc max signal level (dBm) among 3 possible receivers */
...@@ -310,7 +302,6 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -310,7 +302,6 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
} }
struct iwl_hcmd_ops iwlagn_hcmd = { struct iwl_hcmd_ops iwlagn_hcmd = {
.commit_rxon = iwlagn_commit_rxon,
.set_rxon_chain = iwlagn_set_rxon_chain, .set_rxon_chain = iwlagn_set_rxon_chain,
.set_tx_ant = iwlagn_send_tx_ant_config, .set_tx_ant = iwlagn_send_tx_ant_config,
.send_bt_config = iwl_send_bt_config, .send_bt_config = iwl_send_bt_config,
...@@ -318,7 +309,6 @@ struct iwl_hcmd_ops iwlagn_hcmd = { ...@@ -318,7 +309,6 @@ struct iwl_hcmd_ops iwlagn_hcmd = {
}; };
struct iwl_hcmd_ops iwlagn_bt_hcmd = { struct iwl_hcmd_ops iwlagn_bt_hcmd = {
.commit_rxon = iwlagn_commit_rxon,
.set_rxon_chain = iwlagn_set_rxon_chain, .set_rxon_chain = iwlagn_set_rxon_chain,
.set_tx_ant = iwlagn_send_tx_ant_config, .set_tx_ant = iwlagn_send_tx_ant_config,
.send_bt_config = iwlagn_send_advance_bt_config, .send_bt_config = iwlagn_send_advance_bt_config,
...@@ -332,5 +322,4 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { ...@@ -332,5 +322,4 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
.tx_cmd_protection = iwlagn_tx_cmd_protection, .tx_cmd_protection = iwlagn_tx_cmd_protection,
.calc_rssi = iwlagn_calc_rssi, .calc_rssi = iwlagn_calc_rssi,
.request_scan = iwlagn_request_scan, .request_scan = iwlagn_request_scan,
.post_scan = iwlagn_post_scan,
}; };
...@@ -408,9 +408,9 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv, ...@@ -408,9 +408,9 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv,
unsigned long flags; unsigned long flags;
if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " IWL_ERR(priv, "%s: Read index for DMA queue txq_id (%d) "
"is out of range [0-%d] %d %d\n", txq_id, "index %d is out of range [0-%d] %d %d\n", __func__,
index, txq->q.n_bd, txq->q.write_ptr, txq_id, index, txq->q.n_bd, txq->q.write_ptr,
txq->q.read_ptr); txq->q.read_ptr);
return; return;
} }
...@@ -1797,6 +1797,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work) ...@@ -1797,6 +1797,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
priv->cfg->ops->lib->update_chain_flags(priv); priv->cfg->ops->lib->update_chain_flags(priv);
if (smps_request != -1) { if (smps_request != -1) {
priv->current_ht_config.smps = smps_request;
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION)
ieee80211_request_smps(ctx->vif, smps_request); ieee80211_request_smps(ctx->vif, smps_request);
......
...@@ -426,7 +426,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, ...@@ -426,7 +426,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
ieee80211_stop_tx_ba_session(sta, tid); ieee80211_stop_tx_ba_session(sta, tid);
} }
} else { } else {
IWL_ERR(priv, "Aggregation not enabled for tid %d " IWL_DEBUG_HT(priv, "Aggregation not enabled for tid %d "
"because load = %u\n", tid, load); "because load = %u\n", tid, load);
} }
return ret; return ret;
......
...@@ -81,6 +81,21 @@ static int iwlagn_disable_pan(struct iwl_priv *priv, ...@@ -81,6 +81,21 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
return ret; return ret;
} }
static int iwlagn_disconn_pan(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
struct iwl_rxon_cmd *send)
{
__le32 old_filter = send->filter_flags;
int ret;
send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
send->filter_flags = old_filter;
return ret;
}
static void iwlagn_update_qos(struct iwl_priv *priv, static void iwlagn_update_qos(struct iwl_priv *priv,
struct iwl_rxon_context *ctx) struct iwl_rxon_context *ctx)
{ {
...@@ -163,9 +178,6 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv, ...@@ -163,9 +178,6 @@ static int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd, ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd,
sizeof(rxon_assoc), &rxon_assoc, NULL); sizeof(rxon_assoc), &rxon_assoc, NULL);
if (ret)
return ret;
return ret; return ret;
} }
...@@ -175,10 +187,21 @@ static int iwlagn_rxon_disconn(struct iwl_priv *priv, ...@@ -175,10 +187,21 @@ static int iwlagn_rxon_disconn(struct iwl_priv *priv,
int ret; int ret;
struct iwl_rxon_cmd *active = (void *)&ctx->active; struct iwl_rxon_cmd *active = (void *)&ctx->active;
if (ctx->ctxid == IWL_RXON_CTX_BSS) if (ctx->ctxid == IWL_RXON_CTX_BSS) {
ret = iwlagn_disable_bss(priv, ctx, &ctx->staging); ret = iwlagn_disable_bss(priv, ctx, &ctx->staging);
else } else {
ret = iwlagn_disable_pan(priv, ctx, &ctx->staging); ret = iwlagn_disable_pan(priv, ctx, &ctx->staging);
if (ret)
return ret;
if (ctx->vif) {
ret = iwl_send_rxon_timing(priv, ctx);
if (ret) {
IWL_ERR(priv, "Failed to send timing (%d)!\n", ret);
return ret;
}
ret = iwlagn_disconn_pan(priv, ctx, &ctx->staging);
}
}
if (ret) if (ret)
return ret; return ret;
...@@ -205,10 +228,12 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, ...@@ -205,10 +228,12 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
struct iwl_rxon_cmd *active = (void *)&ctx->active; struct iwl_rxon_cmd *active = (void *)&ctx->active;
/* RXON timing must be before associated RXON */ /* RXON timing must be before associated RXON */
ret = iwl_send_rxon_timing(priv, ctx); if (ctx->ctxid == IWL_RXON_CTX_BSS) {
if (ret) { ret = iwl_send_rxon_timing(priv, ctx);
IWL_ERR(priv, "Failed to send timing (%d)!\n", ret); if (ret) {
return ret; IWL_ERR(priv, "Failed to send timing (%d)!\n", ret);
return ret;
}
} }
/* QoS info may be cleared by previous un-assoc RXON */ /* QoS info may be cleared by previous un-assoc RXON */
iwlagn_update_qos(priv, ctx); iwlagn_update_qos(priv, ctx);
...@@ -263,6 +288,12 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv, ...@@ -263,6 +288,12 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
IWL_ERR(priv, "Error sending TX power (%d)\n", ret); IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
return ret; return ret;
} }
if ((ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) &&
priv->cfg->ht_params->smps_mode)
ieee80211_request_smps(ctx->vif,
priv->cfg->ht_params->smps_mode);
return 0; return 0;
} }
...@@ -325,6 +356,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -325,6 +356,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
return 0; return 0;
} }
/*
* force CTS-to-self frames protection if RTS-CTS is not preferred
* one aggregation protection method
*/
if (!(priv->cfg->ht_params &&
priv->cfg->ht_params->use_rts_for_aggregation))
ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
...@@ -342,10 +381,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -342,10 +381,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
* receive commit_rxon request * receive commit_rxon request
* abort any previous channel switch if still in process * abort any previous channel switch if still in process
*/ */
if (priv->switch_rxon.switch_in_progress && if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
(priv->switch_rxon.channel != ctx->staging.channel)) { (priv->switch_channel != ctx->staging.channel)) {
IWL_DEBUG_11H(priv, "abort channel switch on %d\n", IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
le16_to_cpu(priv->switch_rxon.channel)); le16_to_cpu(priv->switch_channel));
iwl_chswitch_done(priv, false); iwl_chswitch_done(priv, false);
} }
...@@ -362,13 +401,16 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -362,13 +401,16 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
} }
memcpy(active, &ctx->staging, sizeof(*active)); memcpy(active, &ctx->staging, sizeof(*active));
return 0; /*
} * We do not commit tx power settings while channel changing,
* do it now if after settings changed.
*/
iwl_set_tx_power(priv, priv->tx_power_next, false);
if (priv->cfg->ops->hcmd->set_pan_params) { /* make sure we are in the right PS state */
ret = priv->cfg->ops->hcmd->set_pan_params(priv); iwl_power_update_mode(priv, true);
if (ret)
return ret; return 0;
} }
iwl_set_rxon_hwcrypto(priv, ctx, !iwlagn_mod_params.sw_crypto); iwl_set_rxon_hwcrypto(priv, ctx, !iwlagn_mod_params.sw_crypto);
...@@ -392,6 +434,12 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -392,6 +434,12 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (ret) if (ret)
return ret; return ret;
if (priv->cfg->ops->hcmd->set_pan_params) {
ret = priv->cfg->ops->hcmd->set_pan_params(priv);
if (ret)
return ret;
}
if (new_assoc) if (new_assoc)
return iwlagn_rxon_connect(priv, ctx); return iwlagn_rxon_connect(priv, ctx);
...@@ -756,6 +804,13 @@ void iwlagn_post_scan(struct iwl_priv *priv) ...@@ -756,6 +804,13 @@ void iwlagn_post_scan(struct iwl_priv *priv)
{ {
struct iwl_rxon_context *ctx; struct iwl_rxon_context *ctx;
/*
* We do not commit power settings while scan is pending,
* do it now if the settings changed.
*/
iwl_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false);
iwl_set_tx_power(priv, priv->tx_power_next, false);
/* /*
* Since setting the RXON may have been deferred while * Since setting the RXON may have been deferred while
* performing the scan, fire one off if needed * performing the scan, fire one off if needed
......
...@@ -1033,8 +1033,8 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -1033,8 +1033,8 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
if (unlikely(tx_fifo < 0)) if (unlikely(tx_fifo < 0))
return tx_fifo; return tx_fifo;
IWL_WARN(priv, "%s on ra = %pM tid = %d\n", IWL_DEBUG_HT(priv, "TX AGG request on ra = %pM tid = %d\n",
__func__, sta->addr, tid); sta->addr, tid);
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
...@@ -1236,9 +1236,9 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) ...@@ -1236,9 +1236,9 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " IWL_ERR(priv, "%s: Read index for DMA queue txq id (%d), "
"is out of range [0-%d] %d %d.\n", txq_id, "index %d is out of range [0-%d] %d %d.\n", __func__,
index, q->n_bd, q->write_ptr, q->read_ptr); txq_id, index, q->n_bd, q->write_ptr, q->read_ptr);
return 0; return 0;
} }
......
...@@ -97,7 +97,7 @@ void iwl_update_chain_flags(struct iwl_priv *priv) ...@@ -97,7 +97,7 @@ void iwl_update_chain_flags(struct iwl_priv *priv)
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
if (ctx->active.rx_chain != ctx->staging.rx_chain) if (ctx->active.rx_chain != ctx->staging.rx_chain)
iwlcore_commit_rxon(priv, ctx); iwlagn_commit_rxon(priv, ctx);
} }
} }
} }
...@@ -274,7 +274,7 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work) ...@@ -274,7 +274,7 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work)
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
if (priv->cfg->ops->hcmd->set_rxon_chain) if (priv->cfg->ops->hcmd->set_rxon_chain)
priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
iwlcore_commit_rxon(priv, ctx); iwlagn_commit_rxon(priv, ctx);
} }
priv->cfg->ops->hcmd->send_bt_config(priv); priv->cfg->ops->hcmd->send_bt_config(priv);
...@@ -2056,7 +2056,7 @@ int iwl_alive_start(struct iwl_priv *priv) ...@@ -2056,7 +2056,7 @@ int iwl_alive_start(struct iwl_priv *priv)
set_bit(STATUS_READY, &priv->status); set_bit(STATUS_READY, &priv->status);
/* Configure the adapter for unassociated operation */ /* Configure the adapter for unassociated operation */
ret = iwlcore_commit_rxon(priv, ctx); ret = iwlagn_commit_rxon(priv, ctx);
if (ret) if (ret)
return ret; return ret;
...@@ -2420,6 +2420,77 @@ static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw) ...@@ -2420,6 +2420,77 @@ static int iwl_mac_offchannel_tx_cancel_wait(struct ieee80211_hw *hw)
* *
*****************************************************************************/ *****************************************************************************/
static const struct ieee80211_iface_limit iwlagn_sta_ap_limits[] = {
{
.max = 1,
.types = BIT(NL80211_IFTYPE_STATION),
},
{
.max = 1,
.types = BIT(NL80211_IFTYPE_AP),
},
};
static const struct ieee80211_iface_limit iwlagn_2sta_limits[] = {
{
.max = 2,
.types = BIT(NL80211_IFTYPE_STATION),
},
};
static const struct ieee80211_iface_limit iwlagn_p2p_sta_go_limits[] = {
{
.max = 1,
.types = BIT(NL80211_IFTYPE_STATION),
},
{
.max = 1,
.types = BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_AP),
},
};
static const struct ieee80211_iface_limit iwlagn_p2p_2sta_limits[] = {
{
.max = 2,
.types = BIT(NL80211_IFTYPE_STATION),
},
{
.max = 1,
.types = BIT(NL80211_IFTYPE_P2P_CLIENT),
},
};
static const struct ieee80211_iface_combination
iwlagn_iface_combinations_dualmode[] = {
{ .num_different_channels = 1,
.max_interfaces = 2,
.beacon_int_infra_match = true,
.limits = iwlagn_sta_ap_limits,
.n_limits = ARRAY_SIZE(iwlagn_sta_ap_limits),
},
{ .num_different_channels = 1,
.max_interfaces = 2,
.limits = iwlagn_2sta_limits,
.n_limits = ARRAY_SIZE(iwlagn_2sta_limits),
},
};
static const struct ieee80211_iface_combination
iwlagn_iface_combinations_p2p[] = {
{ .num_different_channels = 1,
.max_interfaces = 2,
.beacon_int_infra_match = true,
.limits = iwlagn_p2p_sta_go_limits,
.n_limits = ARRAY_SIZE(iwlagn_p2p_sta_go_limits),
},
{ .num_different_channels = 1,
.max_interfaces = 2,
.limits = iwlagn_p2p_2sta_limits,
.n_limits = ARRAY_SIZE(iwlagn_p2p_2sta_limits),
},
};
/* /*
* Not a mac80211 entry point function, but it fits in with all the * Not a mac80211 entry point function, but it fits in with all the
* other mac80211 functions grouped here. * other mac80211 functions grouped here.
...@@ -2460,6 +2531,18 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, ...@@ -2460,6 +2531,18 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; hw->wiphy->interface_modes |= ctx->exclusive_interface_modes;
} }
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) {
hw->wiphy->iface_combinations = iwlagn_iface_combinations_p2p;
hw->wiphy->n_iface_combinations =
ARRAY_SIZE(iwlagn_iface_combinations_p2p);
} else if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
hw->wiphy->iface_combinations = iwlagn_iface_combinations_dualmode;
hw->wiphy->n_iface_combinations =
ARRAY_SIZE(iwlagn_iface_combinations_dualmode);
}
hw->wiphy->max_remain_on_channel_duration = 1000; hw->wiphy->max_remain_on_channel_duration = 1000;
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
...@@ -2711,12 +2794,9 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, ...@@ -2711,12 +2794,9 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
ret = 0; ret = 0;
if (priv->cfg->ht_params && if (priv->cfg->ht_params &&
priv->cfg->ht_params->use_rts_for_aggregation) { priv->cfg->ht_params->use_rts_for_aggregation) {
struct iwl_station_priv *sta_priv =
(void *) sta->drv_priv;
/* /*
* switch off RTS/CTS if it was previously enabled * switch off RTS/CTS if it was previously enabled
*/ */
sta_priv->lq_sta.lq.general_params.flags &= sta_priv->lq_sta.lq.general_params.flags &=
~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK;
iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif),
...@@ -2764,6 +2844,9 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, ...@@ -2764,6 +2844,9 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif),
&sta_priv->lq_sta.lq, CMD_ASYNC, false); &sta_priv->lq_sta.lq, CMD_ASYNC, false);
IWL_INFO(priv, "Tx aggregation enabled on ra = %pM tid = %d\n",
sta->addr, tid);
ret = 0; ret = 0;
break; break;
} }
...@@ -2833,7 +2916,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2833,7 +2916,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
*/ */
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
u16 ch; u16 ch;
unsigned long flags = 0;
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
...@@ -2843,73 +2925,73 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2843,73 +2925,73 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
goto out; goto out;
if (test_bit(STATUS_EXIT_PENDING, &priv->status) || if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
test_bit(STATUS_SCANNING, &priv->status)) test_bit(STATUS_SCANNING, &priv->status) ||
test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
goto out; goto out;
if (!iwl_is_associated_ctx(ctx)) if (!iwl_is_associated_ctx(ctx))
goto out; goto out;
/* channel switch in progress */ if (!priv->cfg->ops->lib->set_channel_switch)
if (priv->switch_rxon.switch_in_progress == true)
goto out; goto out;
if (priv->cfg->ops->lib->set_channel_switch) { ch = channel->hw_value;
if (le16_to_cpu(ctx->active.channel) == ch)
goto out;
ch = channel->hw_value; ch_info = iwl_get_channel_info(priv, channel->band, ch);
if (le16_to_cpu(ctx->active.channel) != ch) { if (!is_channel_valid(ch_info)) {
ch_info = iwl_get_channel_info(priv, IWL_DEBUG_MAC80211(priv, "invalid channel\n");
channel->band, goto out;
ch); }
if (!is_channel_valid(ch_info)) {
IWL_DEBUG_MAC80211(priv, "invalid channel\n");
goto out;
}
spin_lock_irqsave(&priv->lock, flags);
priv->current_ht_config.smps = conf->smps_mode;
/* Configure HT40 channels */
ctx->ht.enabled = conf_is_ht(conf);
if (ctx->ht.enabled) {
if (conf_is_ht40_minus(conf)) {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_BELOW;
ctx->ht.is_40mhz = true;
} else if (conf_is_ht40_plus(conf)) {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
ctx->ht.is_40mhz = true;
} else {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_NONE;
ctx->ht.is_40mhz = false;
}
} else
ctx->ht.is_40mhz = false;
if ((le16_to_cpu(ctx->staging.channel) != ch)) spin_lock_irq(&priv->lock);
ctx->staging.flags = 0;
iwl_set_rxon_channel(priv, channel, ctx); priv->current_ht_config.smps = conf->smps_mode;
iwl_set_rxon_ht(priv, ht_conf);
iwl_set_flags_for_band(priv, ctx, channel->band,
ctx->vif);
spin_unlock_irqrestore(&priv->lock, flags);
iwl_set_rate(priv); /* Configure HT40 channels */
/* ctx->ht.enabled = conf_is_ht(conf);
* at this point, staging_rxon has the if (ctx->ht.enabled) {
* configuration for channel switch if (conf_is_ht40_minus(conf)) {
*/ ctx->ht.extension_chan_offset =
if (priv->cfg->ops->lib->set_channel_switch(priv, IEEE80211_HT_PARAM_CHA_SEC_BELOW;
ch_switch)) ctx->ht.is_40mhz = true;
priv->switch_rxon.switch_in_progress = false; } else if (conf_is_ht40_plus(conf)) {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
ctx->ht.is_40mhz = true;
} else {
ctx->ht.extension_chan_offset =
IEEE80211_HT_PARAM_CHA_SEC_NONE;
ctx->ht.is_40mhz = false;
} }
} else
ctx->ht.is_40mhz = false;
if ((le16_to_cpu(ctx->staging.channel) != ch))
ctx->staging.flags = 0;
iwl_set_rxon_channel(priv, channel, ctx);
iwl_set_rxon_ht(priv, ht_conf);
iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
spin_unlock_irq(&priv->lock);
iwl_set_rate(priv);
/*
* at this point, staging_rxon has the
* configuration for channel switch
*/
set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = cpu_to_le16(ch);
if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false);
} }
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
if (!priv->switch_rxon.switch_in_progress)
ieee80211_chswitch_done(ctx->vif, false);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
} }
...@@ -3018,7 +3100,7 @@ static void iwlagn_disable_roc(struct iwl_priv *priv) ...@@ -3018,7 +3100,7 @@ static void iwlagn_disable_roc(struct iwl_priv *priv)
priv->_agn.hw_roc_channel = NULL; priv->_agn.hw_roc_channel = NULL;
iwlcore_commit_rxon(priv, ctx); iwlagn_commit_rxon(priv, ctx);
ctx->is_active = false; ctx->is_active = false;
} }
...@@ -3061,7 +3143,7 @@ static int iwl_mac_remain_on_channel(struct ieee80211_hw *hw, ...@@ -3061,7 +3143,7 @@ static int iwl_mac_remain_on_channel(struct ieee80211_hw *hw,
priv->_agn.hw_roc_channel = channel; priv->_agn.hw_roc_channel = channel;
priv->_agn.hw_roc_chantype = channel_type; priv->_agn.hw_roc_chantype = channel_type;
priv->_agn.hw_roc_duration = DIV_ROUND_UP(duration * 1000, 1024); priv->_agn.hw_roc_duration = DIV_ROUND_UP(duration * 1000, 1024);
iwlcore_commit_rxon(priv, &priv->contexts[IWL_RXON_CTX_PAN]); iwlagn_commit_rxon(priv, &priv->contexts[IWL_RXON_CTX_PAN]);
queue_delayed_work(priv->workqueue, &priv->_agn.hw_roc_work, queue_delayed_work(priv->workqueue, &priv->_agn.hw_roc_work,
msecs_to_jiffies(duration + 20)); msecs_to_jiffies(duration + 20));
...@@ -3618,8 +3700,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3618,8 +3700,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
destroy_workqueue(priv->workqueue); destroy_workqueue(priv->workqueue);
priv->workqueue = NULL; priv->workqueue = NULL;
free_irq(priv->pci_dev->irq, priv); free_irq(priv->pci_dev->irq, priv);
iwl_free_isr_ict(priv);
out_disable_msi: out_disable_msi:
iwl_free_isr_ict(priv);
pci_disable_msi(priv->pci_dev); pci_disable_msi(priv->pci_dev);
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
out_free_eeprom: out_free_eeprom:
......
...@@ -843,12 +843,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) ...@@ -843,12 +843,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return; return;
if (priv->switch_rxon.switch_in_progress) { if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
ieee80211_chswitch_done(ctx->vif, is_success); ieee80211_chswitch_done(ctx->vif, is_success);
mutex_lock(&priv->mutex);
priv->switch_rxon.switch_in_progress = false;
mutex_unlock(&priv->mutex);
}
} }
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
...@@ -1131,9 +1127,6 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) ...@@ -1131,9 +1127,6 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
if (priv->tx_power_user_lmt == tx_power && !force) if (priv->tx_power_user_lmt == tx_power && !force)
return 0; return 0;
if (!priv->cfg->ops->lib->send_tx_power)
return -EOPNOTSUPP;
if (tx_power < IWLAGN_TX_POWER_TARGET_POWER_MIN) { if (tx_power < IWLAGN_TX_POWER_TARGET_POWER_MIN) {
IWL_WARN(priv, IWL_WARN(priv,
"Requested user TXPOWER %d below lower limit %d.\n", "Requested user TXPOWER %d below lower limit %d.\n",
...@@ -1167,7 +1160,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) ...@@ -1167,7 +1160,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
prev_tx_power = priv->tx_power_user_lmt; prev_tx_power = priv->tx_power_user_lmt;
priv->tx_power_user_lmt = tx_power; priv->tx_power_user_lmt = tx_power;
ret = priv->cfg->ops->lib->send_tx_power(priv); ret = iwlagn_send_tx_power(priv);
/* if fail to set tx_power, restore the orig. tx power */ /* if fail to set tx_power, restore the orig. tx power */
if (ret) { if (ret) {
...@@ -1282,7 +1275,7 @@ static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -1282,7 +1275,7 @@ static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (priv->cfg->ops->hcmd->set_rxon_chain) if (priv->cfg->ops->hcmd->set_rxon_chain)
priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
return iwlcore_commit_rxon(priv, ctx); return iwlagn_commit_rxon(priv, ctx);
} }
static int iwl_setup_interface(struct iwl_priv *priv, static int iwl_setup_interface(struct iwl_priv *priv,
......
...@@ -90,7 +90,6 @@ struct iwl_cmd; ...@@ -90,7 +90,6 @@ struct iwl_cmd;
#define IWL_CMD(x) case x: return #x #define IWL_CMD(x) case x: return #x
struct iwl_hcmd_ops { struct iwl_hcmd_ops {
int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
void (*set_rxon_chain)(struct iwl_priv *priv, void (*set_rxon_chain)(struct iwl_priv *priv,
struct iwl_rxon_context *ctx); struct iwl_rxon_context *ctx);
int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant);
...@@ -112,7 +111,6 @@ struct iwl_hcmd_utils_ops { ...@@ -112,7 +111,6 @@ struct iwl_hcmd_utils_ops {
int (*calc_rssi)(struct iwl_priv *priv, int (*calc_rssi)(struct iwl_priv *priv,
struct iwl_rx_phy_res *rx_resp); struct iwl_rx_phy_res *rx_resp);
int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); int (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif);
void (*post_scan)(struct iwl_priv *priv);
}; };
struct iwl_apm_ops { struct iwl_apm_ops {
...@@ -141,7 +139,6 @@ struct iwl_lib_ops { ...@@ -141,7 +139,6 @@ struct iwl_lib_ops {
struct iwl_apm_ops apm_ops; struct iwl_apm_ops apm_ops;
/* power */ /* power */
int (*send_tx_power) (struct iwl_priv *priv);
void (*update_chain_flags)(struct iwl_priv *priv); void (*update_chain_flags)(struct iwl_priv *priv);
/* eeprom operations (as defined in iwl-eeprom.h) */ /* eeprom operations (as defined in iwl-eeprom.h) */
...@@ -225,7 +222,7 @@ struct iwl_base_params { ...@@ -225,7 +222,7 @@ struct iwl_base_params {
* @ampdu_factor: Maximum A-MPDU length factor * @ampdu_factor: Maximum A-MPDU length factor
* @ampdu_density: Minimum A-MPDU spacing * @ampdu_density: Minimum A-MPDU spacing
* @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
*/ */
struct iwl_bt_params { struct iwl_bt_params {
bool advanced_bt_coexist; bool advanced_bt_coexist;
u8 bt_init_traffic_load; u8 bt_init_traffic_load;
...@@ -238,10 +235,11 @@ struct iwl_bt_params { ...@@ -238,10 +235,11 @@ struct iwl_bt_params {
}; };
/* /*
* @use_rts_for_aggregation: use rts/cts protection for HT traffic * @use_rts_for_aggregation: use rts/cts protection for HT traffic
*/ */
struct iwl_ht_params { struct iwl_ht_params {
const bool ht_greenfield_support; /* if used set to true */ const bool ht_greenfield_support; /* if used set to true */
bool use_rts_for_aggregation; bool use_rts_for_aggregation;
enum ieee80211_smps_mode smps_mode;
}; };
/** /**
...@@ -560,6 +558,7 @@ void iwlcore_free_geos(struct iwl_priv *priv); ...@@ -560,6 +558,7 @@ void iwlcore_free_geos(struct iwl_priv *priv);
#define STATUS_POWER_PMI 16 #define STATUS_POWER_PMI 16
#define STATUS_FW_ERROR 17 #define STATUS_FW_ERROR 17
#define STATUS_DEVICE_ENABLED 18 #define STATUS_DEVICE_ENABLED 18
#define STATUS_CHANNEL_SWITCH_PENDING 19
static inline int iwl_is_ready(struct iwl_priv *priv) static inline int iwl_is_ready(struct iwl_priv *priv)
...@@ -612,11 +611,7 @@ void iwl_apm_stop(struct iwl_priv *priv); ...@@ -612,11 +611,7 @@ void iwl_apm_stop(struct iwl_priv *priv);
int iwl_apm_init(struct iwl_priv *priv); int iwl_apm_init(struct iwl_priv *priv);
int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx); int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
static inline int iwlcore_commit_rxon(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{
return priv->cfg->ops->hcmd->commit_rxon(priv, ctx);
}
static inline const struct ieee80211_supported_band *iwl_get_hw_mode( static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
struct iwl_priv *priv, enum ieee80211_band band) struct iwl_priv *priv, enum ieee80211_band band)
{ {
......
...@@ -982,17 +982,6 @@ struct traffic_stats { ...@@ -982,17 +982,6 @@ struct traffic_stats {
#endif #endif
}; };
/*
* iwl_switch_rxon: "channel switch" structure
*
* @ switch_in_progress: channel switch in progress
* @ channel: new channel
*/
struct iwl_switch_rxon {
bool switch_in_progress;
__le16 channel;
};
/* /*
* schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
* to perform continuous uCode event logging operation if enabled * to perform continuous uCode event logging operation if enabled
...@@ -1288,7 +1277,7 @@ struct iwl_priv { ...@@ -1288,7 +1277,7 @@ struct iwl_priv {
struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
struct iwl_switch_rxon switch_rxon; __le16 switch_channel;
struct { struct {
u32 error_event_table; u32 error_event_table;
......
...@@ -250,19 +250,19 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) ...@@ -250,19 +250,19 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl_rxon_cmd *rxon = (void *)&ctx->active; struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
if (priv->switch_rxon.switch_in_progress) { if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
if (!le32_to_cpu(csa->status) && return;
(csa->channel == priv->switch_rxon.channel)) {
rxon->channel = csa->channel; if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
ctx->staging.channel = csa->channel; rxon->channel = csa->channel;
IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", ctx->staging.channel = csa->channel;
le16_to_cpu(csa->channel)); IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
iwl_chswitch_done(priv, true);
} else {
IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
le16_to_cpu(csa->channel)); le16_to_cpu(csa->channel));
iwl_chswitch_done(priv, false); iwl_chswitch_done(priv, true);
} } else {
IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
le16_to_cpu(csa->channel));
iwl_chswitch_done(priv, false);
} }
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "iwl-sta.h" #include "iwl-sta.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-helpers.h" #include "iwl-helpers.h"
#include "iwl-agn.h"
/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
* sending probe req. This should be set long enough to hear probe responses * sending probe req. This should be set long enough to hear probe responses
...@@ -600,14 +601,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) ...@@ -600,14 +601,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
if (!iwl_is_ready_rf(priv)) if (!iwl_is_ready_rf(priv))
goto out; goto out;
/* iwlagn_post_scan(priv);
* We do not commit power settings while scan is pending,
* do it now if the settings changed.
*/
iwl_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false);
iwl_set_tx_power(priv, priv->tx_power_next, false);
priv->cfg->ops->utils->post_scan(priv);
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
......
...@@ -753,9 +753,9 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx) ...@@ -753,9 +753,9 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
int nfreed = 0; int nfreed = 0;
if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) { if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " IWL_ERR(priv, "%s: Read index for DMA queue txq id (%d), "
"is out of range [0-%d] %d %d.\n", txq_id, "index %d is out of range [0-%d] %d %d.\n", __func__,
idx, q->n_bd, q->write_ptr, q->read_ptr); txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr);
return; return;
} }
......
...@@ -907,7 +907,7 @@ static void if_sdio_interrupt(struct sdio_func *func) ...@@ -907,7 +907,7 @@ static void if_sdio_interrupt(struct sdio_func *func)
card = sdio_get_drvdata(func); card = sdio_get_drvdata(func);
cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret);
if (ret) if (ret || !cause)
goto out; goto out;
lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause);
...@@ -1008,10 +1008,6 @@ static int if_sdio_probe(struct sdio_func *func, ...@@ -1008,10 +1008,6 @@ static int if_sdio_probe(struct sdio_func *func,
if (ret) if (ret)
goto release; goto release;
ret = sdio_claim_irq(func, if_sdio_interrupt);
if (ret)
goto disable;
/* For 1-bit transfers to the 8686 model, we need to enable the /* For 1-bit transfers to the 8686 model, we need to enable the
* interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0 * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0
* bit to allow access to non-vendor registers. */ * bit to allow access to non-vendor registers. */
...@@ -1082,6 +1078,21 @@ static int if_sdio_probe(struct sdio_func *func, ...@@ -1082,6 +1078,21 @@ static int if_sdio_probe(struct sdio_func *func,
else else
card->rx_unit = 0; card->rx_unit = 0;
/*
* Set up the interrupt handler late.
*
* If we set it up earlier, the (buggy) hardware generates a spurious
* interrupt, even before the interrupt has been enabled, with
* CCCR_INTx = 0.
*
* We register the interrupt handler late so that we can handle any
* spurious interrupts, and also to avoid generation of that known
* spurious interrupt in the first place.
*/
ret = sdio_claim_irq(func, if_sdio_interrupt);
if (ret)
goto disable;
/* /*
* Enable interrupts now that everything is set up * Enable interrupts now that everything is set up
*/ */
......
/*
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __MAC80211_HWSIM_H
#define __MAC80211_HWSIM_H
/**
* enum hwsim_tx_control_flags - flags to describe transmission info/status
*
* These flags are used to give the wmediumd extra information in order to
* modify its behavior for each frame
*
* @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
* @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
* @HWSIM_TX_STAT_ACK: Frame was acknowledged
*
*/
enum hwsim_tx_control_flags {
HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0),
HWSIM_TX_CTL_NO_ACK = BIT(1),
HWSIM_TX_STAT_ACK = BIT(2),
};
/**
* DOC: Frame transmission/registration support
*
* Frame transmission and registration support exists to allow userspace
* entities such as wmediumd to receive and process all broadcasted
* frames from a mac80211_hwsim radio device.
*
* This allow user space applications to decide if the frame should be
* dropped or not and implement a wireless medium simulator at user space.
*
* Registration is done by sending a register message to the driver and
* will be automatically unregistered if the user application doesn't
* responds to sent frames.
* Once registered the user application has to take responsibility of
* broadcasting the frames to all listening mac80211_hwsim radio
* interfaces.
*
* For more technical details, see the corresponding command descriptions
* below.
*/
/**
* enum hwsim_commands - supported hwsim commands
*
* @HWSIM_CMD_UNSPEC: unspecified command to catch errors
*
* @HWSIM_CMD_REGISTER: request to register and received all broadcasted
* frames by any mac80211_hwsim radio device.
* @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
* space, uses:
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
* %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
* @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
* kernel, uses:
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
* %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
* @__HWSIM_CMD_MAX: enum limit
*/
enum {
HWSIM_CMD_UNSPEC,
HWSIM_CMD_REGISTER,
HWSIM_CMD_FRAME,
HWSIM_CMD_TX_INFO_FRAME,
__HWSIM_CMD_MAX,
};
#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
/**
* enum hwsim_attrs - hwsim netlink attributes
*
* @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
*
* @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
* the frame is broadcasted to
* @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
* the frame was broadcasted from
* @HWSIM_ATTR_FRAME: Data array
* @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
properly the frame at user space
* @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
space
* @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
space
* @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
* @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
* @__HWSIM_ATTR_MAX: enum limit
*/
enum {
HWSIM_ATTR_UNSPEC,
HWSIM_ATTR_ADDR_RECEIVER,
HWSIM_ATTR_ADDR_TRANSMITTER,
HWSIM_ATTR_FRAME,
HWSIM_ATTR_FLAGS,
HWSIM_ATTR_RX_RATE,
HWSIM_ATTR_SIGNAL,
HWSIM_ATTR_TX_INFO,
HWSIM_ATTR_COOKIE,
__HWSIM_ATTR_MAX,
};
#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
/**
* struct hwsim_tx_rate - rate selection/status
*
* @idx: rate index to attempt to send with
* @count: number of tries in this rate before going to the next rate
*
* A value of -1 for @idx indicates an invalid rate and, if used
* in an array of retry rates, that no more rates should be tried.
*
* When used for transmit status reporting, the driver should
* always report the rate and number of retries used.
*
*/
struct hwsim_tx_rate {
s8 idx;
u8 count;
} __packed;
#endif /* __MAC80211_HWSIM_H */
...@@ -164,12 +164,13 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -164,12 +164,13 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
struct mwifiex_tx_param tx_param; struct mwifiex_tx_param tx_param;
struct txpd *ptx_pd = NULL; struct txpd *ptx_pd = NULL;
if (skb_queue_empty(&pra_list->skb_head)) { skb_src = skb_peek(&pra_list->skb_head);
if (!skb_src) {
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
ra_list_flags); ra_list_flags);
return 0; return 0;
} }
skb_src = skb_peek(&pra_list->skb_head);
tx_info_src = MWIFIEX_SKB_TXCB(skb_src); tx_info_src = MWIFIEX_SKB_TXCB(skb_src);
skb_aggr = dev_alloc_skb(adapter->tx_buf_size); skb_aggr = dev_alloc_skb(adapter->tx_buf_size);
if (!skb_aggr) { if (!skb_aggr) {
...@@ -184,17 +185,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -184,17 +185,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
tx_info_aggr->bss_index = tx_info_src->bss_index; tx_info_aggr->bss_index = tx_info_src->bss_index;
skb_aggr->priority = skb_src->priority; skb_aggr->priority = skb_src->priority;
while (skb_src && ((skb_headroom(skb_aggr) + skb_src->len do {
+ LLC_SNAP_LEN) /* Check if AMSDU can accommodate this MSDU */
<= adapter->tx_buf_size)) { if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
break;
if (!skb_queue_empty(&pra_list->skb_head)) skb_src = skb_dequeue(&pra_list->skb_head);
skb_src = skb_dequeue(&pra_list->skb_head);
else
skb_src = NULL;
if (skb_src) pra_list->total_pkts_size -= skb_src->len;
pra_list->total_pkts_size -= skb_src->len; pra_list->total_pkts--;
atomic_dec(&priv->wmm.tx_pkts_queued); atomic_dec(&priv->wmm.tx_pkts_queued);
...@@ -212,11 +211,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -212,11 +211,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
return -1; return -1;
} }
if (!skb_queue_empty(&pra_list->skb_head)) if (skb_tailroom(skb_aggr) < pad) {
skb_src = skb_peek(&pra_list->skb_head); pad = 0;
else break;
skb_src = NULL; }
} skb_put(skb_aggr, pad);
skb_src = skb_peek(&pra_list->skb_head);
} while (skb_src);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);
...@@ -230,11 +233,19 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -230,11 +233,19 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
skb_push(skb_aggr, headroom); skb_push(skb_aggr, headroom);
tx_param.next_pkt_len = ((pra_list->total_pkts_size) ? /*
(((pra_list->total_pkts_size) > * Padding per MSDU will affect the length of next
adapter->tx_buf_size) ? adapter-> * packet and hence the exact length of next packet
tx_buf_size : pra_list->total_pkts_size + * is uncertain here.
LLC_SNAP_LEN + sizeof(struct txpd)) : 0); *
* Also, aggregation of transmission buffer, while
* downloading the data to the card, wont gain much
* on the AMSDU packets as the AMSDU packets utilizes
* the transmission buffer space to the maximum
* (adapter->tx_buf_size).
*/
tx_param.next_pkt_len = 0;
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA,
skb_aggr->data, skb_aggr->data,
skb_aggr->len, &tx_param); skb_aggr->len, &tx_param);
...@@ -258,6 +269,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -258,6 +269,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
skb_queue_tail(&pra_list->skb_head, skb_aggr); skb_queue_tail(&pra_list->skb_head, skb_aggr);
pra_list->total_pkts_size += skb_aggr->len; pra_list->total_pkts_size += skb_aggr->len;
pra_list->total_pkts++;
atomic_inc(&priv->wmm.tx_pkts_queued); atomic_inc(&priv->wmm.tx_pkts_queued);
......
...@@ -35,8 +35,6 @@ static struct mwifiex_bss_attr mwifiex_bss_sta[] = { ...@@ -35,8 +35,6 @@ static struct mwifiex_bss_attr mwifiex_bss_sta[] = {
static int drv_mode = DRV_MODE_STA; static int drv_mode = DRV_MODE_STA;
static char fw_name[32] = DEFAULT_FW_NAME;
/* Supported drv_mode table */ /* Supported drv_mode table */
static struct mwifiex_drv_mode mwifiex_drv_mode_tbl[] = { static struct mwifiex_drv_mode mwifiex_drv_mode_tbl[] = {
{ {
...@@ -384,20 +382,8 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) ...@@ -384,20 +382,8 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter)
memset(&fw, 0, sizeof(struct mwifiex_fw_image)); memset(&fw, 0, sizeof(struct mwifiex_fw_image));
switch (adapter->revision_id) { err = request_firmware(&adapter->firmware, adapter->fw_name,
case SD8787_W0: adapter->dev);
case SD8787_W1:
strcpy(fw_name, SD8787_W1_FW_NAME);
break;
case SD8787_A0:
case SD8787_A1:
strcpy(fw_name, SD8787_AX_FW_NAME);
break;
default:
break;
}
err = request_firmware(&adapter->firmware, fw_name, adapter->dev);
if (err < 0) { if (err < 0) {
dev_err(adapter->dev, "request_firmware() returned" dev_err(adapter->dev, "request_firmware() returned"
" error code %#x\n", err); " error code %#x\n", err);
......
...@@ -48,15 +48,6 @@ enum { ...@@ -48,15 +48,6 @@ enum {
#define DRV_MODE_STA 0x1 #define DRV_MODE_STA 0x1
#define SD8787_W0 0x30
#define SD8787_W1 0x31
#define SD8787_A0 0x40
#define SD8787_A1 0x41
#define DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin"
#define SD8787_W1_FW_NAME "mrvl/sd8787_uapsta_w1.bin"
#define SD8787_AX_FW_NAME "mrvl/sd8787_uapsta.bin"
struct mwifiex_drv_mode { struct mwifiex_drv_mode {
u16 drv_mode; u16 drv_mode;
u16 intf_num; u16 intf_num;
...@@ -190,6 +181,7 @@ struct mwifiex_ra_list_tbl { ...@@ -190,6 +181,7 @@ struct mwifiex_ra_list_tbl {
struct sk_buff_head skb_head; struct sk_buff_head skb_head;
u8 ra[ETH_ALEN]; u8 ra[ETH_ALEN];
u32 total_pkts_size; u32 total_pkts_size;
u32 total_pkts;
u32 is_11n_enabled; u32 is_11n_enabled;
}; };
...@@ -576,10 +568,10 @@ struct mwifiex_adapter { ...@@ -576,10 +568,10 @@ struct mwifiex_adapter {
u8 priv_num; u8 priv_num;
struct mwifiex_drv_mode *drv_mode; struct mwifiex_drv_mode *drv_mode;
const struct firmware *firmware; const struct firmware *firmware;
char fw_name[32];
struct device *dev; struct device *dev;
bool surprise_removed; bool surprise_removed;
u32 fw_release_number; u32 fw_release_number;
u32 revision_id;
u16 init_wait_q_woken; u16 init_wait_q_woken;
wait_queue_head_t init_wait_q; wait_queue_head_t init_wait_q;
void *card; void *card;
......
此差异已折叠。
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "main.h" #include "main.h"
#define SD8787_DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin"
#define BLOCK_MODE 1 #define BLOCK_MODE 1
#define BYTE_MODE 0 #define BYTE_MODE 0
......
此差异已折叠。
此差异已折叠。
...@@ -152,7 +152,6 @@ void rt2800_write_tx_data(struct queue_entry *entry, ...@@ -152,7 +152,6 @@ void rt2800_write_tx_data(struct queue_entry *entry,
struct txentry_desc *txdesc); struct txentry_desc *txdesc);
void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc); void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
void rt2800_txdone(struct rt2x00_dev *rt2x00dev);
void rt2800_txdone_entry(struct queue_entry *entry, u32 status); void rt2800_txdone_entry(struct queue_entry *entry, u32 status);
void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册