mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 08:56:57 +07:00
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
This commit is contained in:
commit
d46d4d64a8
31
Documentation/ABI/testing/sysfs-bus-bcma
Normal file
31
Documentation/ABI/testing/sysfs-bus-bcma
Normal file
@ -0,0 +1,31 @@
|
||||
What: /sys/bus/bcma/devices/.../manuf
|
||||
Date: May 2011
|
||||
KernelVersion: 2.6.40
|
||||
Contact: Rafał Miłecki <zajec5@gmail.com>
|
||||
Description:
|
||||
Each BCMA core has it's manufacturer id. See
|
||||
include/linux/bcma/bcma.h for possible values.
|
||||
|
||||
What: /sys/bus/bcma/devices/.../id
|
||||
Date: May 2011
|
||||
KernelVersion: 2.6.40
|
||||
Contact: Rafał Miłecki <zajec5@gmail.com>
|
||||
Description:
|
||||
There are a few types of BCMA cores, they can be identified by
|
||||
id field.
|
||||
|
||||
What: /sys/bus/bcma/devices/.../rev
|
||||
Date: May 2011
|
||||
KernelVersion: 2.6.40
|
||||
Contact: Rafał Miłecki <zajec5@gmail.com>
|
||||
Description:
|
||||
BCMA cores of the same type can still slightly differ depending
|
||||
on their revision. Use it for detailed programming.
|
||||
|
||||
What: /sys/bus/bcma/devices/.../class
|
||||
Date: May 2011
|
||||
KernelVersion: 2.6.40
|
||||
Contact: Rafał Miłecki <zajec5@gmail.com>
|
||||
Description:
|
||||
Each BCMA core is identified by few fields, including class it
|
||||
belongs to. See include/linux/bcma/bcma.h for possible values.
|
@ -5812,6 +5812,13 @@ S: Maintained
|
||||
F: drivers/ssb/
|
||||
F: include/linux/ssb/
|
||||
|
||||
BROADCOM SPECIFIC AMBA DRIVER (BCMA)
|
||||
M: Rafał Miłecki <zajec5@gmail.com>
|
||||
L: linux-wireless@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/bcma/
|
||||
F: include/linux/bcma/
|
||||
|
||||
SONY VAIO CONTROL DEVICE DRIVER
|
||||
M: Mattia Dongili <malattia@linux.it>
|
||||
L: platform-driver-x86@vger.kernel.org
|
||||
|
@ -68,6 +68,8 @@ source "drivers/watchdog/Kconfig"
|
||||
|
||||
source "drivers/ssb/Kconfig"
|
||||
|
||||
source "drivers/bcma/Kconfig"
|
||||
|
||||
source "drivers/mfd/Kconfig"
|
||||
|
||||
source "drivers/regulator/Kconfig"
|
||||
|
@ -110,6 +110,7 @@ obj-$(CONFIG_HID) += hid/
|
||||
obj-$(CONFIG_PPC_PS3) += ps3/
|
||||
obj-$(CONFIG_OF) += of/
|
||||
obj-$(CONFIG_SSB) += ssb/
|
||||
obj-$(CONFIG_BCMA) += bcma/
|
||||
obj-$(CONFIG_VHOST_NET) += vhost/
|
||||
obj-$(CONFIG_VLYNQ) += vlynq/
|
||||
obj-$(CONFIG_STAGING) += staging/
|
||||
|
33
drivers/bcma/Kconfig
Normal file
33
drivers/bcma/Kconfig
Normal file
@ -0,0 +1,33 @@
|
||||
config BCMA_POSSIBLE
|
||||
bool
|
||||
depends on HAS_IOMEM && HAS_DMA
|
||||
default y
|
||||
|
||||
menu "Broadcom specific AMBA"
|
||||
depends on BCMA_POSSIBLE
|
||||
|
||||
config BCMA
|
||||
tristate "BCMA support"
|
||||
depends on BCMA_POSSIBLE
|
||||
help
|
||||
Bus driver for Broadcom specific Advanced Microcontroller Bus
|
||||
Architecture.
|
||||
|
||||
config BCMA_HOST_PCI_POSSIBLE
|
||||
bool
|
||||
depends on BCMA && PCI = y
|
||||
default y
|
||||
|
||||
config BCMA_HOST_PCI
|
||||
bool "Support for BCMA on PCI-host bus"
|
||||
depends on BCMA_HOST_PCI_POSSIBLE
|
||||
|
||||
config BCMA_DEBUG
|
||||
bool "BCMA debugging"
|
||||
depends on BCMA
|
||||
help
|
||||
This turns on additional debugging messages.
|
||||
|
||||
If unsure, say N
|
||||
|
||||
endmenu
|
7
drivers/bcma/Makefile
Normal file
7
drivers/bcma/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
bcma-y += main.o scan.o core.o
|
||||
bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
|
||||
bcma-y += driver_pci.o
|
||||
bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
|
||||
obj-$(CONFIG_BCMA) += bcma.o
|
||||
|
||||
ccflags-$(CONFIG_BCMA_DEBUG) := -DDEBUG
|
19
drivers/bcma/README
Normal file
19
drivers/bcma/README
Normal file
@ -0,0 +1,19 @@
|
||||
Broadcom introduced new bus as replacement for older SSB. It is based on AMBA,
|
||||
however from programming point of view there is nothing AMBA specific we use.
|
||||
|
||||
Standard AMBA drivers are platform specific, have hardcoded addresses and use
|
||||
AMBA standard fields like CID and PID.
|
||||
|
||||
In case of Broadcom's cards every device consists of:
|
||||
1) Broadcom specific AMBA device. It is put on AMBA bus, but can not be treated
|
||||
as standard AMBA device. Reading it's CID or PID can cause machine lockup.
|
||||
2) AMBA standard devices called ports or wrappers. They have CIDs (AMBA_CID)
|
||||
and PIDs (0x103BB369), but we do not use that info for anything. One of that
|
||||
devices is used for managing Broadcom specific core.
|
||||
|
||||
Addresses of AMBA devices are not hardcoded in driver and have to be read from
|
||||
EPROM.
|
||||
|
||||
In this situation we decided to introduce separated bus. It can contain up to
|
||||
16 devices identified by Broadcom specific fields: manufacturer, id, revision
|
||||
and class.
|
3
drivers/bcma/TODO
Normal file
3
drivers/bcma/TODO
Normal file
@ -0,0 +1,3 @@
|
||||
- Interrupts
|
||||
- Defines for PCI core driver
|
||||
- Create kernel Documentation (use info from README)
|
28
drivers/bcma/bcma_private.h
Normal file
28
drivers/bcma/bcma_private.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef LINUX_BCMA_PRIVATE_H_
|
||||
#define LINUX_BCMA_PRIVATE_H_
|
||||
|
||||
#ifndef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
#endif
|
||||
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#define BCMA_CORE_SIZE 0x1000
|
||||
|
||||
struct bcma_bus;
|
||||
|
||||
/* main.c */
|
||||
extern int bcma_bus_register(struct bcma_bus *bus);
|
||||
extern void bcma_bus_unregister(struct bcma_bus *bus);
|
||||
|
||||
/* scan.c */
|
||||
int bcma_bus_scan(struct bcma_bus *bus);
|
||||
|
||||
#ifdef CONFIG_BCMA_HOST_PCI
|
||||
/* host_pci.c */
|
||||
extern int __init bcma_host_pci_init(void);
|
||||
extern void __exit bcma_host_pci_exit(void);
|
||||
#endif /* CONFIG_BCMA_HOST_PCI */
|
||||
|
||||
#endif
|
51
drivers/bcma/core.c
Normal file
51
drivers/bcma/core.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* Core ops
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
bool bcma_core_is_enabled(struct bcma_device *core)
|
||||
{
|
||||
if ((bcma_aread32(core, BCMA_IOCTL) & (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC))
|
||||
!= BCMA_IOCTL_CLK)
|
||||
return false;
|
||||
if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_core_is_enabled);
|
||||
|
||||
static void bcma_core_disable(struct bcma_device *core, u32 flags)
|
||||
{
|
||||
if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
|
||||
return;
|
||||
|
||||
bcma_awrite32(core, BCMA_IOCTL, flags);
|
||||
bcma_aread32(core, BCMA_IOCTL);
|
||||
udelay(10);
|
||||
|
||||
bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
int bcma_core_enable(struct bcma_device *core, u32 flags)
|
||||
{
|
||||
bcma_core_disable(core, flags);
|
||||
|
||||
bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
|
||||
bcma_aread32(core, BCMA_IOCTL);
|
||||
|
||||
bcma_awrite32(core, BCMA_RESET_CTL, 0);
|
||||
udelay(1);
|
||||
|
||||
bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
|
||||
bcma_aread32(core, BCMA_IOCTL);
|
||||
udelay(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_core_enable);
|
89
drivers/bcma/driver_chipcommon.c
Normal file
89
drivers/bcma/driver_chipcommon.c
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* ChipCommon core driver
|
||||
*
|
||||
* Copyright 2005, Broadcom Corporation
|
||||
* Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
|
||||
u32 mask, u32 value)
|
||||
{
|
||||
value &= mask;
|
||||
value |= bcma_cc_read32(cc, offset) & ~mask;
|
||||
bcma_cc_write32(cc, offset, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
|
||||
{
|
||||
if (cc->core->id.rev >= 11)
|
||||
cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
|
||||
cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP);
|
||||
if (cc->core->id.rev >= 35)
|
||||
cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
|
||||
|
||||
if (cc->core->id.rev >= 20) {
|
||||
bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
|
||||
bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
|
||||
}
|
||||
|
||||
if (cc->capabilities & BCMA_CC_CAP_PMU)
|
||||
bcma_pmu_init(cc);
|
||||
if (cc->capabilities & BCMA_CC_CAP_PCTL)
|
||||
pr_err("Power control not implemented!\n");
|
||||
}
|
||||
|
||||
/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
|
||||
void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
|
||||
{
|
||||
/* instant NMI */
|
||||
bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks);
|
||||
}
|
||||
|
||||
void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
bcma_cc_write32_masked(cc, BCMA_CC_IRQMASK, mask, value);
|
||||
}
|
||||
|
||||
u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask)
|
||||
{
|
||||
return bcma_cc_read32(cc, BCMA_CC_IRQSTAT) & mask;
|
||||
}
|
||||
|
||||
u32 bcma_chipco_gpio_in(struct bcma_drv_cc *cc, u32 mask)
|
||||
{
|
||||
return bcma_cc_read32(cc, BCMA_CC_GPIOIN) & mask;
|
||||
}
|
||||
|
||||
u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
return bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUT, mask, value);
|
||||
}
|
||||
|
||||
u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
return bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUTEN, mask, value);
|
||||
}
|
||||
|
||||
u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
return bcma_cc_write32_masked(cc, BCMA_CC_GPIOCTL, mask, value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_chipco_gpio_control);
|
||||
|
||||
u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
return bcma_cc_write32_masked(cc, BCMA_CC_GPIOIRQ, mask, value);
|
||||
}
|
||||
|
||||
u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value)
|
||||
{
|
||||
return bcma_cc_write32_masked(cc, BCMA_CC_GPIOPOL, mask, value);
|
||||
}
|
134
drivers/bcma/driver_chipcommon_pmu.c
Normal file
134
drivers/bcma/driver_chipcommon_pmu.c
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* ChipCommon Power Management Unit driver
|
||||
*
|
||||
* Copyright 2009, Michael Buesch <mb@bu3sch.de>
|
||||
* Copyright 2007, Broadcom Corporation
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
static void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
|
||||
u32 offset, u32 mask, u32 set)
|
||||
{
|
||||
u32 value;
|
||||
|
||||
bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR);
|
||||
bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset);
|
||||
bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR);
|
||||
value = bcma_cc_read32(cc, BCMA_CC_CHIPCTL_DATA);
|
||||
value &= mask;
|
||||
value |= set;
|
||||
bcma_cc_write32(cc, BCMA_CC_CHIPCTL_DATA, value);
|
||||
bcma_cc_read32(cc, BCMA_CC_CHIPCTL_DATA);
|
||||
}
|
||||
|
||||
static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
|
||||
{
|
||||
struct bcma_bus *bus = cc->core->bus;
|
||||
|
||||
switch (bus->chipinfo.id) {
|
||||
case 0x4313:
|
||||
case 0x4331:
|
||||
case 43224:
|
||||
case 43225:
|
||||
break;
|
||||
default:
|
||||
pr_err("PLL init unknown for device 0x%04X\n",
|
||||
bus->chipinfo.id);
|
||||
}
|
||||
}
|
||||
|
||||
static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
|
||||
{
|
||||
struct bcma_bus *bus = cc->core->bus;
|
||||
u32 min_msk = 0, max_msk = 0;
|
||||
|
||||
switch (bus->chipinfo.id) {
|
||||
case 0x4313:
|
||||
min_msk = 0x200D;
|
||||
max_msk = 0xFFFF;
|
||||
break;
|
||||
case 43224:
|
||||
break;
|
||||
default:
|
||||
pr_err("PMU resource config unknown for device 0x%04X\n",
|
||||
bus->chipinfo.id);
|
||||
}
|
||||
|
||||
/* Set the resource masks. */
|
||||
if (min_msk)
|
||||
bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
|
||||
if (max_msk)
|
||||
bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
|
||||
}
|
||||
|
||||
void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)
|
||||
{
|
||||
struct bcma_bus *bus = cc->core->bus;
|
||||
|
||||
switch (bus->chipinfo.id) {
|
||||
case 0x4313:
|
||||
case 0x4331:
|
||||
case 43224:
|
||||
break;
|
||||
default:
|
||||
pr_err("PMU switch/regulators init unknown for device "
|
||||
"0x%04X\n", bus->chipinfo.id);
|
||||
}
|
||||
}
|
||||
|
||||
void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
|
||||
{
|
||||
struct bcma_bus *bus = cc->core->bus;
|
||||
|
||||
switch (bus->chipinfo.id) {
|
||||
case 0x4313:
|
||||
bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
|
||||
break;
|
||||
case 0x4331:
|
||||
pr_err("Enabling Ext PA lines not implemented\n");
|
||||
break;
|
||||
case 43224:
|
||||
if (bus->chipinfo.rev == 0) {
|
||||
pr_err("Workarounds for 43224 rev 0 not fully "
|
||||
"implemented\n");
|
||||
bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0);
|
||||
} else {
|
||||
bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr_err("Workarounds unknown for device 0x%04X\n",
|
||||
bus->chipinfo.id);
|
||||
}
|
||||
}
|
||||
|
||||
void bcma_pmu_init(struct bcma_drv_cc *cc)
|
||||
{
|
||||
u32 pmucap;
|
||||
|
||||
pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP);
|
||||
cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION);
|
||||
|
||||
pr_debug("Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev,
|
||||
pmucap);
|
||||
|
||||
if (cc->pmu.rev == 1)
|
||||
bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
|
||||
~BCMA_CC_PMU_CTL_NOILPONW);
|
||||
else
|
||||
bcma_cc_set32(cc, BCMA_CC_PMU_CTL,
|
||||
BCMA_CC_PMU_CTL_NOILPONW);
|
||||
|
||||
if (cc->core->id.id == 0x4329 && cc->core->id.rev == 2)
|
||||
pr_err("Fix for 4329b0 bad LPOM state not implemented!\n");
|
||||
|
||||
bcma_pmu_pll_init(cc);
|
||||
bcma_pmu_resources_init(cc);
|
||||
bcma_pmu_swreg_init(cc);
|
||||
bcma_pmu_workarounds(cc);
|
||||
}
|
163
drivers/bcma/driver_pci.c
Normal file
163
drivers/bcma/driver_pci.c
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* PCI Core
|
||||
*
|
||||
* Copyright 2005, Broadcom Corporation
|
||||
* Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
/**************************************************
|
||||
* R/W ops.
|
||||
**************************************************/
|
||||
|
||||
static u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address)
|
||||
{
|
||||
pcicore_write32(pc, 0x130, address);
|
||||
pcicore_read32(pc, 0x130);
|
||||
return pcicore_read32(pc, 0x134);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data)
|
||||
{
|
||||
pcicore_write32(pc, 0x130, address);
|
||||
pcicore_read32(pc, 0x130);
|
||||
pcicore_write32(pc, 0x134, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy)
|
||||
{
|
||||
const u16 mdio_control = 0x128;
|
||||
const u16 mdio_data = 0x12C;
|
||||
u32 v;
|
||||
int i;
|
||||
|
||||
v = (1 << 30); /* Start of Transaction */
|
||||
v |= (1 << 28); /* Write Transaction */
|
||||
v |= (1 << 17); /* Turnaround */
|
||||
v |= (0x1F << 18);
|
||||
v |= (phy << 4);
|
||||
pcicore_write32(pc, mdio_data, v);
|
||||
|
||||
udelay(10);
|
||||
for (i = 0; i < 200; i++) {
|
||||
v = pcicore_read32(pc, mdio_control);
|
||||
if (v & 0x100 /* Trans complete */)
|
||||
break;
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u8 device, u8 address)
|
||||
{
|
||||
const u16 mdio_control = 0x128;
|
||||
const u16 mdio_data = 0x12C;
|
||||
int max_retries = 10;
|
||||
u16 ret = 0;
|
||||
u32 v;
|
||||
int i;
|
||||
|
||||
v = 0x80; /* Enable Preamble Sequence */
|
||||
v |= 0x2; /* MDIO Clock Divisor */
|
||||
pcicore_write32(pc, mdio_control, v);
|
||||
|
||||
if (pc->core->id.rev >= 10) {
|
||||
max_retries = 200;
|
||||
bcma_pcie_mdio_set_phy(pc, device);
|
||||
}
|
||||
|
||||
v = (1 << 30); /* Start of Transaction */
|
||||
v |= (1 << 29); /* Read Transaction */
|
||||
v |= (1 << 17); /* Turnaround */
|
||||
if (pc->core->id.rev < 10)
|
||||
v |= (u32)device << 22;
|
||||
v |= (u32)address << 18;
|
||||
pcicore_write32(pc, mdio_data, v);
|
||||
/* Wait for the device to complete the transaction */
|
||||
udelay(10);
|
||||
for (i = 0; i < max_retries; i++) {
|
||||
v = pcicore_read32(pc, mdio_control);
|
||||
if (v & 0x100 /* Trans complete */) {
|
||||
udelay(10);
|
||||
ret = pcicore_read32(pc, mdio_data);
|
||||
break;
|
||||
}
|
||||
msleep(1);
|
||||
}
|
||||
pcicore_write32(pc, mdio_control, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u8 device,
|
||||
u8 address, u16 data)
|
||||
{
|
||||
const u16 mdio_control = 0x128;
|
||||
const u16 mdio_data = 0x12C;
|
||||
int max_retries = 10;
|
||||
u32 v;
|
||||
int i;
|
||||
|
||||
v = 0x80; /* Enable Preamble Sequence */
|
||||
v |= 0x2; /* MDIO Clock Divisor */
|
||||
pcicore_write32(pc, mdio_control, v);
|
||||
|
||||
if (pc->core->id.rev >= 10) {
|
||||
max_retries = 200;
|
||||
bcma_pcie_mdio_set_phy(pc, device);
|
||||
}
|
||||
|
||||
v = (1 << 30); /* Start of Transaction */
|
||||
v |= (1 << 28); /* Write Transaction */
|
||||
v |= (1 << 17); /* Turnaround */
|
||||
if (pc->core->id.rev < 10)
|
||||
v |= (u32)device << 22;
|
||||
v |= (u32)address << 18;
|
||||
v |= data;
|
||||
pcicore_write32(pc, mdio_data, v);
|
||||
/* Wait for the device to complete the transaction */
|
||||
udelay(10);
|
||||
for (i = 0; i < max_retries; i++) {
|
||||
v = pcicore_read32(pc, mdio_control);
|
||||
if (v & 0x100 /* Trans complete */)
|
||||
break;
|
||||
msleep(1);
|
||||
}
|
||||
pcicore_write32(pc, mdio_control, 0);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Workarounds.
|
||||
**************************************************/
|
||||
|
||||
static u8 bcma_pcicore_polarity_workaround(struct bcma_drv_pci *pc)
|
||||
{
|
||||
return (bcma_pcie_read(pc, 0x204) & 0x10) ? 0xC0 : 0x80;
|
||||
}
|
||||
|
||||
static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)
|
||||
{
|
||||
const u8 serdes_pll_device = 0x1D;
|
||||
const u8 serdes_rx_device = 0x1F;
|
||||
u16 tmp;
|
||||
|
||||
bcma_pcie_mdio_write(pc, serdes_rx_device, 1 /* Control */,
|
||||
bcma_pcicore_polarity_workaround(pc));
|
||||
tmp = bcma_pcie_mdio_read(pc, serdes_pll_device, 1 /* Control */);
|
||||
if (tmp & 0x4000)
|
||||
bcma_pcie_mdio_write(pc, serdes_pll_device, 1, tmp & ~0x4000);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Init.
|
||||
**************************************************/
|
||||
|
||||
void bcma_core_pci_init(struct bcma_drv_pci *pc)
|
||||
{
|
||||
bcma_pcicore_serdes_workaround(pc);
|
||||
}
|
196
drivers/bcma/host_pci.c
Normal file
196
drivers/bcma/host_pci.c
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* PCI Host
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
static void bcma_host_pci_switch_core(struct bcma_device *core)
|
||||
{
|
||||
pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN,
|
||||
core->addr);
|
||||
pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2,
|
||||
core->wrap);
|
||||
core->bus->mapped_core = core;
|
||||
pr_debug("Switched to core: 0x%X\n", core->id.id);
|
||||
}
|
||||
|
||||
static u8 bcma_host_pci_read8(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
return ioread8(core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static u16 bcma_host_pci_read16(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
return ioread16(core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static u32 bcma_host_pci_read32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
return ioread32(core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void bcma_host_pci_write8(struct bcma_device *core, u16 offset,
|
||||
u8 value)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
iowrite8(value, core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void bcma_host_pci_write16(struct bcma_device *core, u16 offset,
|
||||
u16 value)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
iowrite16(value, core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void bcma_host_pci_write32(struct bcma_device *core, u16 offset,
|
||||
u32 value)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
iowrite32(value, core->bus->mmio + offset);
|
||||
}
|
||||
|
||||
static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
return ioread32(core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset);
|
||||
}
|
||||
|
||||
static void bcma_host_pci_awrite32(struct bcma_device *core, u16 offset,
|
||||
u32 value)
|
||||
{
|
||||
if (core->bus->mapped_core != core)
|
||||
bcma_host_pci_switch_core(core);
|
||||
iowrite32(value, core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset);
|
||||
}
|
||||
|
||||
const struct bcma_host_ops bcma_host_pci_ops = {
|
||||
.read8 = bcma_host_pci_read8,
|
||||
.read16 = bcma_host_pci_read16,
|
||||
.read32 = bcma_host_pci_read32,
|
||||
.write8 = bcma_host_pci_write8,
|
||||
.write16 = bcma_host_pci_write16,
|
||||
.write32 = bcma_host_pci_write32,
|
||||
.aread32 = bcma_host_pci_aread32,
|
||||
.awrite32 = bcma_host_pci_awrite32,
|
||||
};
|
||||
|
||||
static int bcma_host_pci_probe(struct pci_dev *dev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
struct bcma_bus *bus;
|
||||
int err = -ENOMEM;
|
||||
const char *name;
|
||||
u32 val;
|
||||
|
||||
/* Alloc */
|
||||
bus = kzalloc(sizeof(*bus), GFP_KERNEL);
|
||||
if (!bus)
|
||||
goto out;
|
||||
|
||||
/* Basic PCI configuration */
|
||||
err = pci_enable_device(dev);
|
||||
if (err)
|
||||
goto err_kfree_bus;
|
||||
|
||||
name = dev_name(&dev->dev);
|
||||
if (dev->driver && dev->driver->name)
|
||||
name = dev->driver->name;
|
||||
err = pci_request_regions(dev, name);
|
||||
if (err)
|
||||
goto err_pci_disable;
|
||||
pci_set_master(dev);
|
||||
|
||||
/* Disable the RETRY_TIMEOUT register (0x41) to keep
|
||||
* PCI Tx retries from interfering with C3 CPU state */
|
||||
pci_read_config_dword(dev, 0x40, &val);
|
||||
if ((val & 0x0000ff00) != 0)
|
||||
pci_write_config_dword(dev, 0x40, val & 0xffff00ff);
|
||||
|
||||
/* SSB needed additional powering up, do we have any AMBA PCI cards? */
|
||||
if (!pci_is_pcie(dev))
|
||||
pr_err("PCI card detected, report problems.\n");
|
||||
|
||||
/* Map MMIO */
|
||||
err = -ENOMEM;
|
||||
bus->mmio = pci_iomap(dev, 0, ~0UL);
|
||||
if (!bus->mmio)
|
||||
goto err_pci_release_regions;
|
||||
|
||||
/* Host specific */
|
||||
bus->host_pci = dev;
|
||||
bus->hosttype = BCMA_HOSTTYPE_PCI;
|
||||
bus->ops = &bcma_host_pci_ops;
|
||||
|
||||
/* Register */
|
||||
err = bcma_bus_register(bus);
|
||||
if (err)
|
||||
goto err_pci_unmap_mmio;
|
||||
|
||||
pci_set_drvdata(dev, bus);
|
||||
|
||||
out:
|
||||
return err;
|
||||
|
||||
err_pci_unmap_mmio:
|
||||
pci_iounmap(dev, bus->mmio);
|
||||
err_pci_release_regions:
|
||||
pci_release_regions(dev);
|
||||
err_pci_disable:
|
||||
pci_disable_device(dev);
|
||||
err_kfree_bus:
|
||||
kfree(bus);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void bcma_host_pci_remove(struct pci_dev *dev)
|
||||
{
|
||||
struct bcma_bus *bus = pci_get_drvdata(dev);
|
||||
|
||||
bcma_bus_unregister(bus);
|
||||
pci_iounmap(dev, bus->mmio);
|
||||
pci_release_regions(dev);
|
||||
pci_disable_device(dev);
|
||||
kfree(bus);
|
||||
pci_set_drvdata(dev, NULL);
|
||||
}
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
|
||||
{ 0, },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl);
|
||||
|
||||
static struct pci_driver bcma_pci_bridge_driver = {
|
||||
.name = "bcma-pci-bridge",
|
||||
.id_table = bcma_pci_bridge_tbl,
|
||||
.probe = bcma_host_pci_probe,
|
||||
.remove = bcma_host_pci_remove,
|
||||
};
|
||||
|
||||
int __init bcma_host_pci_init(void)
|
||||
{
|
||||
return pci_register_driver(&bcma_pci_bridge_driver);
|
||||
}
|
||||
|
||||
void __exit bcma_host_pci_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&bcma_pci_bridge_driver);
|
||||
}
|
247
drivers/bcma/main.c
Normal file
247
drivers/bcma/main.c
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* Bus subsystem
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
|
||||
MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int bcma_bus_match(struct device *dev, struct device_driver *drv);
|
||||
static int bcma_device_probe(struct device *dev);
|
||||
static int bcma_device_remove(struct device *dev);
|
||||
|
||||
static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%03X\n", core->id.manuf);
|
||||
}
|
||||
static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%03X\n", core->id.id);
|
||||
}
|
||||
static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%02X\n", core->id.rev);
|
||||
}
|
||||
static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
return sprintf(buf, "0x%X\n", core->id.class);
|
||||
}
|
||||
static struct device_attribute bcma_device_attrs[] = {
|
||||
__ATTR_RO(manuf),
|
||||
__ATTR_RO(id),
|
||||
__ATTR_RO(rev),
|
||||
__ATTR_RO(class),
|
||||
__ATTR_NULL,
|
||||
};
|
||||
|
||||
static struct bus_type bcma_bus_type = {
|
||||
.name = "bcma",
|
||||
.match = bcma_bus_match,
|
||||
.probe = bcma_device_probe,
|
||||
.remove = bcma_device_remove,
|
||||
.dev_attrs = bcma_device_attrs,
|
||||
};
|
||||
|
||||
static struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid)
|
||||
{
|
||||
struct bcma_device *core;
|
||||
|
||||
list_for_each_entry(core, &bus->cores, list) {
|
||||
if (core->id.id == coreid)
|
||||
return core;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void bcma_release_core_dev(struct device *dev)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
kfree(core);
|
||||
}
|
||||
|
||||
static int bcma_register_cores(struct bcma_bus *bus)
|
||||
{
|
||||
struct bcma_device *core;
|
||||
int err, dev_id = 0;
|
||||
|
||||
list_for_each_entry(core, &bus->cores, list) {
|
||||
/* We support that cores ourself */
|
||||
switch (core->id.id) {
|
||||
case BCMA_CORE_CHIPCOMMON:
|
||||
case BCMA_CORE_PCI:
|
||||
case BCMA_CORE_PCIE:
|
||||
continue;
|
||||
}
|
||||
|
||||
core->dev.release = bcma_release_core_dev;
|
||||
core->dev.bus = &bcma_bus_type;
|
||||
dev_set_name(&core->dev, "bcma%d:%d", 0/*bus->num*/, dev_id);
|
||||
|
||||
switch (bus->hosttype) {
|
||||
case BCMA_HOSTTYPE_PCI:
|
||||
core->dev.parent = &bus->host_pci->dev;
|
||||
break;
|
||||
case BCMA_HOSTTYPE_NONE:
|
||||
case BCMA_HOSTTYPE_SDIO:
|
||||
break;
|
||||
}
|
||||
|
||||
err = device_register(&core->dev);
|
||||
if (err) {
|
||||
pr_err("Could not register dev for core 0x%03X\n",
|
||||
core->id.id);
|
||||
continue;
|
||||
}
|
||||
core->dev_registered = true;
|
||||
dev_id++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
{
|
||||
struct bcma_device *core;
|
||||
|
||||
list_for_each_entry(core, &bus->cores, list) {
|
||||
if (core->dev_registered)
|
||||
device_unregister(&core->dev);
|
||||
}
|
||||
}
|
||||
|
||||
int bcma_bus_register(struct bcma_bus *bus)
|
||||
{
|
||||
int err;
|
||||
struct bcma_device *core;
|
||||
|
||||
/* Scan for devices (cores) */
|
||||
err = bcma_bus_scan(bus);
|
||||
if (err) {
|
||||
pr_err("Failed to scan: %d\n", err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Init CC core */
|
||||
core = bcma_find_core(bus, BCMA_CORE_CHIPCOMMON);
|
||||
if (core) {
|
||||
bus->drv_cc.core = core;
|
||||
bcma_core_chipcommon_init(&bus->drv_cc);
|
||||
}
|
||||
|
||||
/* Init PCIE core */
|
||||
core = bcma_find_core(bus, BCMA_CORE_PCIE);
|
||||
if (core) {
|
||||
bus->drv_pci.core = core;
|
||||
bcma_core_pci_init(&bus->drv_pci);
|
||||
}
|
||||
|
||||
/* Register found cores */
|
||||
bcma_register_cores(bus);
|
||||
|
||||
pr_info("Bus registered\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_bus_register);
|
||||
|
||||
void bcma_bus_unregister(struct bcma_bus *bus)
|
||||
{
|
||||
bcma_unregister_cores(bus);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_bus_unregister);
|
||||
|
||||
int __bcma_driver_register(struct bcma_driver *drv, struct module *owner)
|
||||
{
|
||||
drv->drv.name = drv->name;
|
||||
drv->drv.bus = &bcma_bus_type;
|
||||
drv->drv.owner = owner;
|
||||
|
||||
return driver_register(&drv->drv);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__bcma_driver_register);
|
||||
|
||||
void bcma_driver_unregister(struct bcma_driver *drv)
|
||||
{
|
||||
driver_unregister(&drv->drv);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_driver_unregister);
|
||||
|
||||
static int bcma_bus_match(struct device *dev, struct device_driver *drv)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
|
||||
const struct bcma_device_id *cid = &core->id;
|
||||
const struct bcma_device_id *did;
|
||||
|
||||
for (did = adrv->id_table; did->manuf || did->id || did->rev; did++) {
|
||||
if ((did->manuf == cid->manuf || did->manuf == BCMA_ANY_MANUF) &&
|
||||
(did->id == cid->id || did->id == BCMA_ANY_ID) &&
|
||||
(did->rev == cid->rev || did->rev == BCMA_ANY_REV) &&
|
||||
(did->class == cid->class || did->class == BCMA_ANY_CLASS))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcma_device_probe(struct device *dev)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
|
||||
drv);
|
||||
int err = 0;
|
||||
|
||||
if (adrv->probe)
|
||||
err = adrv->probe(core);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int bcma_device_remove(struct device *dev)
|
||||
{
|
||||
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
|
||||
struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
|
||||
drv);
|
||||
|
||||
if (adrv->remove)
|
||||
adrv->remove(core);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init bcma_modinit(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bus_register(&bcma_bus_type);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
#ifdef CONFIG_BCMA_HOST_PCI
|
||||
err = bcma_host_pci_init();
|
||||
if (err) {
|
||||
pr_err("PCI host initialization failed\n");
|
||||
err = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
fs_initcall(bcma_modinit);
|
||||
|
||||
static void __exit bcma_modexit(void)
|
||||
{
|
||||
#ifdef CONFIG_BCMA_HOST_PCI
|
||||
bcma_host_pci_exit();
|
||||
#endif
|
||||
bus_unregister(&bcma_bus_type);
|
||||
}
|
||||
module_exit(bcma_modexit)
|
360
drivers/bcma/scan.c
Normal file
360
drivers/bcma/scan.c
Normal file
@ -0,0 +1,360 @@
|
||||
/*
|
||||
* Broadcom specific AMBA
|
||||
* Bus scanning
|
||||
*
|
||||
* Licensed under the GNU/GPL. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "scan.h"
|
||||
#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>
|
||||
|
||||
struct bcma_device_id_name {
|
||||
u16 id;
|
||||
const char *name;
|
||||
};
|
||||
struct bcma_device_id_name bcma_device_names[] = {
|
||||
{ BCMA_CORE_OOB_ROUTER, "OOB Router" },
|
||||
{ BCMA_CORE_INVALID, "Invalid" },
|
||||
{ BCMA_CORE_CHIPCOMMON, "ChipCommon" },
|
||||
{ BCMA_CORE_ILINE20, "ILine 20" },
|
||||
{ BCMA_CORE_SRAM, "SRAM" },
|
||||
{ BCMA_CORE_SDRAM, "SDRAM" },
|
||||
{ BCMA_CORE_PCI, "PCI" },
|
||||
{ BCMA_CORE_MIPS, "MIPS" },
|
||||
{ BCMA_CORE_ETHERNET, "Fast Ethernet" },
|
||||
{ BCMA_CORE_V90, "V90" },
|
||||
{ BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
|
||||
{ BCMA_CORE_ADSL, "ADSL" },
|
||||
{ BCMA_CORE_ILINE100, "ILine 100" },
|
||||
{ BCMA_CORE_IPSEC, "IPSEC" },
|
||||
{ BCMA_CORE_UTOPIA, "UTOPIA" },
|
||||
{ BCMA_CORE_PCMCIA, "PCMCIA" },
|
||||
{ BCMA_CORE_INTERNAL_MEM, "Internal Memory" },
|
||||
{ BCMA_CORE_MEMC_SDRAM, "MEMC SDRAM" },
|
||||
{ BCMA_CORE_OFDM, "OFDM" },
|
||||
{ BCMA_CORE_EXTIF, "EXTIF" },
|
||||
{ BCMA_CORE_80211, "IEEE 802.11" },
|
||||
{ BCMA_CORE_PHY_A, "PHY A" },
|
||||
{ BCMA_CORE_PHY_B, "PHY B" },
|
||||
{ BCMA_CORE_PHY_G, "PHY G" },
|
||||
{ BCMA_CORE_MIPS_3302, "MIPS 3302" },
|
||||
{ BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
|
||||
{ BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
|
||||
{ BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
|
||||
{ BCMA_CORE_USB20_DEV, "USB 2.0 Device" },
|
||||
{ BCMA_CORE_SDIO_HOST, "SDIO Host" },
|
||||
{ BCMA_CORE_ROBOSWITCH, "Roboswitch" },
|
||||
{ BCMA_CORE_PARA_ATA, "PATA" },
|
||||
{ BCMA_CORE_SATA_XORDMA, "SATA XOR-DMA" },
|
||||
{ BCMA_CORE_ETHERNET_GBIT, "GBit Ethernet" },
|
||||
{ BCMA_CORE_PCIE, "PCIe" },
|
||||
{ BCMA_CORE_PHY_N, "PHY N" },
|
||||
{ BCMA_CORE_SRAM_CTL, "SRAM Controller" },
|
||||
{ BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
|
||||
{ BCMA_CORE_ARM_1176, "ARM 1176" },
|
||||
{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
|
||||
{ BCMA_CORE_PHY_LP, "PHY LP" },
|
||||
{ BCMA_CORE_PMU, "PMU" },
|
||||
{ BCMA_CORE_PHY_SSN, "PHY SSN" },
|
||||
{ BCMA_CORE_SDIO_DEV, "SDIO Device" },
|
||||
{ BCMA_CORE_ARM_CM3, "ARM CM3" },
|
||||
{ BCMA_CORE_PHY_HT, "PHY HT" },
|
||||
{ BCMA_CORE_MIPS_74K, "MIPS 74K" },
|
||||
{ BCMA_CORE_MAC_GBIT, "GBit MAC" },
|
||||
{ BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
|
||||
{ BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
|
||||
{ BCMA_CORE_OCP_OCP_BRIDGE, "OCP to OCP Bridge" },
|
||||
{ BCMA_CORE_SHARED_COMMON, "Common Shared" },
|
||||
{ BCMA_CORE_OCP_AHB_BRIDGE, "OCP to AHB Bridge" },
|
||||
{ BCMA_CORE_SPI_HOST, "SPI Host" },
|
||||
{ BCMA_CORE_I2S, "I2S" },
|
||||
{ BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" },
|
||||
{ BCMA_CORE_SHIM, "SHIM" },
|
||||
{ BCMA_CORE_DEFAULT, "Default" },
|
||||
};
|
||||
const char *bcma_device_name(struct bcma_device_id *id)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (id->manuf == BCMA_MANUF_BCM) {
|
||||
for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
|
||||
if (bcma_device_names[i].id == id->id)
|
||||
return bcma_device_names[i].name;
|
||||
}
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
static u32 bcma_scan_read32(struct bcma_bus *bus, u8 current_coreidx,
|
||||
u16 offset)
|
||||
{
|
||||
return readl(bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void bcma_scan_switch_core(struct bcma_bus *bus, u32 addr)
|
||||
{
|
||||
if (bus->hosttype == BCMA_HOSTTYPE_PCI)
|
||||
pci_write_config_dword(bus->host_pci, BCMA_PCI_BAR0_WIN,
|
||||
addr);
|
||||
}
|
||||
|
||||
static u32 bcma_erom_get_ent(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent = readl(*eromptr);
|
||||
(*eromptr)++;
|
||||
return ent;
|
||||
}
|
||||
|
||||
static void bcma_erom_push_ent(u32 **eromptr)
|
||||
{
|
||||
(*eromptr)--;
|
||||
}
|
||||
|
||||
static s32 bcma_erom_get_ci(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent = bcma_erom_get_ent(bus, eromptr);
|
||||
if (!(ent & SCAN_ER_VALID))
|
||||
return -ENOENT;
|
||||
if ((ent & SCAN_ER_TAG) != SCAN_ER_TAG_CI)
|
||||
return -ENOENT;
|
||||
return ent;
|
||||
}
|
||||
|
||||
static bool bcma_erom_is_end(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent = bcma_erom_get_ent(bus, eromptr);
|
||||
bcma_erom_push_ent(eromptr);
|
||||
return (ent == (SCAN_ER_TAG_END | SCAN_ER_VALID));
|
||||
}
|
||||
|
||||
static bool bcma_erom_is_bridge(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent = bcma_erom_get_ent(bus, eromptr);
|
||||
bcma_erom_push_ent(eromptr);
|
||||
return (((ent & SCAN_ER_VALID)) &&
|
||||
((ent & SCAN_ER_TAGX) == SCAN_ER_TAG_ADDR) &&
|
||||
((ent & SCAN_ADDR_TYPE) == SCAN_ADDR_TYPE_BRIDGE));
|
||||
}
|
||||
|
||||
static void bcma_erom_skip_component(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent;
|
||||
while (1) {
|
||||
ent = bcma_erom_get_ent(bus, eromptr);
|
||||
if ((ent & SCAN_ER_VALID) &&
|
||||
((ent & SCAN_ER_TAG) == SCAN_ER_TAG_CI))
|
||||
break;
|
||||
if (ent == (SCAN_ER_TAG_END | SCAN_ER_VALID))
|
||||
break;
|
||||
}
|
||||
bcma_erom_push_ent(eromptr);
|
||||
}
|
||||
|
||||
static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr)
|
||||
{
|
||||
u32 ent = bcma_erom_get_ent(bus, eromptr);
|
||||
if (!(ent & SCAN_ER_VALID))
|
||||
return -ENOENT;
|
||||
if ((ent & SCAN_ER_TAG) != SCAN_ER_TAG_MP)
|
||||
return -ENOENT;
|
||||
return ent;
|
||||
}
|
||||
|
||||
static s32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 **eromptr,
|
||||
u32 type, u8 port)
|
||||
{
|
||||
u32 addrl, addrh, sizel, sizeh = 0;
|
||||
u32 size;
|
||||
|
||||
u32 ent = bcma_erom_get_ent(bus, eromptr);
|
||||
if ((!(ent & SCAN_ER_VALID)) ||
|
||||
((ent & SCAN_ER_TAGX) != SCAN_ER_TAG_ADDR) ||
|
||||
((ent & SCAN_ADDR_TYPE) != type) ||
|
||||
(((ent & SCAN_ADDR_PORT) >> SCAN_ADDR_PORT_SHIFT) != port)) {
|
||||
bcma_erom_push_ent(eromptr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
addrl = ent & SCAN_ADDR_ADDR;
|
||||
if (ent & SCAN_ADDR_AG32)
|
||||
addrh = bcma_erom_get_ent(bus, eromptr);
|
||||
else
|
||||
addrh = 0;
|
||||
|
||||
if ((ent & SCAN_ADDR_SZ) == SCAN_ADDR_SZ_SZD) {
|
||||
size = bcma_erom_get_ent(bus, eromptr);
|
||||
sizel = size & SCAN_SIZE_SZ;
|
||||
if (size & SCAN_SIZE_SG32)
|
||||
sizeh = bcma_erom_get_ent(bus, eromptr);
|
||||
} else
|
||||
sizel = SCAN_ADDR_SZ_BASE <<
|
||||
((ent & SCAN_ADDR_SZ) >> SCAN_ADDR_SZ_SHIFT);
|
||||
|
||||
return addrl;
|
||||
}
|
||||
|
||||
int bcma_bus_scan(struct bcma_bus *bus)
|
||||
{
|
||||
u32 erombase;
|
||||
u32 __iomem *eromptr, *eromend;
|
||||
|
||||
s32 cia, cib;
|
||||
u8 ports[2], wrappers[2];
|
||||
|
||||
s32 tmp;
|
||||
u8 i, j;
|
||||
|
||||
int err;
|
||||
|
||||
INIT_LIST_HEAD(&bus->cores);
|
||||
bus->nr_cores = 0;
|
||||
|
||||
bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
|
||||
|
||||
tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
|
||||
bus->chipinfo.id = (tmp & BCMA_CC_ID_ID) >> BCMA_CC_ID_ID_SHIFT;
|
||||
bus->chipinfo.rev = (tmp & BCMA_CC_ID_REV) >> BCMA_CC_ID_REV_SHIFT;
|
||||
bus->chipinfo.pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT;
|
||||
|
||||
erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
|
||||
eromptr = bus->mmio;
|
||||
eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32);
|
||||
|
||||
bcma_scan_switch_core(bus, erombase);
|
||||
|
||||
while (eromptr < eromend) {
|
||||
struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
|
||||
if (!core)
|
||||
return -ENOMEM;
|
||||
INIT_LIST_HEAD(&core->list);
|
||||
core->bus = bus;
|
||||
|
||||
/* get CIs */
|
||||
cia = bcma_erom_get_ci(bus, &eromptr);
|
||||
if (cia < 0) {
|
||||
bcma_erom_push_ent(&eromptr);
|
||||
if (bcma_erom_is_end(bus, &eromptr))
|
||||
break;
|
||||
err= -EILSEQ;
|
||||
goto out;
|
||||
}
|
||||
cib = bcma_erom_get_ci(bus, &eromptr);
|
||||
if (cib < 0) {
|
||||
err= -EILSEQ;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* parse CIs */
|
||||
core->id.class = (cia & SCAN_CIA_CLASS) >> SCAN_CIA_CLASS_SHIFT;
|
||||
core->id.id = (cia & SCAN_CIA_ID) >> SCAN_CIA_ID_SHIFT;
|
||||
core->id.manuf = (cia & SCAN_CIA_MANUF) >> SCAN_CIA_MANUF_SHIFT;
|
||||
ports[0] = (cib & SCAN_CIB_NMP) >> SCAN_CIB_NMP_SHIFT;
|
||||
ports[1] = (cib & SCAN_CIB_NSP) >> SCAN_CIB_NSP_SHIFT;
|
||||
wrappers[0] = (cib & SCAN_CIB_NMW) >> SCAN_CIB_NMW_SHIFT;
|
||||
wrappers[1] = (cib & SCAN_CIB_NSW) >> SCAN_CIB_NSW_SHIFT;
|
||||
core->id.rev = (cib & SCAN_CIB_REV) >> SCAN_CIB_REV_SHIFT;
|
||||
|
||||
if (((core->id.manuf == BCMA_MANUF_ARM) &&
|
||||
(core->id.id == 0xFFF)) ||
|
||||
(ports[1] == 0)) {
|
||||
bcma_erom_skip_component(bus, &eromptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* check if component is a core at all */
|
||||
if (wrappers[0] + wrappers[1] == 0) {
|
||||
/* we could save addrl of the router
|
||||
if (cid == BCMA_CORE_OOB_ROUTER)
|
||||
*/
|
||||
bcma_erom_skip_component(bus, &eromptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bcma_erom_is_bridge(bus, &eromptr)) {
|
||||
bcma_erom_skip_component(bus, &eromptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get & parse master ports */
|
||||
for (i = 0; i < ports[0]; i++) {
|
||||
u32 mst_port_d = bcma_erom_get_mst_port(bus, &eromptr);
|
||||
if (mst_port_d < 0) {
|
||||
err= -EILSEQ;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* get & parse slave ports */
|
||||
for (i = 0; i < ports[1]; i++) {
|
||||
for (j = 0; ; j++) {
|
||||
tmp = bcma_erom_get_addr_desc(bus, &eromptr,
|
||||
SCAN_ADDR_TYPE_SLAVE, i);
|
||||
if (tmp < 0) {
|
||||
/* no more entries for port _i_ */
|
||||
/* pr_debug("erom: slave port %d "
|
||||
* "has %d descriptors\n", i, j); */
|
||||
break;
|
||||
} else {
|
||||
if (i == 0 && j == 0)
|
||||
core->addr = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* get & parse master wrappers */
|
||||
for (i = 0; i < wrappers[0]; i++) {
|
||||
for (j = 0; ; j++) {
|
||||
tmp = bcma_erom_get_addr_desc(bus, &eromptr,
|
||||
SCAN_ADDR_TYPE_MWRAP, i);
|
||||
if (tmp < 0) {
|
||||
/* no more entries for port _i_ */
|
||||
/* pr_debug("erom: master wrapper %d "
|
||||
* "has %d descriptors\n", i, j); */
|
||||
break;
|
||||
} else {
|
||||
if (i == 0 && j == 0)
|
||||
core->wrap = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* get & parse slave wrappers */
|
||||
for (i = 0; i < wrappers[1]; i++) {
|
||||
u8 hack = (ports[1] == 1) ? 0 : 1;
|
||||
for (j = 0; ; j++) {
|
||||
tmp = bcma_erom_get_addr_desc(bus, &eromptr,
|
||||
SCAN_ADDR_TYPE_SWRAP, i + hack);
|
||||
if (tmp < 0) {
|
||||
/* no more entries for port _i_ */
|
||||
/* pr_debug("erom: master wrapper %d "
|
||||
* has %d descriptors\n", i, j); */
|
||||
break;
|
||||
} else {
|
||||
if (wrappers[0] == 0 && !i && !j)
|
||||
core->wrap = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pr_info("Core %d found: %s "
|
||||
"(manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
|
||||
bus->nr_cores, bcma_device_name(&core->id),
|
||||
core->id.manuf, core->id.id, core->id.rev,
|
||||
core->id.class);
|
||||
|
||||
core->core_index = bus->nr_cores++;
|
||||
list_add(&core->list, &bus->cores);
|
||||
continue;
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
drivers/bcma/scan.h
Normal file
56
drivers/bcma/scan.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef BCMA_SCAN_H_
|
||||
#define BCMA_SCAN_H_
|
||||
|
||||
#define BCMA_ADDR_BASE 0x18000000
|
||||
#define BCMA_WRAP_BASE 0x18100000
|
||||
|
||||
#define SCAN_ER_VALID 0x00000001
|
||||
#define SCAN_ER_TAGX 0x00000006 /* we have to ignore 0x8 bit when checking tag for SCAN_ER_TAG_ADDR */
|
||||
#define SCAN_ER_TAG 0x0000000E
|
||||
#define SCAN_ER_TAG_CI 0x00000000
|
||||
#define SCAN_ER_TAG_MP 0x00000002
|
||||
#define SCAN_ER_TAG_ADDR 0x00000004
|
||||
#define SCAN_ER_TAG_END 0x0000000E
|
||||
#define SCAN_ER_BAD 0xFFFFFFFF
|
||||
|
||||
#define SCAN_CIA_CLASS 0x000000F0
|
||||
#define SCAN_CIA_CLASS_SHIFT 4
|
||||
#define SCAN_CIA_ID 0x000FFF00
|
||||
#define SCAN_CIA_ID_SHIFT 8
|
||||
#define SCAN_CIA_MANUF 0xFFF00000
|
||||
#define SCAN_CIA_MANUF_SHIFT 20
|
||||
|
||||
#define SCAN_CIB_NMP 0x000001F0
|
||||
#define SCAN_CIB_NMP_SHIFT 4
|
||||
#define SCAN_CIB_NSP 0x00003E00
|
||||
#define SCAN_CIB_NSP_SHIFT 9
|
||||
#define SCAN_CIB_NMW 0x0007C000
|
||||
#define SCAN_CIB_NMW_SHIFT 14
|
||||
#define SCAN_CIB_NSW 0x00F80000
|
||||
#define SCAN_CIB_NSW_SHIFT 17
|
||||
#define SCAN_CIB_REV 0xFF000000
|
||||
#define SCAN_CIB_REV_SHIFT 24
|
||||
|
||||
#define SCAN_ADDR_AG32 0x00000008
|
||||
#define SCAN_ADDR_SZ 0x00000030
|
||||
#define SCAN_ADDR_SZ_SHIFT 4
|
||||
#define SCAN_ADDR_SZ_4K 0x00000000
|
||||
#define SCAN_ADDR_SZ_8K 0x00000010
|
||||
#define SCAN_ADDR_SZ_16K 0x00000020
|
||||
#define SCAN_ADDR_SZ_SZD 0x00000030
|
||||
#define SCAN_ADDR_TYPE 0x000000C0
|
||||
#define SCAN_ADDR_TYPE_SLAVE 0x00000000
|
||||
#define SCAN_ADDR_TYPE_BRIDGE 0x00000040
|
||||
#define SCAN_ADDR_TYPE_SWRAP 0x00000080
|
||||
#define SCAN_ADDR_TYPE_MWRAP 0x000000C0
|
||||
#define SCAN_ADDR_PORT 0x00000F00
|
||||
#define SCAN_ADDR_PORT_SHIFT 8
|
||||
#define SCAN_ADDR_ADDR 0xFFFFF000
|
||||
|
||||
#define SCAN_ADDR_SZ_BASE 0x00001000 /* 4KB */
|
||||
|
||||
#define SCAN_SIZE_SZ_ALIGN 0x00000FFF
|
||||
#define SCAN_SIZE_SZ 0xFFFFF000
|
||||
#define SCAN_SIZE_SG32 0x00000008
|
||||
|
||||
#endif /* BCMA_SCAN_H_ */
|
@ -62,6 +62,7 @@ static struct usb_device_id ath3k_table[] = {
|
||||
|
||||
/* Atheros AR3011 with sflash firmware*/
|
||||
{ USB_DEVICE(0x0CF3, 0x3002) },
|
||||
{ USB_DEVICE(0x13d3, 0x3304) },
|
||||
|
||||
/* Atheros AR9285 Malbec with sflash firmware */
|
||||
{ USB_DEVICE(0x03F0, 0x311D) },
|
||||
|
@ -104,6 +104,7 @@ static struct usb_device_id blacklist_table[] = {
|
||||
|
||||
/* Atheros 3011 with sflash firmware */
|
||||
{ USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
|
||||
{ USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
|
||||
|
||||
/* Atheros AR9285 Malbec with sflash firmware */
|
||||
{ USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
|
||||
|
@ -2394,7 +2394,7 @@ ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops)
|
||||
spin_lock_init(&sc->rxbuflock);
|
||||
spin_lock_init(&sc->txbuflock);
|
||||
spin_lock_init(&sc->block);
|
||||
|
||||
spin_lock_init(&sc->irqlock);
|
||||
|
||||
/* Setup interrupt handler */
|
||||
ret = request_irq(sc->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
|
||||
|
@ -415,15 +415,6 @@ static void ar9002_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
|
||||
ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr);
|
||||
}
|
||||
|
||||
static void ar9002_hw_set11n_burstduration(struct ath_hw *ah, void *ds,
|
||||
u32 burstDuration)
|
||||
{
|
||||
struct ar5416_desc *ads = AR5416DESC(ds);
|
||||
|
||||
ads->ds_ctl2 &= ~AR_BurstDur;
|
||||
ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur);
|
||||
}
|
||||
|
||||
void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
|
||||
u32 size, u32 flags)
|
||||
{
|
||||
@ -456,6 +447,5 @@ void ar9002_hw_attach_mac_ops(struct ath_hw *ah)
|
||||
ops->set11n_aggr_middle = ar9002_hw_set11n_aggr_middle;
|
||||
ops->set11n_aggr_last = ar9002_hw_set11n_aggr_last;
|
||||
ops->clr11n_aggr = ar9002_hw_clr11n_aggr;
|
||||
ops->set11n_burstduration = ar9002_hw_set11n_burstduration;
|
||||
ops->set_clrdmask = ar9002_hw_set_clrdmask;
|
||||
}
|
||||
|
@ -517,23 +517,7 @@ static void ar9002_hw_set_nf_limits(struct ath_hw *ah)
|
||||
}
|
||||
}
|
||||
|
||||
void ar9002_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
|
||||
|
||||
priv_ops->set_rf_regs = NULL;
|
||||
priv_ops->rf_alloc_ext_banks = NULL;
|
||||
priv_ops->rf_free_ext_banks = NULL;
|
||||
priv_ops->rf_set_freq = ar9002_hw_set_channel;
|
||||
priv_ops->spur_mitigate_freq = ar9002_hw_spur_mitigate;
|
||||
priv_ops->olc_init = ar9002_olc_init;
|
||||
priv_ops->compute_pll_control = ar9002_hw_compute_pll_control;
|
||||
priv_ops->do_getnf = ar9002_hw_do_getnf;
|
||||
|
||||
ar9002_hw_set_nf_limits(ah);
|
||||
}
|
||||
|
||||
void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
u32 regval;
|
||||
@ -545,10 +529,11 @@ void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
AR_PHY_9285_ANT_DIV_ALT_LNACONF_S;
|
||||
antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >>
|
||||
AR_PHY_9285_FAST_DIV_BIAS_S;
|
||||
antconf->lna1_lna2_delta = -3;
|
||||
antconf->div_group = 0;
|
||||
}
|
||||
EXPORT_SYMBOL(ath9k_hw_antdiv_comb_conf_get);
|
||||
|
||||
void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
static void ar9002_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
u32 regval;
|
||||
@ -566,4 +551,23 @@ void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
|
||||
REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regval);
|
||||
}
|
||||
EXPORT_SYMBOL(ath9k_hw_antdiv_comb_conf_set);
|
||||
|
||||
void ar9002_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
|
||||
struct ath_hw_ops *ops = ath9k_hw_ops(ah);
|
||||
|
||||
priv_ops->set_rf_regs = NULL;
|
||||
priv_ops->rf_alloc_ext_banks = NULL;
|
||||
priv_ops->rf_free_ext_banks = NULL;
|
||||
priv_ops->rf_set_freq = ar9002_hw_set_channel;
|
||||
priv_ops->spur_mitigate_freq = ar9002_hw_spur_mitigate;
|
||||
priv_ops->olc_init = ar9002_olc_init;
|
||||
priv_ops->compute_pll_control = ar9002_hw_compute_pll_control;
|
||||
priv_ops->do_getnf = ar9002_hw_do_getnf;
|
||||
|
||||
ops->antdiv_comb_conf_get = ar9002_hw_antdiv_comb_conf_get;
|
||||
ops->antdiv_comb_conf_set = ar9002_hw_antdiv_comb_conf_set;
|
||||
|
||||
ar9002_hw_set_nf_limits(ah);
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ static const struct ar9300_eeprom ar9300_x113 = {
|
||||
.regDmn = { LE16(0), LE16(0x1f) },
|
||||
.txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
|
||||
.opCapFlags = {
|
||||
.opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
|
||||
.opFlags = AR5416_OPFLAGS_11A,
|
||||
.eepMisc = 0,
|
||||
},
|
||||
.rfSilent = 0,
|
||||
@ -922,7 +922,7 @@ static const struct ar9300_eeprom ar9300_x113 = {
|
||||
.db_stage2 = {3, 3, 3}, /* 3 chain */
|
||||
.db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
|
||||
.db_stage4 = {3, 3, 3}, /* don't exist for 2G */
|
||||
.xpaBiasLvl = 0,
|
||||
.xpaBiasLvl = 0xf,
|
||||
.txFrameToDataStart = 0x0e,
|
||||
.txFrameToPaOn = 0x0e,
|
||||
.txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
|
||||
@ -3442,17 +3442,15 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
|
||||
{
|
||||
int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz);
|
||||
|
||||
if (AR_SREV_9485(ah))
|
||||
if (AR_SREV_9485(ah) || AR_SREV_9340(ah))
|
||||
REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias);
|
||||
else {
|
||||
REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
|
||||
if (!AR_SREV_9340(ah)) {
|
||||
REG_RMW_FIELD(ah, AR_CH0_THERM,
|
||||
AR_CH0_THERM_XPABIASLVL_MSB,
|
||||
bias >> 2);
|
||||
REG_RMW_FIELD(ah, AR_CH0_THERM,
|
||||
AR_CH0_THERM_XPASHORT2GND, 1);
|
||||
}
|
||||
REG_RMW_FIELD(ah, AR_CH0_THERM,
|
||||
AR_CH0_THERM_XPABIASLVL_MSB,
|
||||
bias >> 2);
|
||||
REG_RMW_FIELD(ah, AR_CH0_THERM,
|
||||
AR_CH0_THERM_XPASHORT2GND, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3500,6 +3498,8 @@ static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah,
|
||||
static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
|
||||
{
|
||||
int chain;
|
||||
u32 regval;
|
||||
u32 ant_div_ctl1;
|
||||
static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = {
|
||||
AR_PHY_SWITCH_CHAIN_0,
|
||||
AR_PHY_SWITCH_CHAIN_1,
|
||||
@ -3525,13 +3525,49 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
|
||||
|
||||
if (AR_SREV_9485(ah)) {
|
||||
value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1);
|
||||
REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_CTRL_ALL,
|
||||
value);
|
||||
REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_ENABLE,
|
||||
value >> 6);
|
||||
REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT, AR_FAST_DIV_ENABLE,
|
||||
value >> 7);
|
||||
/*
|
||||
* main_lnaconf, alt_lnaconf, main_tb, alt_tb
|
||||
* are the fields present
|
||||
*/
|
||||
regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
|
||||
regval &= (~AR_ANT_DIV_CTRL_ALL);
|
||||
regval |= (value & 0x3f) << AR_ANT_DIV_CTRL_ALL_S;
|
||||
/* enable_lnadiv */
|
||||
regval &= (~AR_PHY_9485_ANT_DIV_LNADIV);
|
||||
regval |= ((value >> 6) & 0x1) <<
|
||||
AR_PHY_9485_ANT_DIV_LNADIV_S;
|
||||
REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
|
||||
|
||||
/*enable fast_div */
|
||||
regval = REG_READ(ah, AR_PHY_CCK_DETECT);
|
||||
regval &= (~AR_FAST_DIV_ENABLE);
|
||||
regval |= ((value >> 7) & 0x1) <<
|
||||
AR_FAST_DIV_ENABLE_S;
|
||||
REG_WRITE(ah, AR_PHY_CCK_DETECT, regval);
|
||||
ant_div_ctl1 =
|
||||
ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
|
||||
/* check whether antenna diversity is enabled */
|
||||
if ((ant_div_ctl1 >> 0x6) == 0x3) {
|
||||
regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
|
||||
/*
|
||||
* clear bits 25-30 main_lnaconf, alt_lnaconf,
|
||||
* main_tb, alt_tb
|
||||
*/
|
||||
regval &= (~(AR_PHY_9485_ANT_DIV_MAIN_LNACONF |
|
||||
AR_PHY_9485_ANT_DIV_ALT_LNACONF |
|
||||
AR_PHY_9485_ANT_DIV_ALT_GAINTB |
|
||||
AR_PHY_9485_ANT_DIV_MAIN_GAINTB));
|
||||
/* by default use LNA1 for the main antenna */
|
||||
regval |= (AR_PHY_9485_ANT_DIV_LNA1 <<
|
||||
AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S);
|
||||
regval |= (AR_PHY_9485_ANT_DIV_LNA2 <<
|
||||
AR_PHY_9485_ANT_DIV_ALT_LNACONF_S);
|
||||
REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void ar9003_hw_drive_strength_apply(struct ath_hw *ah)
|
||||
@ -4005,6 +4041,16 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
|
||||
POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
|
||||
);
|
||||
|
||||
/* Write the power for duplicated frames - HT40 */
|
||||
|
||||
/* dup40_cck (LSB), dup40_ofdm, ext20_cck, ext20_ofdm (MSB) */
|
||||
REG_WRITE(ah, 0xa3e0,
|
||||
POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
|
||||
POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
|
||||
POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
|
||||
POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
|
||||
);
|
||||
|
||||
/* Write the HT20 power per rate set */
|
||||
|
||||
/* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
|
||||
|
@ -484,16 +484,6 @@ static void ar9003_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
|
||||
ads->ctl12 &= (~AR_IsAggr & ~AR_MoreAggr);
|
||||
}
|
||||
|
||||
static void ar9003_hw_set11n_burstduration(struct ath_hw *ah, void *ds,
|
||||
u32 burstDuration)
|
||||
{
|
||||
struct ar9003_txc *ads = (struct ar9003_txc *) ds;
|
||||
|
||||
ads->ctl13 &= ~AR_BurstDur;
|
||||
ads->ctl13 |= SM(burstDuration, AR_BurstDur);
|
||||
|
||||
}
|
||||
|
||||
void ar9003_hw_set_paprd_txdesc(struct ath_hw *ah, void *ds, u8 chains)
|
||||
{
|
||||
struct ar9003_txc *ads = ds;
|
||||
@ -518,7 +508,6 @@ void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
|
||||
ops->set11n_aggr_middle = ar9003_hw_set11n_aggr_middle;
|
||||
ops->set11n_aggr_last = ar9003_hw_set11n_aggr_last;
|
||||
ops->clr11n_aggr = ar9003_hw_clr11n_aggr;
|
||||
ops->set11n_burstduration = ar9003_hw_set11n_burstduration;
|
||||
ops->set_clrdmask = ar9003_hw_set_clrdmask;
|
||||
}
|
||||
|
||||
|
@ -1184,9 +1184,52 @@ static void ar9003_hw_set_radar_conf(struct ath_hw *ah)
|
||||
conf->radar_inband = 8;
|
||||
}
|
||||
|
||||
static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
u32 regval;
|
||||
|
||||
regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
|
||||
antconf->main_lna_conf = (regval & AR_PHY_9485_ANT_DIV_MAIN_LNACONF) >>
|
||||
AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S;
|
||||
antconf->alt_lna_conf = (regval & AR_PHY_9485_ANT_DIV_ALT_LNACONF) >>
|
||||
AR_PHY_9485_ANT_DIV_ALT_LNACONF_S;
|
||||
antconf->fast_div_bias = (regval & AR_PHY_9485_ANT_FAST_DIV_BIAS) >>
|
||||
AR_PHY_9485_ANT_FAST_DIV_BIAS_S;
|
||||
antconf->lna1_lna2_delta = -9;
|
||||
antconf->div_group = 2;
|
||||
}
|
||||
|
||||
static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
u32 regval;
|
||||
|
||||
regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
|
||||
regval &= ~(AR_PHY_9485_ANT_DIV_MAIN_LNACONF |
|
||||
AR_PHY_9485_ANT_DIV_ALT_LNACONF |
|
||||
AR_PHY_9485_ANT_FAST_DIV_BIAS |
|
||||
AR_PHY_9485_ANT_DIV_MAIN_GAINTB |
|
||||
AR_PHY_9485_ANT_DIV_ALT_GAINTB);
|
||||
regval |= ((antconf->main_lna_conf <<
|
||||
AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S)
|
||||
& AR_PHY_9485_ANT_DIV_MAIN_LNACONF);
|
||||
regval |= ((antconf->alt_lna_conf << AR_PHY_9485_ANT_DIV_ALT_LNACONF_S)
|
||||
& AR_PHY_9485_ANT_DIV_ALT_LNACONF);
|
||||
regval |= ((antconf->fast_div_bias << AR_PHY_9485_ANT_FAST_DIV_BIAS_S)
|
||||
& AR_PHY_9485_ANT_FAST_DIV_BIAS);
|
||||
regval |= ((antconf->main_gaintb << AR_PHY_9485_ANT_DIV_MAIN_GAINTB_S)
|
||||
& AR_PHY_9485_ANT_DIV_MAIN_GAINTB);
|
||||
regval |= ((antconf->alt_gaintb << AR_PHY_9485_ANT_DIV_ALT_GAINTB_S)
|
||||
& AR_PHY_9485_ANT_DIV_ALT_GAINTB);
|
||||
|
||||
REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
|
||||
}
|
||||
|
||||
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
{
|
||||
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
|
||||
struct ath_hw_ops *ops = ath9k_hw_ops(ah);
|
||||
static const u32 ar9300_cca_regs[6] = {
|
||||
AR_PHY_CCA_0,
|
||||
AR_PHY_CCA_1,
|
||||
@ -1213,6 +1256,9 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
|
||||
priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs;
|
||||
priv_ops->set_radar_params = ar9003_hw_set_radar_params;
|
||||
|
||||
ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get;
|
||||
ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set;
|
||||
|
||||
ar9003_hw_set_nf_limits(ah);
|
||||
ar9003_hw_set_radar_conf(ah);
|
||||
memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs));
|
||||
|
@ -261,12 +261,34 @@
|
||||
#define AR_PHY_EXT_CCA0 (AR_AGC_BASE + 0x20)
|
||||
#define AR_PHY_RESTART (AR_AGC_BASE + 0x24)
|
||||
|
||||
/*
|
||||
* Antenna Diversity settings
|
||||
*/
|
||||
#define AR_PHY_MC_GAIN_CTRL (AR_AGC_BASE + 0x28)
|
||||
#define AR_ANT_DIV_CTRL_ALL 0x7e000000
|
||||
#define AR_ANT_DIV_CTRL_ALL_S 25
|
||||
#define AR_ANT_DIV_ENABLE 0x1000000
|
||||
#define AR_ANT_DIV_ENABLE_S 24
|
||||
|
||||
|
||||
#define AR_PHY_9485_ANT_FAST_DIV_BIAS 0x00007e00
|
||||
#define AR_PHY_9485_ANT_FAST_DIV_BIAS_S 9
|
||||
#define AR_PHY_9485_ANT_DIV_LNADIV 0x01000000
|
||||
#define AR_PHY_9485_ANT_DIV_LNADIV_S 24
|
||||
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF 0x06000000
|
||||
#define AR_PHY_9485_ANT_DIV_ALT_LNACONF_S 25
|
||||
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF 0x18000000
|
||||
#define AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S 27
|
||||
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB 0x20000000
|
||||
#define AR_PHY_9485_ANT_DIV_ALT_GAINTB_S 29
|
||||
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB 0x40000000
|
||||
#define AR_PHY_9485_ANT_DIV_MAIN_GAINTB_S 30
|
||||
|
||||
#define AR_PHY_9485_ANT_DIV_LNA1_MINUS_LNA2 0x0
|
||||
#define AR_PHY_9485_ANT_DIV_LNA2 0x1
|
||||
#define AR_PHY_9485_ANT_DIV_LNA1 0x2
|
||||
#define AR_PHY_9485_ANT_DIV_LNA1_PLUS_LNA2 0x3
|
||||
|
||||
#define AR_PHY_EXTCHN_PWRTHR1 (AR_AGC_BASE + 0x2c)
|
||||
#define AR_PHY_EXT_CHN_WIN (AR_AGC_BASE + 0x30)
|
||||
#define AR_PHY_20_40_DET_THR (AR_AGC_BASE + 0x34)
|
||||
|
@ -62,7 +62,6 @@ struct ath_node;
|
||||
#define ATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<<i))
|
||||
|
||||
struct ath_config {
|
||||
u32 ath_aggr_prot;
|
||||
u16 txpowlimit;
|
||||
u8 cabqReadytime;
|
||||
};
|
||||
@ -484,7 +483,6 @@ static inline void ath_deinit_leds(struct ath_softc *sc)
|
||||
#define ATH_ANT_DIV_COMB_ALT_ANT_RATIO 30
|
||||
#define ATH_ANT_DIV_COMB_ALT_ANT_RATIO2 20
|
||||
|
||||
#define ATH_ANT_DIV_COMB_LNA1_LNA2_DELTA -3
|
||||
#define ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA -1
|
||||
#define ATH_ANT_DIV_COMB_LNA1_DELTA_HI -4
|
||||
#define ATH_ANT_DIV_COMB_LNA1_DELTA_MID -2
|
||||
@ -565,6 +563,7 @@ struct ath_ant_comb {
|
||||
#define PS_WAIT_FOR_PSPOLL_DATA BIT(2)
|
||||
#define PS_WAIT_FOR_TX_ACK BIT(3)
|
||||
#define PS_BEACON_SYNC BIT(4)
|
||||
#define PS_TSFOOR_SYNC BIT(5)
|
||||
|
||||
struct ath_rate_table;
|
||||
|
||||
|
@ -620,7 +620,13 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
|
||||
ath9k_hw_disable_interrupts(ah);
|
||||
ath9k_hw_set_sta_beacon_timers(ah, &bs);
|
||||
ah->imask |= ATH9K_INT_BMISS;
|
||||
ath9k_hw_set_interrupts(ah, ah->imask);
|
||||
|
||||
/*
|
||||
* If the beacon config is called beacause of TSFOOR,
|
||||
* Interrupts will be enabled back at the end of ath9k_tasklet
|
||||
*/
|
||||
if (!(sc->ps_flags & PS_TSFOOR_SYNC))
|
||||
ath9k_hw_set_interrupts(ah, ah->imask);
|
||||
}
|
||||
|
||||
static void ath_beacon_config_adhoc(struct ath_softc *sc,
|
||||
@ -661,7 +667,12 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc,
|
||||
ath9k_hw_disable_interrupts(ah);
|
||||
ath9k_beacon_init(sc, nexttbtt, intval);
|
||||
sc->beacon.bmisscnt = 0;
|
||||
ath9k_hw_set_interrupts(ah, ah->imask);
|
||||
/*
|
||||
* If the beacon config is called beacause of TSFOOR,
|
||||
* Interrupts will be enabled back at the end of ath9k_tasklet
|
||||
*/
|
||||
if (!(sc->ps_flags & PS_TSFOOR_SYNC))
|
||||
ath9k_hw_set_interrupts(ah, ah->imask);
|
||||
}
|
||||
|
||||
static bool ath9k_allow_beacon_config(struct ath_softc *sc,
|
||||
|
@ -69,15 +69,21 @@ static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah,
|
||||
int16_t *nfarray)
|
||||
{
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
struct ieee80211_conf *conf = &common->hw->conf;
|
||||
struct ath_nf_limits *limit;
|
||||
struct ath9k_nfcal_hist *h;
|
||||
bool high_nf_mid = false;
|
||||
u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
|
||||
int i;
|
||||
|
||||
h = cal->nfCalHist;
|
||||
limit = ath9k_hw_get_nf_limits(ah, ah->curchan);
|
||||
|
||||
for (i = 0; i < NUM_NF_READINGS; i++) {
|
||||
if (!(chainmask & (1 << i)) ||
|
||||
((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)))
|
||||
continue;
|
||||
|
||||
h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];
|
||||
|
||||
if (++h[i].currIndex >= ATH9K_NF_CAL_HIST_MAX)
|
||||
@ -225,6 +231,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
int32_t val;
|
||||
u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
struct ieee80211_conf *conf = &common->hw->conf;
|
||||
s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
|
||||
|
||||
if (ah->caldata)
|
||||
@ -234,6 +241,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
if (chainmask & (1 << i)) {
|
||||
s16 nfval;
|
||||
|
||||
if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))
|
||||
continue;
|
||||
|
||||
if (h)
|
||||
nfval = h[i].privNF;
|
||||
else
|
||||
@ -293,6 +303,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
ENABLE_REGWRITE_BUFFER(ah);
|
||||
for (i = 0; i < NUM_NF_READINGS; i++) {
|
||||
if (chainmask & (1 << i)) {
|
||||
if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))
|
||||
continue;
|
||||
|
||||
val = REG_READ(ah, ah->nf_regs[i]);
|
||||
val &= 0xFFFFFE00;
|
||||
val |= (((u32) (-50) << 1) & 0x1ff);
|
||||
@ -396,14 +409,6 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
|
||||
}
|
||||
}
|
||||
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
|
||||
{
|
||||
if (!ah->curchan || !ah->curchan->noisefloor)
|
||||
return ath9k_hw_get_default_nf(ah, chan);
|
||||
|
||||
return ah->curchan->noisefloor;
|
||||
}
|
||||
EXPORT_SYMBOL(ath9k_hw_getchan_noise);
|
||||
|
||||
void ath9k_hw_bstuck_nfcal(struct ath_hw *ah)
|
||||
{
|
||||
|
@ -106,7 +106,6 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan);
|
||||
void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
|
||||
struct ath9k_channel *chan);
|
||||
void ath9k_hw_bstuck_nfcal(struct ath_hw *ah);
|
||||
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
|
||||
void ath9k_hw_reset_calibration(struct ath_hw *ah,
|
||||
struct ath9k_cal_list *currCal);
|
||||
|
||||
|
@ -116,17 +116,23 @@ static inline void ath9k_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
|
||||
ath9k_hw_ops(ah)->clr11n_aggr(ah, ds);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_set11n_burstduration(struct ath_hw *ah, void *ds,
|
||||
u32 burstDuration)
|
||||
{
|
||||
ath9k_hw_ops(ah)->set11n_burstduration(ah, ds, burstDuration);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_set_clrdmask(struct ath_hw *ah, void *ds, bool val)
|
||||
{
|
||||
ath9k_hw_ops(ah)->set_clrdmask(ah, ds, val);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
|
||||
}
|
||||
|
||||
static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf)
|
||||
{
|
||||
ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
|
||||
}
|
||||
|
||||
/* Private hardware call ops */
|
||||
|
||||
/* PHY ops */
|
||||
|
@ -2022,6 +2022,22 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
|
||||
}
|
||||
|
||||
|
||||
if (AR_SREV_9485(ah)) {
|
||||
ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
|
||||
/*
|
||||
* enable the diversity-combining algorithm only when
|
||||
* both enable_lna_div and enable_fast_div are set
|
||||
* Table for Diversity
|
||||
* ant_div_alt_lnaconf bit 0-1
|
||||
* ant_div_main_lnaconf bit 2-3
|
||||
* ant_div_alt_gaintb bit 4
|
||||
* ant_div_main_gaintb bit 5
|
||||
* enable_ant_div_lnadiv bit 6
|
||||
* enable_ant_fast_div bit 7
|
||||
*/
|
||||
if ((ant_div_ctl1 >> 0x6) == 0x3)
|
||||
pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB;
|
||||
}
|
||||
|
||||
if (AR_SREV_9485_10(ah)) {
|
||||
pCap->pcie_lcr_extsync_en = true;
|
||||
|
@ -479,6 +479,10 @@ struct ath_hw_antcomb_conf {
|
||||
u8 main_lna_conf;
|
||||
u8 alt_lna_conf;
|
||||
u8 fast_div_bias;
|
||||
u8 main_gaintb;
|
||||
u8 alt_gaintb;
|
||||
int lna1_lna2_delta;
|
||||
u8 div_group;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -628,9 +632,12 @@ struct ath_hw_ops {
|
||||
u32 numDelims);
|
||||
void (*set11n_aggr_last)(struct ath_hw *ah, void *ds);
|
||||
void (*clr11n_aggr)(struct ath_hw *ah, void *ds);
|
||||
void (*set11n_burstduration)(struct ath_hw *ah, void *ds,
|
||||
u32 burstDuration);
|
||||
void (*set_clrdmask)(struct ath_hw *ah, void *ds, bool val);
|
||||
void (*antdiv_comb_conf_get)(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf);
|
||||
void (*antdiv_comb_conf_set)(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf);
|
||||
|
||||
};
|
||||
|
||||
struct ath_nf_limits {
|
||||
@ -906,10 +913,6 @@ void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
|
||||
void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
|
||||
u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
|
||||
void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
|
||||
void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf);
|
||||
void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
|
||||
struct ath_hw_antcomb_conf *antconf);
|
||||
|
||||
/* General Operation */
|
||||
bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
|
||||
|
@ -430,8 +430,13 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
|
||||
SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH));
|
||||
|
||||
REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ);
|
||||
REG_WRITE(ah, AR_DMISC(q),
|
||||
AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x2);
|
||||
|
||||
if (AR_SREV_9340(ah))
|
||||
REG_WRITE(ah, AR_DMISC(q),
|
||||
AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1);
|
||||
else
|
||||
REG_WRITE(ah, AR_DMISC(q),
|
||||
AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x2);
|
||||
|
||||
if (qi->tqi_cbrPeriod) {
|
||||
REG_WRITE(ah, AR_QCBRCFG(q),
|
||||
|
@ -689,6 +689,17 @@ void ath9k_tasklet(unsigned long data)
|
||||
!ath9k_hw_check_alive(ah))
|
||||
ieee80211_queue_work(sc->hw, &sc->hw_check_work);
|
||||
|
||||
if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) {
|
||||
/*
|
||||
* TSF sync does not look correct; remain awake to sync with
|
||||
* the next Beacon.
|
||||
*/
|
||||
ath_dbg(common, ATH_DBG_PS,
|
||||
"TSFOOR - Sync with next Beacon\n");
|
||||
sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC |
|
||||
PS_TSFOOR_SYNC;
|
||||
}
|
||||
|
||||
if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
|
||||
rxmask = (ATH9K_INT_RXHP | ATH9K_INT_RXLP | ATH9K_INT_RXEOL |
|
||||
ATH9K_INT_RXORN);
|
||||
@ -711,16 +722,6 @@ void ath9k_tasklet(unsigned long data)
|
||||
ath_tx_tasklet(sc);
|
||||
}
|
||||
|
||||
if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) {
|
||||
/*
|
||||
* TSF sync does not look correct; remain awake to sync with
|
||||
* the next Beacon.
|
||||
*/
|
||||
ath_dbg(common, ATH_DBG_PS,
|
||||
"TSFOOR - Sync with next Beacon\n");
|
||||
sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC;
|
||||
}
|
||||
|
||||
if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
|
||||
if (status & ATH9K_INT_GENTIMER)
|
||||
ath_gen_timer_isr(sc->sc_ah);
|
||||
@ -1384,7 +1385,9 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
|
||||
ath9k_hw_set_tsfadjust(ah, 0);
|
||||
sc->sc_flags &= ~SC_OP_TSF_RESET;
|
||||
|
||||
if (iter_data.nwds + iter_data.nmeshes)
|
||||
if (iter_data.nmeshes)
|
||||
ah->opmode = NL80211_IFTYPE_MESH_POINT;
|
||||
else if (iter_data.nwds)
|
||||
ah->opmode = NL80211_IFTYPE_AP;
|
||||
else if (iter_data.nadhocs)
|
||||
ah->opmode = NL80211_IFTYPE_ADHOC;
|
||||
@ -1408,6 +1411,7 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
|
||||
|
||||
/* Set up ANI */
|
||||
if ((iter_data.naps + iter_data.nadhocs) > 0) {
|
||||
sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
|
||||
sc->sc_flags |= SC_OP_ANI_RUN;
|
||||
ath_start_ani(common);
|
||||
} else {
|
||||
@ -1778,6 +1782,11 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
|
||||
struct ieee80211_key_conf ps_key = { };
|
||||
|
||||
ath_node_attach(sc, sta);
|
||||
|
||||
if (vif->type != NL80211_IFTYPE_AP &&
|
||||
vif->type != NL80211_IFTYPE_AP_VLAN)
|
||||
return 0;
|
||||
|
||||
an->ps_key = ath_key_config(common, vif, sta, &ps_key);
|
||||
|
||||
return 0;
|
||||
@ -2039,9 +2048,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
if (changed & BSS_CHANGED_BSSID) {
|
||||
ath9k_config_bss(sc, vif);
|
||||
|
||||
/* Set aggregation protection mode parameters */
|
||||
sc->config.ath_aggr_prot = 0;
|
||||
|
||||
ath_dbg(common, ATH_DBG_CONFIG, "BSSID: %pM aid: 0x%x\n",
|
||||
common->curbssid, common->curaid);
|
||||
}
|
||||
@ -2261,6 +2267,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
|
||||
struct ath_softc *sc = hw->priv;
|
||||
int timeout = 200; /* ms */
|
||||
int i, j;
|
||||
bool drain_txq;
|
||||
|
||||
mutex_lock(&sc->mutex);
|
||||
cancel_delayed_work_sync(&sc->tx_complete_work);
|
||||
@ -2269,7 +2276,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
|
||||
timeout = 1;
|
||||
|
||||
for (j = 0; j < timeout; j++) {
|
||||
int npend = 0;
|
||||
bool npend = false;
|
||||
|
||||
if (j)
|
||||
usleep_range(1000, 2000);
|
||||
@ -2278,7 +2285,10 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
|
||||
if (!ATH_TXQ_SETUP(sc, i))
|
||||
continue;
|
||||
|
||||
npend += ath9k_has_pending_frames(sc, &sc->tx.txq[i]);
|
||||
npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]);
|
||||
|
||||
if (npend)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!npend)
|
||||
@ -2286,7 +2296,10 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop)
|
||||
}
|
||||
|
||||
ath9k_ps_wakeup(sc);
|
||||
if (!ath_drain_all_txq(sc, false))
|
||||
spin_lock_bh(&sc->sc_pcu_lock);
|
||||
drain_txq = ath_drain_all_txq(sc, false);
|
||||
spin_unlock_bh(&sc->sc_pcu_lock);
|
||||
if (!drain_txq)
|
||||
ath_reset(sc, false);
|
||||
ath9k_ps_restore(sc);
|
||||
ieee80211_wake_queues(hw);
|
||||
|
@ -28,6 +28,33 @@ static inline bool ath_is_alt_ant_ratio_better(int alt_ratio, int maxdelta,
|
||||
(alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50);
|
||||
}
|
||||
|
||||
static inline bool ath_ant_div_comb_alt_check(u8 div_group, int alt_ratio,
|
||||
int curr_main_set, int curr_alt_set,
|
||||
int alt_rssi_avg, int main_rssi_avg)
|
||||
{
|
||||
bool result = false;
|
||||
switch (div_group) {
|
||||
case 0:
|
||||
if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)
|
||||
result = true;
|
||||
break;
|
||||
case 1:
|
||||
if ((((curr_main_set == ATH_ANT_DIV_COMB_LNA2) &&
|
||||
(curr_alt_set == ATH_ANT_DIV_COMB_LNA1) &&
|
||||
(alt_rssi_avg >= (main_rssi_avg - 5))) ||
|
||||
((curr_main_set == ATH_ANT_DIV_COMB_LNA1) &&
|
||||
(curr_alt_set == ATH_ANT_DIV_COMB_LNA2) &&
|
||||
(alt_rssi_avg >= (main_rssi_avg - 2)))) &&
|
||||
(alt_rssi_avg >= 4))
|
||||
result = true;
|
||||
else
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline bool ath9k_check_auto_sleep(struct ath_softc *sc)
|
||||
{
|
||||
return sc->ps_enabled &&
|
||||
@ -572,6 +599,7 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
|
||||
ath_dbg(common, ATH_DBG_PS,
|
||||
"Reconfigure Beacon timers based on timestamp from the AP\n");
|
||||
ath_set_beacon(sc);
|
||||
sc->ps_flags &= ~PS_TSFOOR_SYNC;
|
||||
}
|
||||
|
||||
if (ath_beacon_dtim_pending_cab(skb)) {
|
||||
@ -916,7 +944,8 @@ static void ath9k_process_rssi(struct ath_common *common,
|
||||
int last_rssi;
|
||||
__le16 fc;
|
||||
|
||||
if (ah->opmode != NL80211_IFTYPE_STATION)
|
||||
if ((ah->opmode != NL80211_IFTYPE_STATION) &&
|
||||
(ah->opmode != NL80211_IFTYPE_ADHOC))
|
||||
return;
|
||||
|
||||
fc = hdr->frame_control;
|
||||
@ -1288,49 +1317,138 @@ static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb,
|
||||
}
|
||||
}
|
||||
|
||||
static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf)
|
||||
static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf,
|
||||
struct ath_ant_comb *antcomb, int alt_ratio)
|
||||
{
|
||||
/* Adjust the fast_div_bias based on main and alt lna conf */
|
||||
switch ((ant_conf->main_lna_conf << 4) | ant_conf->alt_lna_conf) {
|
||||
case (0x01): /* A-B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x3b;
|
||||
break;
|
||||
case (0x02): /* A-B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x3d;
|
||||
break;
|
||||
case (0x03): /* A-B A+B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
break;
|
||||
case (0x10): /* LNA2 A-B */
|
||||
ant_conf->fast_div_bias = 0x7;
|
||||
break;
|
||||
case (0x12): /* LNA2 LNA1 */
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
break;
|
||||
case (0x13): /* LNA2 A+B */
|
||||
ant_conf->fast_div_bias = 0x7;
|
||||
break;
|
||||
case (0x20): /* LNA1 A-B */
|
||||
ant_conf->fast_div_bias = 0x6;
|
||||
break;
|
||||
case (0x21): /* LNA1 LNA2 */
|
||||
ant_conf->fast_div_bias = 0x0;
|
||||
break;
|
||||
case (0x23): /* LNA1 A+B */
|
||||
ant_conf->fast_div_bias = 0x6;
|
||||
break;
|
||||
case (0x30): /* A+B A-B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
break;
|
||||
case (0x31): /* A+B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x3b;
|
||||
break;
|
||||
case (0x32): /* A+B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x3d;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (ant_conf->div_group == 0) {
|
||||
/* Adjust the fast_div_bias based on main and alt lna conf */
|
||||
switch ((ant_conf->main_lna_conf << 4) |
|
||||
ant_conf->alt_lna_conf) {
|
||||
case (0x01): /* A-B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x3b;
|
||||
break;
|
||||
case (0x02): /* A-B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x3d;
|
||||
break;
|
||||
case (0x03): /* A-B A+B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
break;
|
||||
case (0x10): /* LNA2 A-B */
|
||||
ant_conf->fast_div_bias = 0x7;
|
||||
break;
|
||||
case (0x12): /* LNA2 LNA1 */
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
break;
|
||||
case (0x13): /* LNA2 A+B */
|
||||
ant_conf->fast_div_bias = 0x7;
|
||||
break;
|
||||
case (0x20): /* LNA1 A-B */
|
||||
ant_conf->fast_div_bias = 0x6;
|
||||
break;
|
||||
case (0x21): /* LNA1 LNA2 */
|
||||
ant_conf->fast_div_bias = 0x0;
|
||||
break;
|
||||
case (0x23): /* LNA1 A+B */
|
||||
ant_conf->fast_div_bias = 0x6;
|
||||
break;
|
||||
case (0x30): /* A+B A-B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
break;
|
||||
case (0x31): /* A+B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x3b;
|
||||
break;
|
||||
case (0x32): /* A+B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x3d;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (ant_conf->div_group == 2) {
|
||||
/* Adjust the fast_div_bias based on main and alt_lna_conf */
|
||||
switch ((ant_conf->main_lna_conf << 4) |
|
||||
ant_conf->alt_lna_conf) {
|
||||
case (0x01): /* A-B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x02): /* A-B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x03): /* A-B A+B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x10): /* LNA2 A-B */
|
||||
if (!(antcomb->scan) &&
|
||||
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
else
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x12): /* LNA2 LNA1 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x13): /* LNA2 A+B */
|
||||
if (!(antcomb->scan) &&
|
||||
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
else
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x20): /* LNA1 A-B */
|
||||
if (!(antcomb->scan) &&
|
||||
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
else
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x21): /* LNA1 LNA2 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x23): /* LNA1 A+B */
|
||||
if (!(antcomb->scan) &&
|
||||
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
else
|
||||
ant_conf->fast_div_bias = 0x2;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x30): /* A+B A-B */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x31): /* A+B LNA2 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
case (0x32): /* A+B LNA1 */
|
||||
ant_conf->fast_div_bias = 0x1;
|
||||
ant_conf->main_gaintb = 0;
|
||||
ant_conf->alt_gaintb = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Antenna diversity and combining */
|
||||
@ -1350,8 +1468,8 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
|
||||
main_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_MAIN_SHIFT) &
|
||||
ATH_ANT_RX_MASK;
|
||||
|
||||
/* Record packet only when alt_rssi is positive */
|
||||
if (alt_rssi > 0) {
|
||||
/* Record packet only when both main_rssi and alt_rssi is positive */
|
||||
if (main_rssi > 0 && alt_rssi > 0) {
|
||||
antcomb->total_pkt_count++;
|
||||
antcomb->main_total_rssi += main_rssi;
|
||||
antcomb->alt_total_rssi += alt_rssi;
|
||||
@ -1411,7 +1529,9 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
|
||||
}
|
||||
|
||||
if (!antcomb->scan) {
|
||||
if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) {
|
||||
if (ath_ant_div_comb_alt_check(div_ant_conf.div_group,
|
||||
alt_ratio, curr_main_set, curr_alt_set,
|
||||
alt_rssi_avg, main_rssi_avg)) {
|
||||
if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) {
|
||||
/* Switch main and alt LNA */
|
||||
div_ant_conf.main_lna_conf =
|
||||
@ -1440,7 +1560,7 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
|
||||
}
|
||||
|
||||
if ((alt_rssi_avg < (main_rssi_avg +
|
||||
ATH_ANT_DIV_COMB_LNA1_LNA2_DELTA)))
|
||||
div_ant_conf.lna1_lna2_delta)))
|
||||
goto div_comb_done;
|
||||
}
|
||||
|
||||
@ -1554,8 +1674,7 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
|
||||
antcomb->quick_scan_cnt++;
|
||||
|
||||
div_comb_done:
|
||||
ath_ant_div_conf_fast_divbias(&div_ant_conf);
|
||||
|
||||
ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio);
|
||||
ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf);
|
||||
|
||||
antcomb->scan_start_time = jiffies;
|
||||
|
@ -1663,8 +1663,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
|
||||
rix = rates[i].idx;
|
||||
series[i].Tries = rates[i].count;
|
||||
|
||||
if ((sc->config.ath_aggr_prot && bf_isaggr(bf)) ||
|
||||
(rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
|
||||
if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
|
||||
series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
|
||||
flags |= ATH9K_TXDESC_RTSENA;
|
||||
} else if (rates[i].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
||||
@ -1733,8 +1732,6 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
|
||||
!is_pspoll, ctsrate,
|
||||
0, series, 4, flags);
|
||||
|
||||
if (sc->config.ath_aggr_prot && flags)
|
||||
ath9k_hw_set11n_burstduration(sc->sc_ah, bf->bf_desc, 8192);
|
||||
}
|
||||
|
||||
static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
|
||||
@ -1848,6 +1845,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_sta *sta = info->control.sta;
|
||||
struct ieee80211_vif *vif = info->control.vif;
|
||||
struct ath_softc *sc = hw->priv;
|
||||
struct ath_txq *txq = txctl->txq;
|
||||
struct ath_buf *bf;
|
||||
@ -1885,6 +1883,11 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
|
||||
memmove(skb->data, skb->data + padsize, padpos);
|
||||
}
|
||||
|
||||
if ((vif && vif->type != NL80211_IFTYPE_AP &&
|
||||
vif->type != NL80211_IFTYPE_AP_VLAN) ||
|
||||
!ieee80211_is_data(hdr->frame_control))
|
||||
info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
|
||||
|
||||
setup_frame_info(hw, skb, frmlen);
|
||||
|
||||
/*
|
||||
|
@ -883,7 +883,7 @@ static void carl9170_op_configure_filter(struct ieee80211_hw *hw,
|
||||
* then checking the error flags, later.
|
||||
*/
|
||||
|
||||
if (changed_flags & FIF_ALLMULTI && *new_flags & FIF_ALLMULTI)
|
||||
if (*new_flags & FIF_ALLMULTI)
|
||||
multicast = ~0ULL;
|
||||
|
||||
if (multicast != ar->cur_mc_hash)
|
||||
|
@ -156,10 +156,8 @@ static void carl9170_tx_ps_unblock(struct ar9170 *ar, struct sk_buff *skb)
|
||||
|
||||
static void carl9170_tx_accounting_free(struct ar9170 *ar, struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_tx_info *txinfo;
|
||||
int queue;
|
||||
|
||||
txinfo = IEEE80211_SKB_CB(skb);
|
||||
queue = skb_get_queue_mapping(skb);
|
||||
|
||||
spin_lock_bh(&ar->tx_stats_lock);
|
||||
@ -380,7 +378,6 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
|
||||
{
|
||||
struct _carl9170_tx_superframe *super = (void *) skb->data;
|
||||
struct ieee80211_hdr *hdr = (void *) super->frame_data;
|
||||
struct carl9170_tx_info *ar_info;
|
||||
struct ieee80211_sta *sta;
|
||||
struct carl9170_sta_info *sta_info;
|
||||
struct carl9170_sta_tid *tid_info;
|
||||
@ -391,8 +388,6 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
|
||||
(!(super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_AGGR))))
|
||||
return;
|
||||
|
||||
ar_info = (void *) txinfo->rate_driver_data;
|
||||
|
||||
rcu_read_lock();
|
||||
sta = __carl9170_get_tx_sta(ar, skb);
|
||||
if (unlikely(!sta))
|
||||
@ -623,7 +618,6 @@ static void __carl9170_tx_process_status(struct ar9170 *ar,
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct ieee80211_tx_info *txinfo;
|
||||
struct carl9170_tx_info *arinfo;
|
||||
unsigned int r, t, q;
|
||||
bool success = true;
|
||||
|
||||
@ -639,7 +633,6 @@ static void __carl9170_tx_process_status(struct ar9170 *ar,
|
||||
}
|
||||
|
||||
txinfo = IEEE80211_SKB_CB(skb);
|
||||
arinfo = (void *) txinfo->rate_driver_data;
|
||||
|
||||
if (!(info & CARL9170_TX_STATUS_SUCCESS))
|
||||
success = false;
|
||||
@ -1321,7 +1314,6 @@ static bool carl9170_tx_ampdu_queue(struct ar9170 *ar,
|
||||
struct carl9170_sta_info *sta_info;
|
||||
struct carl9170_sta_tid *agg;
|
||||
struct sk_buff *iter;
|
||||
unsigned int max;
|
||||
u16 tid, seq, qseq, off;
|
||||
bool run = false;
|
||||
|
||||
@ -1331,7 +1323,6 @@ static bool carl9170_tx_ampdu_queue(struct ar9170 *ar,
|
||||
|
||||
rcu_read_lock();
|
||||
agg = rcu_dereference(sta_info->agg[tid]);
|
||||
max = sta_info->ampdu_max_len;
|
||||
|
||||
if (!agg)
|
||||
goto err_unlock_rcu;
|
||||
|
@ -2686,6 +2686,17 @@ void b43_mac_suspend(struct b43_wldev *dev)
|
||||
dev->mac_suspended++;
|
||||
}
|
||||
|
||||
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
|
||||
void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on)
|
||||
{
|
||||
u32 tmslow = ssb_read32(dev->dev, SSB_TMSLOW);
|
||||
if (on)
|
||||
tmslow |= B43_TMSLOW_MACPHYCLKEN;
|
||||
else
|
||||
tmslow &= ~B43_TMSLOW_MACPHYCLKEN;
|
||||
ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
|
||||
}
|
||||
|
||||
static void b43_adjust_opmode(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_wl *wl = dev->wl;
|
||||
@ -2842,7 +2853,7 @@ static int b43_chip_init(struct b43_wldev *dev)
|
||||
{
|
||||
struct b43_phy *phy = &dev->phy;
|
||||
int err;
|
||||
u32 value32, macctl;
|
||||
u32 macctl;
|
||||
u16 value16;
|
||||
|
||||
/* Initialize the MAC control */
|
||||
@ -2920,9 +2931,7 @@ static int b43_chip_init(struct b43_wldev *dev)
|
||||
b43_write32(dev, B43_MMIO_DMA4_IRQ_MASK, 0x0000DC00);
|
||||
b43_write32(dev, B43_MMIO_DMA5_IRQ_MASK, 0x0000DC00);
|
||||
|
||||
value32 = ssb_read32(dev->dev, SSB_TMSLOW);
|
||||
value32 |= 0x00100000;
|
||||
ssb_write32(dev->dev, SSB_TMSLOW, value32);
|
||||
b43_mac_phy_clock_set(dev, true);
|
||||
|
||||
b43_write16(dev, B43_MMIO_POWERUP_DELAY,
|
||||
dev->dev->bus->chipco.fast_pwrup_delay);
|
||||
@ -4213,33 +4222,18 @@ static void b43_bluetooth_coext_disable(struct b43_wldev *dev)
|
||||
|
||||
static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev)
|
||||
{
|
||||
#ifdef CONFIG_SSB_DRIVER_PCICORE
|
||||
struct ssb_bus *bus = dev->dev->bus;
|
||||
u32 tmp;
|
||||
|
||||
if (bus->pcicore.dev &&
|
||||
bus->pcicore.dev->id.coreid == SSB_DEV_PCI &&
|
||||
bus->pcicore.dev->id.revision <= 5) {
|
||||
/* IMCFGLO timeouts workaround. */
|
||||
if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) ||
|
||||
(bus->chip_id == 0x4312)) {
|
||||
tmp = ssb_read32(dev->dev, SSB_IMCFGLO);
|
||||
switch (bus->bustype) {
|
||||
case SSB_BUSTYPE_PCI:
|
||||
case SSB_BUSTYPE_PCMCIA:
|
||||
tmp &= ~SSB_IMCFGLO_REQTO;
|
||||
tmp &= ~SSB_IMCFGLO_SERTO;
|
||||
tmp |= 0x32;
|
||||
break;
|
||||
case SSB_BUSTYPE_SSB:
|
||||
tmp &= ~SSB_IMCFGLO_REQTO;
|
||||
tmp &= ~SSB_IMCFGLO_SERTO;
|
||||
tmp |= 0x53;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
tmp &= ~SSB_IMCFGLO_REQTO;
|
||||
tmp &= ~SSB_IMCFGLO_SERTO;
|
||||
tmp |= 0x3;
|
||||
ssb_write32(dev->dev, SSB_IMCFGLO, tmp);
|
||||
ssb_commit_settings(bus);
|
||||
}
|
||||
#endif /* CONFIG_SSB_DRIVER_PCICORE */
|
||||
}
|
||||
|
||||
static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle)
|
||||
@ -4863,25 +4857,8 @@ static void b43_one_core_detach(struct ssb_device *dev)
|
||||
static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
|
||||
{
|
||||
struct b43_wldev *wldev;
|
||||
struct pci_dev *pdev;
|
||||
int err = -ENOMEM;
|
||||
|
||||
if (!list_empty(&wl->devlist)) {
|
||||
/* We are not the first core on this chip. */
|
||||
pdev = (dev->bus->bustype == SSB_BUSTYPE_PCI) ? dev->bus->host_pci : NULL;
|
||||
/* Only special chips support more than one wireless
|
||||
* core, although some of the other chips have more than
|
||||
* one wireless core as well. Check for this and
|
||||
* bail out early.
|
||||
*/
|
||||
if (!pdev ||
|
||||
((pdev->device != 0x4321) &&
|
||||
(pdev->device != 0x4313) && (pdev->device != 0x431A))) {
|
||||
b43dbg(wl, "Ignoring unconnected 802.11 core\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
wldev = kzalloc(sizeof(*wldev), GFP_KERNEL);
|
||||
if (!wldev)
|
||||
goto out;
|
||||
@ -5002,7 +4979,7 @@ static int b43_wireless_init(struct ssb_device *dev)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int b43_probe(struct ssb_device *dev, const struct ssb_device_id *id)
|
||||
static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
|
||||
{
|
||||
struct b43_wl *wl;
|
||||
int err;
|
||||
@ -5040,7 +5017,7 @@ static int b43_probe(struct ssb_device *dev, const struct ssb_device_id *id)
|
||||
return err;
|
||||
}
|
||||
|
||||
static void b43_remove(struct ssb_device *dev)
|
||||
static void b43_ssb_remove(struct ssb_device *dev)
|
||||
{
|
||||
struct b43_wl *wl = ssb_get_devtypedata(dev);
|
||||
struct b43_wldev *wldev = ssb_get_drvdata(dev);
|
||||
@ -5083,8 +5060,8 @@ void b43_controller_restart(struct b43_wldev *dev, const char *reason)
|
||||
static struct ssb_driver b43_ssb_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.id_table = b43_ssb_tbl,
|
||||
.probe = b43_probe,
|
||||
.remove = b43_remove,
|
||||
.probe = b43_ssb_probe,
|
||||
.remove = b43_ssb_remove,
|
||||
};
|
||||
|
||||
static void b43_print_driverinfo(void)
|
||||
|
@ -133,6 +133,7 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags);
|
||||
|
||||
void b43_mac_suspend(struct b43_wldev *dev);
|
||||
void b43_mac_enable(struct b43_wldev *dev);
|
||||
void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on);
|
||||
|
||||
|
||||
struct b43_request_fw_context;
|
||||
|
@ -3540,17 +3540,6 @@ static int b43_nphy_cal_rx_iq(struct b43_wldev *dev,
|
||||
return b43_nphy_rev2_cal_rx_iq(dev, target, type, debug);
|
||||
}
|
||||
|
||||
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
|
||||
static void b43_nphy_mac_phy_clock_set(struct b43_wldev *dev, bool on)
|
||||
{
|
||||
u32 tmslow = ssb_read32(dev->dev, SSB_TMSLOW);
|
||||
if (on)
|
||||
tmslow |= B43_TMSLOW_MACPHYCLKEN;
|
||||
else
|
||||
tmslow &= ~B43_TMSLOW_MACPHYCLKEN;
|
||||
ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
|
||||
}
|
||||
|
||||
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
|
||||
static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
|
||||
{
|
||||
@ -3691,7 +3680,7 @@ int b43_phy_initn(struct b43_wldev *dev)
|
||||
b43_phy_write(dev, B43_NPHY_BBCFG, tmp & ~B43_NPHY_BBCFG_RSTCCA);
|
||||
b43_nphy_bmac_clock_fgc(dev, 0);
|
||||
|
||||
b43_nphy_mac_phy_clock_set(dev, true);
|
||||
b43_mac_phy_clock_set(dev, true);
|
||||
|
||||
b43_nphy_pa_override(dev, false);
|
||||
b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX);
|
||||
|
@ -2234,7 +2234,7 @@ static int b43legacy_chip_init(struct b43legacy_wldev *dev)
|
||||
b43legacy_write32(dev, B43legacy_MMIO_DMA5_IRQ_MASK, 0x0000DC00);
|
||||
|
||||
value32 = ssb_read32(dev->dev, SSB_TMSLOW);
|
||||
value32 |= 0x00100000;
|
||||
value32 |= B43legacy_TMSLOW_MACPHYCLKEN;
|
||||
ssb_write32(dev->dev, SSB_TMSLOW, value32);
|
||||
|
||||
b43legacy_write16(dev, B43legacy_MMIO_POWERUP_DELAY,
|
||||
@ -3104,37 +3104,6 @@ static void setup_struct_wldev_for_init(struct b43legacy_wldev *dev)
|
||||
memset(&dev->noisecalc, 0, sizeof(dev->noisecalc));
|
||||
}
|
||||
|
||||
static void b43legacy_imcfglo_timeouts_workaround(struct b43legacy_wldev *dev)
|
||||
{
|
||||
#ifdef CONFIG_SSB_DRIVER_PCICORE
|
||||
struct ssb_bus *bus = dev->dev->bus;
|
||||
u32 tmp;
|
||||
|
||||
if (bus->pcicore.dev &&
|
||||
bus->pcicore.dev->id.coreid == SSB_DEV_PCI &&
|
||||
bus->pcicore.dev->id.revision <= 5) {
|
||||
/* IMCFGLO timeouts workaround. */
|
||||
tmp = ssb_read32(dev->dev, SSB_IMCFGLO);
|
||||
switch (bus->bustype) {
|
||||
case SSB_BUSTYPE_PCI:
|
||||
case SSB_BUSTYPE_PCMCIA:
|
||||
tmp &= ~SSB_IMCFGLO_REQTO;
|
||||
tmp &= ~SSB_IMCFGLO_SERTO;
|
||||
tmp |= 0x32;
|
||||
break;
|
||||
case SSB_BUSTYPE_SSB:
|
||||
tmp &= ~SSB_IMCFGLO_REQTO;
|
||||
tmp &= ~SSB_IMCFGLO_SERTO;
|
||||
tmp |= 0x53;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ssb_write32(dev->dev, SSB_IMCFGLO, tmp);
|
||||
}
|
||||
#endif /* CONFIG_SSB_DRIVER_PCICORE */
|
||||
}
|
||||
|
||||
static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
|
||||
bool idle) {
|
||||
u16 pu_delay = 1050;
|
||||
@ -3278,7 +3247,6 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
|
||||
/* Enable IRQ routing to this device. */
|
||||
ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev);
|
||||
|
||||
b43legacy_imcfglo_timeouts_workaround(dev);
|
||||
prepare_phy_data_for_init(dev);
|
||||
b43legacy_phy_calibrate(dev);
|
||||
err = b43legacy_chip_init(dev);
|
||||
@ -3728,26 +3696,8 @@ static int b43legacy_one_core_attach(struct ssb_device *dev,
|
||||
struct b43legacy_wl *wl)
|
||||
{
|
||||
struct b43legacy_wldev *wldev;
|
||||
struct pci_dev *pdev;
|
||||
int err = -ENOMEM;
|
||||
|
||||
if (!list_empty(&wl->devlist)) {
|
||||
/* We are not the first core on this chip. */
|
||||
pdev = (dev->bus->bustype == SSB_BUSTYPE_PCI) ? dev->bus->host_pci : NULL;
|
||||
/* Only special chips support more than one wireless
|
||||
* core, although some of the other chips have more than
|
||||
* one wireless core as well. Check for this and
|
||||
* bail out early.
|
||||
*/
|
||||
if (!pdev ||
|
||||
((pdev->device != 0x4321) &&
|
||||
(pdev->device != 0x4313) &&
|
||||
(pdev->device != 0x431A))) {
|
||||
b43legacydbg(wl, "Ignoring unconnected 802.11 core\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
wldev = kzalloc(sizeof(*wldev), GFP_KERNEL);
|
||||
if (!wldev)
|
||||
goto out;
|
||||
|
@ -2604,7 +2604,7 @@ static ssize_t iwl4965_rs_sta_dbgfs_scale_table_write(struct file *file,
|
||||
struct iwl_lq_sta *lq_sta = file->private_data;
|
||||
struct iwl_priv *priv;
|
||||
char buf[64];
|
||||
int buf_size;
|
||||
size_t buf_size;
|
||||
u32 parsed_rate;
|
||||
struct iwl_station_priv *sta_priv =
|
||||
container_of(lq_sta, struct iwl_station_priv, lq_sta);
|
||||
|
@ -102,6 +102,16 @@ config IWLWIFI_DEVICE_TRACING
|
||||
occur.
|
||||
endmenu
|
||||
|
||||
config IWLWIFI_DEVICE_SVTOOL
|
||||
bool "iwlwifi device svtool support"
|
||||
depends on IWLAGN
|
||||
select NL80211_TESTMODE
|
||||
help
|
||||
This option enables the svtool support for iwlwifi device through
|
||||
NL80211_TESTMODE. svtool is a software validation tool that runs in
|
||||
the user space and interacts with the device in the kernel space
|
||||
through the generic netlink message via NL80211_TESTMODE channel.
|
||||
|
||||
config IWL_P2P
|
||||
bool "iwlwifi experimental P2P support"
|
||||
depends on IWLAGN
|
||||
|
@ -16,6 +16,7 @@ iwlagn-objs += iwl-2000.o
|
||||
|
||||
iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
|
||||
iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
|
||||
iwlagn-$(CONFIG_IWLWIFI_DEVICE_SVTOOL) += iwl-sv-open.o
|
||||
|
||||
CFLAGS_iwl-devtrace.o := -I$(src)
|
||||
|
||||
|
@ -171,8 +171,6 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
|
||||
|
||||
static struct iwl_lib_ops iwl1000_lib = {
|
||||
.set_hw_params = iwl1000_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
|
@ -252,8 +252,6 @@ static int iwl2030_hw_channel_switch(struct iwl_priv *priv,
|
||||
|
||||
static struct iwl_lib_ops iwl2000_lib = {
|
||||
.set_hw_params = iwl2000_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
|
@ -339,8 +339,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
|
||||
|
||||
static struct iwl_lib_ops iwl5000_lib = {
|
||||
.set_hw_params = iwl5000_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
@ -376,8 +374,6 @@ static struct iwl_lib_ops iwl5000_lib = {
|
||||
|
||||
static struct iwl_lib_ops iwl5150_lib = {
|
||||
.set_hw_params = iwl5150_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
|
@ -278,8 +278,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
|
||||
|
||||
static struct iwl_lib_ops iwl6000_lib = {
|
||||
.set_hw_params = iwl6000_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
@ -316,8 +314,6 @@ static struct iwl_lib_ops iwl6000_lib = {
|
||||
|
||||
static struct iwl_lib_ops iwl6030_lib = {
|
||||
.set_hw_params = iwl6000_hw_set_hw_params,
|
||||
.txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
|
||||
.txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
|
||||
.txq_set_sched = iwlagn_txq_set_sched,
|
||||
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
|
||||
.txq_free_tfd = iwl_hw_txq_free_tfd,
|
||||
|
@ -54,12 +54,6 @@ int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
|
||||
}
|
||||
}
|
||||
|
||||
/* Currently this is the superset of everything */
|
||||
static u16 iwlagn_get_hcmd_size(u8 cmd_id, u16 len)
|
||||
{
|
||||
return len;
|
||||
}
|
||||
|
||||
static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
|
||||
{
|
||||
u16 size = (u16)sizeof(struct iwl_addsta_cmd);
|
||||
@ -332,7 +326,6 @@ struct iwl_hcmd_ops iwlagn_bt_hcmd = {
|
||||
};
|
||||
|
||||
struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
|
||||
.get_hcmd_size = iwlagn_get_hcmd_size,
|
||||
.build_addsta_hcmd = iwlagn_build_addsta_hcmd,
|
||||
.gain_computation = iwlagn_gain_computation,
|
||||
.chain_noise_reset = iwlagn_chain_noise_reset,
|
||||
|
@ -3086,7 +3086,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
|
||||
struct iwl_lq_sta *lq_sta = file->private_data;
|
||||
struct iwl_priv *priv;
|
||||
char buf[64];
|
||||
int buf_size;
|
||||
size_t buf_size;
|
||||
u32 parsed_rate;
|
||||
struct iwl_station_priv *sta_priv =
|
||||
container_of(lq_sta, struct iwl_station_priv, lq_sta);
|
||||
|
@ -98,9 +98,9 @@ static inline int get_fifo_from_tid(struct iwl_rxon_context *ctx, u16 tid)
|
||||
/**
|
||||
* iwlagn_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
|
||||
*/
|
||||
void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
u16 byte_cnt)
|
||||
static void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
u16 byte_cnt)
|
||||
{
|
||||
struct iwlagn_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr;
|
||||
int write_ptr = txq->q.write_ptr;
|
||||
@ -112,21 +112,19 @@ void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
|
||||
WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX);
|
||||
|
||||
if (txq_id != priv->cmd_queue) {
|
||||
sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id;
|
||||
sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl;
|
||||
sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id;
|
||||
sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl;
|
||||
|
||||
switch (sec_ctl & TX_CMD_SEC_MSK) {
|
||||
case TX_CMD_SEC_CCM:
|
||||
len += CCMP_MIC_LEN;
|
||||
break;
|
||||
case TX_CMD_SEC_TKIP:
|
||||
len += TKIP_ICV_LEN;
|
||||
break;
|
||||
case TX_CMD_SEC_WEP:
|
||||
len += WEP_IV_LEN + WEP_ICV_LEN;
|
||||
break;
|
||||
}
|
||||
switch (sec_ctl & TX_CMD_SEC_MSK) {
|
||||
case TX_CMD_SEC_CCM:
|
||||
len += CCMP_MIC_LEN;
|
||||
break;
|
||||
case TX_CMD_SEC_TKIP:
|
||||
len += TKIP_ICV_LEN;
|
||||
break;
|
||||
case TX_CMD_SEC_WEP:
|
||||
len += WEP_IV_LEN + WEP_ICV_LEN;
|
||||
break;
|
||||
}
|
||||
|
||||
bc_ent = cpu_to_le16((len & 0xFFF) | (sta_id << 12));
|
||||
@ -138,8 +136,8 @@ void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent;
|
||||
}
|
||||
|
||||
void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq)
|
||||
static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq)
|
||||
{
|
||||
struct iwlagn_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr;
|
||||
int txq_id = txq->q.id;
|
||||
@ -539,7 +537,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
struct iwl_tx_cmd *tx_cmd;
|
||||
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
|
||||
int txq_id;
|
||||
dma_addr_t phys_addr;
|
||||
dma_addr_t phys_addr = 0;
|
||||
dma_addr_t txcmd_phys;
|
||||
dma_addr_t scratch_phys;
|
||||
u16 len, firstlen, secondlen;
|
||||
@ -566,7 +564,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
if (iwl_is_rfkill(priv)) {
|
||||
IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
|
||||
goto drop_unlock;
|
||||
goto drop_unlock_priv;
|
||||
}
|
||||
|
||||
fc = hdr->frame_control;
|
||||
@ -591,7 +589,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
if (sta_id == IWL_INVALID_STATION) {
|
||||
IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
|
||||
hdr->addr1);
|
||||
goto drop_unlock;
|
||||
goto drop_unlock_priv;
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,10 +633,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
if (ieee80211_is_data_qos(fc)) {
|
||||
qc = ieee80211_get_qos_ctl(hdr);
|
||||
tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
if (WARN_ON_ONCE(tid >= MAX_TID_COUNT)) {
|
||||
spin_unlock(&priv->sta_lock);
|
||||
goto drop_unlock;
|
||||
}
|
||||
|
||||
if (WARN_ON_ONCE(tid >= MAX_TID_COUNT))
|
||||
goto drop_unlock_sta;
|
||||
|
||||
seq_number = priv->stations[sta_id].tid[tid].seq_number;
|
||||
seq_number &= IEEE80211_SCTL_SEQ;
|
||||
hdr->seq_ctrl = hdr->seq_ctrl &
|
||||
@ -656,18 +654,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
txq = &priv->txq[txq_id];
|
||||
q = &txq->q;
|
||||
|
||||
if (unlikely(iwl_queue_space(q) < q->high_mark)) {
|
||||
spin_unlock(&priv->sta_lock);
|
||||
goto drop_unlock;
|
||||
}
|
||||
|
||||
if (ieee80211_is_data_qos(fc)) {
|
||||
priv->stations[sta_id].tid[tid].tfds_in_queue++;
|
||||
if (!ieee80211_has_morefrags(fc))
|
||||
priv->stations[sta_id].tid[tid].seq_number = seq_number;
|
||||
}
|
||||
|
||||
spin_unlock(&priv->sta_lock);
|
||||
if (unlikely(iwl_queue_space(q) < q->high_mark))
|
||||
goto drop_unlock_sta;
|
||||
|
||||
/* Set up driver data for this TFD */
|
||||
memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
|
||||
@ -731,12 +719,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
txcmd_phys = pci_map_single(priv->pci_dev,
|
||||
&out_cmd->hdr, firstlen,
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
if (unlikely(pci_dma_mapping_error(priv->pci_dev, txcmd_phys)))
|
||||
goto drop_unlock_sta;
|
||||
dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
|
||||
dma_unmap_len_set(out_meta, len, firstlen);
|
||||
/* Add buffer containing Tx command and MAC(!) header to TFD's
|
||||
* first entry */
|
||||
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
|
||||
txcmd_phys, firstlen, 1, 0);
|
||||
|
||||
if (!ieee80211_has_morefrags(hdr->frame_control)) {
|
||||
txq->need_update = 1;
|
||||
@ -751,10 +737,30 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
if (secondlen > 0) {
|
||||
phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
|
||||
secondlen, PCI_DMA_TODEVICE);
|
||||
if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) {
|
||||
pci_unmap_single(priv->pci_dev,
|
||||
dma_unmap_addr(out_meta, mapping),
|
||||
dma_unmap_len(out_meta, len),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
goto drop_unlock_sta;
|
||||
}
|
||||
}
|
||||
|
||||
if (ieee80211_is_data_qos(fc)) {
|
||||
priv->stations[sta_id].tid[tid].tfds_in_queue++;
|
||||
if (!ieee80211_has_morefrags(fc))
|
||||
priv->stations[sta_id].tid[tid].seq_number = seq_number;
|
||||
}
|
||||
|
||||
spin_unlock(&priv->sta_lock);
|
||||
|
||||
/* Attach buffers to TFD */
|
||||
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
|
||||
txcmd_phys, firstlen, 1, 0);
|
||||
if (secondlen > 0)
|
||||
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
|
||||
phys_addr, secondlen,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
|
||||
offsetof(struct iwl_tx_cmd, scratch);
|
||||
@ -773,8 +779,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
|
||||
/* Set up entry for this TFD in Tx byte-count array */
|
||||
if (info->flags & IEEE80211_TX_CTL_AMPDU)
|
||||
priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq,
|
||||
le16_to_cpu(tx_cmd->len));
|
||||
iwlagn_txq_update_byte_cnt_tbl(priv, txq,
|
||||
le16_to_cpu(tx_cmd->len));
|
||||
|
||||
pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
|
||||
firstlen, PCI_DMA_BIDIRECTIONAL);
|
||||
@ -820,7 +826,9 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
|
||||
|
||||
return 0;
|
||||
|
||||
drop_unlock:
|
||||
drop_unlock_sta:
|
||||
spin_unlock(&priv->sta_lock);
|
||||
drop_unlock_priv:
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
return -1;
|
||||
}
|
||||
@ -1253,8 +1261,7 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
|
||||
txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
|
||||
tx_info->skb = NULL;
|
||||
|
||||
if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
|
||||
priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq);
|
||||
iwlagn_txq_inval_byte_cnt_tbl(priv, txq);
|
||||
|
||||
priv->cfg->ops->lib->txq_free_tfd(priv, txq);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void iwlagn_rx_calib_result(struct iwl_priv *priv,
|
||||
iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len);
|
||||
}
|
||||
|
||||
static int iwlagn_init_alive_start(struct iwl_priv *priv)
|
||||
int iwlagn_init_alive_start(struct iwl_priv *priv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -102,70 +102,6 @@ void iwl_update_chain_flags(struct iwl_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_clear_free_frames(struct iwl_priv *priv)
|
||||
{
|
||||
struct list_head *element;
|
||||
|
||||
IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
|
||||
priv->frames_count);
|
||||
|
||||
while (!list_empty(&priv->free_frames)) {
|
||||
element = priv->free_frames.next;
|
||||
list_del(element);
|
||||
kfree(list_entry(element, struct iwl_frame, list));
|
||||
priv->frames_count--;
|
||||
}
|
||||
|
||||
if (priv->frames_count) {
|
||||
IWL_WARN(priv, "%d frames still in use. Did we lose one?\n",
|
||||
priv->frames_count);
|
||||
priv->frames_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_frame *frame;
|
||||
struct list_head *element;
|
||||
if (list_empty(&priv->free_frames)) {
|
||||
frame = kzalloc(sizeof(*frame), GFP_KERNEL);
|
||||
if (!frame) {
|
||||
IWL_ERR(priv, "Could not allocate frame!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
priv->frames_count++;
|
||||
return frame;
|
||||
}
|
||||
|
||||
element = priv->free_frames.next;
|
||||
list_del(element);
|
||||
return list_entry(element, struct iwl_frame, list);
|
||||
}
|
||||
|
||||
static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame)
|
||||
{
|
||||
memset(frame, 0, sizeof(*frame));
|
||||
list_add(&frame->list, &priv->free_frames);
|
||||
}
|
||||
|
||||
static u32 iwl_fill_beacon_frame(struct iwl_priv *priv,
|
||||
struct ieee80211_hdr *hdr,
|
||||
int left)
|
||||
{
|
||||
lockdep_assert_held(&priv->mutex);
|
||||
|
||||
if (!priv->beacon_skb)
|
||||
return 0;
|
||||
|
||||
if (priv->beacon_skb->len > left)
|
||||
return 0;
|
||||
|
||||
memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len);
|
||||
|
||||
return priv->beacon_skb->len;
|
||||
}
|
||||
|
||||
/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */
|
||||
static void iwl_set_beacon_tim(struct iwl_priv *priv,
|
||||
struct iwl_tx_beacon_cmd *tx_beacon_cmd,
|
||||
@ -193,13 +129,18 @@ static void iwl_set_beacon_tim(struct iwl_priv *priv,
|
||||
IWL_WARN(priv, "Unable to find TIM Element in beacon\n");
|
||||
}
|
||||
|
||||
static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
|
||||
struct iwl_frame *frame)
|
||||
int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_tx_beacon_cmd *tx_beacon_cmd;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = REPLY_TX_BEACON,
|
||||
.flags = CMD_SIZE_HUGE,
|
||||
};
|
||||
u32 frame_size;
|
||||
u32 rate_flags;
|
||||
u32 rate;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* We have to set up the TX command, the TX Beacon command, and the
|
||||
* beacon contents.
|
||||
@ -212,17 +153,19 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize memory */
|
||||
tx_beacon_cmd = &frame->u.beacon;
|
||||
memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
|
||||
if (WARN_ON(!priv->beacon_skb))
|
||||
return -EINVAL;
|
||||
|
||||
/* Allocate beacon memory */
|
||||
tx_beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd) + priv->beacon_skb->len,
|
||||
GFP_KERNEL);
|
||||
if (!tx_beacon_cmd)
|
||||
return -ENOMEM;
|
||||
|
||||
frame_size = priv->beacon_skb->len;
|
||||
|
||||
/* Set up TX beacon contents */
|
||||
frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame,
|
||||
sizeof(frame->u) - sizeof(*tx_beacon_cmd));
|
||||
if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE))
|
||||
return 0;
|
||||
if (!frame_size)
|
||||
return 0;
|
||||
memcpy(tx_beacon_cmd->frame, priv->beacon_skb->data, frame_size);
|
||||
|
||||
/* Set up TX command fields */
|
||||
tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);
|
||||
@ -245,41 +188,16 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
|
||||
tx_beacon_cmd->tx.rate_n_flags = iwl_hw_set_rate_n_flags(rate,
|
||||
rate_flags);
|
||||
|
||||
return sizeof(*tx_beacon_cmd) + frame_size;
|
||||
}
|
||||
/* Submit command */
|
||||
cmd.len = sizeof(*tx_beacon_cmd) + frame_size;
|
||||
cmd.data = tx_beacon_cmd;
|
||||
|
||||
int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_frame *frame;
|
||||
unsigned int frame_size;
|
||||
int rc;
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = REPLY_TX_BEACON,
|
||||
.flags = CMD_SIZE_HUGE,
|
||||
};
|
||||
err = iwl_send_cmd_sync(priv, &cmd);
|
||||
|
||||
frame = iwl_get_free_frame(priv);
|
||||
if (!frame) {
|
||||
IWL_ERR(priv, "Could not obtain free frame buffer for beacon "
|
||||
"command.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
/* Free temporary storage */
|
||||
kfree(tx_beacon_cmd);
|
||||
|
||||
frame_size = iwl_hw_get_beacon_cmd(priv, frame);
|
||||
if (!frame_size) {
|
||||
IWL_ERR(priv, "Error configuring the beacon command\n");
|
||||
iwl_free_frame(priv, frame);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cmd.len = frame_size;
|
||||
cmd.data = &frame->u.cmd[0];
|
||||
|
||||
rc = iwl_send_cmd_sync(priv, &cmd);
|
||||
|
||||
iwl_free_frame(priv, frame);
|
||||
|
||||
return rc;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
|
||||
@ -776,6 +694,8 @@ static void iwl_rx_handle(struct iwl_priv *priv)
|
||||
|
||||
wake_up_all(&priv->_agn.notif_waitq);
|
||||
}
|
||||
if (priv->pre_rx_handler)
|
||||
priv->pre_rx_handler(priv, rxb);
|
||||
|
||||
/* Based on type of command response or notification,
|
||||
* handle those that need handling via function in
|
||||
@ -2211,7 +2131,7 @@ static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
|
||||
* from protocol/runtime uCode (initialization uCode's
|
||||
* Alive gets handled by iwl_init_alive_start()).
|
||||
*/
|
||||
static int iwl_alive_start(struct iwl_priv *priv)
|
||||
int iwl_alive_start(struct iwl_priv *priv)
|
||||
{
|
||||
int ret = 0;
|
||||
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
|
||||
@ -2354,9 +2274,6 @@ static void __iwl_down(struct iwl_priv *priv)
|
||||
|
||||
dev_kfree_skb(priv->beacon_skb);
|
||||
priv->beacon_skb = NULL;
|
||||
|
||||
/* clear out any free frames */
|
||||
iwl_clear_free_frames(priv);
|
||||
}
|
||||
|
||||
static void iwl_down(struct iwl_priv *priv)
|
||||
@ -3414,8 +3331,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
|
||||
spin_lock_init(&priv->sta_lock);
|
||||
spin_lock_init(&priv->hcmd_lock);
|
||||
|
||||
INIT_LIST_HEAD(&priv->free_frames);
|
||||
|
||||
mutex_init(&priv->mutex);
|
||||
|
||||
priv->ieee_channels = NULL;
|
||||
@ -3507,6 +3422,7 @@ struct ieee80211_ops iwlagn_hw_ops = {
|
||||
.cancel_remain_on_channel = iwl_mac_cancel_remain_on_channel,
|
||||
.offchannel_tx = iwl_mac_offchannel_tx,
|
||||
.offchannel_tx_cancel_wait = iwl_mac_offchannel_tx_cancel_wait,
|
||||
CFG80211_TESTMODE_CMD(iwl_testmode_cmd)
|
||||
};
|
||||
|
||||
static u32 iwl_hw_detect(struct iwl_priv *priv)
|
||||
@ -3816,6 +3732,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
iwl_setup_deferred_work(priv);
|
||||
iwl_setup_rx_handlers(priv);
|
||||
iwl_testmode_init(priv);
|
||||
|
||||
/*********************************************
|
||||
* 8. Enable interrupts and read RFKILL state
|
||||
|
@ -139,11 +139,6 @@ void iwlagn_set_wr_ptrs(struct iwl_priv *priv,
|
||||
void iwlagn_tx_queue_set_status(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
int tx_fifo_id, int scd_retry);
|
||||
void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
u16 byte_cnt);
|
||||
void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq);
|
||||
void iwlagn_txq_set_sched(struct iwl_priv *priv, u32 mask);
|
||||
void iwl_free_tfds_in_queue(struct iwl_priv *priv,
|
||||
int sta_id, int tid, int freed);
|
||||
@ -344,5 +339,22 @@ iwlagn_wait_notification(struct iwl_priv *priv,
|
||||
void __releases(wait_entry)
|
||||
iwlagn_remove_notification(struct iwl_priv *priv,
|
||||
struct iwl_notification_wait *wait_entry);
|
||||
extern int iwlagn_init_alive_start(struct iwl_priv *priv);
|
||||
extern int iwl_alive_start(struct iwl_priv *priv);
|
||||
/* svtool */
|
||||
#ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
|
||||
extern int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len);
|
||||
extern void iwl_testmode_init(struct iwl_priv *priv);
|
||||
#else
|
||||
static inline
|
||||
int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
static inline
|
||||
void iwl_testmode_init(struct iwl_priv *priv)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __iwl_agn_h__ */
|
||||
|
@ -99,7 +99,6 @@ struct iwl_hcmd_ops {
|
||||
};
|
||||
|
||||
struct iwl_hcmd_utils_ops {
|
||||
u16 (*get_hcmd_size)(u8 cmd_id, u16 len);
|
||||
u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data);
|
||||
void (*gain_computation)(struct iwl_priv *priv,
|
||||
u32 *average_noise,
|
||||
@ -129,11 +128,6 @@ struct iwl_lib_ops {
|
||||
/* set hw dependent parameters */
|
||||
int (*set_hw_params)(struct iwl_priv *priv);
|
||||
/* Handling TX */
|
||||
void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
u16 byte_cnt);
|
||||
void (*txq_inval_byte_cnt_tbl)(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq);
|
||||
void (*txq_set_sched)(struct iwl_priv *priv, u32 mask);
|
||||
int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv,
|
||||
struct iwl_tx_queue *txq,
|
||||
|
@ -238,15 +238,6 @@ struct iwl_channel_info {
|
||||
#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
|
||||
#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
|
||||
|
||||
struct iwl_frame {
|
||||
union {
|
||||
struct ieee80211_hdr frame;
|
||||
struct iwl_tx_beacon_cmd beacon;
|
||||
u8 raw[IEEE80211_FRAME_LEN];
|
||||
u8 cmd[360];
|
||||
} u;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
|
||||
#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
|
||||
@ -1188,12 +1179,10 @@ struct iwl_priv {
|
||||
struct ieee80211_rate *ieee_rates;
|
||||
struct iwl_cfg *cfg;
|
||||
|
||||
/* temporary frame storage list */
|
||||
struct list_head free_frames;
|
||||
int frames_count;
|
||||
|
||||
enum ieee80211_band band;
|
||||
|
||||
void (*pre_rx_handler)(struct iwl_priv *priv,
|
||||
struct iwl_rx_mem_buffer *rxb);
|
||||
void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
|
||||
struct iwl_rx_mem_buffer *rxb);
|
||||
|
||||
@ -1569,21 +1558,24 @@ iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)
|
||||
ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
|
||||
if (priv->valid_contexts & BIT(ctx->ctxid))
|
||||
|
||||
static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
|
||||
{
|
||||
return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int iwl_is_associated(struct iwl_priv *priv,
|
||||
enum iwl_rxon_context_id ctxid)
|
||||
{
|
||||
return (priv->contexts[ctxid].active.filter_flags &
|
||||
RXON_FILTER_ASSOC_MSK) ? 1 : 0;
|
||||
return iwl_is_associated_ctx(&priv->contexts[ctxid]);
|
||||
}
|
||||
|
||||
static inline int iwl_is_any_associated(struct iwl_priv *priv)
|
||||
{
|
||||
return iwl_is_associated(priv, IWL_RXON_CTX_BSS);
|
||||
}
|
||||
|
||||
static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
|
||||
{
|
||||
return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
|
||||
struct iwl_rxon_context *ctx;
|
||||
for_each_context(priv, ctx)
|
||||
if (iwl_is_associated_ctx(ctx))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
|
||||
|
@ -48,8 +48,21 @@ module_param(led_mode, int, S_IRUGO);
|
||||
MODULE_PARM_DESC(led_mode, "0=system default, "
|
||||
"1=On(RF On)/Off(RF Off), 2=blinking");
|
||||
|
||||
/* Throughput OFF time(ms) ON time (ms)
|
||||
* >300 25 25
|
||||
* >200 to 300 40 40
|
||||
* >100 to 200 55 55
|
||||
* >70 to 100 65 65
|
||||
* >50 to 70 75 75
|
||||
* >20 to 50 85 85
|
||||
* >10 to 20 95 95
|
||||
* >5 to 10 110 110
|
||||
* >1 to 5 130 130
|
||||
* >0 to 1 167 167
|
||||
* <=0 SOLID ON
|
||||
*/
|
||||
static const struct ieee80211_tpt_blink iwl_blink[] = {
|
||||
{ .throughput = 0 * 1024 - 1, .blink_time = 334 },
|
||||
{ .throughput = 0, .blink_time = 334 },
|
||||
{ .throughput = 1 * 1024 - 1, .blink_time = 260 },
|
||||
{ .throughput = 5 * 1024 - 1, .blink_time = 220 },
|
||||
{ .throughput = 10 * 1024 - 1, .blink_time = 190 },
|
||||
@ -125,6 +138,11 @@ static int iwl_led_cmd(struct iwl_priv *priv,
|
||||
if (priv->blink_on == on && priv->blink_off == off)
|
||||
return 0;
|
||||
|
||||
if (off == 0) {
|
||||
/* led is SOLID_ON */
|
||||
on = IWL_LED_SOLID;
|
||||
}
|
||||
|
||||
IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n",
|
||||
priv->cfg->base_params->led_compensation);
|
||||
led_cmd.on = iwl_blink_compensation(priv, on,
|
||||
|
469
drivers/net/wireless/iwlwifi/iwl-sv-open.c
Normal file
469
drivers/net/wireless/iwlwifi/iwl-sv-open.c
Normal file
@ -0,0 +1,469 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
* redistributing this file, you may do so under either license.
|
||||
*
|
||||
* GPL LICENSE SUMMARY
|
||||
*
|
||||
* Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
||||
* USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution
|
||||
* in the file called LICENSE.GPL.
|
||||
*
|
||||
* Contact Information:
|
||||
* Intel Linux Wireless <ilw@linux.intel.com>
|
||||
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
*
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name Intel Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/cfg80211.h>
|
||||
#include <net/mac80211.h>
|
||||
#include <net/netlink.h>
|
||||
|
||||
|
||||
#include "iwl-dev.h"
|
||||
#include "iwl-core.h"
|
||||
#include "iwl-debug.h"
|
||||
#include "iwl-fh.h"
|
||||
#include "iwl-io.h"
|
||||
#include "iwl-agn.h"
|
||||
#include "iwl-testmode.h"
|
||||
|
||||
|
||||
/* The TLVs used in the gnl message policy between the kernel module and
|
||||
* user space application. iwl_testmode_gnl_msg_policy is to be carried
|
||||
* through the NL80211_CMD_TESTMODE channel regulated by nl80211.
|
||||
* See iwl-testmode.h
|
||||
*/
|
||||
static
|
||||
struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
|
||||
[IWL_TM_ATTR_COMMAND] = { .type = NLA_U32, },
|
||||
|
||||
[IWL_TM_ATTR_UCODE_CMD_ID] = { .type = NLA_U8, },
|
||||
[IWL_TM_ATTR_UCODE_CMD_DATA] = { .type = NLA_UNSPEC, },
|
||||
|
||||
[IWL_TM_ATTR_REG_OFFSET] = { .type = NLA_U32, },
|
||||
[IWL_TM_ATTR_REG_VALUE8] = { .type = NLA_U8, },
|
||||
[IWL_TM_ATTR_REG_VALUE32] = { .type = NLA_U32, },
|
||||
|
||||
[IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, },
|
||||
[IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, },
|
||||
};
|
||||
|
||||
/*
|
||||
* See the struct iwl_rx_packet in iwl-commands.h for the format of the
|
||||
* received events from the device
|
||||
*/
|
||||
static inline int get_event_length(struct iwl_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
||||
if (pkt)
|
||||
return le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function multicasts the spontaneous messages from the device to the
|
||||
* user space. It is invoked whenever there is a received messages
|
||||
* from the device. This function is called within the ISR of the rx handlers
|
||||
* in iwlagn driver.
|
||||
*
|
||||
* The parsing of the message content is left to the user space application,
|
||||
* The message content is treated as unattacked raw data and is encapsulated
|
||||
* with IWL_TM_ATTR_UCODE_RX_PKT multicasting to the user space.
|
||||
*
|
||||
* @priv: the instance of iwlwifi device
|
||||
* @rxb: pointer to rx data content received by the ISR
|
||||
*
|
||||
* See the message policies and TLVs in iwl_testmode_gnl_msg_policy[].
|
||||
* For the messages multicasting to the user application, the mandatory
|
||||
* TLV fields are :
|
||||
* IWL_TM_ATTR_COMMAND must be IWL_TM_CMD_DEV2APP_UCODE_RX_PKT
|
||||
* IWL_TM_ATTR_UCODE_RX_PKT for carrying the message content
|
||||
*/
|
||||
|
||||
static void iwl_testmode_ucode_rx_pkt(struct iwl_priv *priv,
|
||||
struct iwl_rx_mem_buffer *rxb)
|
||||
{
|
||||
struct ieee80211_hw *hw = priv->hw;
|
||||
struct sk_buff *skb;
|
||||
void *data;
|
||||
int length;
|
||||
|
||||
data = (void *)rxb_addr(rxb);
|
||||
length = get_event_length(rxb);
|
||||
|
||||
if (!data || length == 0)
|
||||
return;
|
||||
|
||||
skb = cfg80211_testmode_alloc_event_skb(hw->wiphy, 20 + length,
|
||||
GFP_ATOMIC);
|
||||
if (skb == NULL) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Run out of memory for messages to user space ?\n");
|
||||
return;
|
||||
}
|
||||
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND, IWL_TM_CMD_DEV2APP_UCODE_RX_PKT);
|
||||
NLA_PUT(skb, IWL_TM_ATTR_UCODE_RX_PKT, length, data);
|
||||
cfg80211_testmode_event(skb, GFP_ATOMIC);
|
||||
return;
|
||||
|
||||
nla_put_failure:
|
||||
kfree_skb(skb);
|
||||
IWL_DEBUG_INFO(priv, "Ouch, overran buffer, check allocation!\n");
|
||||
}
|
||||
|
||||
void iwl_testmode_init(struct iwl_priv *priv)
|
||||
{
|
||||
priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function handles the user application commands to the ucode.
|
||||
*
|
||||
* It retrieves the mandatory fields IWL_TM_ATTR_UCODE_CMD_ID and
|
||||
* IWL_TM_ATTR_UCODE_CMD_DATA and calls to the handler to send the
|
||||
* host command to the ucode.
|
||||
*
|
||||
* If any mandatory field is missing, -ENOMSG is replied to the user space
|
||||
* application; otherwise, the actual execution result of the host command to
|
||||
* ucode is replied.
|
||||
*
|
||||
* @hw: ieee80211_hw object that represents the device
|
||||
* @tb: gnl message fields from the user space
|
||||
*/
|
||||
static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||
{
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
struct iwl_host_cmd cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(struct iwl_host_cmd));
|
||||
|
||||
if (!tb[IWL_TM_ATTR_UCODE_CMD_ID] ||
|
||||
!tb[IWL_TM_ATTR_UCODE_CMD_DATA]) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error finding ucode command mandatory fields\n");
|
||||
return -ENOMSG;
|
||||
}
|
||||
|
||||
cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]);
|
||||
cmd.data = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
|
||||
cmd.len = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
|
||||
IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
|
||||
" len %d\n", cmd.id, cmd.flags, cmd.len);
|
||||
/* ok, let's submit the command to ucode */
|
||||
return iwl_send_cmd(priv, &cmd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function handles the user application commands for register access.
|
||||
*
|
||||
* It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the
|
||||
* handlers respectively.
|
||||
*
|
||||
* If it's an unknown commdn ID, -ENOSYS is returned; or -ENOMSG if the
|
||||
* mandatory fields(IWL_TM_ATTR_REG_OFFSET,IWL_TM_ATTR_REG_VALUE32,
|
||||
* IWL_TM_ATTR_REG_VALUE8) are missing; Otherwise 0 is replied indicating
|
||||
* the success of the command execution.
|
||||
*
|
||||
* If IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_READ32, the register read
|
||||
* value is returned with IWL_TM_ATTR_REG_VALUE32.
|
||||
*
|
||||
* @hw: ieee80211_hw object that represents the device
|
||||
* @tb: gnl message fields from the user space
|
||||
*/
|
||||
static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||
{
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
u32 ofs, val32;
|
||||
u8 val8;
|
||||
struct sk_buff *skb;
|
||||
int status = 0;
|
||||
|
||||
if (!tb[IWL_TM_ATTR_REG_OFFSET]) {
|
||||
IWL_DEBUG_INFO(priv, "Error finding register offset\n");
|
||||
return -ENOMSG;
|
||||
}
|
||||
ofs = nla_get_u32(tb[IWL_TM_ATTR_REG_OFFSET]);
|
||||
IWL_INFO(priv, "testmode register access command offset 0x%x\n", ofs);
|
||||
|
||||
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
||||
case IWL_TM_CMD_APP2DEV_REG_READ32:
|
||||
val32 = iwl_read32(priv, ofs);
|
||||
IWL_INFO(priv, "32bit value to read 0x%x\n", val32);
|
||||
|
||||
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
|
||||
if (!skb) {
|
||||
IWL_DEBUG_INFO(priv, "Error allocating memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
NLA_PUT_U32(skb, IWL_TM_ATTR_REG_VALUE32, val32);
|
||||
status = cfg80211_testmode_reply(skb);
|
||||
if (status < 0)
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error sending msg : %d\n", status);
|
||||
break;
|
||||
case IWL_TM_CMD_APP2DEV_REG_WRITE32:
|
||||
if (!tb[IWL_TM_ATTR_REG_VALUE32]) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error finding value to write\n");
|
||||
return -ENOMSG;
|
||||
} else {
|
||||
val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]);
|
||||
IWL_INFO(priv, "32bit value to write 0x%x\n", val32);
|
||||
iwl_write32(priv, ofs, val32);
|
||||
}
|
||||
break;
|
||||
case IWL_TM_CMD_APP2DEV_REG_WRITE8:
|
||||
if (!tb[IWL_TM_ATTR_REG_VALUE8]) {
|
||||
IWL_DEBUG_INFO(priv, "Error finding value to write\n");
|
||||
return -ENOMSG;
|
||||
} else {
|
||||
val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]);
|
||||
IWL_INFO(priv, "8bit value to write 0x%x\n", val8);
|
||||
iwl_write8(priv, ofs, val8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
IWL_DEBUG_INFO(priv, "Unknown testmode register command ID\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
nla_put_failure:
|
||||
kfree_skb(skb);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
|
||||
static int iwl_testmode_cfg_init_calib(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_notification_wait calib_wait;
|
||||
int ret;
|
||||
|
||||
iwlagn_init_notification_wait(priv, &calib_wait,
|
||||
CALIBRATION_COMPLETE_NOTIFICATION,
|
||||
NULL, NULL);
|
||||
ret = iwlagn_init_alive_start(priv);
|
||||
if (ret) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error configuring init calibration: %d\n", ret);
|
||||
goto cfg_init_calib_error;
|
||||
}
|
||||
|
||||
ret = iwlagn_wait_notification(priv, &calib_wait, 2 * HZ);
|
||||
if (ret)
|
||||
IWL_DEBUG_INFO(priv, "Error detecting"
|
||||
" CALIBRATION_COMPLETE_NOTIFICATION: %d\n", ret);
|
||||
return ret;
|
||||
|
||||
cfg_init_calib_error:
|
||||
iwlagn_remove_notification(priv, &calib_wait);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function handles the user application commands for driver.
|
||||
*
|
||||
* It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the
|
||||
* handlers respectively.
|
||||
*
|
||||
* If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned
|
||||
* value of the actual command execution is replied to the user application.
|
||||
*
|
||||
* If there's any message responding to the user space, IWL_TM_ATTR_SYNC_RSP
|
||||
* is used for carry the message while IWL_TM_ATTR_COMMAND must set to
|
||||
* IWL_TM_CMD_DEV2APP_SYNC_RSP.
|
||||
*
|
||||
* @hw: ieee80211_hw object that represents the device
|
||||
* @tb: gnl message fields from the user space
|
||||
*/
|
||||
static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||
{
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
struct sk_buff *skb;
|
||||
unsigned char *rsp_data_ptr = NULL;
|
||||
int status = 0, rsp_data_len = 0;
|
||||
|
||||
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
||||
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
|
||||
rsp_data_ptr = (unsigned char *)priv->cfg->name;
|
||||
rsp_data_len = strlen(priv->cfg->name);
|
||||
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
||||
rsp_data_len + 20);
|
||||
if (!skb) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error allocating memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
|
||||
IWL_TM_CMD_DEV2APP_SYNC_RSP);
|
||||
NLA_PUT(skb, IWL_TM_ATTR_SYNC_RSP,
|
||||
rsp_data_len, rsp_data_ptr);
|
||||
status = cfg80211_testmode_reply(skb);
|
||||
if (status < 0)
|
||||
IWL_DEBUG_INFO(priv, "Error sending msg : %d\n",
|
||||
status);
|
||||
break;
|
||||
|
||||
case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
|
||||
status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
|
||||
UCODE_SUBTYPE_INIT, -1);
|
||||
if (status)
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error loading init ucode: %d\n", status);
|
||||
break;
|
||||
|
||||
case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
|
||||
iwl_testmode_cfg_init_calib(priv);
|
||||
iwlagn_stop_device(priv);
|
||||
break;
|
||||
|
||||
case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
|
||||
status = iwlagn_load_ucode_wait_alive(priv,
|
||||
&priv->ucode_rt,
|
||||
UCODE_SUBTYPE_REGULAR,
|
||||
UCODE_SUBTYPE_REGULAR_NEW);
|
||||
if (status) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error loading runtime ucode: %d\n", status);
|
||||
break;
|
||||
}
|
||||
status = iwl_alive_start(priv);
|
||||
if (status)
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error starting the device: %d\n", status);
|
||||
break;
|
||||
|
||||
default:
|
||||
IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
return status;
|
||||
|
||||
nla_put_failure:
|
||||
kfree_skb(skb);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
/* The testmode gnl message handler that takes the gnl message from the
|
||||
* user space and parses it per the policy iwl_testmode_gnl_msg_policy, then
|
||||
* invoke the corresponding handlers.
|
||||
*
|
||||
* This function is invoked when there is user space application sending
|
||||
* gnl message through the testmode tunnel NL80211_CMD_TESTMODE regulated
|
||||
* by nl80211.
|
||||
*
|
||||
* It retrieves the mandatory field, IWL_TM_ATTR_COMMAND, before
|
||||
* dispatching it to the corresponding handler.
|
||||
*
|
||||
* If IWL_TM_ATTR_COMMAND is missing, -ENOMSG is replied to user application;
|
||||
* -ENOSYS is replied to the user application if the command is unknown;
|
||||
* Otherwise, the command is dispatched to the respective handler.
|
||||
*
|
||||
* @hw: ieee80211_hw object that represents the device
|
||||
* @data: pointer to user space message
|
||||
* @len: length in byte of @data
|
||||
*/
|
||||
int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
|
||||
{
|
||||
struct nlattr *tb[IWL_TM_ATTR_MAX - 1];
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
int result;
|
||||
|
||||
result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len,
|
||||
iwl_testmode_gnl_msg_policy);
|
||||
if (result != 0) {
|
||||
IWL_DEBUG_INFO(priv,
|
||||
"Error parsing the gnl message : %d\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* IWL_TM_ATTR_COMMAND is absolutely mandatory */
|
||||
if (!tb[IWL_TM_ATTR_COMMAND]) {
|
||||
IWL_DEBUG_INFO(priv, "Error finding testmode command type\n");
|
||||
return -ENOMSG;
|
||||
}
|
||||
/* in case multiple accesses to the device happens */
|
||||
mutex_lock(&priv->mutex);
|
||||
|
||||
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
||||
case IWL_TM_CMD_APP2DEV_UCODE:
|
||||
IWL_DEBUG_INFO(priv, "testmode cmd to uCode\n");
|
||||
result = iwl_testmode_ucode(hw, tb);
|
||||
break;
|
||||
case IWL_TM_CMD_APP2DEV_REG_READ32:
|
||||
case IWL_TM_CMD_APP2DEV_REG_WRITE32:
|
||||
case IWL_TM_CMD_APP2DEV_REG_WRITE8:
|
||||
IWL_DEBUG_INFO(priv, "testmode cmd to register\n");
|
||||
result = iwl_testmode_reg(hw, tb);
|
||||
break;
|
||||
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
|
||||
case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
|
||||
case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
|
||||
case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
|
||||
IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
|
||||
result = iwl_testmode_driver(hw, tb);
|
||||
break;
|
||||
default:
|
||||
IWL_DEBUG_INFO(priv, "Unknown testmode command\n");
|
||||
result = -ENOSYS;
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&priv->mutex);
|
||||
return result;
|
||||
}
|
151
drivers/net/wireless/iwlwifi/iwl-testmode.h
Normal file
151
drivers/net/wireless/iwlwifi/iwl-testmode.h
Normal file
@ -0,0 +1,151 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
* redistributing this file, you may do so under either license.
|
||||
*
|
||||
* GPL LICENSE SUMMARY
|
||||
*
|
||||
* Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
||||
* USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution
|
||||
* in the file called LICENSE.GPL.
|
||||
*
|
||||
* Contact Information:
|
||||
* Intel Linux Wireless <ilw@linux.intel.com>
|
||||
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
*
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name Intel Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __IWL_TESTMODE_H__
|
||||
#define __IWL_TESTMODE_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
|
||||
/* Commands from user space to kernel space(IWL_TM_CMD_ID_APP2DEV_XX) and
|
||||
* from and kernel space to user space(IWL_TM_CMD_ID_DEV2APP_XX).
|
||||
* The command ID is carried with IWL_TM_ATTR_COMMAND. There are three types of
|
||||
* of command from user space and two types of command from kernel space.
|
||||
* See below.
|
||||
*/
|
||||
enum iwl_tm_cmd_t {
|
||||
/* commands from user application to the uCode,
|
||||
* the actual uCode host command ID is carried with
|
||||
* IWL_TM_ATTR_UCODE_CMD_ID */
|
||||
IWL_TM_CMD_APP2DEV_UCODE = 1,
|
||||
|
||||
/* commands from user applicaiton to access register */
|
||||
IWL_TM_CMD_APP2DEV_REG_READ32,
|
||||
IWL_TM_CMD_APP2DEV_REG_WRITE32,
|
||||
IWL_TM_CMD_APP2DEV_REG_WRITE8,
|
||||
|
||||
/* commands fom user space for pure driver level operations */
|
||||
IWL_TM_CMD_APP2DEV_GET_DEVICENAME,
|
||||
IWL_TM_CMD_APP2DEV_LOAD_INIT_FW,
|
||||
IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB,
|
||||
IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW,
|
||||
/* if there is other new command for the driver layer operation,
|
||||
* append them here */
|
||||
|
||||
|
||||
/* commands from kernel space to carry the synchronous response
|
||||
* to user application */
|
||||
IWL_TM_CMD_DEV2APP_SYNC_RSP,
|
||||
|
||||
/* commands from kernel space to multicast the spontaneous messages
|
||||
* to user application */
|
||||
IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
|
||||
IWL_TM_CMD_MAX,
|
||||
};
|
||||
|
||||
enum iwl_tm_attr_t {
|
||||
IWL_TM_ATTR_NOT_APPLICABLE = 0,
|
||||
|
||||
/* From user space to kernel space:
|
||||
* the command either destines to ucode, driver, or register;
|
||||
* See enum iwl_tm_cmd_t.
|
||||
*
|
||||
* From kernel space to user space:
|
||||
* the command either carries synchronous response,
|
||||
* or the spontaneous message multicast from the device;
|
||||
* See enum iwl_tm_cmd_t. */
|
||||
IWL_TM_ATTR_COMMAND,
|
||||
|
||||
/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE,
|
||||
* The mandatory fields are :
|
||||
* IWL_TM_ATTR_UCODE_CMD_ID for recognizable command ID;
|
||||
* IWL_TM_ATTR_COMMAND_FLAG for the flags of the commands;
|
||||
* The optional fields are:
|
||||
* IWL_TM_ATTR_UCODE_CMD_DATA for the actual command payload
|
||||
* to the ucode */
|
||||
IWL_TM_ATTR_UCODE_CMD_ID,
|
||||
IWL_TM_ATTR_UCODE_CMD_DATA,
|
||||
|
||||
/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_XXX,
|
||||
* The mandatory fields are:
|
||||
* IWL_TM_ATTR_REG_OFFSET for the offset of the target register;
|
||||
* IWL_TM_ATTR_REG_VALUE8 or IWL_TM_ATTR_REG_VALUE32 for value */
|
||||
IWL_TM_ATTR_REG_OFFSET,
|
||||
IWL_TM_ATTR_REG_VALUE8,
|
||||
IWL_TM_ATTR_REG_VALUE32,
|
||||
|
||||
/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_SYNC_RSP,
|
||||
* The mandatory fields are:
|
||||
* IWL_TM_ATTR_SYNC_RSP for the data content responding to the user
|
||||
* application command */
|
||||
IWL_TM_ATTR_SYNC_RSP,
|
||||
/* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
|
||||
* The mandatory fields are:
|
||||
* IWL_TM_ATTR_UCODE_RX_PKT for the data content multicast to the user
|
||||
* application */
|
||||
IWL_TM_ATTR_UCODE_RX_PKT,
|
||||
|
||||
IWL_TM_ATTR_MAX,
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -442,12 +442,10 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
struct iwl_cmd_meta *out_meta;
|
||||
dma_addr_t phys_addr;
|
||||
unsigned long flags;
|
||||
int len;
|
||||
u32 idx;
|
||||
u16 fix_size;
|
||||
bool is_ct_kill = false;
|
||||
|
||||
cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len);
|
||||
fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
|
||||
|
||||
/*
|
||||
@ -502,7 +500,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
}
|
||||
|
||||
memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */
|
||||
out_meta->flags = cmd->flags | CMD_MAPPED;
|
||||
if (cmd->flags & CMD_WANT_SKB)
|
||||
out_meta->source = cmd;
|
||||
if (cmd->flags & CMD_ASYNC)
|
||||
@ -519,9 +516,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
INDEX_TO_SEQ(q->write_ptr));
|
||||
if (cmd->flags & CMD_SIZE_HUGE)
|
||||
out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
|
||||
len = sizeof(struct iwl_device_cmd);
|
||||
if (idx == TFD_CMD_SLOTS)
|
||||
len = IWL_MAX_CMD_SIZE;
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
switch (out_cmd->hdr.cmd) {
|
||||
@ -543,17 +537,20 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
q->write_ptr, idx, priv->cmd_queue);
|
||||
}
|
||||
#endif
|
||||
txq->need_update = 1;
|
||||
|
||||
if (priv->cfg->ops->lib->txq_update_byte_cnt_tbl)
|
||||
/* Set up entry in queue's byte count circular buffer */
|
||||
priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
|
||||
|
||||
phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr,
|
||||
fix_size, PCI_DMA_BIDIRECTIONAL);
|
||||
if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) {
|
||||
idx = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
dma_unmap_addr_set(out_meta, mapping, phys_addr);
|
||||
dma_unmap_len_set(out_meta, len, fix_size);
|
||||
|
||||
out_meta->flags = cmd->flags | CMD_MAPPED;
|
||||
|
||||
txq->need_update = 1;
|
||||
|
||||
trace_iwlwifi_dev_hcmd(priv, &out_cmd->hdr, fix_size, cmd->flags);
|
||||
|
||||
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
|
||||
@ -564,6 +561,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
|
||||
iwl_txq_update_write_ptr(priv, txq);
|
||||
|
||||
out:
|
||||
spin_unlock_irqrestore(&priv->hcmd_lock, flags);
|
||||
return idx;
|
||||
}
|
||||
|
@ -1576,7 +1576,8 @@ static void iwm_rx_process_amsdu(struct iwm_priv *iwm, struct sk_buff *skb)
|
||||
IWM_HEXDUMP(iwm, DBG, RX, "A-MSDU: ", skb->data, skb->len);
|
||||
|
||||
__skb_queue_head_init(&list);
|
||||
ieee80211_amsdu_to_8023s(skb, &list, ndev->dev_addr, wdev->iftype, 0);
|
||||
ieee80211_amsdu_to_8023s(skb, &list, ndev->dev_addr, wdev->iftype, 0,
|
||||
true);
|
||||
|
||||
while ((frame = __skb_dequeue(&list))) {
|
||||
ndev->stats.rx_packets++;
|
||||
|
@ -6,6 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/slab.h>
|
||||
@ -1322,8 +1324,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
|
||||
sme->ssid, sme->ssid_len,
|
||||
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
||||
if (!bss) {
|
||||
lbs_pr_err("assoc: bss %pM not in scan results\n",
|
||||
sme->bssid);
|
||||
wiphy_err(wiphy, "assoc: bss %pM not in scan results\n",
|
||||
sme->bssid);
|
||||
ret = -ENOENT;
|
||||
goto done;
|
||||
}
|
||||
@ -1380,8 +1382,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
|
||||
lbs_enable_rsn(priv, sme->crypto.cipher_group != 0);
|
||||
break;
|
||||
default:
|
||||
lbs_pr_err("unsupported cipher group 0x%x\n",
|
||||
sme->crypto.cipher_group);
|
||||
wiphy_err(wiphy, "unsupported cipher group 0x%x\n",
|
||||
sme->crypto.cipher_group);
|
||||
ret = -ENOTSUPP;
|
||||
goto done;
|
||||
}
|
||||
@ -1499,7 +1501,7 @@ static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev,
|
||||
params->key, params->key_len);
|
||||
break;
|
||||
default:
|
||||
lbs_pr_err("unhandled cipher 0x%x\n", params->cipher);
|
||||
wiphy_err(wiphy, "unhandled cipher 0x%x\n", params->cipher);
|
||||
ret = -ENOTSUPP;
|
||||
break;
|
||||
}
|
||||
@ -2127,13 +2129,13 @@ int lbs_cfg_register(struct lbs_private *priv)
|
||||
|
||||
ret = wiphy_register(wdev->wiphy);
|
||||
if (ret < 0)
|
||||
lbs_pr_err("cannot register wiphy device\n");
|
||||
pr_err("cannot register wiphy device\n");
|
||||
|
||||
priv->wiphy_registered = true;
|
||||
|
||||
ret = register_netdev(priv->dev);
|
||||
if (ret)
|
||||
lbs_pr_err("cannot register network device\n");
|
||||
pr_err("cannot register network device\n");
|
||||
|
||||
INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
|
||||
|
||||
|
@ -110,7 +110,7 @@ int lbs_update_hw_spec(struct lbs_private *priv)
|
||||
* CF card firmware 5.0.16p0: cap 0x00000303
|
||||
* USB dongle firmware 5.110.17p2: cap 0x00000303
|
||||
*/
|
||||
lbs_pr_info("%pM, fw %u.%u.%up%u, cap 0x%08x\n",
|
||||
netdev_info(priv->dev, "%pM, fw %u.%u.%up%u, cap 0x%08x\n",
|
||||
cmd.permanentaddr,
|
||||
priv->fwrelease >> 24 & 0xff,
|
||||
priv->fwrelease >> 16 & 0xff,
|
||||
@ -141,7 +141,8 @@ int lbs_update_hw_spec(struct lbs_private *priv)
|
||||
/* if it's unidentified region code, use the default (USA) */
|
||||
if (i >= MRVDRV_MAX_REGION_CODE) {
|
||||
priv->regioncode = 0x10;
|
||||
lbs_pr_info("unidentified region code; using the default (USA)\n");
|
||||
netdev_info(priv->dev,
|
||||
"unidentified region code; using the default (USA)\n");
|
||||
}
|
||||
|
||||
if (priv->current_addr[0] == 0xff)
|
||||
@ -211,7 +212,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
|
||||
(uint8_t *)&cmd_config.wol_conf,
|
||||
sizeof(struct wol_config));
|
||||
} else {
|
||||
lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret);
|
||||
netdev_info(priv->dev, "HOST_SLEEP_CFG failed %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -314,7 +315,7 @@ static int lbs_wait_for_ds_awake(struct lbs_private *priv)
|
||||
if (priv->is_deep_sleep) {
|
||||
if (!wait_event_interruptible_timeout(priv->ds_awake_q,
|
||||
!priv->is_deep_sleep, (10 * HZ))) {
|
||||
lbs_pr_err("ds_awake_q: timer expired\n");
|
||||
netdev_err(priv->dev, "ds_awake_q: timer expired\n");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
@ -339,7 +340,7 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
|
||||
netif_carrier_off(priv->dev);
|
||||
}
|
||||
} else {
|
||||
lbs_pr_err("deep sleep: already enabled\n");
|
||||
netdev_err(priv->dev, "deep sleep: already enabled\n");
|
||||
}
|
||||
} else {
|
||||
if (priv->is_deep_sleep) {
|
||||
@ -349,8 +350,8 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
|
||||
if (!ret) {
|
||||
ret = lbs_wait_for_ds_awake(priv);
|
||||
if (ret)
|
||||
lbs_pr_err("deep sleep: wakeup"
|
||||
"failed\n");
|
||||
netdev_err(priv->dev,
|
||||
"deep sleep: wakeup failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -384,8 +385,9 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
|
||||
ret = lbs_host_sleep_cfg(priv, priv->wol_criteria,
|
||||
(struct wol_config *)NULL);
|
||||
if (ret) {
|
||||
lbs_pr_info("Host sleep configuration failed: "
|
||||
"%d\n", ret);
|
||||
netdev_info(priv->dev,
|
||||
"Host sleep configuration failed: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
if (priv->psstate == PS_STATE_FULL_POWER) {
|
||||
@ -395,19 +397,21 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
|
||||
sizeof(cmd),
|
||||
lbs_ret_host_sleep_activate, 0);
|
||||
if (ret)
|
||||
lbs_pr_info("HOST_SLEEP_ACTIVATE "
|
||||
"failed: %d\n", ret);
|
||||
netdev_info(priv->dev,
|
||||
"HOST_SLEEP_ACTIVATE failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
if (!wait_event_interruptible_timeout(
|
||||
priv->host_sleep_q,
|
||||
priv->is_host_sleep_activated,
|
||||
(10 * HZ))) {
|
||||
lbs_pr_err("host_sleep_q: timer expired\n");
|
||||
netdev_err(priv->dev,
|
||||
"host_sleep_q: timer expired\n");
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
lbs_pr_err("host sleep: already enabled\n");
|
||||
netdev_err(priv->dev, "host sleep: already enabled\n");
|
||||
}
|
||||
} else {
|
||||
if (priv->is_host_sleep_activated)
|
||||
@ -1007,7 +1011,8 @@ static void lbs_submit_command(struct lbs_private *priv,
|
||||
ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
|
||||
|
||||
if (ret) {
|
||||
lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
|
||||
netdev_info(priv->dev, "DNLD_CMD: hw_host_to_card failed: %d\n",
|
||||
ret);
|
||||
/* Let the timer kick in and retry, and potentially reset
|
||||
the whole thing if the condition persists */
|
||||
timeo = HZ/4;
|
||||
@ -1276,7 +1281,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
|
||||
spin_lock_irqsave(&priv->driver_lock, flags);
|
||||
|
||||
if (priv->cur_cmd) {
|
||||
lbs_pr_alert( "EXEC_NEXT_CMD: already processing command!\n");
|
||||
netdev_alert(priv->dev,
|
||||
"EXEC_NEXT_CMD: already processing command!\n");
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
ret = -1;
|
||||
goto done;
|
||||
@ -1438,7 +1444,7 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
|
||||
ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep,
|
||||
sizeof(confirm_sleep));
|
||||
if (ret) {
|
||||
lbs_pr_alert("confirm_sleep failed\n");
|
||||
netdev_alert(priv->dev, "confirm_sleep failed\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1664,7 +1670,7 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
|
||||
spin_lock_irqsave(&priv->driver_lock, flags);
|
||||
ret = cmdnode->result;
|
||||
if (ret)
|
||||
lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n",
|
||||
netdev_info(priv->dev, "PREP_CMD: command 0x%04x failed: %d\n",
|
||||
command, ret);
|
||||
|
||||
__lbs_cleanup_and_insert_cmd(priv, cmdnode);
|
||||
|
@ -2,6 +2,7 @@
|
||||
* This file contains the handling of command
|
||||
* responses as well as events generated by firmware.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
@ -85,15 +86,18 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
|
||||
lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);
|
||||
|
||||
if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
|
||||
lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
|
||||
le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
|
||||
netdev_info(priv->dev,
|
||||
"Received CMD_RESP with invalid sequence %d (expected %d)\n",
|
||||
le16_to_cpu(resp->seqnum),
|
||||
le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
ret = -1;
|
||||
goto done;
|
||||
}
|
||||
if (respcmd != CMD_RET(curcmd) &&
|
||||
respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
|
||||
lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
|
||||
netdev_info(priv->dev, "Invalid CMD_RESP %x to command %x!\n",
|
||||
respcmd, curcmd);
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
ret = -1;
|
||||
goto done;
|
||||
@ -102,7 +106,8 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
|
||||
if (resp->result == cpu_to_le16(0x0004)) {
|
||||
/* 0x0004 means -EAGAIN. Drop the response, let it time out
|
||||
and be resubmitted */
|
||||
lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
|
||||
netdev_info(priv->dev,
|
||||
"Firmware returns DEFER to command %x. Will let it time out...\n",
|
||||
le16_to_cpu(resp->command));
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
ret = -1;
|
||||
@ -314,28 +319,28 @@ int lbs_process_event(struct lbs_private *priv, u32 event)
|
||||
lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_RSSI_LOW:
|
||||
lbs_pr_alert("EVENT: rssi low\n");
|
||||
netdev_alert(priv->dev, "EVENT: rssi low\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_SNR_LOW:
|
||||
lbs_pr_alert("EVENT: snr low\n");
|
||||
netdev_alert(priv->dev, "EVENT: snr low\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_MAX_FAIL:
|
||||
lbs_pr_alert("EVENT: max fail\n");
|
||||
netdev_alert(priv->dev, "EVENT: max fail\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_RSSI_HIGH:
|
||||
lbs_pr_alert("EVENT: rssi high\n");
|
||||
netdev_alert(priv->dev, "EVENT: rssi high\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_SNR_HIGH:
|
||||
lbs_pr_alert("EVENT: snr high\n");
|
||||
netdev_alert(priv->dev, "EVENT: snr high\n");
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_MESH_AUTO_STARTED:
|
||||
/* Ignore spurious autostart events */
|
||||
lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
|
||||
netdev_info(priv->dev, "EVENT: MESH_AUTO_STARTED (ignoring)\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
lbs_pr_alert("EVENT: unknown event id %d\n", event);
|
||||
netdev_alert(priv->dev, "EVENT: unknown event id %d\n", event);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -151,13 +151,14 @@ static ssize_t lbs_host_sleep_write(struct file *file,
|
||||
ret = lbs_set_host_sleep(priv, 0);
|
||||
else if (host_sleep == 1) {
|
||||
if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
|
||||
lbs_pr_info("wake parameters not configured");
|
||||
netdev_info(priv->dev,
|
||||
"wake parameters not configured\n");
|
||||
ret = -EINVAL;
|
||||
goto out_unlock;
|
||||
}
|
||||
ret = lbs_set_host_sleep(priv, 1);
|
||||
} else {
|
||||
lbs_pr_err("invalid option\n");
|
||||
netdev_err(priv->dev, "invalid option\n");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,6 @@ do { if ((lbs_debug & (grp)) == (grp)) \
|
||||
#define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args)
|
||||
#define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args)
|
||||
|
||||
#define lbs_pr_info(format, args...) \
|
||||
printk(KERN_INFO DRV_NAME": " format, ## args)
|
||||
#define lbs_pr_err(format, args...) \
|
||||
printk(KERN_ERR DRV_NAME": " format, ## args)
|
||||
#define lbs_pr_alert(format, args...) \
|
||||
printk(KERN_ALERT DRV_NAME": " format, ## args)
|
||||
|
||||
#ifdef DEBUG
|
||||
static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
|
||||
{
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
@ -362,7 +364,7 @@ static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb)
|
||||
if (status & IF_CS_BIT_COMMAND)
|
||||
break;
|
||||
if (++loops > 100) {
|
||||
lbs_pr_err("card not ready for commands\n");
|
||||
netdev_err(priv->dev, "card not ready for commands\n");
|
||||
goto done;
|
||||
}
|
||||
mdelay(1);
|
||||
@ -432,14 +434,16 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
|
||||
/* is hardware ready? */
|
||||
status = if_cs_read16(priv->card, IF_CS_CARD_STATUS);
|
||||
if ((status & IF_CS_BIT_RESP) == 0) {
|
||||
lbs_pr_err("no cmd response in card\n");
|
||||
netdev_err(priv->dev, "no cmd response in card\n");
|
||||
*len = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*len = if_cs_read16(priv->card, IF_CS_RESP_LEN);
|
||||
if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) {
|
||||
lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len);
|
||||
netdev_err(priv->dev,
|
||||
"card cmd buffer has invalid # of bytes (%d)\n",
|
||||
*len);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -473,7 +477,9 @@ static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)
|
||||
|
||||
len = if_cs_read16(priv->card, IF_CS_READ_LEN);
|
||||
if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
|
||||
lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len);
|
||||
netdev_err(priv->dev,
|
||||
"card data buffer has invalid # of bytes (%d)\n",
|
||||
len);
|
||||
priv->dev->stats.rx_dropped++;
|
||||
goto dat_err;
|
||||
}
|
||||
@ -653,8 +659,8 @@ static int if_cs_prog_helper(struct if_cs_card *card, const struct firmware *fw)
|
||||
ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
|
||||
IF_CS_BIT_COMMAND);
|
||||
if (ret < 0) {
|
||||
lbs_pr_err("can't download helper at 0x%x, ret %d\n",
|
||||
sent, ret);
|
||||
pr_err("can't download helper at 0x%x, ret %d\n",
|
||||
sent, ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -684,7 +690,7 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
|
||||
ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW,
|
||||
IF_CS_SQ_HELPER_OK);
|
||||
if (ret < 0) {
|
||||
lbs_pr_err("helper firmware doesn't answer\n");
|
||||
pr_err("helper firmware doesn't answer\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -692,13 +698,13 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
|
||||
len = if_cs_read16(card, IF_CS_SQ_READ_LOW);
|
||||
if (len & 1) {
|
||||
retry++;
|
||||
lbs_pr_info("odd, need to retry this firmware block\n");
|
||||
pr_info("odd, need to retry this firmware block\n");
|
||||
} else {
|
||||
retry = 0;
|
||||
}
|
||||
|
||||
if (retry > 20) {
|
||||
lbs_pr_err("could not download firmware\n");
|
||||
pr_err("could not download firmware\n");
|
||||
ret = -ENODEV;
|
||||
goto done;
|
||||
}
|
||||
@ -718,14 +724,14 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
|
||||
ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
|
||||
IF_CS_BIT_COMMAND);
|
||||
if (ret < 0) {
|
||||
lbs_pr_err("can't download firmware at 0x%x\n", sent);
|
||||
pr_err("can't download firmware at 0x%x\n", sent);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
|
||||
if (ret < 0)
|
||||
lbs_pr_err("firmware download failed\n");
|
||||
pr_err("firmware download failed\n");
|
||||
|
||||
done:
|
||||
lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
|
||||
@ -759,7 +765,8 @@ static int if_cs_host_to_card(struct lbs_private *priv,
|
||||
ret = if_cs_send_cmd(priv, buf, nb);
|
||||
break;
|
||||
default:
|
||||
lbs_pr_err("%s: unsupported type %d\n", __func__, type);
|
||||
netdev_err(priv->dev, "%s: unsupported type %d\n",
|
||||
__func__, type);
|
||||
}
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
|
||||
@ -788,7 +795,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
|
||||
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
|
||||
|
||||
if (p_dev->resource[1]->end) {
|
||||
lbs_pr_err("wrong CIS (check number of IO windows)\n");
|
||||
pr_err("wrong CIS (check number of IO windows)\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -809,7 +816,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
|
||||
card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL);
|
||||
if (!card) {
|
||||
lbs_pr_err("error in kzalloc\n");
|
||||
pr_err("error in kzalloc\n");
|
||||
goto out;
|
||||
}
|
||||
card->p_dev = p_dev;
|
||||
@ -818,7 +825,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
|
||||
|
||||
if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
|
||||
lbs_pr_err("error in pcmcia_loop_config\n");
|
||||
pr_err("error in pcmcia_loop_config\n");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
@ -834,14 +841,14 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
card->iobase = ioport_map(p_dev->resource[0]->start,
|
||||
resource_size(p_dev->resource[0]));
|
||||
if (!card->iobase) {
|
||||
lbs_pr_err("error in ioport_map\n");
|
||||
pr_err("error in ioport_map\n");
|
||||
ret = -EIO;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
ret = pcmcia_enable_device(p_dev);
|
||||
if (ret) {
|
||||
lbs_pr_err("error in pcmcia_enable_device\n");
|
||||
pr_err("error in pcmcia_enable_device\n");
|
||||
goto out2;
|
||||
}
|
||||
|
||||
@ -856,8 +863,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
|
||||
card->model = get_model(p_dev->manf_id, p_dev->card_id);
|
||||
if (card->model == MODEL_UNKNOWN) {
|
||||
lbs_pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
|
||||
p_dev->manf_id, p_dev->card_id);
|
||||
pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
|
||||
p_dev->manf_id, p_dev->card_id);
|
||||
goto out2;
|
||||
}
|
||||
|
||||
@ -866,20 +873,20 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
if (card->model == MODEL_8305) {
|
||||
card->align_regs = 1;
|
||||
if (prod_id < IF_CS_CF8305_B1_REV) {
|
||||
lbs_pr_err("8305 rev B0 and older are not supported\n");
|
||||
pr_err("8305 rev B0 and older are not supported\n");
|
||||
ret = -ENODEV;
|
||||
goto out2;
|
||||
}
|
||||
}
|
||||
|
||||
if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) {
|
||||
lbs_pr_err("8381 rev B2 and older are not supported\n");
|
||||
pr_err("8381 rev B2 and older are not supported\n");
|
||||
ret = -ENODEV;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) {
|
||||
lbs_pr_err("8385 rev B0 and older are not supported\n");
|
||||
pr_err("8385 rev B0 and older are not supported\n");
|
||||
ret = -ENODEV;
|
||||
goto out2;
|
||||
}
|
||||
@ -887,7 +894,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
ret = lbs_get_firmware(&p_dev->dev, NULL, NULL, card->model,
|
||||
&fw_table[0], &helper, &mainfw);
|
||||
if (ret) {
|
||||
lbs_pr_err("failed to find firmware (%d)\n", ret);
|
||||
pr_err("failed to find firmware (%d)\n", ret);
|
||||
goto out2;
|
||||
}
|
||||
|
||||
@ -918,7 +925,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
ret = request_irq(p_dev->irq, if_cs_interrupt,
|
||||
IRQF_SHARED, DRV_NAME, card);
|
||||
if (ret) {
|
||||
lbs_pr_err("error in request_irq\n");
|
||||
pr_err("error in request_irq\n");
|
||||
goto out3;
|
||||
}
|
||||
|
||||
@ -931,7 +938,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
||||
|
||||
/* And finally bring the card up */
|
||||
if (lbs_start_card(priv) != 0) {
|
||||
lbs_pr_err("could not activate card\n");
|
||||
pr_err("could not activate card\n");
|
||||
goto out3;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
* if_sdio_card_to_host() to pad the data.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/slab.h>
|
||||
@ -409,7 +411,7 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
lbs_pr_err("problem fetching packet from firmware\n");
|
||||
pr_err("problem fetching packet from firmware\n");
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
|
||||
|
||||
@ -446,7 +448,7 @@ static void if_sdio_host_to_card_worker(struct work_struct *work)
|
||||
}
|
||||
|
||||
if (ret)
|
||||
lbs_pr_err("error %d sending packet to firmware\n", ret);
|
||||
pr_err("error %d sending packet to firmware\n", ret);
|
||||
|
||||
sdio_release_host(card->func);
|
||||
|
||||
@ -555,7 +557,7 @@ static int if_sdio_prog_helper(struct if_sdio_card *card,
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
lbs_pr_err("failed to load helper firmware\n");
|
||||
pr_err("failed to load helper firmware\n");
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
|
||||
return ret;
|
||||
@ -669,7 +671,7 @@ static int if_sdio_prog_real(struct if_sdio_card *card,
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
lbs_pr_err("failed to load firmware\n");
|
||||
pr_err("failed to load firmware\n");
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
|
||||
return ret;
|
||||
@ -723,7 +725,7 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
|
||||
ret = lbs_get_firmware(&card->func->dev, lbs_helper_name, lbs_fw_name,
|
||||
card->model, &fw_table[0], &helper, &mainfw);
|
||||
if (ret) {
|
||||
lbs_pr_err("failed to find firmware (%d)\n", ret);
|
||||
pr_err("failed to find firmware (%d)\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -849,7 +851,7 @@ static int if_sdio_enter_deep_sleep(struct lbs_private *priv)
|
||||
ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd),
|
||||
lbs_cmd_copyback, (unsigned long) &cmd);
|
||||
if (ret)
|
||||
lbs_pr_err("DEEP_SLEEP cmd failed\n");
|
||||
netdev_err(priv->dev, "DEEP_SLEEP cmd failed\n");
|
||||
|
||||
mdelay(200);
|
||||
return ret;
|
||||
@ -865,7 +867,7 @@ static int if_sdio_exit_deep_sleep(struct lbs_private *priv)
|
||||
|
||||
sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret);
|
||||
if (ret)
|
||||
lbs_pr_err("sdio_writeb failed!\n");
|
||||
netdev_err(priv->dev, "sdio_writeb failed!\n");
|
||||
|
||||
sdio_release_host(card->func);
|
||||
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
|
||||
@ -882,7 +884,7 @@ static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv)
|
||||
|
||||
sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret);
|
||||
if (ret)
|
||||
lbs_pr_err("sdio_writeb failed!\n");
|
||||
netdev_err(priv->dev, "sdio_writeb failed!\n");
|
||||
|
||||
sdio_release_host(card->func);
|
||||
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
|
||||
@ -961,7 +963,7 @@ static int if_sdio_probe(struct sdio_func *func,
|
||||
}
|
||||
|
||||
if (i == func->card->num_info) {
|
||||
lbs_pr_err("unable to identify card model\n");
|
||||
pr_err("unable to identify card model\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -995,7 +997,7 @@ static int if_sdio_probe(struct sdio_func *func,
|
||||
break;
|
||||
}
|
||||
if (i == ARRAY_SIZE(fw_table)) {
|
||||
lbs_pr_err("unknown card model 0x%x\n", card->model);
|
||||
pr_err("unknown card model 0x%x\n", card->model);
|
||||
ret = -ENODEV;
|
||||
goto free;
|
||||
}
|
||||
@ -1101,7 +1103,7 @@ static int if_sdio_probe(struct sdio_func *func,
|
||||
lbs_deb_sdio("send function INIT command\n");
|
||||
if (__lbs_cmd(priv, CMD_FUNC_INIT, &cmd, sizeof(cmd),
|
||||
lbs_cmd_copyback, (unsigned long) &cmd))
|
||||
lbs_pr_alert("CMD_FUNC_INIT cmd failed\n");
|
||||
netdev_alert(priv->dev, "CMD_FUNC_INIT cmd failed\n");
|
||||
}
|
||||
|
||||
ret = lbs_start_card(priv);
|
||||
@ -1163,7 +1165,7 @@ static void if_sdio_remove(struct sdio_func *func)
|
||||
if (__lbs_cmd(card->priv, CMD_FUNC_SHUTDOWN,
|
||||
&cmd, sizeof(cmd), lbs_cmd_copyback,
|
||||
(unsigned long) &cmd))
|
||||
lbs_pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n");
|
||||
pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n");
|
||||
}
|
||||
|
||||
|
||||
@ -1202,20 +1204,19 @@ static int if_sdio_suspend(struct device *dev)
|
||||
|
||||
mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);
|
||||
|
||||
lbs_pr_info("%s: suspend: PM flags = 0x%x\n",
|
||||
sdio_func_id(func), flags);
|
||||
dev_info(dev, "%s: suspend: PM flags = 0x%x\n",
|
||||
sdio_func_id(func), flags);
|
||||
|
||||
/* If we aren't being asked to wake on anything, we should bail out
|
||||
* and let the SD stack power down the card.
|
||||
*/
|
||||
if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) {
|
||||
lbs_pr_info("Suspend without wake params -- "
|
||||
"powering down card.");
|
||||
dev_info(dev, "Suspend without wake params -- powering down card\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
if (!(flags & MMC_PM_KEEP_POWER)) {
|
||||
lbs_pr_err("%s: cannot remain alive while host is suspended\n",
|
||||
dev_err(dev, "%s: cannot remain alive while host is suspended\n",
|
||||
sdio_func_id(func));
|
||||
return -ENOSYS;
|
||||
}
|
||||
@ -1237,7 +1238,7 @@ static int if_sdio_resume(struct device *dev)
|
||||
struct if_sdio_card *card = sdio_get_drvdata(func);
|
||||
int ret;
|
||||
|
||||
lbs_pr_info("%s: resume: we're back\n", sdio_func_id(func));
|
||||
dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func));
|
||||
|
||||
ret = lbs_resume(card->priv);
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/jiffies.h>
|
||||
@ -305,8 +307,7 @@ static int spu_wait_for_u16(struct if_spi_card *card, u16 reg,
|
||||
}
|
||||
udelay(100);
|
||||
if (time_after(jiffies, timeout)) {
|
||||
lbs_pr_err("%s: timeout with val=%02x, "
|
||||
"target_mask=%02x, target=%02x\n",
|
||||
pr_err("%s: timeout with val=%02x, target_mask=%02x, target=%02x\n",
|
||||
__func__, val, target_mask, target);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
@ -405,7 +406,7 @@ static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
|
||||
if (err)
|
||||
return err;
|
||||
if ((rval & 0xF) != mode) {
|
||||
lbs_pr_err("Can't read bus mode register.\n");
|
||||
pr_err("Can't read bus mode register\n");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
@ -534,7 +535,7 @@ static int if_spi_prog_helper_firmware(struct if_spi_card *card,
|
||||
|
||||
out:
|
||||
if (err)
|
||||
lbs_pr_err("failed to load helper firmware (err=%d)\n", err);
|
||||
pr_err("failed to load helper firmware (err=%d)\n", err);
|
||||
lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
|
||||
return err;
|
||||
}
|
||||
@ -557,7 +558,7 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
|
||||
IF_SPI_HIST_CMD_DOWNLOAD_RDY,
|
||||
IF_SPI_HIST_CMD_DOWNLOAD_RDY);
|
||||
if (err) {
|
||||
lbs_pr_err("timed out waiting for host_int_status\n");
|
||||
pr_err("timed out waiting for host_int_status\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -567,9 +568,8 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
|
||||
return err;
|
||||
|
||||
if (len > IF_SPI_CMD_BUF_SIZE) {
|
||||
lbs_pr_err("firmware load device requested a larger "
|
||||
"tranfer than we are prepared to "
|
||||
"handle. (len = %d)\n", len);
|
||||
pr_err("firmware load device requested a larger transfer than we are prepared to handle (len = %d)\n",
|
||||
len);
|
||||
return -EIO;
|
||||
}
|
||||
if (len & 0x1) {
|
||||
@ -585,6 +585,7 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
|
||||
static int if_spi_prog_main_firmware(struct if_spi_card *card,
|
||||
const struct firmware *firmware)
|
||||
{
|
||||
struct lbs_private *priv = card->priv;
|
||||
int len, prev_len;
|
||||
int bytes, crc_err = 0, err = 0;
|
||||
const u8 *fw;
|
||||
@ -598,8 +599,9 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
|
||||
|
||||
err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0);
|
||||
if (err) {
|
||||
lbs_pr_err("%s: timed out waiting for initial "
|
||||
"scratch reg = 0\n", __func__);
|
||||
netdev_err(priv->dev,
|
||||
"%s: timed out waiting for initial scratch reg = 0\n",
|
||||
__func__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -617,15 +619,14 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
|
||||
* If there are no more bytes left, we would normally
|
||||
* expect to have terminated with len = 0
|
||||
*/
|
||||
lbs_pr_err("Firmware load wants more bytes "
|
||||
"than we have to offer.\n");
|
||||
netdev_err(priv->dev,
|
||||
"Firmware load wants more bytes than we have to offer.\n");
|
||||
break;
|
||||
}
|
||||
if (crc_err) {
|
||||
/* Previous transfer failed. */
|
||||
if (++num_crc_errs > MAX_MAIN_FW_LOAD_CRC_ERR) {
|
||||
lbs_pr_err("Too many CRC errors encountered "
|
||||
"in firmware load.\n");
|
||||
pr_err("Too many CRC errors encountered in firmware load.\n");
|
||||
err = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@ -654,21 +655,20 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
|
||||
prev_len = len;
|
||||
}
|
||||
if (bytes > prev_len) {
|
||||
lbs_pr_err("firmware load wants fewer bytes than "
|
||||
"we have to offer.\n");
|
||||
pr_err("firmware load wants fewer bytes than we have to offer\n");
|
||||
}
|
||||
|
||||
/* Confirm firmware download */
|
||||
err = spu_wait_for_u32(card, IF_SPI_SCRATCH_4_REG,
|
||||
SUCCESSFUL_FW_DOWNLOAD_MAGIC);
|
||||
if (err) {
|
||||
lbs_pr_err("failed to confirm the firmware download\n");
|
||||
pr_err("failed to confirm the firmware download\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
if (err)
|
||||
lbs_pr_err("failed to load firmware (err=%d)\n", err);
|
||||
pr_err("failed to load firmware (err=%d)\n", err);
|
||||
lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
|
||||
return err;
|
||||
}
|
||||
@ -709,13 +709,13 @@ static int if_spi_c2h_cmd(struct if_spi_card *card)
|
||||
if (err)
|
||||
goto out;
|
||||
if (!len) {
|
||||
lbs_pr_err("%s: error: card has no data for host\n",
|
||||
netdev_err(priv->dev, "%s: error: card has no data for host\n",
|
||||
__func__);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
} else if (len > IF_SPI_CMD_BUF_SIZE) {
|
||||
lbs_pr_err("%s: error: response packet too large: "
|
||||
"%d bytes, but maximum is %d\n",
|
||||
netdev_err(priv->dev,
|
||||
"%s: error: response packet too large: %d bytes, but maximum is %d\n",
|
||||
__func__, len, IF_SPI_CMD_BUF_SIZE);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
@ -737,7 +737,7 @@ static int if_spi_c2h_cmd(struct if_spi_card *card)
|
||||
|
||||
out:
|
||||
if (err)
|
||||
lbs_pr_err("%s: err=%d\n", __func__, err);
|
||||
netdev_err(priv->dev, "%s: err=%d\n", __func__, err);
|
||||
lbs_deb_leave(LBS_DEB_SPI);
|
||||
return err;
|
||||
}
|
||||
@ -745,6 +745,7 @@ static int if_spi_c2h_cmd(struct if_spi_card *card)
|
||||
/* Move data from the card to the host */
|
||||
static int if_spi_c2h_data(struct if_spi_card *card)
|
||||
{
|
||||
struct lbs_private *priv = card->priv;
|
||||
struct sk_buff *skb;
|
||||
char *data;
|
||||
u16 len;
|
||||
@ -757,13 +758,13 @@ static int if_spi_c2h_data(struct if_spi_card *card)
|
||||
if (err)
|
||||
goto out;
|
||||
if (!len) {
|
||||
lbs_pr_err("%s: error: card has no data for host\n",
|
||||
netdev_err(priv->dev, "%s: error: card has no data for host\n",
|
||||
__func__);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
} else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
|
||||
lbs_pr_err("%s: error: card has %d bytes of data, but "
|
||||
"our maximum skb size is %zu\n",
|
||||
netdev_err(priv->dev,
|
||||
"%s: error: card has %d bytes of data, but our maximum skb size is %zu\n",
|
||||
__func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
@ -795,7 +796,7 @@ static int if_spi_c2h_data(struct if_spi_card *card)
|
||||
dev_kfree_skb(skb);
|
||||
out:
|
||||
if (err)
|
||||
lbs_pr_err("%s: err=%d\n", __func__, err);
|
||||
netdev_err(priv->dev, "%s: err=%d\n", __func__, err);
|
||||
lbs_deb_leave(LBS_DEB_SPI);
|
||||
return err;
|
||||
}
|
||||
@ -804,6 +805,7 @@ static int if_spi_c2h_data(struct if_spi_card *card)
|
||||
static void if_spi_h2c(struct if_spi_card *card,
|
||||
struct if_spi_packet *packet, int type)
|
||||
{
|
||||
struct lbs_private *priv = card->priv;
|
||||
int err = 0;
|
||||
u16 int_type, port_reg;
|
||||
|
||||
@ -817,7 +819,8 @@ static void if_spi_h2c(struct if_spi_card *card,
|
||||
port_reg = IF_SPI_CMD_RDWRPORT_REG;
|
||||
break;
|
||||
default:
|
||||
lbs_pr_err("can't transfer buffer of type %d\n", type);
|
||||
netdev_err(priv->dev, "can't transfer buffer of type %d\n",
|
||||
type);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@ -831,7 +834,7 @@ static void if_spi_h2c(struct if_spi_card *card,
|
||||
kfree(packet);
|
||||
|
||||
if (err)
|
||||
lbs_pr_err("%s: error %d\n", __func__, err);
|
||||
netdev_err(priv->dev, "%s: error %d\n", __func__, err);
|
||||
}
|
||||
|
||||
/* Inform the host about a card event */
|
||||
@ -855,7 +858,7 @@ static void if_spi_e2h(struct if_spi_card *card)
|
||||
lbs_queue_event(priv, cause & 0xff);
|
||||
out:
|
||||
if (err)
|
||||
lbs_pr_err("%s: error %d\n", __func__, err);
|
||||
netdev_err(priv->dev, "%s: error %d\n", __func__, err);
|
||||
}
|
||||
|
||||
static void if_spi_host_to_card_worker(struct work_struct *work)
|
||||
@ -865,8 +868,10 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
|
||||
u16 hiStatus;
|
||||
unsigned long flags;
|
||||
struct if_spi_packet *packet;
|
||||
struct lbs_private *priv;
|
||||
|
||||
card = container_of(work, struct if_spi_card, packet_work);
|
||||
priv = card->priv;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_SPI);
|
||||
|
||||
@ -877,7 +882,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
|
||||
err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
|
||||
&hiStatus);
|
||||
if (err) {
|
||||
lbs_pr_err("I/O error\n");
|
||||
netdev_err(priv->dev, "I/O error\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -940,7 +945,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
|
||||
|
||||
err:
|
||||
if (err)
|
||||
lbs_pr_err("%s: got error %d\n", __func__, err);
|
||||
netdev_err(priv->dev, "%s: got error %d\n", __func__, err);
|
||||
|
||||
lbs_deb_leave(LBS_DEB_SPI);
|
||||
}
|
||||
@ -963,7 +968,8 @@ static int if_spi_host_to_card(struct lbs_private *priv,
|
||||
lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
|
||||
|
||||
if (nb == 0) {
|
||||
lbs_pr_err("%s: invalid size requested: %d\n", __func__, nb);
|
||||
netdev_err(priv->dev, "%s: invalid size requested: %d\n",
|
||||
__func__, nb);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@ -991,7 +997,8 @@ static int if_spi_host_to_card(struct lbs_private *priv,
|
||||
spin_unlock_irqrestore(&card->buffer_lock, flags);
|
||||
break;
|
||||
default:
|
||||
lbs_pr_err("can't transfer buffer of type %d", type);
|
||||
netdev_err(priv->dev, "can't transfer buffer of type %d\n",
|
||||
type);
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -1024,6 +1031,7 @@ static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
|
||||
|
||||
static int if_spi_init_card(struct if_spi_card *card)
|
||||
{
|
||||
struct lbs_private *priv = card->priv;
|
||||
struct spi_device *spi = card->spi;
|
||||
int err, i;
|
||||
u32 scratch;
|
||||
@ -1052,8 +1060,8 @@ static int if_spi_init_card(struct if_spi_card *card)
|
||||
break;
|
||||
}
|
||||
if (i == ARRAY_SIZE(fw_table)) {
|
||||
lbs_pr_err("Unsupported chip_id: 0x%02x\n",
|
||||
card->card_id);
|
||||
netdev_err(priv->dev, "Unsupported chip_id: 0x%02x\n",
|
||||
card->card_id);
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
@ -1062,7 +1070,8 @@ static int if_spi_init_card(struct if_spi_card *card)
|
||||
card->card_id, &fw_table[0], &helper,
|
||||
&mainfw);
|
||||
if (err) {
|
||||
lbs_pr_err("failed to find firmware (%d)\n", err);
|
||||
netdev_err(priv->dev, "failed to find firmware (%d)\n",
|
||||
err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1187,7 +1196,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
|
||||
err = request_irq(spi->irq, if_spi_host_interrupt,
|
||||
IRQF_TRIGGER_FALLING, "libertas_spi", card);
|
||||
if (err) {
|
||||
lbs_pr_err("can't get host irq line-- request_irq failed\n");
|
||||
pr_err("can't get host irq line-- request_irq failed\n");
|
||||
goto terminate_workqueue;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* This file contains functions used in USB interface module.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/firmware.h>
|
||||
@ -153,7 +156,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
|
||||
lbs_host_to_card_done(priv);
|
||||
} else {
|
||||
/* print the failure status number for debug */
|
||||
lbs_pr_info("URB in failure status: %d\n", urb->status);
|
||||
pr_info("URB in failure status: %d\n", urb->status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +206,7 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
|
||||
wake_method.hdr.size = cpu_to_le16(sizeof(wake_method));
|
||||
wake_method.action = cpu_to_le16(CMD_ACT_GET);
|
||||
if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) {
|
||||
lbs_pr_info("Firmware does not seem to support PS mode\n");
|
||||
netdev_info(priv->dev, "Firmware does not seem to support PS mode\n");
|
||||
priv->fwcapinfo &= ~FW_CAPINFO_PS;
|
||||
} else {
|
||||
if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) {
|
||||
@ -212,7 +215,8 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
|
||||
/* The versions which boot up this way don't seem to
|
||||
work even if we set it to the command interrupt */
|
||||
priv->fwcapinfo &= ~FW_CAPINFO_PS;
|
||||
lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n");
|
||||
netdev_info(priv->dev,
|
||||
"Firmware doesn't wake via command interrupt; disabling PS mode\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +228,7 @@ static void if_usb_fw_timeo(unsigned long priv)
|
||||
if (cardp->fwdnldover) {
|
||||
lbs_deb_usb("Download complete, no event. Assuming success\n");
|
||||
} else {
|
||||
lbs_pr_err("Download timed out\n");
|
||||
pr_err("Download timed out\n");
|
||||
cardp->surprise_removed = 1;
|
||||
}
|
||||
wake_up(&cardp->fw_wq);
|
||||
@ -258,7 +262,7 @@ static int if_usb_probe(struct usb_interface *intf,
|
||||
|
||||
cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL);
|
||||
if (!cardp) {
|
||||
lbs_pr_err("Out of memory allocating private data.\n");
|
||||
pr_err("Out of memory allocating private data\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -348,10 +352,12 @@ static int if_usb_probe(struct usb_interface *intf,
|
||||
usb_set_intfdata(intf, cardp);
|
||||
|
||||
if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_fw))
|
||||
lbs_pr_err("cannot register lbs_flash_fw attribute\n");
|
||||
netdev_err(priv->dev,
|
||||
"cannot register lbs_flash_fw attribute\n");
|
||||
|
||||
if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_boot2))
|
||||
lbs_pr_err("cannot register lbs_flash_boot2 attribute\n");
|
||||
netdev_err(priv->dev,
|
||||
"cannot register lbs_flash_boot2 attribute\n");
|
||||
|
||||
/*
|
||||
* EHS_REMOVE_WAKEUP is not supported on all versions of the firmware.
|
||||
@ -536,7 +542,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
|
||||
int ret = -1;
|
||||
|
||||
if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) {
|
||||
lbs_pr_err("No free skb\n");
|
||||
pr_err("No free skb\n");
|
||||
goto rx_ret;
|
||||
}
|
||||
|
||||
@ -595,7 +601,7 @@ static void if_usb_receive_fwload(struct urb *urb)
|
||||
|
||||
if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) &&
|
||||
tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) {
|
||||
lbs_pr_info("Firmware ready event received\n");
|
||||
pr_info("Firmware ready event received\n");
|
||||
wake_up(&cardp->fw_wq);
|
||||
} else {
|
||||
lbs_deb_usb("Waiting for confirmation; got %x %x\n",
|
||||
@ -622,20 +628,20 @@ static void if_usb_receive_fwload(struct urb *urb)
|
||||
bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) ||
|
||||
bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) {
|
||||
if (!cardp->bootcmdresp)
|
||||
lbs_pr_info("Firmware already seems alive; resetting\n");
|
||||
pr_info("Firmware already seems alive; resetting\n");
|
||||
cardp->bootcmdresp = -1;
|
||||
} else {
|
||||
lbs_pr_info("boot cmd response wrong magic number (0x%x)\n",
|
||||
pr_info("boot cmd response wrong magic number (0x%x)\n",
|
||||
le32_to_cpu(bootcmdresp.magic));
|
||||
}
|
||||
} else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) &&
|
||||
(bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) &&
|
||||
(bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) {
|
||||
lbs_pr_info("boot cmd response cmd_tag error (%d)\n",
|
||||
bootcmdresp.cmd);
|
||||
pr_info("boot cmd response cmd_tag error (%d)\n",
|
||||
bootcmdresp.cmd);
|
||||
} else if (bootcmdresp.result != BOOT_CMD_RESP_OK) {
|
||||
lbs_pr_info("boot cmd response result error (%d)\n",
|
||||
bootcmdresp.result);
|
||||
pr_info("boot cmd response result error (%d)\n",
|
||||
bootcmdresp.result);
|
||||
} else {
|
||||
cardp->bootcmdresp = 1;
|
||||
lbs_deb_usbd(&cardp->udev->dev,
|
||||
@ -901,7 +907,7 @@ static int check_fwfile_format(const uint8_t *data, uint32_t totlen)
|
||||
} while (!exit);
|
||||
|
||||
if (ret)
|
||||
lbs_pr_err("firmware file format check FAIL\n");
|
||||
pr_err("firmware file format check FAIL\n");
|
||||
else
|
||||
lbs_deb_fw("firmware file format check PASS\n");
|
||||
|
||||
@ -998,7 +1004,7 @@ static int __if_usb_prog_firmware(struct if_usb_card *cardp,
|
||||
|
||||
ret = get_fw(cardp, fwname);
|
||||
if (ret) {
|
||||
lbs_pr_err("failed to find firmware (%d)\n", ret);
|
||||
pr_err("failed to find firmware (%d)\n", ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1073,13 +1079,13 @@ static int __if_usb_prog_firmware(struct if_usb_card *cardp,
|
||||
usb_kill_urb(cardp->rx_urb);
|
||||
|
||||
if (!cardp->fwdnldover) {
|
||||
lbs_pr_info("failed to load fw, resetting device!\n");
|
||||
pr_info("failed to load fw, resetting device!\n");
|
||||
if (--reset_count >= 0) {
|
||||
if_usb_reset_device(cardp);
|
||||
goto restart;
|
||||
}
|
||||
|
||||
lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
|
||||
pr_info("FW download failure, time = %d ms\n", i * 100);
|
||||
ret = -EIO;
|
||||
goto release_fw;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
* thread etc..
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/etherdevice.h>
|
||||
@ -34,6 +36,10 @@ unsigned int lbs_debug;
|
||||
EXPORT_SYMBOL_GPL(lbs_debug);
|
||||
module_param_named(libertas_debug, lbs_debug, int, 0644);
|
||||
|
||||
unsigned int lbs_disablemesh;
|
||||
EXPORT_SYMBOL_GPL(lbs_disablemesh);
|
||||
module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644);
|
||||
|
||||
|
||||
/*
|
||||
* This global structure is used to send the confirm_sleep command as
|
||||
@ -149,28 +155,6 @@ static int lbs_eth_stop(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lbs_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
struct lbs_private *priv = dev->ml_priv;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_TX);
|
||||
|
||||
lbs_pr_err("tx watch dog timeout\n");
|
||||
|
||||
dev->trans_start = jiffies; /* prevent tx timeout */
|
||||
|
||||
if (priv->currenttxskb)
|
||||
lbs_send_tx_feedback(priv, 0);
|
||||
|
||||
/* XX: Shouldn't we also call into the hw-specific driver
|
||||
to kick it somehow? */
|
||||
lbs_host_to_card_done(priv);
|
||||
|
||||
/* FIXME: reset the card */
|
||||
|
||||
lbs_deb_leave(LBS_DEB_TX);
|
||||
}
|
||||
|
||||
void lbs_host_to_card_done(struct lbs_private *priv)
|
||||
{
|
||||
unsigned long flags;
|
||||
@ -464,8 +448,8 @@ static int lbs_thread(void *data)
|
||||
if (priv->cmd_timed_out && priv->cur_cmd) {
|
||||
struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
|
||||
|
||||
lbs_pr_info("Timeout submitting command 0x%04x\n",
|
||||
le16_to_cpu(cmdnode->cmdbuf->command));
|
||||
netdev_info(dev, "Timeout submitting command 0x%04x\n",
|
||||
le16_to_cpu(cmdnode->cmdbuf->command));
|
||||
lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
|
||||
if (priv->reset_card)
|
||||
priv->reset_card(priv);
|
||||
@ -492,8 +476,8 @@ static int lbs_thread(void *data)
|
||||
* after firmware fixes it
|
||||
*/
|
||||
priv->psstate = PS_STATE_AWAKE;
|
||||
lbs_pr_alert("ignore PS_SleepConfirm in "
|
||||
"non-connected state\n");
|
||||
netdev_alert(dev,
|
||||
"ignore PS_SleepConfirm in non-connected state\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -587,7 +571,8 @@ int lbs_suspend(struct lbs_private *priv)
|
||||
if (priv->is_deep_sleep) {
|
||||
ret = lbs_set_deep_sleep(priv, 0);
|
||||
if (ret) {
|
||||
lbs_pr_err("deep sleep cancellation failed: %d\n", ret);
|
||||
netdev_err(priv->dev,
|
||||
"deep sleep cancellation failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
priv->deep_sleep_required = 1;
|
||||
@ -620,7 +605,8 @@ int lbs_resume(struct lbs_private *priv)
|
||||
priv->deep_sleep_required = 0;
|
||||
ret = lbs_set_deep_sleep(priv, 1);
|
||||
if (ret)
|
||||
lbs_pr_err("deep sleep activation failed: %d\n", ret);
|
||||
netdev_err(priv->dev,
|
||||
"deep sleep activation failed: %d\n", ret);
|
||||
}
|
||||
|
||||
if (priv->setup_fw_on_resume)
|
||||
@ -648,8 +634,8 @@ static void lbs_cmd_timeout_handler(unsigned long data)
|
||||
if (!priv->cur_cmd)
|
||||
goto out;
|
||||
|
||||
lbs_pr_info("command 0x%04x timed out\n",
|
||||
le16_to_cpu(priv->cur_cmd->cmdbuf->command));
|
||||
netdev_info(priv->dev, "command 0x%04x timed out\n",
|
||||
le16_to_cpu(priv->cur_cmd->cmdbuf->command));
|
||||
|
||||
priv->cmd_timed_out = 1;
|
||||
wake_up_interruptible(&priv->waitq);
|
||||
@ -754,7 +740,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
|
||||
|
||||
/* Allocate the command buffers */
|
||||
if (lbs_allocate_cmd_buffer(priv)) {
|
||||
lbs_pr_err("Out of memory allocating command buffers\n");
|
||||
pr_err("Out of memory allocating command buffers\n");
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
@ -764,7 +750,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
|
||||
/* Create the event FIFO */
|
||||
ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL);
|
||||
if (ret) {
|
||||
lbs_pr_err("Out of memory allocating event FIFO buffer\n");
|
||||
pr_err("Out of memory allocating event FIFO buffer\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -791,7 +777,6 @@ static const struct net_device_ops lbs_netdev_ops = {
|
||||
.ndo_stop = lbs_eth_stop,
|
||||
.ndo_start_xmit = lbs_hard_start_xmit,
|
||||
.ndo_set_mac_address = lbs_set_mac_address,
|
||||
.ndo_tx_timeout = lbs_tx_timeout,
|
||||
.ndo_set_multicast_list = lbs_set_multicast_list,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
@ -816,7 +801,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
||||
/* Allocate an Ethernet device and register it */
|
||||
wdev = lbs_cfg_alloc(dmdev);
|
||||
if (IS_ERR(wdev)) {
|
||||
lbs_pr_err("cfg80211 init failed\n");
|
||||
pr_err("cfg80211 init failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -825,7 +810,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
||||
priv->wdev = wdev;
|
||||
|
||||
if (lbs_init_adapter(priv)) {
|
||||
lbs_pr_err("failed to initialize adapter structure.\n");
|
||||
pr_err("failed to initialize adapter structure\n");
|
||||
goto err_wdev;
|
||||
}
|
||||
|
||||
@ -957,17 +942,20 @@ int lbs_start_card(struct lbs_private *priv)
|
||||
goto done;
|
||||
|
||||
if (lbs_cfg_register(priv)) {
|
||||
lbs_pr_err("cannot register device\n");
|
||||
pr_err("cannot register device\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
lbs_update_channel(priv);
|
||||
|
||||
lbs_init_mesh(priv);
|
||||
if (!lbs_disablemesh)
|
||||
lbs_init_mesh(priv);
|
||||
else
|
||||
pr_info("%s: mesh disabled\n", dev->name);
|
||||
|
||||
lbs_debugfs_init_one(priv, dev);
|
||||
|
||||
lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
|
||||
netdev_info(dev, "Marvell WLAN 802.11 adapter\n");
|
||||
|
||||
ret = 0;
|
||||
|
||||
@ -1094,16 +1082,16 @@ int lbs_get_firmware(struct device *dev, const char *user_helper,
|
||||
if (user_helper) {
|
||||
ret = request_firmware(helper, user_helper, dev);
|
||||
if (ret) {
|
||||
lbs_pr_err("couldn't find helper firmware %s",
|
||||
user_helper);
|
||||
dev_err(dev, "couldn't find helper firmware %s\n",
|
||||
user_helper);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (user_mainfw) {
|
||||
ret = request_firmware(mainfw, user_mainfw, dev);
|
||||
if (ret) {
|
||||
lbs_pr_err("couldn't find main firmware %s",
|
||||
user_mainfw);
|
||||
dev_err(dev, "couldn't find main firmware %s\n",
|
||||
user_mainfw);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/netdevice.h>
|
||||
@ -267,7 +269,7 @@ int lbs_init_mesh(struct lbs_private *priv)
|
||||
lbs_add_mesh(priv);
|
||||
|
||||
if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
|
||||
lbs_pr_err("cannot register lbs_mesh attribute\n");
|
||||
netdev_err(dev, "cannot register lbs_mesh attribute\n");
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
@ -395,7 +397,7 @@ int lbs_add_mesh(struct lbs_private *priv)
|
||||
/* Register virtual mesh interface */
|
||||
ret = register_netdev(mesh_dev);
|
||||
if (ret) {
|
||||
lbs_pr_err("cannot register mshX virtual interface\n");
|
||||
pr_err("cannot register mshX virtual interface\n");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
@ -973,7 +975,7 @@ static ssize_t mesh_id_get(struct device *dev, struct device_attribute *attr,
|
||||
return ret;
|
||||
|
||||
if (defs.meshie.val.mesh_id_len > IEEE80211_MAX_SSID_LEN) {
|
||||
lbs_pr_err("inconsistent mesh ID length");
|
||||
dev_err(dev, "inconsistent mesh ID length\n");
|
||||
defs.meshie.val.mesh_id_len = IEEE80211_MAX_SSID_LEN;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* This file contains the handling of RX in wlan driver.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
@ -191,7 +194,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
|
||||
case 12: /* 54 Mbps */
|
||||
return 108;
|
||||
}
|
||||
lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
|
||||
pr_alert("Invalid Marvell WLAN rate %i\n", rate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -248,7 +251,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
|
||||
/* add space for the new radio header */
|
||||
if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
|
||||
pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) {
|
||||
lbs_pr_alert("%s: couldn't pskb_expand_head\n", __func__);
|
||||
netdev_alert(dev, "%s: couldn't pskb_expand_head\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
kfree_skb(skb);
|
||||
goto done;
|
||||
|
@ -187,7 +187,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
|
||||
*/
|
||||
int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf)
|
||||
{
|
||||
struct mwifiex_ds_11n_tx_cfg *tx_cfg = NULL;
|
||||
struct mwifiex_ds_11n_tx_cfg *tx_cfg;
|
||||
struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg;
|
||||
|
||||
if (data_buf) {
|
||||
@ -274,7 +274,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
|
||||
int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
|
||||
void *data_buf)
|
||||
{
|
||||
struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl = NULL;
|
||||
struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl;
|
||||
struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl =
|
||||
&resp->params.amsdu_aggr_ctrl;
|
||||
|
||||
@ -461,8 +461,7 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
|
||||
struct mwifiex_bssdescriptor *bss_desc)
|
||||
{
|
||||
u16 max_amsdu = MWIFIEX_TX_DATA_BUF_SIZE_2K;
|
||||
u16 tx_buf = 0;
|
||||
u16 curr_tx_buf_size = 0;
|
||||
u16 tx_buf, curr_tx_buf_size = 0;
|
||||
|
||||
if (bss_desc->bcn_ht_cap) {
|
||||
if (le16_to_cpu(bss_desc->bcn_ht_cap->cap_info) &
|
||||
|
@ -60,7 +60,7 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr,
|
||||
* later with ethertype
|
||||
*/
|
||||
};
|
||||
struct tx_packet_hdr *tx_header = NULL;
|
||||
struct tx_packet_hdr *tx_header;
|
||||
|
||||
skb_put(skb_aggr, sizeof(*tx_header));
|
||||
|
||||
@ -135,131 +135,6 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Counts the number of subframes in an aggregate packet.
|
||||
*
|
||||
* This function parses an aggregate packet buffer, looking for
|
||||
* subframes and counting the number of such subframe found. The
|
||||
* function automatically skips the DA/SA fields at the beginning
|
||||
* of each subframe and padding at the end.
|
||||
*/
|
||||
static int
|
||||
mwifiex_11n_get_num_aggr_pkts(u8 *data, int total_pkt_len)
|
||||
{
|
||||
int pkt_count = 0, pkt_len, pad;
|
||||
|
||||
while (total_pkt_len > 0) {
|
||||
/* Length will be in network format, change it to host */
|
||||
pkt_len = ntohs((*(__be16 *)(data + 2 * ETH_ALEN)));
|
||||
pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ?
|
||||
(4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0;
|
||||
data += pkt_len + pad + sizeof(struct ethhdr);
|
||||
total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr);
|
||||
++pkt_count;
|
||||
}
|
||||
|
||||
return pkt_count;
|
||||
}
|
||||
|
||||
/*
|
||||
* De-aggregate received packets.
|
||||
*
|
||||
* This function parses the received aggregate buffer, extracts each subframe,
|
||||
* strips off the SNAP header from them and sends the data portion for further
|
||||
* processing.
|
||||
*
|
||||
* Each subframe body is copied onto a separate buffer, which are freed by
|
||||
* upper layer after processing. The function also performs sanity tests on
|
||||
* the received buffer.
|
||||
*/
|
||||
int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
u16 pkt_len;
|
||||
int total_pkt_len;
|
||||
u8 *data;
|
||||
int pad;
|
||||
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
|
||||
struct rxpd *local_rx_pd = (struct rxpd *) skb->data;
|
||||
struct sk_buff *skb_daggr;
|
||||
struct mwifiex_rxinfo *rx_info_daggr = NULL;
|
||||
int ret = -1;
|
||||
struct rx_packet_hdr *rx_pkt_hdr;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
|
||||
|
||||
data = (u8 *) (local_rx_pd + local_rx_pd->rx_pkt_offset);
|
||||
total_pkt_len = local_rx_pd->rx_pkt_length;
|
||||
|
||||
/* Sanity test */
|
||||
if (total_pkt_len > MWIFIEX_RX_DATA_BUF_SIZE) {
|
||||
dev_err(adapter->dev, "total pkt len greater than buffer"
|
||||
" size %d\n", total_pkt_len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rx_info->use_count = mwifiex_11n_get_num_aggr_pkts(data, total_pkt_len);
|
||||
|
||||
while (total_pkt_len > 0) {
|
||||
rx_pkt_hdr = (struct rx_packet_hdr *) data;
|
||||
/* Length will be in network format, change it to host */
|
||||
pkt_len = ntohs((*(__be16 *) (data + 2 * ETH_ALEN)));
|
||||
if (pkt_len > total_pkt_len) {
|
||||
dev_err(adapter->dev, "pkt_len %d > total_pkt_len %d\n",
|
||||
total_pkt_len, pkt_len);
|
||||
break;
|
||||
}
|
||||
|
||||
pad = (((pkt_len + sizeof(struct ethhdr)) & 3)) ?
|
||||
(4 - ((pkt_len + sizeof(struct ethhdr)) & 3)) : 0;
|
||||
|
||||
total_pkt_len -= pkt_len + pad + sizeof(struct ethhdr);
|
||||
|
||||
if (memcmp(&rx_pkt_hdr->rfc1042_hdr,
|
||||
rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) {
|
||||
memmove(data + LLC_SNAP_LEN, data, 2 * ETH_ALEN);
|
||||
data += LLC_SNAP_LEN;
|
||||
pkt_len += sizeof(struct ethhdr) - LLC_SNAP_LEN;
|
||||
} else {
|
||||
*(u16 *) (data + 2 * ETH_ALEN) = (u16) 0;
|
||||
pkt_len += sizeof(struct ethhdr);
|
||||
}
|
||||
|
||||
skb_daggr = dev_alloc_skb(pkt_len);
|
||||
if (!skb_daggr) {
|
||||
dev_err(adapter->dev, "%s: failed to alloc skb_daggr\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
rx_info_daggr = MWIFIEX_SKB_RXCB(skb_daggr);
|
||||
|
||||
rx_info_daggr->bss_index = rx_info->bss_index;
|
||||
skb_daggr->tstamp = skb->tstamp;
|
||||
rx_info_daggr->parent = skb;
|
||||
skb_daggr->priority = skb->priority;
|
||||
skb_put(skb_daggr, pkt_len);
|
||||
memcpy(skb_daggr->data, data, pkt_len);
|
||||
|
||||
ret = mwifiex_recv_packet(adapter, skb_daggr);
|
||||
|
||||
switch (ret) {
|
||||
case -EINPROGRESS:
|
||||
break;
|
||||
case -1:
|
||||
dev_err(adapter->dev, "deaggr: host_to_card failed\n");
|
||||
case 0:
|
||||
mwifiex_recv_packet_complete(adapter, skb_daggr, ret);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
data += pkt_len + pad;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create aggregated packet.
|
||||
*
|
||||
@ -285,8 +160,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct sk_buff *skb_aggr, *skb_src;
|
||||
struct mwifiex_txinfo *tx_info_aggr, *tx_info_src;
|
||||
int pad = 0;
|
||||
int ret = 0;
|
||||
int pad = 0, ret;
|
||||
struct mwifiex_tx_param tx_param;
|
||||
struct txpd *ptx_pd = NULL;
|
||||
|
||||
@ -319,7 +193,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
|
||||
else
|
||||
skb_src = NULL;
|
||||
|
||||
pra_list->total_pkts_size -= skb_src->len;
|
||||
if (skb_src)
|
||||
pra_list->total_pkts_size -= skb_src->len;
|
||||
|
||||
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
|
||||
ra_list_flags);
|
||||
@ -374,7 +249,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
|
||||
(adapter->pps_uapsd_mode) &&
|
||||
(adapter->tx_lock_flag)) {
|
||||
priv->adapter->tx_lock_flag = false;
|
||||
ptx_pd->flags = 0;
|
||||
if (ptx_pd)
|
||||
ptx_pd->flags = 0;
|
||||
}
|
||||
|
||||
skb_queue_tail(&pra_list->skb_head, skb_aggr);
|
||||
|
@ -39,7 +39,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
|
||||
*rx_reor_tbl_ptr, int start_win)
|
||||
{
|
||||
int no_pkt_to_send, i;
|
||||
void *rx_tmp_ptr = NULL;
|
||||
void *rx_tmp_ptr;
|
||||
unsigned long flags;
|
||||
|
||||
no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ?
|
||||
@ -88,7 +88,7 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
|
||||
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr)
|
||||
{
|
||||
int i, j, xchg;
|
||||
void *rx_tmp_ptr = NULL;
|
||||
void *rx_tmp_ptr;
|
||||
unsigned long flags;
|
||||
|
||||
for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) {
|
||||
@ -335,8 +335,8 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
|
||||
&cmd->params.add_ba_rsp;
|
||||
struct host_cmd_ds_11n_addba_req *cmd_addba_req =
|
||||
(struct host_cmd_ds_11n_addba_req *) data_buf;
|
||||
u8 tid = 0;
|
||||
int win_size = 0;
|
||||
u8 tid;
|
||||
int win_size;
|
||||
uint16_t block_ack_param_set;
|
||||
|
||||
cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);
|
||||
@ -406,9 +406,8 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
|
||||
u8 *ta, u8 pkt_type, void *payload)
|
||||
{
|
||||
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
|
||||
int start_win, end_win, win_size;
|
||||
int ret = 0;
|
||||
u16 pkt_index = 0;
|
||||
int start_win, end_win, win_size, ret;
|
||||
u16 pkt_index;
|
||||
|
||||
rx_reor_tbl_ptr =
|
||||
mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv,
|
||||
@ -540,7 +539,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
|
||||
(struct host_cmd_ds_11n_addba_rsp *)
|
||||
&resp->params.add_ba_rsp;
|
||||
int tid, win_size;
|
||||
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr = NULL;
|
||||
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
|
||||
uint16_t block_ack_param_set;
|
||||
|
||||
block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
|
||||
|
@ -77,18 +77,15 @@ mwifiex_channels_to_cfg80211_channel_type(int channel_type)
|
||||
static int
|
||||
mwifiex_is_alg_wep(u32 cipher)
|
||||
{
|
||||
int alg = 0;
|
||||
|
||||
switch (cipher) {
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
alg = 1;
|
||||
break;
|
||||
return 1;
|
||||
default:
|
||||
alg = 0;
|
||||
break;
|
||||
}
|
||||
return alg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -408,7 +405,7 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
|
||||
static int
|
||||
mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (frag_thr < MWIFIEX_FRAG_MIN_VALUE
|
||||
|| frag_thr > MWIFIEX_FRAG_MAX_VALUE)
|
||||
@ -449,7 +446,6 @@ static int
|
||||
mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
|
||||
{
|
||||
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
|
||||
@ -473,7 +469,7 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
struct vif_params *params)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
||||
|
||||
if (priv->bss_mode == type) {
|
||||
@ -717,7 +713,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
|
||||
{
|
||||
struct ieee80211_channel *chan;
|
||||
struct mwifiex_bss_info bss_info;
|
||||
int ie_len = 0;
|
||||
int ie_len;
|
||||
u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)];
|
||||
|
||||
if (mwifiex_get_bss_info(priv, &bss_info))
|
||||
@ -765,7 +761,6 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
|
||||
static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
|
||||
struct mwifiex_802_11_ssid *ssid)
|
||||
{
|
||||
struct mwifiex_scan_resp scan_resp;
|
||||
struct mwifiex_bssdescriptor *scan_table;
|
||||
int i, j;
|
||||
struct ieee80211_channel *chan;
|
||||
@ -775,10 +770,6 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
|
||||
int beacon_size;
|
||||
u8 element_id, element_len;
|
||||
|
||||
memset(&scan_resp, 0, sizeof(scan_resp));
|
||||
scan_resp.scan_table = (u8 *) priv->adapter->scan_table;
|
||||
scan_resp.num_in_scan_table = priv->adapter->num_in_scan_table;
|
||||
|
||||
#define MAX_IE_BUF 2048
|
||||
ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL);
|
||||
if (!ie_buf) {
|
||||
@ -787,8 +778,8 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
scan_table = (struct mwifiex_bssdescriptor *) scan_resp.scan_table;
|
||||
for (i = 0; i < scan_resp.num_in_scan_table; i++) {
|
||||
scan_table = priv->adapter->scan_table;
|
||||
for (i = 0; i < priv->adapter->num_in_scan_table; i++) {
|
||||
if (ssid) {
|
||||
/* Inform specific BSS only */
|
||||
if (memcmp(ssid->ssid, scan_table[i].ssid.ssid,
|
||||
@ -903,8 +894,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
|
||||
{
|
||||
struct mwifiex_802_11_ssid req_ssid;
|
||||
struct mwifiex_ssid_bssid ssid_bssid;
|
||||
int ret = 0;
|
||||
int auth_type = 0;
|
||||
int ret, auth_type = 0;
|
||||
|
||||
memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid));
|
||||
memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid));
|
||||
@ -1044,7 +1034,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
|
||||
goto done;
|
||||
}
|
||||
|
||||
priv->assoc_request = 1;
|
||||
priv->assoc_request = -EINPROGRESS;
|
||||
|
||||
wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n",
|
||||
(char *) sme->ssid, sme->bssid);
|
||||
@ -1052,6 +1042,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
|
||||
ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
|
||||
priv->bss_mode, sme->channel, sme, 0);
|
||||
|
||||
priv->assoc_request = 1;
|
||||
done:
|
||||
priv->assoc_result = ret;
|
||||
queue_work(priv->workqueue, &priv->cfg_workqueue);
|
||||
@ -1080,7 +1071,7 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
|
||||
goto done;
|
||||
}
|
||||
|
||||
priv->ibss_join_request = 1;
|
||||
priv->ibss_join_request = -EINPROGRESS;
|
||||
|
||||
wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n",
|
||||
(char *) params->ssid, params->bssid);
|
||||
@ -1088,6 +1079,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
|
||||
ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid,
|
||||
params->bssid, priv->bss_mode,
|
||||
params->channel, NULL, params->privacy);
|
||||
|
||||
priv->ibss_join_request = 1;
|
||||
done:
|
||||
priv->ibss_join_result = ret;
|
||||
queue_work(priv->workqueue, &priv->cfg_workqueue);
|
||||
@ -1244,8 +1237,8 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
|
||||
int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac,
|
||||
struct mwifiex_private *priv)
|
||||
{
|
||||
int ret = 0;
|
||||
void *wdev_priv = NULL;
|
||||
int ret;
|
||||
void *wdev_priv;
|
||||
struct wireless_dev *wdev;
|
||||
|
||||
wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
|
||||
@ -1257,8 +1250,10 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac,
|
||||
wdev->wiphy =
|
||||
wiphy_new(&mwifiex_cfg80211_ops,
|
||||
sizeof(struct mwifiex_private *));
|
||||
if (!wdev->wiphy)
|
||||
if (!wdev->wiphy) {
|
||||
kfree(wdev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
wdev->wiphy->max_scan_ssids = 10;
|
||||
wdev->wiphy->interface_modes =
|
||||
@ -1298,6 +1293,7 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac,
|
||||
dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n",
|
||||
__func__);
|
||||
wiphy_free(wdev->wiphy);
|
||||
kfree(wdev);
|
||||
return ret;
|
||||
} else {
|
||||
dev_dbg(priv->adapter->dev,
|
||||
@ -1380,7 +1376,7 @@ mwifiex_cfg80211_results(struct work_struct *work)
|
||||
kfree(scan_req);
|
||||
}
|
||||
|
||||
if (priv->assoc_request) {
|
||||
if (priv->assoc_request == 1) {
|
||||
if (!priv->assoc_result) {
|
||||
cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
|
||||
NULL, 0, NULL, 0,
|
||||
@ -1399,7 +1395,7 @@ mwifiex_cfg80211_results(struct work_struct *work)
|
||||
priv->assoc_result = 0;
|
||||
}
|
||||
|
||||
if (priv->ibss_join_request) {
|
||||
if (priv->ibss_join_request == 1) {
|
||||
if (!priv->ibss_join_result) {
|
||||
cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid,
|
||||
GFP_KERNEL);
|
||||
|
@ -91,7 +91,7 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
|
||||
cmd_node->wait_q_enabled = false;
|
||||
|
||||
if (cmd_node->resp_skb) {
|
||||
mwifiex_recv_complete(adapter, cmd_node->resp_skb, 0);
|
||||
dev_kfree_skb_any(cmd_node->resp_skb);
|
||||
cmd_node->resp_skb = NULL;
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
|
||||
{
|
||||
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct host_cmd_ds_command *host_cmd;
|
||||
uint16_t cmd_code;
|
||||
uint16_t cmd_size;
|
||||
@ -222,25 +222,24 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
|
||||
*/
|
||||
static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
u16 cmd_len = 0;
|
||||
int ret;
|
||||
struct mwifiex_private *priv;
|
||||
struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf =
|
||||
(struct mwifiex_opt_sleep_confirm_buffer *)
|
||||
struct mwifiex_opt_sleep_confirm *sleep_cfm_buf =
|
||||
(struct mwifiex_opt_sleep_confirm *)
|
||||
adapter->sleep_cfm->data;
|
||||
cmd_len = sizeof(struct mwifiex_opt_sleep_confirm);
|
||||
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
|
||||
|
||||
sleep_cfm_buf->ps_cfm_sleep.seq_num =
|
||||
sleep_cfm_buf->seq_num =
|
||||
cpu_to_le16((HostCmd_SET_SEQ_NO_BSS_INFO
|
||||
(adapter->seq_num, priv->bss_num,
|
||||
priv->bss_type)));
|
||||
adapter->seq_num++;
|
||||
|
||||
skb_push(adapter->sleep_cfm, INTF_HEADER_LEN);
|
||||
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
|
||||
adapter->sleep_cfm->data,
|
||||
adapter->sleep_cfm->len +
|
||||
INTF_HEADER_LEN, NULL);
|
||||
adapter->sleep_cfm->len, NULL);
|
||||
skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN);
|
||||
|
||||
if (ret == -1) {
|
||||
dev_err(adapter->dev, "SLEEP_CFM: failed\n");
|
||||
@ -249,14 +248,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
|
||||
}
|
||||
if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY))
|
||||
== MWIFIEX_BSS_ROLE_STA) {
|
||||
if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl)
|
||||
if (!sleep_cfm_buf->resp_ctrl)
|
||||
/* Response is not needed for sleep
|
||||
confirm command */
|
||||
adapter->ps_state = PS_STATE_SLEEP;
|
||||
else
|
||||
adapter->ps_state = PS_STATE_SLEEP_CFM;
|
||||
|
||||
if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl
|
||||
if (!sleep_cfm_buf->resp_ctrl
|
||||
&& (adapter->is_hs_configured
|
||||
&& !adapter->sleep_period.period)) {
|
||||
adapter->pm_wakeup_card_req = true;
|
||||
@ -292,7 +291,7 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
|
||||
if (!cmd_array) {
|
||||
dev_err(adapter->dev, "%s: failed to alloc cmd_array\n",
|
||||
__func__);
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
adapter->cmd_pool = cmd_array;
|
||||
@ -340,7 +339,7 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
|
||||
}
|
||||
if (!cmd_array[i].resp_skb)
|
||||
continue;
|
||||
mwifiex_recv_complete(adapter, cmd_array[i].resp_skb, 0);
|
||||
dev_kfree_skb_any(cmd_array[i].resp_skb);
|
||||
}
|
||||
/* Release struct cmd_ctrl_node */
|
||||
if (adapter->cmd_pool) {
|
||||
@ -364,13 +363,13 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
int mwifiex_process_event(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_private *priv =
|
||||
mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
|
||||
struct sk_buff *skb = adapter->event_skb;
|
||||
u32 eventcause = adapter->event_cause;
|
||||
struct timeval tstamp;
|
||||
struct mwifiex_rxinfo *rx_info = NULL;
|
||||
struct mwifiex_rxinfo *rx_info;
|
||||
|
||||
/* Save the last event to debug log */
|
||||
adapter->dbg.last_event_index =
|
||||
@ -403,7 +402,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
|
||||
adapter->event_cause = 0;
|
||||
adapter->event_skb = NULL;
|
||||
|
||||
mwifiex_recv_complete(adapter, skb, 0);
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -446,10 +445,10 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
|
||||
int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
|
||||
u16 cmd_action, u32 cmd_oid, void *data_buf)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct cmd_ctrl_node *cmd_node = NULL;
|
||||
struct host_cmd_ds_command *cmd_ptr = NULL;
|
||||
struct cmd_ctrl_node *cmd_node;
|
||||
struct host_cmd_ds_command *cmd_ptr;
|
||||
|
||||
if (!adapter) {
|
||||
pr_err("PREP_CMD: adapter is NULL\n");
|
||||
@ -605,8 +604,8 @@ mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
|
||||
*/
|
||||
int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct mwifiex_private *priv = NULL;
|
||||
struct cmd_ctrl_node *cmd_node = NULL;
|
||||
struct mwifiex_private *priv;
|
||||
struct cmd_ctrl_node *cmd_node;
|
||||
int ret = 0;
|
||||
struct host_cmd_ds_command *host_cmd;
|
||||
unsigned long cmd_flags;
|
||||
@ -673,7 +672,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct host_cmd_ds_command *resp = NULL;
|
||||
struct host_cmd_ds_command *resp;
|
||||
struct mwifiex_private *priv =
|
||||
mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
|
||||
int ret = 0;
|
||||
@ -805,7 +804,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
|
||||
{
|
||||
struct mwifiex_adapter *adapter =
|
||||
(struct mwifiex_adapter *) function_context;
|
||||
struct cmd_ctrl_node *cmd_node = NULL;
|
||||
struct cmd_ctrl_node *cmd_node;
|
||||
struct timeval tstamp;
|
||||
|
||||
adapter->num_cmd_timeout++;
|
||||
@ -877,7 +876,7 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
|
||||
void
|
||||
mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
|
||||
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
|
||||
unsigned long flags;
|
||||
|
||||
/* Cancel current cmd */
|
||||
@ -1160,7 +1159,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
|
||||
{
|
||||
struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh =
|
||||
&cmd->params.psmode_enh;
|
||||
u8 *tlv = NULL;
|
||||
u8 *tlv;
|
||||
u16 cmd_size = 0;
|
||||
|
||||
cmd->command = cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
|
||||
|
@ -193,7 +193,7 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
|
||||
unsigned long page = get_zeroed_page(GFP_KERNEL);
|
||||
char *p = (char *) page, fmt[64];
|
||||
struct mwifiex_bss_info info;
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret;
|
||||
int i = 0;
|
||||
|
||||
if (!p)
|
||||
@ -288,7 +288,7 @@ mwifiex_getlog_read(struct file *file, char __user *ubuf,
|
||||
(struct mwifiex_private *) file->private_data;
|
||||
unsigned long page = get_zeroed_page(GFP_KERNEL);
|
||||
char *p = (char *) page;
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret;
|
||||
struct mwifiex_ds_get_stats stats;
|
||||
|
||||
if (!p)
|
||||
@ -400,7 +400,7 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
|
||||
struct mwifiex_debug_data *d = &items[0];
|
||||
unsigned long page = get_zeroed_page(GFP_KERNEL);
|
||||
char *p = (char *) page;
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret;
|
||||
size_t size, addr;
|
||||
long val;
|
||||
int i, j;
|
||||
@ -507,7 +507,7 @@ mwifiex_regrdwr_write(struct file *file,
|
||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||
char *buf = (char *) addr;
|
||||
size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1));
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
|
||||
|
||||
if (!buf)
|
||||
@ -650,7 +650,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
|
||||
(struct mwifiex_private *) file->private_data;
|
||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||
char *buf = (char *) addr;
|
||||
int pos = 0, ret = 0, i = 0;
|
||||
int pos = 0, ret = 0, i;
|
||||
u8 value[MAX_EEPROM_DATA];
|
||||
|
||||
if (!buf)
|
||||
|
@ -816,14 +816,7 @@ struct host_cmd_ds_txpwr_cfg {
|
||||
|
||||
struct mwifiex_scan_cmd_config {
|
||||
/*
|
||||
* BSS Type to be sent in the firmware command
|
||||
*
|
||||
* Field can be used to restrict the types of networks returned in the
|
||||
* scan. Valid settings are:
|
||||
*
|
||||
* - MWIFIEX_SCAN_MODE_BSS (infrastructure)
|
||||
* - MWIFIEX_SCAN_MODE_IBSS (adhoc)
|
||||
* - MWIFIEX_SCAN_MODE_ANY (unrestricted, adhoc and infrastructure)
|
||||
* BSS mode to be sent in the firmware command
|
||||
*/
|
||||
u8 bss_mode;
|
||||
|
||||
@ -866,13 +859,6 @@ struct mwifiex_user_scan_cfg {
|
||||
u8 keep_previous_scan;
|
||||
/*
|
||||
* BSS mode to be sent in the firmware command
|
||||
*
|
||||
* Field can be used to restrict the types of networks returned in the
|
||||
* scan. Valid settings are:
|
||||
*
|
||||
* - MWIFIEX_SCAN_MODE_BSS (infrastructure)
|
||||
* - MWIFIEX_SCAN_MODE_IBSS (adhoc)
|
||||
* - MWIFIEX_SCAN_MODE_ANY (unrestricted, adhoc and infrastructure)
|
||||
*/
|
||||
u8 bss_mode;
|
||||
/* Configure the number of probe requests for active chan scans */
|
||||
@ -1198,9 +1184,4 @@ struct mwifiex_opt_sleep_confirm {
|
||||
__le16 action;
|
||||
__le16 resp_ctrl;
|
||||
} __packed;
|
||||
|
||||
struct mwifiex_opt_sleep_confirm_buffer {
|
||||
u8 hdr[4];
|
||||
struct mwifiex_opt_sleep_confirm ps_cfm_sleep;
|
||||
} __packed;
|
||||
#endif /* !_MWIFIEX_FW_H_ */
|
||||
|
@ -41,7 +41,7 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
|
||||
if (!bss_prio) {
|
||||
dev_err(adapter->dev, "%s: failed to alloc bss_prio\n",
|
||||
__func__);
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
bss_prio->priv = priv;
|
||||
@ -151,7 +151,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
|
||||
*/
|
||||
static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u32 buf_size;
|
||||
struct mwifiex_bssdescriptor *temp_scan_table;
|
||||
|
||||
@ -161,7 +161,7 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter)
|
||||
if (!temp_scan_table) {
|
||||
dev_err(adapter->dev, "%s: failed to alloc temp_scan_table\n",
|
||||
__func__);
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
adapter->scan_table = temp_scan_table;
|
||||
@ -175,7 +175,7 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter)
|
||||
}
|
||||
|
||||
adapter->sleep_cfm =
|
||||
dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm_buffer)
|
||||
dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm)
|
||||
+ INTF_HEADER_LEN);
|
||||
|
||||
if (!adapter->sleep_cfm) {
|
||||
@ -197,10 +197,10 @@ static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct mwifiex_opt_sleep_confirm_buffer *sleep_cfm_buf = NULL;
|
||||
struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL;
|
||||
|
||||
skb_put(adapter->sleep_cfm, sizeof(sleep_cfm_buf->ps_cfm_sleep));
|
||||
sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm_buffer *)
|
||||
skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm));
|
||||
sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *)
|
||||
(adapter->sleep_cfm->data);
|
||||
|
||||
adapter->cmd_sent = false;
|
||||
@ -268,16 +268,14 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
|
||||
mwifiex_wmm_init(adapter);
|
||||
|
||||
if (adapter->sleep_cfm) {
|
||||
memset(&sleep_cfm_buf->ps_cfm_sleep, 0,
|
||||
adapter->sleep_cfm->len);
|
||||
sleep_cfm_buf->ps_cfm_sleep.command =
|
||||
cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
|
||||
sleep_cfm_buf->ps_cfm_sleep.size =
|
||||
cpu_to_le16(adapter->sleep_cfm->len);
|
||||
sleep_cfm_buf->ps_cfm_sleep.result = 0;
|
||||
sleep_cfm_buf->ps_cfm_sleep.action = cpu_to_le16(SLEEP_CONFIRM);
|
||||
sleep_cfm_buf->ps_cfm_sleep.resp_ctrl =
|
||||
cpu_to_le16(RESP_NEEDED);
|
||||
memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len);
|
||||
sleep_cfm_buf->command =
|
||||
cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
|
||||
sleep_cfm_buf->size =
|
||||
cpu_to_le16(adapter->sleep_cfm->len);
|
||||
sleep_cfm_buf->result = 0;
|
||||
sleep_cfm_buf->action = cpu_to_le16(SLEEP_CONFIRM);
|
||||
sleep_cfm_buf->resp_ctrl = cpu_to_le16(RESP_NEEDED);
|
||||
}
|
||||
memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params));
|
||||
memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period));
|
||||
@ -342,9 +340,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct mwifiex_private *priv = NULL;
|
||||
s32 i = 0;
|
||||
u32 j = 0;
|
||||
struct mwifiex_private *priv;
|
||||
s32 i, j;
|
||||
|
||||
spin_lock_init(&adapter->mwifiex_lock);
|
||||
spin_lock_init(&adapter->int_lock);
|
||||
@ -400,9 +397,8 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct mwifiex_private *priv = NULL;
|
||||
s32 i = 0;
|
||||
s32 j = 0;
|
||||
struct mwifiex_private *priv;
|
||||
s32 i, j;
|
||||
|
||||
/* Free lists */
|
||||
list_del(&adapter->cmd_free_q);
|
||||
@ -436,10 +432,9 @@ void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
int mwifiex_init_fw(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
struct mwifiex_private *priv = NULL;
|
||||
u8 i = 0;
|
||||
u8 first_sta = true;
|
||||
int ret;
|
||||
struct mwifiex_private *priv;
|
||||
u8 i, first_sta = true;
|
||||
int is_cmd_pend_q_empty;
|
||||
unsigned long flags;
|
||||
|
||||
@ -497,8 +492,7 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv)
|
||||
{
|
||||
int i;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct mwifiex_bss_prio_node *bssprio_node = NULL, *tmp_node = NULL,
|
||||
**cur = NULL;
|
||||
struct mwifiex_bss_prio_node *bssprio_node, *tmp_node, **cur;
|
||||
struct list_head *head;
|
||||
spinlock_t *lock;
|
||||
unsigned long flags;
|
||||
@ -552,8 +546,8 @@ int
|
||||
mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = -EINPROGRESS;
|
||||
struct mwifiex_private *priv = NULL;
|
||||
s32 i = 0;
|
||||
struct mwifiex_private *priv;
|
||||
s32 i;
|
||||
unsigned long flags;
|
||||
|
||||
/* mwifiex already shutdown */
|
||||
@ -608,9 +602,8 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
|
||||
int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
|
||||
struct mwifiex_fw_image *pmfw)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret, winner;
|
||||
u32 poll_num = 1;
|
||||
int winner;
|
||||
|
||||
/* Check if firmware is already running */
|
||||
ret = adapter->if_ops.check_fw_status(adapter, poll_num, &winner);
|
||||
|
@ -22,50 +22,17 @@
|
||||
|
||||
#include <net/mac80211.h>
|
||||
|
||||
enum {
|
||||
MWIFIEX_SCAN_MODE_UNCHANGED = 0,
|
||||
MWIFIEX_SCAN_MODE_BSS,
|
||||
MWIFIEX_SCAN_MODE_IBSS,
|
||||
MWIFIEX_SCAN_MODE_ANY
|
||||
};
|
||||
|
||||
enum {
|
||||
MWIFIEX_SCAN_TYPE_UNCHANGED = 0,
|
||||
MWIFIEX_SCAN_TYPE_ACTIVE,
|
||||
MWIFIEX_SCAN_TYPE_PASSIVE
|
||||
};
|
||||
|
||||
struct mwifiex_get_scan_table_fixed {
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 channel;
|
||||
u8 rssi;
|
||||
long long network_tsf;
|
||||
};
|
||||
|
||||
struct mwifiex_scan_time_params {
|
||||
u32 specific_scan_time;
|
||||
u32 active_scan_time;
|
||||
u32 passive_scan_time;
|
||||
};
|
||||
|
||||
struct mwifiex_user_scan {
|
||||
u32 scan_cfg_len;
|
||||
u8 scan_cfg_buf[1];
|
||||
};
|
||||
|
||||
struct mwifiex_scan_req {
|
||||
u32 scan_mode;
|
||||
u32 scan_type;
|
||||
struct mwifiex_802_11_ssid scan_ssid;
|
||||
struct mwifiex_scan_time_params scan_time;
|
||||
struct mwifiex_user_scan user_scan;
|
||||
};
|
||||
|
||||
struct mwifiex_scan_resp {
|
||||
u32 num_in_scan_table;
|
||||
u8 *scan_table;
|
||||
};
|
||||
|
||||
#define MWIFIEX_PROMISC_MODE 1
|
||||
#define MWIFIEX_MULTICAST_MODE 2
|
||||
#define MWIFIEX_ALL_MULTI_MODE 4
|
||||
@ -77,18 +44,11 @@ struct mwifiex_multicast_list {
|
||||
u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
|
||||
};
|
||||
|
||||
#define MWIFIEX_MAX_CHANNEL_NUM 128
|
||||
|
||||
struct mwifiex_chan_freq {
|
||||
u32 channel;
|
||||
u32 freq;
|
||||
};
|
||||
|
||||
struct mwifiex_chan_list {
|
||||
u32 num_of_chan;
|
||||
struct mwifiex_chan_freq cf[MWIFIEX_MAX_CHANNEL_NUM];
|
||||
};
|
||||
|
||||
struct mwifiex_ssid_bssid {
|
||||
struct mwifiex_802_11_ssid ssid;
|
||||
u8 bssid[ETH_ALEN];
|
||||
@ -136,18 +96,8 @@ struct mwifiex_ds_get_stats {
|
||||
u32 wep_icv_error[4];
|
||||
};
|
||||
|
||||
#define BCN_RSSI_LAST_MASK 0x00000001
|
||||
#define BCN_RSSI_AVG_MASK 0x00000002
|
||||
#define DATA_RSSI_LAST_MASK 0x00000004
|
||||
#define DATA_RSSI_AVG_MASK 0x00000008
|
||||
#define BCN_SNR_LAST_MASK 0x00000010
|
||||
#define BCN_SNR_AVG_MASK 0x00000020
|
||||
#define DATA_SNR_LAST_MASK 0x00000040
|
||||
#define DATA_SNR_AVG_MASK 0x00000080
|
||||
#define BCN_NF_LAST_MASK 0x00000100
|
||||
#define BCN_NF_AVG_MASK 0x00000200
|
||||
#define DATA_NF_LAST_MASK 0x00000400
|
||||
#define DATA_NF_AVG_MASK 0x00000800
|
||||
#define ALL_RSSI_INFO_MASK 0x00000fff
|
||||
|
||||
struct mwifiex_ds_get_signal {
|
||||
@ -174,11 +124,6 @@ struct mwifiex_ds_get_signal {
|
||||
s16 data_nf_avg;
|
||||
};
|
||||
|
||||
struct mwifiex_fw_info {
|
||||
u32 fw_ver;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
#define MWIFIEX_MAX_VER_STR_LEN 128
|
||||
|
||||
struct mwifiex_ver_ext {
|
||||
@ -286,11 +231,6 @@ struct mwifiex_rate_cfg {
|
||||
u32 rate;
|
||||
};
|
||||
|
||||
struct mwifiex_data_rate {
|
||||
u32 tx_data_rate;
|
||||
u32 rx_data_rate;
|
||||
};
|
||||
|
||||
struct mwifiex_power_cfg {
|
||||
u32 is_power_auto;
|
||||
u32 power_level;
|
||||
@ -309,21 +249,14 @@ struct mwifiex_ds_hs_cfg {
|
||||
};
|
||||
|
||||
#define DEEP_SLEEP_ON 1
|
||||
#define DEEP_SLEEP_OFF 0
|
||||
|
||||
#define DEEP_SLEEP_IDLE_TIME 100
|
||||
#define PS_MODE_AUTO 1
|
||||
|
||||
struct mwifiex_ds_auto_ds {
|
||||
u16 auto_ds;
|
||||
u16 idle_time;
|
||||
};
|
||||
|
||||
#define PS_MODE_UNCHANGED 0
|
||||
#define PS_MODE_AUTO 1
|
||||
#define PS_MODE_POLL 2
|
||||
#define PS_MODE_NULL 3
|
||||
|
||||
|
||||
struct mwifiex_ds_pm_cfg {
|
||||
union {
|
||||
u32 ps_mode;
|
||||
@ -333,18 +266,6 @@ struct mwifiex_ds_pm_cfg {
|
||||
} param;
|
||||
};
|
||||
|
||||
struct mwifiex_ioctl_wmm_queue_status_ac {
|
||||
u8 wmm_acm;
|
||||
u8 flow_required;
|
||||
u8 flow_created;
|
||||
u8 disabled;
|
||||
};
|
||||
|
||||
struct mwifiex_ds_wmm_queue_status {
|
||||
struct mwifiex_ioctl_wmm_queue_status_ac
|
||||
ac_status[IEEE80211_MAX_QUEUES];
|
||||
};
|
||||
|
||||
struct mwifiex_ds_11n_tx_cfg {
|
||||
u16 tx_htcap;
|
||||
u16 tx_htinfo;
|
||||
|
@ -143,9 +143,8 @@ mwifiex_cmd_append_tsf_tlv(struct mwifiex_private *priv, u8 **buffer,
|
||||
static int mwifiex_get_common_rates(struct mwifiex_private *priv, u8 *rate1,
|
||||
u32 rate1_size, u8 *rate2, u32 rate2_size)
|
||||
{
|
||||
int ret = 0;
|
||||
u8 *ptr = rate1;
|
||||
u8 *tmp = NULL;
|
||||
int ret;
|
||||
u8 *ptr = rate1, *tmp;
|
||||
u32 i, j;
|
||||
|
||||
tmp = kmalloc(rate1_size, GFP_KERNEL);
|
||||
@ -203,7 +202,7 @@ mwifiex_setup_rates_from_bssdesc(struct mwifiex_private *priv,
|
||||
u8 *out_rates, u32 *out_rates_size)
|
||||
{
|
||||
u8 card_rates[MWIFIEX_SUPPORTED_RATES];
|
||||
u32 card_rates_size = 0;
|
||||
u32 card_rates_size;
|
||||
|
||||
/* Copy AP supported rates */
|
||||
memcpy(out_rates, bss_desc->supported_rates, MWIFIEX_SUPPORTED_RATES);
|
||||
@ -1359,7 +1358,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
|
||||
static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
|
||||
{
|
||||
u8 mac_address[ETH_ALEN];
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
if (mac) {
|
||||
|
@ -69,7 +69,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
|
||||
|
||||
adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL);
|
||||
if (!adapter)
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
|
||||
g_adapter = adapter;
|
||||
adapter->card = card;
|
||||
@ -150,7 +150,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
|
||||
*/
|
||||
static int mwifiex_unregister(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
s32 i = 0;
|
||||
s32 i;
|
||||
|
||||
del_timer(&adapter->cmd_timer);
|
||||
|
||||
@ -379,8 +379,7 @@ static void mwifiex_free_adapter(struct mwifiex_adapter *adapter)
|
||||
*/
|
||||
static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
int err;
|
||||
int ret, err;
|
||||
struct mwifiex_fw_image fw;
|
||||
|
||||
memset(&fw, 0, sizeof(struct mwifiex_fw_image));
|
||||
@ -449,7 +448,7 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter)
|
||||
static void
|
||||
mwifiex_fill_buffer(struct sk_buff *skb)
|
||||
{
|
||||
struct ethhdr *eth = NULL;
|
||||
struct ethhdr *eth;
|
||||
struct iphdr *iph;
|
||||
struct timeval tv;
|
||||
u8 tid = 0;
|
||||
@ -510,20 +509,20 @@ static int
|
||||
mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
||||
struct sk_buff *new_skb = NULL;
|
||||
struct sk_buff *new_skb;
|
||||
struct mwifiex_txinfo *tx_info;
|
||||
|
||||
dev_dbg(priv->adapter->dev, "data: %lu BSS(%d): Data <= kernel\n",
|
||||
jiffies, priv->bss_index);
|
||||
|
||||
if (priv->adapter->surprise_removed) {
|
||||
kfree(skb);
|
||||
kfree_skb(skb);
|
||||
priv->stats.tx_dropped++;
|
||||
return 0;
|
||||
}
|
||||
if (!skb->len || (skb->len > ETH_FRAME_LEN)) {
|
||||
dev_err(priv->adapter->dev, "Tx: bad skb len %d\n", skb->len);
|
||||
kfree(skb);
|
||||
kfree_skb(skb);
|
||||
priv->stats.tx_dropped++;
|
||||
return 0;
|
||||
}
|
||||
@ -536,7 +535,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN);
|
||||
if (unlikely(!new_skb)) {
|
||||
dev_err(priv->adapter->dev, "Tx: cannot alloca new_skb\n");
|
||||
kfree(skb);
|
||||
kfree_skb(skb);
|
||||
priv->stats.tx_dropped++;
|
||||
return 0;
|
||||
}
|
||||
@ -571,7 +570,7 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr)
|
||||
{
|
||||
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
||||
struct sockaddr *hw_addr = (struct sockaddr *) addr;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN);
|
||||
|
||||
@ -696,9 +695,9 @@ static struct mwifiex_private *mwifiex_add_interface(
|
||||
struct mwifiex_adapter *adapter,
|
||||
u8 bss_index, u8 bss_type)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct mwifiex_private *priv = NULL;
|
||||
void *mdev_priv = NULL;
|
||||
struct net_device *dev;
|
||||
struct mwifiex_private *priv;
|
||||
void *mdev_priv;
|
||||
|
||||
dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), "mlan%d",
|
||||
ether_setup, 1);
|
||||
@ -759,7 +758,7 @@ static struct mwifiex_private *mwifiex_add_interface(
|
||||
static void
|
||||
mwifiex_remove_interface(struct mwifiex_adapter *adapter, u8 bss_index)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
struct net_device *dev;
|
||||
struct mwifiex_private *priv = adapter->priv[bss_index];
|
||||
|
||||
if (!priv)
|
||||
|
@ -479,9 +479,9 @@ struct mwifiex_private {
|
||||
u8 report_scan_result;
|
||||
struct cfg80211_scan_request *scan_request;
|
||||
int scan_result_status;
|
||||
bool assoc_request;
|
||||
int assoc_request;
|
||||
u16 assoc_result;
|
||||
bool ibss_join_request;
|
||||
int ibss_join_request;
|
||||
u16 ibss_join_result;
|
||||
bool disconnect;
|
||||
u8 cfg_bssid[6];
|
||||
@ -692,10 +692,6 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter);
|
||||
|
||||
int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
|
||||
|
||||
int mwifiex_recv_complete(struct mwifiex_adapter *,
|
||||
struct sk_buff *skb,
|
||||
int status);
|
||||
|
||||
int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb);
|
||||
|
||||
int mwifiex_process_event(struct mwifiex_adapter *adapter);
|
||||
|
@ -117,8 +117,8 @@ mwifiex_search_oui_in_ie(struct ie_body *iebody, u8 *oui)
|
||||
static u8
|
||||
mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
|
||||
{
|
||||
u8 *oui = NULL;
|
||||
struct ie_body *iebody = NULL;
|
||||
u8 *oui;
|
||||
struct ie_body *iebody;
|
||||
u8 ret = MWIFIEX_OUI_NOT_PRESENT;
|
||||
|
||||
if (((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)).
|
||||
@ -144,8 +144,8 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
|
||||
static u8
|
||||
mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
|
||||
{
|
||||
u8 *oui = NULL;
|
||||
struct ie_body *iebody = NULL;
|
||||
u8 *oui;
|
||||
struct ie_body *iebody;
|
||||
u8 ret = MWIFIEX_OUI_NOT_PRESENT;
|
||||
|
||||
if (((bss_desc->bcn_wpa_ie) && ((*(bss_desc->bcn_wpa_ie)).
|
||||
@ -181,7 +181,7 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
|
||||
struct mwifiex_ssid_bssid *ssid_bssid)
|
||||
{
|
||||
struct mwifiex_ssid_bssid tmp_ssid_bssid;
|
||||
u8 *mac = NULL;
|
||||
u8 *mac;
|
||||
|
||||
if (!ssid_bssid)
|
||||
return -1;
|
||||
@ -213,7 +213,7 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
|
||||
int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
|
||||
struct mwifiex_user_scan_cfg *scan_req)
|
||||
{
|
||||
int status = 0;
|
||||
int status;
|
||||
|
||||
priv->adapter->cmd_wait_q.condition = false;
|
||||
|
||||
@ -2253,8 +2253,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
|
||||
{
|
||||
int ret = 0;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct cmd_ctrl_node *cmd_node = NULL;
|
||||
union mwifiex_scan_cmd_config_tlv *scan_cfg_out = NULL;
|
||||
struct cmd_ctrl_node *cmd_node;
|
||||
union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
|
||||
struct mwifiex_ie_types_chan_list_param_set *chan_list_out;
|
||||
u32 buf_size;
|
||||
struct mwifiex_chan_scan_param_set *scan_chan_list;
|
||||
@ -2283,7 +2283,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
|
||||
GFP_KERNEL);
|
||||
if (!scan_cfg_out) {
|
||||
dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
buf_size = sizeof(struct mwifiex_chan_scan_param_set) *
|
||||
@ -2292,7 +2292,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
|
||||
if (!scan_chan_list) {
|
||||
dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
|
||||
kfree(scan_cfg_out);
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
keep_previous_scan = false;
|
||||
@ -2404,8 +2404,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
|
||||
{
|
||||
int ret = 0;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct cmd_ctrl_node *cmd_node = NULL;
|
||||
struct host_cmd_ds_802_11_scan_rsp *scan_rsp = NULL;
|
||||
struct cmd_ctrl_node *cmd_node;
|
||||
struct host_cmd_ds_802_11_scan_rsp *scan_rsp;
|
||||
struct mwifiex_bssdescriptor *bss_new_entry = NULL;
|
||||
struct mwifiex_ie_types_data *tlv_data;
|
||||
struct mwifiex_ie_types_tsf_timestamp *tsf_tlv;
|
||||
@ -2491,7 +2491,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
|
||||
GFP_KERNEL);
|
||||
if (!bss_new_entry) {
|
||||
dev_err(adapter->dev, " failed to alloc bss_new_entry\n");
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < scan_rsp->number_of_sets && bytes_left; idx++) {
|
||||
@ -2881,7 +2881,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
|
||||
scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL);
|
||||
if (!scan_cfg) {
|
||||
dev_err(adapter->dev, "failed to alloc scan_cfg\n");
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid,
|
||||
@ -2906,7 +2906,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
|
||||
int mwifiex_request_scan(struct mwifiex_private *priv,
|
||||
struct mwifiex_802_11_ssid *req_ssid)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (down_interruptible(&priv->async_sem)) {
|
||||
dev_err(priv->adapter->dev, "%s: acquire semaphore\n",
|
||||
|
@ -46,7 +46,7 @@ static struct semaphore add_remove_card_sem;
|
||||
static int
|
||||
mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct sdio_mmc_card *card = NULL;
|
||||
|
||||
pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n",
|
||||
@ -68,6 +68,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
|
||||
|
||||
if (ret) {
|
||||
pr_err("%s: failed to enable function\n", __func__);
|
||||
kfree(card);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -119,7 +120,7 @@ static int mwifiex_sdio_suspend(struct device *dev)
|
||||
{
|
||||
struct sdio_func *func = dev_to_sdio_func(dev);
|
||||
struct sdio_mmc_card *card;
|
||||
struct mwifiex_adapter *adapter = NULL;
|
||||
struct mwifiex_adapter *adapter;
|
||||
mmc_pm_flag_t pm_flag = 0;
|
||||
int hs_actived = 0;
|
||||
int i;
|
||||
@ -177,7 +178,7 @@ static int mwifiex_sdio_resume(struct device *dev)
|
||||
{
|
||||
struct sdio_func *func = dev_to_sdio_func(dev);
|
||||
struct sdio_mmc_card *card;
|
||||
struct mwifiex_adapter *adapter = NULL;
|
||||
struct mwifiex_adapter *adapter;
|
||||
mmc_pm_flag_t pm_flag = 0;
|
||||
int i;
|
||||
|
||||
@ -420,7 +421,7 @@ static int mwifiex_write_data_to_card(struct mwifiex_adapter *adapter,
|
||||
u8 *payload, u32 pkt_len, u32 port)
|
||||
{
|
||||
u32 i = 0;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
do {
|
||||
ret = mwifiex_write_data_sync(adapter, payload, pkt_len, port);
|
||||
@ -531,7 +532,7 @@ static int
|
||||
mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits)
|
||||
{
|
||||
u32 tries;
|
||||
u32 cs = 0;
|
||||
u32 cs;
|
||||
|
||||
for (tries = 0; tries < MAX_POLL_TRIES; tries++) {
|
||||
if (mwifiex_read_reg(adapter, CARD_STATUS_REG, &cs))
|
||||
@ -553,7 +554,7 @@ mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits)
|
||||
static int
|
||||
mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat)
|
||||
{
|
||||
u32 fws0 = 0, fws1 = 0;
|
||||
u32 fws0, fws1;
|
||||
|
||||
if (mwifiex_read_reg(adapter, CARD_FW_STATUS0_REG, &fws0))
|
||||
return -1;
|
||||
@ -574,7 +575,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat)
|
||||
*/
|
||||
static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
u32 host_int_mask = 0;
|
||||
u32 host_int_mask;
|
||||
|
||||
/* Read back the host_int_mask register */
|
||||
if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask))
|
||||
@ -614,7 +615,7 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter,
|
||||
u32 *type, u8 *buffer,
|
||||
u32 npayload, u32 ioport)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u32 nb;
|
||||
|
||||
if (!buffer) {
|
||||
@ -652,14 +653,14 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter,
|
||||
static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
|
||||
struct mwifiex_fw_image *fw)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u8 *firmware = fw->fw_buf;
|
||||
u32 firmware_len = fw->fw_len;
|
||||
u32 offset = 0;
|
||||
u32 base0, base1;
|
||||
u8 *fwbuf;
|
||||
u16 len = 0;
|
||||
u32 txlen = 0, tx_blocks = 0, tries = 0;
|
||||
u32 txlen, tx_blocks = 0, tries;
|
||||
u32 i = 0;
|
||||
|
||||
if (!firmware_len) {
|
||||
@ -676,7 +677,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
|
||||
if (!fwbuf) {
|
||||
dev_err(adapter->dev, "unable to alloc buffer for firmware."
|
||||
" Terminating download\n");
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Perform firmware data transfer */
|
||||
@ -830,7 +831,7 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
|
||||
static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct sdio_mmc_card *card = adapter->card;
|
||||
u32 sdio_ireg = 0;
|
||||
u32 sdio_ireg;
|
||||
unsigned long flags;
|
||||
|
||||
if (mwifiex_read_data_sync(adapter, card->mp_regs, MAX_MP_REGS,
|
||||
@ -964,7 +965,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter,
|
||||
s32 f_do_rx_cur = 0;
|
||||
s32 f_aggr_cur = 0;
|
||||
struct sk_buff *skb_deaggr;
|
||||
u32 pind = 0;
|
||||
u32 pind;
|
||||
u32 pkt_len, pkt_type = 0;
|
||||
u8 *curr_ptr;
|
||||
u32 rx_len = skb->len;
|
||||
@ -1114,7 +1115,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
|
||||
struct sdio_mmc_card *card = adapter->card;
|
||||
int ret = 0;
|
||||
u8 sdio_ireg;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct sk_buff *skb;
|
||||
u8 port = CTRL_PORT;
|
||||
u32 len_reg_l, len_reg_u;
|
||||
u32 rx_blocks;
|
||||
@ -1377,7 +1378,7 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
|
||||
struct mwifiex_tx_param *tx_param)
|
||||
{
|
||||
struct sdio_mmc_card *card = adapter->card;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u32 buf_block_len;
|
||||
u32 blk_size;
|
||||
u8 port = CTRL_PORT;
|
||||
@ -1560,7 +1561,7 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
|
||||
{
|
||||
struct sdio_mmc_card *card = adapter->card;
|
||||
int ret;
|
||||
u32 sdio_ireg = 0;
|
||||
u32 sdio_ireg;
|
||||
|
||||
/*
|
||||
* Read the HOST_INT_STATUS_REG for ACK the first interrupt got
|
||||
@ -1605,7 +1606,7 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
|
||||
card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL);
|
||||
if (!card->mp_regs) {
|
||||
dev_err(adapter->dev, "failed to alloc mp_regs\n");
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
|
||||
|
@ -274,8 +274,8 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv,
|
||||
static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
|
||||
u16 cmd_action, void *data_buf)
|
||||
{
|
||||
struct mwifiex_types_power_group *pg_tlv = NULL;
|
||||
struct host_cmd_ds_txpwr_cfg *txp = NULL;
|
||||
struct mwifiex_types_power_group *pg_tlv;
|
||||
struct host_cmd_ds_txpwr_cfg *txp;
|
||||
struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg;
|
||||
|
||||
cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG);
|
||||
@ -478,7 +478,7 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv,
|
||||
struct mwifiex_ie_type_key_param_set *key_param_set,
|
||||
u16 *key_param_len)
|
||||
{
|
||||
int cur_key_param_len = 0;
|
||||
int cur_key_param_len;
|
||||
u8 i;
|
||||
|
||||
/* Multi-key_param_set TLV is supported */
|
||||
@ -1121,7 +1121,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
|
||||
*/
|
||||
int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u16 enable = true;
|
||||
struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
|
||||
struct mwifiex_ds_auto_ds auto_ds;
|
||||
|
@ -43,7 +43,7 @@ static void
|
||||
mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
|
||||
struct host_cmd_ds_command *resp)
|
||||
{
|
||||
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
|
||||
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct host_cmd_ds_802_11_ps_mode_enh *pm;
|
||||
unsigned long flags;
|
||||
@ -124,7 +124,7 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
|
||||
{
|
||||
struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
|
||||
&resp->params.rssi_info_rsp;
|
||||
struct mwifiex_ds_get_signal *signal = NULL;
|
||||
struct mwifiex_ds_get_signal *signal;
|
||||
|
||||
priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
|
||||
priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
|
||||
@ -232,7 +232,7 @@ static int mwifiex_ret_get_log(struct mwifiex_private *priv,
|
||||
{
|
||||
struct host_cmd_ds_802_11_get_log *get_log =
|
||||
(struct host_cmd_ds_802_11_get_log *) &resp->params.get_log;
|
||||
struct mwifiex_ds_get_stats *stats = NULL;
|
||||
struct mwifiex_ds_get_stats *stats;
|
||||
|
||||
if (data_buf) {
|
||||
stats = (struct mwifiex_ds_get_stats *) data_buf;
|
||||
@ -280,10 +280,10 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
|
||||
struct host_cmd_ds_command *resp,
|
||||
void *data_buf)
|
||||
{
|
||||
struct mwifiex_rate_cfg *ds_rate = NULL;
|
||||
struct mwifiex_rate_cfg *ds_rate;
|
||||
struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
|
||||
struct mwifiex_rate_scope *rate_scope;
|
||||
struct mwifiex_ie_types_header *head = NULL;
|
||||
struct mwifiex_ie_types_header *head;
|
||||
u16 tlv, tlv_buf_len;
|
||||
u8 *tlv_buf;
|
||||
u32 i;
|
||||
@ -368,9 +368,9 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
|
||||
*/
|
||||
static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
|
||||
{
|
||||
int length = -1, max_power = -1, min_power = -1;
|
||||
struct mwifiex_types_power_group *pg_tlv_hdr = NULL;
|
||||
struct mwifiex_power_group *pg = NULL;
|
||||
int length, max_power = -1, min_power = -1;
|
||||
struct mwifiex_types_power_group *pg_tlv_hdr;
|
||||
struct mwifiex_power_group *pg;
|
||||
|
||||
if (data_buf) {
|
||||
pg_tlv_hdr =
|
||||
@ -418,8 +418,8 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
|
||||
{
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
|
||||
struct mwifiex_types_power_group *pg_tlv_hdr = NULL;
|
||||
struct mwifiex_power_group *pg = NULL;
|
||||
struct mwifiex_types_power_group *pg_tlv_hdr;
|
||||
struct mwifiex_power_group *pg;
|
||||
u16 action = le16_to_cpu(txp_cfg->action);
|
||||
|
||||
switch (action) {
|
||||
@ -593,7 +593,7 @@ static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
|
||||
&resp->params.domain_info_resp;
|
||||
struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain;
|
||||
u16 action = le16_to_cpu(domain_info->action);
|
||||
u8 no_of_triplet = 0;
|
||||
u8 no_of_triplet;
|
||||
|
||||
no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) -
|
||||
IEEE80211_COUNTRY_STRING_LEN) /
|
||||
@ -661,7 +661,7 @@ static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
|
||||
void *data_buf)
|
||||
{
|
||||
struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
|
||||
struct host_cmd_ds_version_ext *version_ext = NULL;
|
||||
struct host_cmd_ds_version_ext *version_ext;
|
||||
|
||||
if (data_buf) {
|
||||
version_ext = (struct host_cmd_ds_version_ext *)data_buf;
|
||||
@ -682,8 +682,8 @@ static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
|
||||
static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
|
||||
void *data_buf)
|
||||
{
|
||||
struct mwifiex_ds_reg_rw *reg_rw = NULL;
|
||||
struct mwifiex_ds_read_eeprom *eeprom = NULL;
|
||||
struct mwifiex_ds_reg_rw *reg_rw;
|
||||
struct mwifiex_ds_read_eeprom *eeprom;
|
||||
|
||||
if (data_buf) {
|
||||
reg_rw = (struct mwifiex_ds_reg_rw *) data_buf;
|
||||
|
@ -149,7 +149,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
|
||||
int mwifiex_bss_start(struct mwifiex_private *priv,
|
||||
struct mwifiex_ssid_bssid *ssid_bssid)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
s32 i = -1;
|
||||
|
||||
@ -376,7 +376,7 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv,
|
||||
{
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
struct mwifiex_bssdescriptor *bss_desc;
|
||||
s32 tbl_idx = 0;
|
||||
s32 tbl_idx;
|
||||
|
||||
if (!info)
|
||||
return -1;
|
||||
@ -436,9 +436,8 @@ int mwifiex_set_radio_band_cfg(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_band_cfg *radio_cfg)
|
||||
{
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
u8 infra_band = 0;
|
||||
u8 adhoc_band = 0;
|
||||
u32 adhoc_channel = 0;
|
||||
u8 infra_band, adhoc_band;
|
||||
u32 adhoc_channel;
|
||||
|
||||
infra_band = (u8) radio_cfg->config_bands;
|
||||
adhoc_band = (u8) radio_cfg->adhoc_start_band;
|
||||
@ -636,7 +635,7 @@ int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *priv,
|
||||
int
|
||||
mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_bss_info bss_info;
|
||||
struct mwifiex_ssid_bssid ssid_bssid;
|
||||
u16 curr_chan = 0;
|
||||
@ -755,11 +754,10 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
|
||||
struct mwifiex_rate_cfg *rate_cfg)
|
||||
{
|
||||
u8 rates[MWIFIEX_SUPPORTED_RATES];
|
||||
u8 *rate = NULL;
|
||||
int rate_index = 0;
|
||||
u8 *rate;
|
||||
int rate_index, ret;
|
||||
u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
|
||||
u32 i = 0;
|
||||
int ret = 0;
|
||||
u32 i;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
|
||||
if (rate_cfg->is_rate_auto) {
|
||||
@ -819,7 +817,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
|
||||
static int mwifiex_rate_ioctl_cfg(struct mwifiex_private *priv,
|
||||
struct mwifiex_rate_cfg *rate_cfg)
|
||||
{
|
||||
int status = 0;
|
||||
int status;
|
||||
|
||||
if (!rate_cfg)
|
||||
return -1;
|
||||
@ -841,7 +839,7 @@ static int mwifiex_rate_ioctl_cfg(struct mwifiex_private *priv,
|
||||
int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
|
||||
struct mwifiex_rate_cfg *rate)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
memset(rate, 0, sizeof(struct mwifiex_rate_cfg));
|
||||
rate->action = HostCmd_ACT_GEN_GET;
|
||||
@ -875,11 +873,11 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
|
||||
int mwifiex_set_tx_power(struct mwifiex_private *priv,
|
||||
struct mwifiex_power_cfg *power_cfg)
|
||||
{
|
||||
int ret = 0;
|
||||
struct host_cmd_ds_txpwr_cfg *txp_cfg = NULL;
|
||||
struct mwifiex_types_power_group *pg_tlv = NULL;
|
||||
struct mwifiex_power_group *pg = NULL;
|
||||
u8 *buf = NULL;
|
||||
int ret;
|
||||
struct host_cmd_ds_txpwr_cfg *txp_cfg;
|
||||
struct mwifiex_types_power_group *pg_tlv;
|
||||
struct mwifiex_power_group *pg;
|
||||
u8 *buf;
|
||||
u16 dbm = 0;
|
||||
|
||||
if (!power_cfg->is_power_auto) {
|
||||
@ -897,7 +895,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
|
||||
if (!buf) {
|
||||
dev_err(priv->adapter->dev, "%s: failed to alloc cmd buffer\n",
|
||||
__func__);
|
||||
return -1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf;
|
||||
@ -960,7 +958,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
|
||||
*/
|
||||
int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
u16 sub_cmd;
|
||||
|
||||
@ -1078,8 +1076,8 @@ static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv,
|
||||
static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_encrypt_key *encrypt_key)
|
||||
{
|
||||
int ret = 0;
|
||||
struct mwifiex_wep_key *wep_key = NULL;
|
||||
int ret;
|
||||
struct mwifiex_wep_key *wep_key;
|
||||
int index;
|
||||
|
||||
if (priv->wep_key_curr_index >= NUM_WEP_KEYS)
|
||||
@ -1142,7 +1140,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
|
||||
static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_encrypt_key *encrypt_key)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u8 remove_key = false;
|
||||
struct host_cmd_ds_802_11_key_material *ibss_key;
|
||||
|
||||
@ -1209,7 +1207,7 @@ static int
|
||||
mwifiex_sec_ioctl_encrypt_key(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_encrypt_key *encrypt_key)
|
||||
{
|
||||
int status = 0;
|
||||
int status;
|
||||
|
||||
if (encrypt_key->is_wapi_key)
|
||||
status = mwifiex_sec_ioctl_set_wapi_key(priv, encrypt_key);
|
||||
@ -1252,11 +1250,9 @@ mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version,
|
||||
int mwifiex_get_signal_info(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_get_signal *signal)
|
||||
{
|
||||
struct mwifiex_ds_get_signal info;
|
||||
int status = 0;
|
||||
int status;
|
||||
|
||||
memset(&info, 0, sizeof(struct mwifiex_ds_get_signal));
|
||||
info.selector = ALL_RSSI_INFO_MASK;
|
||||
signal->selector = ALL_RSSI_INFO_MASK;
|
||||
|
||||
/* Signal info can be obtained only if connected */
|
||||
if (!priv->media_connected) {
|
||||
@ -1269,13 +1265,10 @@ int mwifiex_get_signal_info(struct mwifiex_private *priv,
|
||||
HostCmd_ACT_GEN_GET, 0, signal);
|
||||
|
||||
if (!status) {
|
||||
if (signal)
|
||||
memcpy(signal, &info,
|
||||
sizeof(struct mwifiex_ds_get_signal));
|
||||
if (info.selector & BCN_RSSI_AVG_MASK)
|
||||
priv->w_stats.qual.level = info.bcn_rssi_avg;
|
||||
if (info.selector & BCN_NF_AVG_MASK)
|
||||
priv->w_stats.qual.noise = info.bcn_nf_avg;
|
||||
if (signal->selector & BCN_RSSI_AVG_MASK)
|
||||
priv->w_stats.qual.level = signal->bcn_rssi_avg;
|
||||
if (signal->selector & BCN_NF_AVG_MASK)
|
||||
priv->w_stats.qual.noise = signal->bcn_nf_avg;
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1334,20 +1327,15 @@ int
|
||||
mwifiex_get_stats_info(struct mwifiex_private *priv,
|
||||
struct mwifiex_ds_get_stats *log)
|
||||
{
|
||||
int ret = 0;
|
||||
struct mwifiex_ds_get_stats get_log;
|
||||
int ret;
|
||||
|
||||
memset(&get_log, 0, sizeof(struct mwifiex_ds_get_stats));
|
||||
ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_GET_LOG,
|
||||
HostCmd_ACT_GEN_GET, 0, &get_log);
|
||||
HostCmd_ACT_GEN_GET, 0, log);
|
||||
|
||||
if (!ret) {
|
||||
if (log)
|
||||
memcpy(log, &get_log, sizeof(struct
|
||||
mwifiex_ds_get_stats));
|
||||
priv->w_stats.discard.fragment = get_log.fcs_error;
|
||||
priv->w_stats.discard.retries = get_log.retry;
|
||||
priv->w_stats.discard.misc = get_log.ack_failure;
|
||||
priv->w_stats.discard.fragment = log->fcs_error;
|
||||
priv->w_stats.discard.retries = log->retry;
|
||||
priv->w_stats.discard.misc = log->ack_failure;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1425,7 +1413,7 @@ int
|
||||
mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
|
||||
u32 reg_offset, u32 *value)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_ds_reg_rw reg_rw;
|
||||
|
||||
reg_rw.type = cpu_to_le32(reg_type);
|
||||
@ -1451,7 +1439,7 @@ int
|
||||
mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
|
||||
u8 *value)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_ds_read_eeprom rd_eeprom;
|
||||
|
||||
rd_eeprom.offset = cpu_to_le16((u16) offset);
|
||||
|
@ -41,7 +41,7 @@
|
||||
int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
|
||||
struct mwifiex_private *priv = adapter->priv[rx_info->bss_index];
|
||||
struct rx_packet_hdr *rx_pkt_hdr;
|
||||
@ -123,7 +123,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
|
||||
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
|
||||
struct rx_packet_hdr *rx_pkt_hdr;
|
||||
u8 ta[ETH_ALEN];
|
||||
u16 rx_pkt_type = 0;
|
||||
u16 rx_pkt_type;
|
||||
struct mwifiex_private *priv = adapter->priv[rx_info->bss_index];
|
||||
|
||||
local_rx_pd = (struct rxpd *) (skb->data);
|
||||
@ -141,10 +141,28 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
|
||||
dev_kfree_skb_any(skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (local_rx_pd->rx_pkt_type == PKT_TYPE_AMSDU) {
|
||||
mwifiex_11n_deaggregate_pkt(priv, skb);
|
||||
return ret;
|
||||
struct sk_buff_head list;
|
||||
struct sk_buff *rx_skb;
|
||||
|
||||
__skb_queue_head_init(&list);
|
||||
|
||||
skb_pull(skb, local_rx_pd->rx_pkt_offset);
|
||||
skb_trim(skb, local_rx_pd->rx_pkt_length);
|
||||
|
||||
ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr,
|
||||
priv->wdev->iftype, 0, false);
|
||||
|
||||
while (!skb_queue_empty(&list)) {
|
||||
rx_skb = __skb_dequeue(&list);
|
||||
ret = mwifiex_recv_packet(adapter, rx_skb);
|
||||
if (ret == -1)
|
||||
dev_err(adapter->dev, "Rx of A-MSDU failed");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the packet is not an unicast packet then send the packet
|
||||
* directly to os. Don't pass thru rx reordering
|
||||
|
@ -113,8 +113,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
|
||||
/* sizeof(struct txpd) + Interface specific header */
|
||||
#define NULL_PACKET_HDR 64
|
||||
u32 data_len = NULL_PACKET_HDR;
|
||||
struct sk_buff *skb = NULL;
|
||||
int ret = 0;
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
struct mwifiex_txinfo *tx_info = NULL;
|
||||
|
||||
if (adapter->surprise_removed)
|
||||
|
@ -68,7 +68,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
|
||||
{
|
||||
int ret = -1;
|
||||
struct mwifiex_adapter *adapter = priv->adapter;
|
||||
u8 *head_ptr = NULL;
|
||||
u8 *head_ptr;
|
||||
struct txpd *local_tx_pd = NULL;
|
||||
|
||||
head_ptr = (u8 *) mwifiex_process_sta_txpd(priv, skb);
|
||||
@ -121,8 +121,8 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
|
||||
int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
|
||||
struct sk_buff *skb, int status)
|
||||
{
|
||||
struct mwifiex_private *priv = NULL, *tpriv = NULL;
|
||||
struct mwifiex_txinfo *tx_info = NULL;
|
||||
struct mwifiex_private *priv, *tpriv;
|
||||
struct mwifiex_txinfo *tx_info;
|
||||
int i;
|
||||
|
||||
if (!skb)
|
||||
@ -169,9 +169,9 @@ int mwifiex_recv_packet_complete(struct mwifiex_adapter *adapter,
|
||||
struct sk_buff *skb, int status)
|
||||
{
|
||||
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
|
||||
struct mwifiex_rxinfo *rx_info_parent = NULL;
|
||||
struct mwifiex_rxinfo *rx_info_parent;
|
||||
struct mwifiex_private *priv;
|
||||
struct sk_buff *skb_parent = NULL;
|
||||
struct sk_buff *skb_parent;
|
||||
unsigned long flags;
|
||||
|
||||
priv = adapter->priv[rx_info->bss_index];
|
||||
|
@ -152,8 +152,8 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv,
|
||||
*/
|
||||
int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
|
||||
{
|
||||
struct mwifiex_rxinfo *rx_info = NULL;
|
||||
struct mwifiex_private *priv = NULL;
|
||||
struct mwifiex_rxinfo *rx_info;
|
||||
struct mwifiex_private *priv;
|
||||
|
||||
if (!skb)
|
||||
return -1;
|
||||
@ -176,31 +176,6 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive packet completion callback handler.
|
||||
*
|
||||
* This function updates the statistics and frees the buffer SKB.
|
||||
*/
|
||||
int mwifiex_recv_complete(struct mwifiex_adapter *adapter,
|
||||
struct sk_buff *skb, int status)
|
||||
{
|
||||
struct mwifiex_private *priv = NULL;
|
||||
struct mwifiex_rxinfo *rx_info = NULL;
|
||||
|
||||
if (!skb)
|
||||
return 0;
|
||||
|
||||
rx_info = MWIFIEX_SKB_RXCB(skb);
|
||||
priv = mwifiex_bss_index_to_priv(adapter, rx_info->bss_index);
|
||||
|
||||
if (priv && (status == -1))
|
||||
priv->stats.rx_dropped++;
|
||||
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* IOCTL completion callback handler.
|
||||
*
|
||||
|
@ -799,7 +799,7 @@ u8
|
||||
mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
u8 ret_val = 0;
|
||||
u8 ret_val;
|
||||
struct timeval out_tstamp, in_tstamp;
|
||||
u32 queue_delay;
|
||||
|
||||
|
@ -784,7 +784,8 @@ static inline void mwl8k_remove_dma_header(struct sk_buff *skb, __le16 qos)
|
||||
#define REDUCED_TX_HEADROOM 8
|
||||
|
||||
static void
|
||||
mwl8k_add_dma_header(struct mwl8k_priv *priv, struct sk_buff *skb, int tail_pad)
|
||||
mwl8k_add_dma_header(struct mwl8k_priv *priv, struct sk_buff *skb,
|
||||
int head_pad, int tail_pad)
|
||||
{
|
||||
struct ieee80211_hdr *wh;
|
||||
int hdrlen;
|
||||
@ -816,7 +817,7 @@ mwl8k_add_dma_header(struct mwl8k_priv *priv, struct sk_buff *skb, int tail_pad)
|
||||
skb->truesize += REDUCED_TX_HEADROOM;
|
||||
}
|
||||
|
||||
reqd_hdrlen = sizeof(*tr);
|
||||
reqd_hdrlen = sizeof(*tr) + head_pad;
|
||||
|
||||
if (hdrlen != reqd_hdrlen)
|
||||
skb_push(skb, reqd_hdrlen - hdrlen);
|
||||
@ -845,6 +846,7 @@ static void mwl8k_encapsulate_tx_frame(struct mwl8k_priv *priv,
|
||||
struct ieee80211_tx_info *tx_info;
|
||||
struct ieee80211_key_conf *key_conf;
|
||||
int data_pad;
|
||||
int head_pad = 0;
|
||||
|
||||
wh = (struct ieee80211_hdr *)skb->data;
|
||||
|
||||
@ -856,9 +858,7 @@ static void mwl8k_encapsulate_tx_frame(struct mwl8k_priv *priv,
|
||||
|
||||
/*
|
||||
* Make sure the packet header is in the DMA header format (4-address
|
||||
* without QoS), the necessary crypto padding between the header and the
|
||||
* payload has already been provided by mac80211, but it doesn't add
|
||||
* tail padding when HW crypto is enabled.
|
||||
* without QoS), and add head & tail padding when HW crypto is enabled.
|
||||
*
|
||||
* We have the following trailer padding requirements:
|
||||
* - WEP: 4 trailer bytes (ICV)
|
||||
@ -867,6 +867,7 @@ static void mwl8k_encapsulate_tx_frame(struct mwl8k_priv *priv,
|
||||
*/
|
||||
data_pad = 0;
|
||||
if (key_conf != NULL) {
|
||||
head_pad = key_conf->iv_len;
|
||||
switch (key_conf->cipher) {
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
@ -880,7 +881,7 @@ static void mwl8k_encapsulate_tx_frame(struct mwl8k_priv *priv,
|
||||
break;
|
||||
}
|
||||
}
|
||||
mwl8k_add_dma_header(priv, skb, data_pad);
|
||||
mwl8k_add_dma_header(priv, skb, head_pad, data_pad);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1837,7 +1838,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
|
||||
if (priv->ap_fw)
|
||||
mwl8k_encapsulate_tx_frame(priv, skb);
|
||||
else
|
||||
mwl8k_add_dma_header(priv, skb, 0);
|
||||
mwl8k_add_dma_header(priv, skb, 0, 0);
|
||||
|
||||
wh = &((struct mwl8k_dma_data *)skb->data)->wh;
|
||||
|
||||
@ -3997,7 +3998,7 @@ static int mwl8k_cmd_encryption_set_key(struct ieee80211_hw *hw,
|
||||
mwl8k_vif->wep_key_conf[idx].enabled = 1;
|
||||
}
|
||||
|
||||
keymlen = 0;
|
||||
keymlen = key->keylen;
|
||||
action = MWL8K_ENCR_SET_KEY;
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
@ -4071,7 +4072,6 @@ static int mwl8k_set_key(struct ieee80211_hw *hw,
|
||||
addr = sta->addr;
|
||||
|
||||
if (cmd_param == SET_KEY) {
|
||||
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
rc = mwl8k_cmd_encryption_set_key(hw, vif, addr, key);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
@ -331,10 +331,9 @@ static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
|
||||
struct p54p_ring_control *ring_control = priv->ring_control;
|
||||
struct p54p_desc *desc;
|
||||
dma_addr_t mapping;
|
||||
u32 device_idx, idx, i;
|
||||
u32 idx, i;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
device_idx = le32_to_cpu(ring_control->device_idx[1]);
|
||||
idx = le32_to_cpu(ring_control->host_idx[1]);
|
||||
i = idx % ARRAY_SIZE(ring_control->tx_data);
|
||||
|
||||
|
@ -93,7 +93,7 @@ config RT2800PCI_RT35XX
|
||||
intended for testers and developers.
|
||||
|
||||
config RT2800PCI_RT53XX
|
||||
bool "rt2800-pci - Include support for rt53xx devices (EXPERIMENTAL)"
|
||||
bool "rt2800pci - Include support for rt53xx devices (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
default y
|
||||
---help---
|
||||
@ -163,6 +163,15 @@ config RT2800USB_RT35XX
|
||||
Support for these devices is non-functional at the moment and is
|
||||
intended for testers and developers.
|
||||
|
||||
config RT2800USB_RT53XX
|
||||
bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
default y
|
||||
---help---
|
||||
This adds support for rt53xx wireless chipset family to the
|
||||
rt2800pci driver.
|
||||
Supported chips: RT5370
|
||||
|
||||
config RT2800USB_UNKNOWN
|
||||
bool "rt2800usb - Include support for unknown (USB) devices"
|
||||
default n
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user