mirror of
https://github.com/torvalds/linux.git
synced 2026-06-10 07:32:29 +02:00
wifi->esp8089:
ESP8089 driver update to V1.9.1(30/01/2015);
Update the V2.4 esp_prealloc program.
This commit is contained in:
parent
c4f332cc42
commit
aea5d474dd
|
|
@ -3,9 +3,10 @@
|
|||
DRIVER_NAME := wlan
|
||||
include drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/esp_config.mk
|
||||
|
||||
EXTRA_CFLAGS += -DDEBUG -DSIP_DEBUG -DFAST_TX_STATUS -DANDROID -DKERNEL_IV_WAR -DRX_SENDUP_SYNC -DDEBUGFS -DHAS_FW -DTEST_MODE -DESP_ANDROID_LOGGER -DLOOKAHEAD -DSIF_DSR_WAR -DESP_PREALLOC
|
||||
EXTRA_CFLAGS += -DDEBUG -DSIP_DEBUG -DFAST_TX_STATUS -DKERNEL_IV_WAR -DRX_SENDUP_SYNC -DHAS_FW -DTEST_MODE -DESP_ANDROID_LOGGER -DESP_CLASS -DESP_PREALLOC
|
||||
|
||||
obj-$(CONFIG_ESP8089) := $(DRIVER_NAME).o
|
||||
$(DRIVER_NAME)-y += esp_init.o
|
||||
$(DRIVER_NAME)-y += esp_debug.o
|
||||
$(DRIVER_NAME)-y += sdio_sif_esp.o
|
||||
$(DRIVER_NAME)-y += spi_sif_esp.o
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -93,7 +93,7 @@ int sip_parse_event_debug(struct esp_pub *epub, const u8 *src, u8 *dst)
|
|||
|
||||
while (mask != 0) {
|
||||
index = ffs(mask) - 1;
|
||||
if (index >= ESP_PUB_MAX_STA)
|
||||
if (index > ESP_PUB_MAX_STA)
|
||||
break;
|
||||
enode = esp_get_node_by_index(epub, index);
|
||||
if (enode == NULL) {
|
||||
|
|
@ -318,6 +318,37 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
atomic_set(&sip->noise_floor, ep->noise_floor);
|
||||
break;
|
||||
}
|
||||
|
||||
case SIP_EVT_NULLFUNC_REPORT:{
|
||||
struct sip_evt_nullfunc_report *nr = (struct sip_evt_nullfunc_report *)(buf + SIP_CTRL_HDR_LEN);
|
||||
struct esp_node *enode = NULL;
|
||||
u8 ifidx = nr->ifidx;
|
||||
u8 index = nr->index;
|
||||
u8 status = nr->status;
|
||||
|
||||
if (index < 0 && index > ESP_PUB_MAX_STA)
|
||||
break;
|
||||
|
||||
if (sip->epub->master_ifidx != ifidx)
|
||||
break;
|
||||
|
||||
enode = esp_get_node_by_index(sip->epub, index);
|
||||
if (!enode)
|
||||
break;
|
||||
|
||||
if (atomic_read(&enode->sta_state) == ESP_STA_STATE_LOST)
|
||||
break;
|
||||
|
||||
/* assert status equals 0 , else ignore */
|
||||
if (status != 0)
|
||||
esp_dbg(ESP_DBG_ERROR, "nulldata status strange");
|
||||
|
||||
atomic_set(&enode->loss_count, 0);
|
||||
atomic_set(&enode->time_remain, ESP_ND_TIME_REMAIN_MAX);
|
||||
atomic_set(&enode->sta_state, ESP_STA_STATE_NORM);
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "index %d, status %d, loss %d, tremain %d", index, status, atomic_read(&enode->loss_count), atomic_read(&enode->time_remain));
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -334,6 +365,9 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
void sip_send_chip_init(struct esp_sip *sip)
|
||||
{
|
||||
size_t size = 0;
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
u8 *tmp_init_data = NULL;
|
||||
#endif
|
||||
#ifndef HAS_INIT_DATA
|
||||
const struct firmware *fw_entry;
|
||||
u8 * esp_init_data = NULL;
|
||||
|
|
@ -357,15 +391,30 @@ void sip_send_chip_init(struct esp_sip *sip)
|
|||
}
|
||||
#else
|
||||
size = sizeof(esp_init_data);
|
||||
|
||||
#endif /* !HAS_INIT_DATA */
|
||||
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
tmp_init_data = kmemdup(esp_init_data, size, GFP_KERNEL);
|
||||
if (tmp_init_data == NULL) {
|
||||
esp_dbg(ESP_DBG_ERROR, "tmp_init_data alloc failed");
|
||||
#ifndef HAS_INIT_DATA
|
||||
kfree(esp_init_data);
|
||||
#endif /* !HAS_INIT_DATA */
|
||||
return;
|
||||
}
|
||||
fix_init_data(tmp_init_data, size);
|
||||
#else
|
||||
fix_init_data(esp_init_data, size);
|
||||
|
||||
#endif
|
||||
atomic_sub(1, &sip->tx_credits);
|
||||
|
||||
sip_send_cmd(sip, SIP_CMD_INIT, size, (void *)esp_init_data);
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
sip_send_cmd(sip, SIP_CMD_INIT, size, (void *)tmp_init_data);
|
||||
|
||||
kfree(tmp_init_data);
|
||||
#else
|
||||
sip_send_cmd(sip, SIP_CMD_INIT, size, (void *)esp_init_data);
|
||||
#endif
|
||||
#ifndef HAS_INIT_DATA
|
||||
kfree(esp_init_data);
|
||||
#endif /* !HAS_INIT_DATA */
|
||||
|
|
@ -607,14 +656,14 @@ int sip_send_setkey(struct esp_pub *epub, u8 bssid_no, u8 *peer_addr, struct iee
|
|||
setkeycmd->hw_key_idx= key->hw_key_idx;
|
||||
|
||||
if (isvalid) {
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
|
||||
setkeycmd->alg= key->alg;
|
||||
#else
|
||||
setkeycmd->alg= esp_cipher2alg(key->cipher);
|
||||
#endif /* NEW_KERNEL */
|
||||
setkeycmd->keyidx = key->keyidx;
|
||||
setkeycmd->keylen = key->keylen;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
|
||||
if (key->alg == ALG_TKIP) {
|
||||
#else
|
||||
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <net/mac80211.h>
|
||||
#include "sip2_common.h"
|
||||
|
||||
#include "esp_debug.h"
|
||||
#include "esp_sif.h"
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS) && defined(DEBUG_FS)
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static struct dentry *esp_debugfs_root = NULL;
|
||||
|
||||
static int esp_debugfs_open(struct inode *inode, struct file *filp)
|
||||
|
|
@ -129,7 +130,7 @@ struct dentry *esp_dump_array(const char *name, struct dentry *parent, struct de
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size) {
|
||||
struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size, struct file_operations *fops) {
|
||||
struct dentry *rc;
|
||||
umode_t mode = 0644;
|
||||
|
||||
|
|
@ -139,7 +140,10 @@ struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int
|
|||
if(!parent)
|
||||
parent = esp_debugfs_root;
|
||||
|
||||
rc = debugfs_create_file(name, mode, parent, data, &esp_debugfs_fops);
|
||||
if (fops == NULL)
|
||||
rc = debugfs_create_file(name, mode, parent, data, &esp_debugfs_fops); /* default */
|
||||
else
|
||||
rc = debugfs_create_file(name, mode, parent, data, fops);
|
||||
|
||||
if (!rc)
|
||||
goto Fail;
|
||||
|
|
@ -176,7 +180,7 @@ int esp_debugfs_init(void)
|
|||
esp_dbg(ESP_DBG, "esp debugfs init\n");
|
||||
esp_debugfs_root = debugfs_create_dir("esp_debug", NULL);
|
||||
|
||||
if (!esp_debugfs_root || IS_ERR_OR_NULL(esp_debugfs_root)) {
|
||||
if (!esp_debugfs_root || IS_ERR(esp_debugfs_root)) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
|
@ -192,6 +196,233 @@ void esp_debugfs_exit(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUGFS_BOOTMODE
|
||||
static int fcc_w_cb(void *data)
|
||||
{
|
||||
esp_dbg(ESP_DBG_TRACE, "%s callback", __func__);
|
||||
if (sif_get_esp_run() != 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s set fcc mode must after close driver ", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ate_r_cb(void *data)
|
||||
{
|
||||
esp_dbg(ESP_DBG_TRACE, "%s callback", __func__);
|
||||
|
||||
((struct dbgfs_bootmode_item *)data)->var = sif_get_ate_config();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ate_w_cb(void *data)
|
||||
{
|
||||
int var = ((struct dbgfs_bootmode_item *)data)->var;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s callback", __func__);
|
||||
if (sif_get_esp_run() != 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s set ate mode must after close driver ", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
sif_record_ate_config(var);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nor_r_cb(void *data)
|
||||
{
|
||||
esp_dbg(ESP_DBG_TRACE, "%s callback", __func__);
|
||||
|
||||
((struct dbgfs_bootmode_item *)data)->var = sif_get_esp_run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int nor_w_cb(void *data)
|
||||
{
|
||||
int var;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s callback", __func__);
|
||||
var = ((struct dbgfs_bootmode_item *)data)->var;
|
||||
switch (var) {
|
||||
case 0:
|
||||
if (sif_get_esp_run() != 0)
|
||||
esp_common_exit();
|
||||
else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s already down", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sif_get_esp_run() == 0)
|
||||
esp_common_init();
|
||||
else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s already up!", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sif_get_esp_run() == 0) {
|
||||
int i;
|
||||
struct dbgfs_bootmode_item *di = ((struct dbgfs_bootmode_item *)data) - DBGFS_NOR_MODE;
|
||||
for (i = 0; i < DBGFS_MODE_MAX; i++) {
|
||||
if (i == DBGFS_NOR_MODE)
|
||||
continue;
|
||||
di[i].var = 0;
|
||||
if (di[i].w_cb)
|
||||
di[i].w_cb(&di[i]);
|
||||
}
|
||||
|
||||
esp_dbg(ESP_SHOW, "%s reset all the boot mode", __func__);
|
||||
} else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s must down pre!", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
esp_dbg(ESP_DBG_ERROR, "%s unspec cmd", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dbgfs_bootmode_item di[DBGFS_MODE_MAX] = {
|
||||
{"fccmode", DBGFS_FCC_MODE, 0, NULL, NULL, fcc_w_cb},
|
||||
{"atemode", DBGFS_ATE_MODE, 0, NULL, ate_r_cb, ate_w_cb},
|
||||
{"normode", DBGFS_NOR_MODE, 0, NULL, nor_r_cb, nor_w_cb},
|
||||
};
|
||||
|
||||
static int debugfs_bootmode_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < DBGFS_MODE_MAX; i++) {
|
||||
if (strncmp(filp->f_dentry->d_name.name, di[i].name, sizeof(NAME_LEN_MAX)) == 0) {
|
||||
filp->private_data = &di[i];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
filp->private_data = inode->i_private;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 called_flag[DBGFS_MODE_MAX] = {0, 0, 0};
|
||||
|
||||
static ssize_t debugfs_bootmode_read(struct file *filp, char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
int ret;
|
||||
int id;
|
||||
char tmpbuf[32+1];
|
||||
|
||||
if (*ppos >= 32)
|
||||
return 0;
|
||||
if (*ppos + count > 32)
|
||||
count = 32 - *ppos;
|
||||
|
||||
id = ((struct dbgfs_bootmode_item*)filp->private_data)->id;
|
||||
if (called_flag[id] == 0 && di[id].r_cb) {
|
||||
di[id].r_cb(&di[id]);
|
||||
called_flag[id] = 1;
|
||||
}
|
||||
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "0x%08x\n", di[id].var);
|
||||
|
||||
ret = simple_read_from_buffer(userbuf, count, ppos, tmpbuf + *ppos, strlen(tmpbuf + *ppos));
|
||||
if (ret == 0)
|
||||
called_flag[id] = 0;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s 0x%x, ret %d, count %zu, pos %d", __func__, di[id].var, ret, count, *(int *)ppos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t debugfs_bootmode_write(struct file *filp, const char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
int id;
|
||||
int ret;
|
||||
u32 org_var;
|
||||
char tmpbuf[32+1];
|
||||
|
||||
if (*ppos >= 32)
|
||||
return 0;
|
||||
if (*ppos + count > 32)
|
||||
count = 32 - *ppos;
|
||||
|
||||
if (copy_from_user(tmpbuf, userbuf, count))
|
||||
return -EFAULT;
|
||||
|
||||
if (tmpbuf[count-1] == '\n')
|
||||
tmpbuf[count-1] = '\0';
|
||||
else
|
||||
tmpbuf[count] = '\0';
|
||||
|
||||
id = ((struct dbgfs_bootmode_item*)filp->private_data)->id;
|
||||
|
||||
org_var = di[id].var;
|
||||
|
||||
if (tmpbuf[0] == '0' && (tmpbuf[1] == 'x' || tmpbuf[1] == 'X'))
|
||||
ret = strict_strtoul(tmpbuf, 16, (unsigned long *)&di[id].var);
|
||||
else
|
||||
ret = strict_strtoul(tmpbuf, 16, (unsigned long *)&di[id].var);
|
||||
|
||||
if (ret) {
|
||||
esp_dbg(ESP_DBG_ERROR, "invalid input");
|
||||
return count;
|
||||
}
|
||||
|
||||
if (di[id].w_cb) {
|
||||
ret = di[id].w_cb(&di[id]);
|
||||
if (ret)
|
||||
di[id].var = org_var;
|
||||
}
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s 0x%x", __func__, di[id].var);
|
||||
return count;
|
||||
}
|
||||
|
||||
struct file_operations debugfs_bootmode_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = debugfs_bootmode_open,
|
||||
.read = debugfs_bootmode_read,
|
||||
.write = debugfs_bootmode_write,
|
||||
};
|
||||
|
||||
u32 dbgfs_get_bootmode_var(DBGFS_BOOTMODE_ID_t id)
|
||||
{
|
||||
if (id >= DBGFS_MODE_MAX)
|
||||
return 0xffffffff;
|
||||
|
||||
return di[id].var;
|
||||
}
|
||||
|
||||
struct dbgfs_bootmode_item *dbgfs_get_bootmode_di(DBGFS_BOOTMODE_ID_t id)
|
||||
{
|
||||
if (id >= DBGFS_MODE_MAX)
|
||||
return NULL;
|
||||
|
||||
return &di[id];
|
||||
}
|
||||
|
||||
|
||||
void dbgfs_bootmode_init(void)
|
||||
{
|
||||
int id;
|
||||
struct dentry *de;
|
||||
|
||||
if(!esp_debugfs_root)
|
||||
return;
|
||||
|
||||
for (id = 0; id < DBGFS_MODE_MAX; id++) {
|
||||
de = esp_dump(di[id].name, NULL, &di[id].var, 32, &debugfs_bootmode_fops);
|
||||
if (de == NULL)
|
||||
esp_dbg(ESP_DBG_ERROR, "dbgfs bootmode init error, continue!");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* DEBUGFS_BOOTMODE */
|
||||
#else
|
||||
|
||||
inline struct dentry *esp_dump_var(const char *name, struct dentry *parent, void *value, esp_type type) {
|
||||
|
|
@ -202,7 +433,7 @@ inline struct dentry *esp_dump_array(const char *name, struct dentry *parent, st
|
|||
return NULL;
|
||||
}
|
||||
|
||||
inline struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size) {
|
||||
inline struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size, struct file_operations *fops) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,33 @@
|
|||
#include <linux/debugfs.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)
|
||||
|
||||
#define NAME_LEN_MAX 12
|
||||
|
||||
typedef enum DBGFS_BOOTMODE_ID {
|
||||
DBGFS_FCC_MODE = 0,
|
||||
DBGFS_ATE_MODE,
|
||||
DBGFS_NOR_MODE,
|
||||
DBGFS_MODE_MAX,
|
||||
}DBGFS_BOOTMODE_ID_t;
|
||||
|
||||
struct dbgfs_bootmode_item {
|
||||
char name[NAME_LEN_MAX];
|
||||
DBGFS_BOOTMODE_ID_t id;
|
||||
u32 var;
|
||||
void *priv_data;
|
||||
int (*r_cb)(void *data);
|
||||
int (*w_cb)(void *data);
|
||||
};
|
||||
|
||||
u32 dbgfs_get_bootmode_var(DBGFS_BOOTMODE_ID_t id);
|
||||
struct dbgfs_bootmode_item *dbgfs_get_bootmode_di(DBGFS_BOOTMODE_ID_t id);
|
||||
void dbgfs_bootmode_init(void);
|
||||
void dbgfs_fcctest_set(u8 *buf, int size);
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum esp_type {
|
||||
ESP_BOOL,
|
||||
ESP_U8,
|
||||
|
|
@ -25,11 +52,12 @@ typedef enum esp_type {
|
|||
ESP_U64
|
||||
} esp_type;
|
||||
|
||||
|
||||
struct dentry *esp_dump_var(const char *name, struct dentry *parent, void *value, esp_type type);
|
||||
|
||||
struct dentry *esp_dump_array(const char *name, struct dentry *parent, struct debugfs_blob_wrapper *blob);
|
||||
|
||||
struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size);
|
||||
struct dentry *esp_dump(const char *name, struct dentry *parent, void *data, int size, struct file_operations *fops);
|
||||
|
||||
struct dentry *esp_debugfs_add_sub_dir(const char *name);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
* file operation in kernel space
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -395,6 +396,82 @@ int request_init_conf(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
static inline int is_le(void)
|
||||
{
|
||||
u16 n = 0x0001;
|
||||
return ((u8 *)&n)[0] == 1? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int conv_b2l_u32(u32 n)
|
||||
{
|
||||
u8 *p = (u8 *)&n;
|
||||
|
||||
return (u32)*p + (((u32)*(p+1))<<8) + (((u32)*(p+2))<<16) + (((u32)*(p+3))<<24);
|
||||
}
|
||||
|
||||
static void fcctest_set(u8 *buf, int size)
|
||||
{
|
||||
u32 mode = 0;
|
||||
struct fcc_mode *fm;
|
||||
|
||||
if (buf == NULL)
|
||||
return;
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)
|
||||
mode = dbgfs_get_bootmode_var(DBGFS_FCC_MODE);
|
||||
#endif
|
||||
#ifdef ESP_CLASS
|
||||
if (mode == 0)
|
||||
mode = sif_get_fccmode();
|
||||
else if (sif_get_fccmode() != 0)
|
||||
mode = sif_get_fccmode();
|
||||
#endif
|
||||
if (!is_le())/* big endian */
|
||||
mode = conv_b2l_u32(mode);
|
||||
|
||||
fm = (struct fcc_mode *)&mode;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s mode 0x%08x id 0x%02x", __func__, mode, fm->id);
|
||||
|
||||
if (fm->id == 0 || fm->id >= FCC_MODE_MAX)
|
||||
return;
|
||||
|
||||
switch (fm->id) {
|
||||
case FCC_MODE_SELFTEST:
|
||||
esp_dbg(ESP_SHOW, "selftest");
|
||||
buf[79] = 0x1;
|
||||
break;
|
||||
case FCC_MODE_CONT_TX:
|
||||
esp_dbg(ESP_SHOW, "continue tx");
|
||||
buf[80] = 0x1;
|
||||
buf[82] = fm->u.fcc_cont_tx.channel;
|
||||
buf[83] = fm->u.fcc_cont_tx.rate_offset;
|
||||
buf[81] = 0x1;
|
||||
buf[78] = 0x1;
|
||||
|
||||
if((buf[75]|buf[76]|buf[77]) == 0){
|
||||
buf[75] = 0x93;
|
||||
buf[76] = 0x43;
|
||||
buf[77] = 0x00;
|
||||
}
|
||||
break;
|
||||
case FCC_MODE_NORM_TX:
|
||||
esp_dbg(ESP_SHOW, "normal tx");
|
||||
buf[80] = 0x1;
|
||||
buf[82] = fm->u.fcc_norm_tx.channel;
|
||||
buf[83] = fm->u.fcc_norm_tx.rate_offset;
|
||||
break;
|
||||
case FCC_MODE_SDIO_NOISE:
|
||||
esp_dbg(ESP_SHOW, "sdio noise");
|
||||
buf[79] = 0x2;
|
||||
break;
|
||||
default:
|
||||
esp_dbg(ESP_DBG_ERROR, "not support the fccmode id");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void fix_init_data(u8 *init_data_buf, int buf_size)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -407,4 +484,208 @@ void fix_init_data(u8 *init_data_buf, int buf_size)
|
|||
}
|
||||
}
|
||||
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
fcctest_set(init_data_buf, buf_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ESP_CLASS
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t nor_show(struct class *cls, struct class_attribute *attr, char *ubuf)
|
||||
#else
|
||||
static ssize_t nor_show(struct class *cls, char *ubuf)
|
||||
#endif
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
count = sprintf(ubuf, "0x%08x\n", sif_get_esp_run());
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t nor_store(struct class *cls, struct class_attribute *attr, const char *ubuf, size_t count)
|
||||
#else
|
||||
static ssize_t nor_store(struct class *cls, const char *ubuf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
unsigned long var;
|
||||
|
||||
if (ubuf[0] == '0' && (ubuf[1] == 'x' || ubuf[1] == 'X'))
|
||||
ret = strict_strtoul(ubuf, 16, &var);
|
||||
else
|
||||
ret = strict_strtoul(ubuf, 10, &var);
|
||||
|
||||
if (ret) {
|
||||
esp_dbg(ESP_DBG_ERROR, "invalid input");
|
||||
return count;
|
||||
}
|
||||
|
||||
switch (var) {
|
||||
case 0:
|
||||
if (sif_get_esp_run() != 0)
|
||||
esp_common_exit();
|
||||
else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s already down", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sif_get_esp_run() == 0) esp_common_init();
|
||||
else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s already up!", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sif_get_esp_run() == 0) {
|
||||
sif_record_ate_config(0);
|
||||
sif_record_fccmode(0);
|
||||
esp_dbg(ESP_SHOW, "%s reset all the boot mode", __func__);
|
||||
} else {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s must down pre!", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
esp_dbg(ESP_DBG_ERROR, "%s unspec cmd", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t ate_show(struct class *cls, struct class_attribute *attr, char *ubuf)
|
||||
#else
|
||||
static ssize_t ate_show(struct class *cls, char *ubuf)
|
||||
#endif
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
count = sprintf(ubuf, "0x%08x\n", sif_get_ate_config());
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t ate_store(struct class *cls, struct class_attribute *attr, const char *ubuf, size_t count)
|
||||
#else
|
||||
static ssize_t ate_store(struct class *cls, const char *ubuf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
unsigned long var;
|
||||
|
||||
if (ubuf[0] == '0' && (ubuf[1] == 'x' || ubuf[1] == 'X'))
|
||||
ret = strict_strtoul(ubuf, 16, &var);
|
||||
else
|
||||
ret = strict_strtoul(ubuf, 10, &var);
|
||||
|
||||
if (ret) {
|
||||
esp_dbg(ESP_DBG_ERROR, "invalid input");
|
||||
return count;
|
||||
}
|
||||
|
||||
if (sif_get_esp_run() != 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s set ate mode must after close driver ", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
sif_record_ate_config((int)var);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t fcc_show(struct class *cls, struct class_attribute *attr, char *ubuf)
|
||||
#else
|
||||
static ssize_t fcc_show(struct class *cls, char *ubuf)
|
||||
#endif
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
count = sprintf(ubuf, "0x%08x\n", sif_get_fccmode());
|
||||
return count;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
|
||||
static ssize_t fcc_store(struct class *cls, struct class_attribute *attr, const char *ubuf, size_t count)
|
||||
#else
|
||||
static ssize_t fcc_store(struct class *cls, const char *ubuf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
unsigned long var;
|
||||
|
||||
if (ubuf[0] == '0' && (ubuf[1] == 'x' || ubuf[1] == 'X'))
|
||||
ret = strict_strtoul(ubuf, 16, &var);
|
||||
else
|
||||
ret = strict_strtoul(ubuf, 10, &var);
|
||||
|
||||
if (ret) {
|
||||
esp_dbg(ESP_DBG_ERROR, "invalid input");
|
||||
return count;
|
||||
}
|
||||
|
||||
if (sif_get_esp_run() != 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s set ate mode must after close driver ", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
sif_record_fccmode((u32)var);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static struct class *esp_class = NULL;
|
||||
static CLASS_ATTR(normode, 0664, nor_show, nor_store);
|
||||
static CLASS_ATTR(atemode, 0664, ate_show, ate_store);
|
||||
static CLASS_ATTR(fccmode, 0664, fcc_show, fcc_store);
|
||||
|
||||
int esp_class_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "esp_class init\n");
|
||||
|
||||
esp_class = class_create(THIS_MODULE, "esp_boot");
|
||||
if (IS_ERR(esp_class))
|
||||
{
|
||||
esp_dbg(ESP_DBG_ERROR, "esp_class create failed.\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
ret = class_create_file(esp_class, &class_attr_normode);
|
||||
if (ret) {
|
||||
class_destroy(esp_class);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = class_create_file(esp_class, &class_attr_atemode);
|
||||
if (ret) {
|
||||
class_remove_file(esp_class, &class_attr_normode);
|
||||
class_destroy(esp_class);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = class_create_file(esp_class, &class_attr_fccmode);
|
||||
if (ret) {
|
||||
class_remove_file(esp_class, &class_attr_atemode);
|
||||
class_remove_file(esp_class, &class_attr_normode);
|
||||
class_destroy(esp_class);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esp_class_deinit(void)
|
||||
{
|
||||
class_remove_file(esp_class, &class_attr_fccmode);
|
||||
class_remove_file(esp_class, &class_attr_fccmode);
|
||||
class_remove_file(esp_class, &class_attr_atemode);
|
||||
class_remove_file(esp_class, &class_attr_normode);
|
||||
class_destroy(esp_class);
|
||||
|
||||
esp_class = NULL;
|
||||
}
|
||||
|
||||
#endif /* ESP_CLASS */
|
||||
|
|
|
|||
|
|
@ -56,4 +56,55 @@ extern int logger_write( const unsigned char prio,
|
|||
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
|
||||
#define FCC_MODE_ID_MASK 0x000000ff
|
||||
#define FCC_MODE_ID_SHIFT 0
|
||||
#define FM_GET_ID(mode) ((mode&FCC_MODE_ID_MASK)>>FCC_MODE_ID_SHIFT)
|
||||
/* fcc tx / fcc continue tx */
|
||||
#define FCC_MODE_CHANNEL_MASK 0x0000ff00
|
||||
#define FCC_MODE_CHANNEL_SHIFT 8
|
||||
#define FM_GET_CHANNEL(mode) ((mode&FCC_MODE_CHAN_MASK)>>FCC_MODE_CHANNEL_SHIFT)
|
||||
#define FCC_MODE_RATE_OFFSET_MASK 0x00ff0000
|
||||
#define FCC_MODE_RATE_OFFSET_SHIFT 16
|
||||
#define FM_GET_RATE_OFFSET(mode) ((mode&FCC_MODE_RATE_OFFSET_MASK)>>FCC_MODE_RATE_OFFSET_SHIFT)
|
||||
|
||||
typedef enum FCC_MODE_ID {
|
||||
FCC_MODE_ILDE = 0,
|
||||
FCC_MODE_SELFTEST = 1,
|
||||
FCC_MODE_CONT_TX,
|
||||
FCC_MODE_NORM_TX,
|
||||
FCC_MODE_SDIO_NOISE,
|
||||
FCC_MODE_MAX,
|
||||
} FCC_MODE_ID_t;
|
||||
|
||||
|
||||
/* little ending:
|
||||
* low bit <-- --> high bit *
|
||||
* id channel rate reserve */
|
||||
struct fcc_mode {
|
||||
u8 id;
|
||||
union {
|
||||
struct {
|
||||
u8 reserve[3];
|
||||
} fcc_selftest;
|
||||
struct {
|
||||
u8 channel;
|
||||
u8 rate_offset;
|
||||
u8 reserve;
|
||||
} fcc_norm_tx;
|
||||
struct {
|
||||
u8 channel;
|
||||
u8 rate_offset;
|
||||
u8 reserve;
|
||||
} fcc_cont_tx;
|
||||
} u;
|
||||
} __packed;
|
||||
#endif /* FCC */
|
||||
|
||||
#ifdef ESP_CLASS
|
||||
int esp_class_init(void);
|
||||
void esp_class_deinit(void);
|
||||
#endif
|
||||
|
||||
#endif /* _ESP_FILE_H_ */
|
||||
|
|
|
|||
107
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/esp_init.c
Executable file
107
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/esp_init.c
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* init , call sdio_init or spi_init
|
||||
*
|
||||
*/
|
||||
|
||||
#include "esp_pub.h"
|
||||
#include "esp_sif.h"
|
||||
#include "esp_debug.h"
|
||||
#include "esp_version.h"
|
||||
#include "esp_file.h"
|
||||
|
||||
int esp_common_init(void)
|
||||
{
|
||||
int ret;
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
if (sif_get_esp_run() != 0) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef ESP_USE_SDIO
|
||||
ret = esp_sdio_init();
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
ret = esp_spi_init();
|
||||
#endif
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
if (ret == 0)
|
||||
sif_record_esp_run(1);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
void esp_common_exit(void)
|
||||
{
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
if (sif_get_esp_run() == 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef ESP_USE_SDIO
|
||||
esp_sdio_exit();
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
esp_spi_exit();
|
||||
#endif
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
sif_record_esp_run(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int /*__init*/ esp_init(void)
|
||||
{
|
||||
u64 ver;
|
||||
int edf_ret = 0;
|
||||
|
||||
#ifdef DRIVER_VER
|
||||
ver = DRIVER_VER;
|
||||
esp_dbg(ESP_SHOW, "\n*****%s %s EAGLE DRIVER VER:%llx*****\n\n", __DATE__, __TIME__, ver);
|
||||
#endif
|
||||
edf_ret = esp_debugfs_init(); /* if failed, continue */
|
||||
if (edf_ret == 0) {
|
||||
#if defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)
|
||||
dbgfs_bootmode_init();
|
||||
#endif
|
||||
esp_dump_var("esp_msg_level", NULL, &esp_msg_level, ESP_U32);
|
||||
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
esp_dump_var("log_off", NULL, &log_off, ESP_U32);
|
||||
#endif /* ESP_ANDROID_LOGGER */
|
||||
}
|
||||
#ifdef ESP_CLASS
|
||||
esp_class_init();
|
||||
#endif
|
||||
request_init_conf();
|
||||
|
||||
return esp_common_init();
|
||||
}
|
||||
|
||||
static void /*__exit */ esp_exit(void)
|
||||
{
|
||||
esp_debugfs_exit();
|
||||
#ifdef ESP_CLASS
|
||||
esp_class_deinit();
|
||||
#endif
|
||||
|
||||
esp_common_exit();
|
||||
}
|
||||
|
||||
int rockchip_wifi_init_module_esp8089(void)
|
||||
{
|
||||
|
||||
return esp_init();
|
||||
}
|
||||
|
||||
void rockchip_wifi_exit_module_esp8089(void)
|
||||
{
|
||||
esp_exit();
|
||||
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(rockchip_wifi_init_module_esp8089);
|
||||
EXPORT_SYMBOL(rockchip_wifi_exit_module_esp8089);
|
||||
|
||||
//module_init(esp_init);
|
||||
//module_exit(esp_exit);
|
||||
|
|
@ -163,7 +163,7 @@ int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, u8 *value)
|
|||
|
||||
p_tbuf[0] = 0x80 | (reg_addr & 0x1f);
|
||||
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_WIN_CMD, p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_WIN_CMD, p_tbuf, 4, ESP_SIF_NOSYNC);
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr,u8 *value)
|
|||
memcpy(p_tbuf,value,4);
|
||||
p_tbuf[4] = 0xc0 |(reg_addr & 0x1f);
|
||||
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_CONF_W5, p_tbuf, 5, ESP_SIF_NOSYNC);
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_CONF_W5, p_tbuf, 8, ESP_SIF_NOSYNC);
|
||||
|
||||
kfree(p_tbuf);
|
||||
return ret;
|
||||
|
|
@ -216,7 +216,7 @@ int sif_ack_target_read_err(struct esp_pub *epub)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sif_had_io_enable(struct esp_pub *epub)
|
||||
int sif_hda_io_enable(struct esp_pub *epub)
|
||||
{
|
||||
u32 *p_tbuf = NULL;
|
||||
int ret;
|
||||
|
|
@ -232,13 +232,13 @@ int sif_had_io_enable(struct esp_pub *epub)
|
|||
goto _err;
|
||||
|
||||
*p_tbuf = 0x30;
|
||||
ret = esp_common_write_with_addr((epub), SLC_HOST_CONF_W4 + 1, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
ret = esp_common_writebyte_with_addr((epub), SLC_HOST_CONF_W4 + 1, (u8)*p_tbuf, ESP_SIF_NOSYNC);
|
||||
|
||||
if(ret)
|
||||
goto _err;
|
||||
//set w3 0
|
||||
*p_tbuf = 0x1;
|
||||
ret = esp_common_write_with_addr((epub), SLC_HOST_CONF_W3, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
ret = esp_common_writebyte_with_addr((epub), SLC_HOST_CONF_W3, (u8)*p_tbuf, ESP_SIF_NOSYNC);
|
||||
|
||||
_err:
|
||||
kfree(p_tbuf);
|
||||
|
|
@ -648,4 +648,28 @@ int sif_get_wakeup_gpio_config(void)
|
|||
return wakeup_gpio;
|
||||
}
|
||||
|
||||
#ifdef ESP_CLASS
|
||||
static int fcc_mode = 0;
|
||||
void sif_record_fccmode(int value)
|
||||
{
|
||||
fcc_mode = value;
|
||||
}
|
||||
|
||||
int sif_get_fccmode(void)
|
||||
{
|
||||
return fcc_mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
static int esp_run = 0;
|
||||
void sif_record_esp_run(int value)
|
||||
{
|
||||
esp_run = value;
|
||||
}
|
||||
|
||||
int sif_get_esp_run(void)
|
||||
{
|
||||
return esp_run;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,15 +25,24 @@
|
|||
#include "esp_wl.h"
|
||||
#include "esp_utils.h"
|
||||
#include <linux/rfkill-wlan.h>
|
||||
|
||||
#include "esp_mac80211.h"
|
||||
#define ESP_IEEE80211_DBG esp_dbg
|
||||
|
||||
#define GET_NEXT_SEQ(seq) (((seq) +1) & 0x0fff)
|
||||
|
||||
#ifdef P2P_CONCURRENT
|
||||
extern void reset_signal_count(void);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
static void beacon_tim_init(void);
|
||||
static u8 beacon_tim_save(u8 this_tim);
|
||||
static bool beacon_tim_alter(struct sk_buff *beacon);
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) && defined(P2P_CONCURRENT)
|
||||
static u8 esp_mac_addr[ETH_ALEN * 2];
|
||||
#endif
|
||||
static u8 getaddr_index(u8 * addr, struct esp_pub *epub);
|
||||
static int dup_addr_by_index(u8 *addr, struct esp_pub *epub, u8 index);
|
||||
|
||||
static
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
|
|
@ -65,7 +74,9 @@ esp_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
|
|||
if(!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
|
||||
u8 tidno = ieee80211_get_qos_ctl(wh)[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
struct esp_node * node = esp_get_node_by_addr(epub, wh->addr1);
|
||||
struct ieee80211_sta *sta = control->sta;
|
||||
struct esp_node * node = (struct esp_node *)sta->drv_priv;
|
||||
if(sta->ht_cap.ht_supported)
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
struct ieee80211_sta *sta = tx_info->control.sta;
|
||||
struct esp_node * node = (struct esp_node *)sta->drv_priv;
|
||||
|
|
@ -93,12 +104,7 @@ esp_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
|
|||
#endif
|
||||
|
||||
sip_tx_data_pkt_enqueue(epub, skb);
|
||||
if (epub)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
ieee80211_queue_work(hw, &epub->tx_work);
|
||||
#else
|
||||
queue_work(hw->workqueue,&epub->tx_work);
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
return NETDEV_TX_OK;
|
||||
#endif /*2.6.39*/
|
||||
|
|
@ -179,6 +185,172 @@ static int esp_op_resume(struct ieee80211_hw *hw)
|
|||
#endif //CONFIG_PM
|
||||
#endif
|
||||
|
||||
void esp_sendup_deauth(struct esp_pub *epub, u8 *sta_addr)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct esp_80211_deauth *deauth;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s", __func__);
|
||||
|
||||
skb = __dev_alloc_skb(sizeof(struct esp_80211_deauth), GFP_KERNEL);
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
skb_put(skb, sizeof(struct esp_80211_deauth));
|
||||
|
||||
deauth = (struct esp_80211_deauth *)skb->data;
|
||||
deauth->hdr.frame_control = 0x00c0; /* deauth */
|
||||
deauth->hdr.duration_id = 0x003c; /* 60ms */
|
||||
memcpy(deauth->hdr.addr1, epub->master_addr, ETH_ALEN); /* dst */
|
||||
memcpy(deauth->hdr.addr2, sta_addr, ETH_ALEN); /* src */
|
||||
memcpy(deauth->hdr.addr3, epub->master_addr, ETH_ALEN); /* bssid */
|
||||
deauth->hdr.seq_ctrl = 0x0000;
|
||||
deauth->reason_code = 0x0003; /* sta leaving */
|
||||
|
||||
#ifndef RX_SENDUP_SYNC
|
||||
skb_queue_tail(&epub->rxq, skb);
|
||||
queue_work(epub->esp_wkq, &sip->epub->sendup_work);
|
||||
#else
|
||||
local_bh_disable();
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
ieee80211_rx(epub->hw, skb);
|
||||
#else
|
||||
ieee80211_rx(epub->hw, skb ,(struct ieee80211_rx_status *)skb->cb);
|
||||
#endif
|
||||
local_bh_enable();
|
||||
#endif /* RX_SENDUP_SYNC */
|
||||
}
|
||||
|
||||
static void esp_send_nulldata(struct esp_pub *epub, struct esp_vif *evif, struct esp_node *enode)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct esp_80211_nulldata *nulldata;
|
||||
struct ieee80211_vif *vif = container_of((void *)evif, struct ieee80211_vif, drv_priv);
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s enter, enode %d", __func__, enode->index);
|
||||
|
||||
skb = dev_alloc_skb(epub->hw->extra_tx_headroom+ sizeof(*nulldata));
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
skb_reserve(skb, epub->hw->extra_tx_headroom);
|
||||
skb_put(skb, sizeof(*nulldata));
|
||||
nulldata = (struct esp_80211_nulldata *)skb->data;
|
||||
memset(nulldata, 0x00, sizeof(*nulldata));
|
||||
|
||||
nulldata->hdr.frame_control = 0x0248; /* null data , FROM DS 1 */
|
||||
nulldata->hdr.duration_id = 0x003c; /* 60ms */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
memcpy(nulldata->hdr.addr1, enode->sta->addr, ETH_ALEN); /* dst */
|
||||
#else
|
||||
memcpy(nulldata->hdr.addr1, enode->addr, ETH_ALEN); /* dst */
|
||||
#endif
|
||||
memcpy(nulldata->hdr.addr2, epub->master_addr, ETH_ALEN); /* bssid */
|
||||
memcpy(nulldata->hdr.addr3, epub->master_addr, ETH_ALEN); /* src */
|
||||
nulldata->hdr.seq_ctrl = 0x0000;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
|
||||
#endif
|
||||
IEEE80211_SKB_CB(skb)->control.vif = vif;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
|
||||
IEEE80211_SKB_CB(skb)->control.sta = enode->sta;
|
||||
#endif
|
||||
IEEE80211_SKB_CB(skb)->control.hw_key = NULL;
|
||||
sip_tx_data_pkt_enqueue(epub, skb);
|
||||
}
|
||||
|
||||
static void esp_send_nulldata_alarm(unsigned long data)
|
||||
{
|
||||
u8 tim = 0;
|
||||
u8 index;
|
||||
u32 map;
|
||||
struct esp_node *enode;
|
||||
struct esp_vif *evif = (struct esp_vif *)data;
|
||||
struct esp_pub *epub = evif->epub;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s enter", __func__);
|
||||
map = epub->enodes_map;
|
||||
while (map != 0) {
|
||||
index = ffs(map) - 1;
|
||||
if (index > ESP_PUB_MAX_STA)
|
||||
break;
|
||||
enode = esp_get_node_by_index(epub, index);
|
||||
if (enode && enode->ifidx == epub->master_ifidx) {
|
||||
if (atomic_read(&enode->sta_state) == ESP_STA_STATE_NORM) {
|
||||
if (atomic_dec_and_test(&enode->time_remain)) {
|
||||
atomic_set(&enode->sta_state, ESP_STA_STATE_WAIT);
|
||||
esp_send_nulldata(epub, evif, enode);
|
||||
} else if (atomic_read(&enode->time_remain) == 1) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
tim |= (1<<enode->sta->aid);
|
||||
#else
|
||||
tim |= (1<<enode->aid);
|
||||
#endif
|
||||
}
|
||||
} else if (atomic_read(&enode->sta_state) == ESP_STA_STATE_WAIT) {
|
||||
atomic_inc(&enode->loss_count);
|
||||
if (atomic_read(&enode->loss_count) <= ESP_LOSS_COUNT_MAX) {
|
||||
atomic_set(&enode->sta_state, ESP_STA_STATE_WAIT);
|
||||
esp_send_nulldata(epub, evif, enode);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
tim |= (1<<enode->sta->aid);
|
||||
#else
|
||||
tim |= (1<<enode->aid);
|
||||
#endif
|
||||
} else {
|
||||
atomic_set(&enode->sta_state, ESP_STA_STATE_LOST);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
esp_sendup_deauth(epub, enode->sta->addr);
|
||||
#else
|
||||
esp_sendup_deauth(epub, enode->addr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
map &= ~(1<<index);
|
||||
}
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
if (tim) {
|
||||
beacon_tim_save(tim);
|
||||
esp_dbg(ESP_DBG_TRACE, "tim 0x%02x", tim);
|
||||
}
|
||||
#endif
|
||||
|
||||
mod_timer(&evif->nulldata_timer, jiffies + msecs_to_jiffies(ESP_ND_TIMER_INTERVAL));
|
||||
|
||||
}
|
||||
|
||||
void esp_sta_gc_conn_monitor_open(struct esp_pub *epub, struct esp_vif *evif)
|
||||
{
|
||||
if (epub == NULL || evif == NULL)
|
||||
return;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "master_ifidx %d\n", epub->master_ifidx);
|
||||
|
||||
dup_addr_by_index(epub->master_addr, epub, evif->index);
|
||||
epub->master_ifidx = evif->index;
|
||||
|
||||
init_timer(&evif->nulldata_timer);
|
||||
evif->nulldata_timer.expires = jiffies + msecs_to_jiffies(1000);
|
||||
evif->nulldata_timer.data = (unsigned long) evif;
|
||||
evif->nulldata_timer.function = esp_send_nulldata_alarm;
|
||||
add_timer(&evif->nulldata_timer);
|
||||
}
|
||||
|
||||
void esp_sta_gc_conn_monitor_close(struct esp_pub *epub, struct esp_vif *evif)
|
||||
{
|
||||
if (epub == NULL || evif == NULL)
|
||||
return;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s enter", __func__);
|
||||
|
||||
del_timer_sync(&evif->nulldata_timer);
|
||||
memset(epub->master_addr, 0x00, ETH_ALEN);
|
||||
epub->master_ifidx = ESP_PUB_MAX_VIF;
|
||||
}
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34))
|
||||
static int esp_op_add_interface(struct ieee80211_hw *hw,
|
||||
struct ieee80211_if_init_conf *conf)
|
||||
|
|
@ -346,6 +518,7 @@ static void esp_op_remove_interface(struct ieee80211_hw *hw,
|
|||
evif->beacon_interval = 0;
|
||||
del_timer_sync(&evif->beacon_timer);
|
||||
evif->ap_up = false;
|
||||
esp_sta_gc_conn_monitor_close(epub, evif);
|
||||
}
|
||||
epub->vif = NULL;
|
||||
evif->epub = NULL;
|
||||
|
|
@ -357,24 +530,30 @@ static void esp_op_remove_interface(struct ieee80211_hw *hw,
|
|||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
#define BEACON_TIM_SAVE_MAX 20
|
||||
#define BEACON_TIM_SAVE_MAX 12
|
||||
u8 beacon_tim_saved[BEACON_TIM_SAVE_MAX];
|
||||
int beacon_tim_count;
|
||||
spinlock_t tim_lock;
|
||||
static void beacon_tim_init(void)
|
||||
{
|
||||
memset(beacon_tim_saved, BEACON_TIM_SAVE_MAX, 0);
|
||||
beacon_tim_count = 0;
|
||||
spin_lock_init(&tim_lock);
|
||||
}
|
||||
|
||||
static u8 beacon_tim_save(u8 this_tim)
|
||||
{
|
||||
u8 all_tim = 0;
|
||||
int i;
|
||||
|
||||
spin_lock(&tim_lock);
|
||||
beacon_tim_saved[beacon_tim_count] = this_tim;
|
||||
if(++beacon_tim_count >= BEACON_TIM_SAVE_MAX)
|
||||
beacon_tim_count = 0;
|
||||
for(i = 0; i < BEACON_TIM_SAVE_MAX; i++)
|
||||
all_tim |= beacon_tim_saved[i];
|
||||
spin_unlock(&tim_lock);
|
||||
|
||||
return all_tim;
|
||||
}
|
||||
|
||||
|
|
@ -395,8 +574,8 @@ static bool beacon_tim_alter(struct sk_buff *beacon)
|
|||
p = mgmt->u.beacon.variable;
|
||||
|
||||
while (remain_len > 0) {
|
||||
len = *(++p);
|
||||
if (*p == WLAN_EID_TIM) { // tim field
|
||||
len = *(++p);
|
||||
tim_end = p + len;
|
||||
tim_count = *(++p);
|
||||
p += 2;
|
||||
|
|
@ -408,8 +587,10 @@ static bool beacon_tim_alter(struct sk_buff *beacon)
|
|||
*p = beacon_tim_save(*p);
|
||||
}
|
||||
return tim_count == 0;
|
||||
}
|
||||
p += (len + 1);
|
||||
} else {
|
||||
len = *(++p);
|
||||
p += (len + 1);
|
||||
}
|
||||
remain_len -= (2 + len);
|
||||
}
|
||||
|
||||
|
|
@ -662,6 +843,7 @@ static void esp_op_bss_info_changed(struct ieee80211_hw *hw,
|
|||
if (info->enable_beacon && evif->ap_up != true) {
|
||||
evif->beacon_interval = info->beacon_int;
|
||||
init_beacon_timer(vif);
|
||||
esp_sta_gc_conn_monitor_open(epub, evif);
|
||||
sip_send_bss_info_update(epub, evif, (u8*)info->bssid, 2);
|
||||
evif->ap_up = true;
|
||||
} else if (!info->enable_beacon && evif->ap_up &&
|
||||
|
|
@ -674,6 +856,7 @@ static void esp_op_bss_info_changed(struct ieee80211_hw *hw,
|
|||
ESP_IEEE80211_DBG(ESP_DBG_TRACE, " %s AP disable beacon, interval is %d\n", __func__, info->beacon_int);
|
||||
evif->beacon_interval = 0;
|
||||
del_timer_sync(&evif->beacon_timer);
|
||||
esp_sta_gc_conn_monitor_close(epub, evif);
|
||||
sip_send_bss_info_update(epub, evif, (u8*)info->bssid, 2);
|
||||
evif->ap_up = false;
|
||||
}
|
||||
|
|
@ -1012,6 +1195,9 @@ static int esp_node_attach(struct ieee80211_hw *hw, u8 ifidx, const u8 *addr)
|
|||
#endif
|
||||
node->ifidx = ifidx;
|
||||
node->index = i;
|
||||
atomic_set(&node->loss_count, 0);
|
||||
atomic_set(&node->time_remain, ESP_ND_TIME_REMAIN_MAX);
|
||||
atomic_set(&node->sta_state, ESP_STA_STATE_NORM);
|
||||
|
||||
for(tidno = 0, tid = &node->tid[tidno]; tidno < WME_NUM_TID; tidno++) {
|
||||
tid->ssn = 0;
|
||||
|
|
@ -1178,6 +1364,10 @@ static int esp_op_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, co
|
|||
#endif
|
||||
struct esp_vif *evif = (struct esp_vif *)vif->drv_priv;
|
||||
int index;
|
||||
|
||||
if (vif->type == NL80211_IFTYPE_STATION)
|
||||
reset_signal_count();
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28))
|
||||
ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter, addr %pM\n", __func__, addr);
|
||||
index = esp_node_attach(hw, evif->index, addr);
|
||||
|
|
@ -1248,7 +1438,7 @@ static void esp_op_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif
|
|||
ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__);
|
||||
|
||||
switch (cmd) {
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
|
||||
case STA_NOTIFY_ADD:
|
||||
ESP_IEEE80211_DBG(ESP_DBG_ERROR, "%s cmd add\n", __func__);
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
|
|
@ -1936,6 +2126,9 @@ struct esp_pub * esp_pub_alloc_mac80211(struct device *dev)
|
|||
ret = -ENOMEM;
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
epub->master_ifidx = ESP_PUB_MAX_VIF;
|
||||
|
||||
epub->scan_permit_valid = false;
|
||||
INIT_DELAYED_WORK(&epub->scan_timeout_work, hw_scan_timeout_report);
|
||||
|
||||
|
|
@ -2085,6 +2278,7 @@ esp_pub_init_mac80211(struct esp_pub *epub)
|
|||
IEEE80211_HW_HAS_RATE_CONTROL |
|
||||
#endif /* >= 2.6.33 */
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
|
||||
IEEE80211_HW_MFP_CAPABLE |
|
||||
IEEE80211_HW_SUPPORTS_PS |
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
|
|
@ -2138,7 +2332,7 @@ esp_pub_init_mac80211(struct esp_pub *epub)
|
|||
/*add to support 11n*/
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.ht_supported = true;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.cap = 0x116C;//IEEE80211_HT_CAP_RX_STBC; //IEEE80211_HT_CAP_SGI_20;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.cap = 0x112C;//IEEE80211_HT_CAP_RX_STBC; //IEEE80211_HT_CAP_SGI_20;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;
|
||||
|
|
@ -2153,7 +2347,7 @@ esp_pub_init_mac80211(struct esp_pub *epub)
|
|||
//epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
|
||||
#else
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.ht_supported = true;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.cap = 0x116C;//IEEE80211_HT_CAP_RX_STBC; //IEEE80211_HT_CAP_SGI_20;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.cap = 0x112C;//IEEE80211_HT_CAP_RX_STBC; //IEEE80211_HT_CAP_SGI_20;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.ampdu_factor = 1;//IEEE80211_HT_MAX_AMPDU_16K;
|
||||
epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.ampdu_density = 0;//IEEE80211_HT_MPDU_DENSITY_NONE;
|
||||
memset(&epub->wl.sbands[IEEE80211_BAND_2GHZ].ht_info.supp_mcs_set, 0,
|
||||
|
|
@ -2197,7 +2391,7 @@ esp_register_mac80211(struct esp_pub *epub)
|
|||
{
|
||||
int ret = 0;
|
||||
u8 mac[ETH_ALEN];
|
||||
#ifdef P2P_CONCURRENT
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) && defined(P2P_CONCURRENT)
|
||||
u8 *wlan_addr;
|
||||
u8 *p2p_addr;
|
||||
int idx;
|
||||
|
|
@ -2215,7 +2409,7 @@ esp_register_mac80211(struct esp_pub *epub)
|
|||
memcpy(epub->mac_addr, mac, ETH_ALEN);
|
||||
}
|
||||
|
||||
#ifdef P2P_CONCURRENT
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) && defined(P2P_CONCURRENT)
|
||||
epub->hw->wiphy->addresses = (struct mac_address *)esp_mac_addr;
|
||||
memcpy(&epub->hw->wiphy->addresses[0], epub->mac_addr, ETH_ALEN);
|
||||
memcpy(&epub->hw->wiphy->addresses[1], epub->mac_addr, ETH_ALEN);
|
||||
|
|
@ -2225,7 +2419,7 @@ esp_register_mac80211(struct esp_pub *epub)
|
|||
for (idx = 0; idx < 64; idx++) {
|
||||
p2p_addr[0] = wlan_addr[0] | 0x02;
|
||||
p2p_addr[0] ^= idx << 2;
|
||||
if (strncmp(p2p_addr, wlan_addr, 6) != 0)
|
||||
if (memcmp(p2p_addr, wlan_addr, ETH_ALEN) != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -2265,7 +2459,7 @@ esp_register_mac80211(struct esp_pub *epub)
|
|||
|
||||
static u8 getaddr_index(u8 * addr, struct esp_pub *epub)
|
||||
{
|
||||
#ifdef P2P_CONCURRENT
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) && defined(P2P_CONCURRENT)
|
||||
int i;
|
||||
for(i = 0; i < ESP_PUB_MAX_VIF; i++)
|
||||
if(memcmp(addr, (u8 *)&epub->hw->wiphy->addresses[i], ETH_ALEN) == 0)
|
||||
|
|
@ -2276,3 +2470,23 @@ static u8 getaddr_index(u8 * addr, struct esp_pub *epub)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int dup_addr_by_index(u8 *addr, struct esp_pub *epub, u8 index)
|
||||
{
|
||||
if (addr == NULL)
|
||||
return -EINVAL;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) && defined(P2P_CONCURRENT)
|
||||
if (index >= ESP_PUB_MAX_VIF || index < 0) {
|
||||
memcpy(addr, epub->mac_addr, ETH_ALEN);
|
||||
return -ERANGE;
|
||||
}
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
|
||||
memcpy(addr, &epub->hw->wiphy->addresses[index], ETH_ALEN);
|
||||
#else
|
||||
memcpy(addr, epub->mac_addr, ETH_ALEN);
|
||||
#endif /* kernel version */
|
||||
#else
|
||||
memcpy(addr, epub->mac_addr, ETH_ALEN);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,38 @@
|
|||
*/
|
||||
#ifndef _ESP_MAC80211_H_
|
||||
#define _ESP_MAC80211_H_
|
||||
#include <linux/ieee80211.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35))
|
||||
struct ieee80211_hdr_3addr {
|
||||
__le16 frame_control;
|
||||
__le16 duration_id;
|
||||
u8 addr1[ETH_ALEN];
|
||||
u8 addr2[ETH_ALEN];
|
||||
u8 addr3[ETH_ALEN];
|
||||
__le16 seq_ctrl;
|
||||
} __packed;
|
||||
#endif
|
||||
|
||||
/*MGMT --------------------------------------------------------- */
|
||||
struct esp_80211_deauth {
|
||||
struct ieee80211_hdr_3addr hdr;
|
||||
__le16 reason_code;
|
||||
} __packed;
|
||||
|
||||
/*CONTROL --------------------------------------------------------- */
|
||||
|
||||
/*DATA --------------------------------------------------------- */
|
||||
struct esp_80211_nulldata {
|
||||
struct ieee80211_hdr_3addr hdr;
|
||||
} __packed;
|
||||
|
||||
/*IE --------------------------------------------------------- */
|
||||
struct esp_80211_wmm_ac_param {
|
||||
u8 aci_aifsn; /* AIFSN, ACM, ACI */
|
||||
u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
|
||||
u16 txop_limit;
|
||||
};
|
||||
__le16 txop_limit;
|
||||
} __packed;
|
||||
|
||||
struct esp_80211_wmm_param_element {
|
||||
/* Element ID: 221 (0xdd); length: 24 */
|
||||
|
|
@ -22,7 +48,7 @@ struct esp_80211_wmm_param_element {
|
|||
u8 qos_info; /* AP/STA specif QoS info */
|
||||
u8 reserved; /* 0 */
|
||||
struct esp_80211_wmm_ac_param ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
|
||||
};
|
||||
} __packed;
|
||||
|
||||
|
||||
#endif /* _ESP_MAC80211_H_ */
|
||||
|
|
|
|||
|
|
@ -74,12 +74,6 @@ int esp_pub_init_all(struct esp_pub *epub)
|
|||
printk(KERN_ERR "%s sip alloc failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
esp_dump_var("esp_msg_level", NULL, &esp_msg_level, ESP_U32);
|
||||
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
esp_dump_var("log_off", NULL, &log_off, ESP_U32);
|
||||
#endif /* ESP_ANDROID_LOGGER */
|
||||
} else {
|
||||
atomic_set(&epub->sip->state, SIP_PREPARE_BOOT);
|
||||
atomic_set(&epub->sip->tx_credits, 0);
|
||||
|
|
@ -173,6 +167,7 @@ struct esp_fw_blk_hdr {
|
|||
static int esp_download_fw(struct esp_pub * epub)
|
||||
{
|
||||
#ifndef HAS_FW
|
||||
char * esp_fw_name = NULL;
|
||||
const struct firmware *fw_entry;
|
||||
#endif /* !HAS_FW */
|
||||
u8 * fw_buf = NULL;
|
||||
|
|
@ -186,9 +181,9 @@ static int esp_download_fw(struct esp_pub * epub)
|
|||
#ifndef HAS_FW
|
||||
|
||||
if(sif_get_ate_config() == 1) {
|
||||
char * esp_fw_name = ESP_FW_NAME3;
|
||||
esp_fw_name = ESP_FW_NAME3;
|
||||
} else {
|
||||
char * esp_fw_name = epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT ? ESP_FW_NAME1 : ESP_FW_NAME2;
|
||||
esp_fw_name = epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT ? ESP_FW_NAME1 : ESP_FW_NAME2;
|
||||
}
|
||||
ret = esp_request_firmware(&fw_entry, esp_fw_name, epub->dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,17 @@ struct esp_tx_tid {
|
|||
u16 ssn;
|
||||
};
|
||||
|
||||
enum sta_state {
|
||||
ESP_STA_STATE_NORM,
|
||||
ESP_STA_STATE_WAIT,
|
||||
ESP_STA_STATE_LOST,
|
||||
};
|
||||
|
||||
|
||||
#define ESP_LOSS_COUNT_MAX 5
|
||||
#define ESP_ND_TIME_REMAIN_MAX 11 /* 12*500ms 6000ms (12-1)*/
|
||||
#define ESP_ND_TIME_REMAIN_MIN 0 /* immediate */
|
||||
#define ESP_ND_TIMER_INTERVAL 500 /* 500ms */
|
||||
#define WME_NUM_TID 16
|
||||
struct esp_node {
|
||||
struct esp_tx_tid tid[WME_NUM_TID];
|
||||
|
|
@ -57,6 +68,9 @@ struct esp_node {
|
|||
#endif
|
||||
u8 ifidx;
|
||||
u8 index;
|
||||
atomic_t loss_count;
|
||||
atomic_t time_remain;
|
||||
atomic_t sta_state;
|
||||
};
|
||||
|
||||
#define WME_AC_BE 2
|
||||
|
|
@ -78,6 +92,7 @@ struct esp_vif {
|
|||
u32 beacon_interval;
|
||||
bool ap_up;
|
||||
struct timer_list beacon_timer;
|
||||
struct timer_list nulldata_timer; /* gc use this, too */
|
||||
};
|
||||
|
||||
/* WLAN related, mostly... */
|
||||
|
|
@ -176,6 +191,8 @@ struct esp_pub {
|
|||
|
||||
//u8 bssid[ETH_ALEN];
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
u8 master_addr[ETH_ALEN];
|
||||
u8 master_ifidx;
|
||||
|
||||
u32 rx_filter;
|
||||
unsigned long scan_permit;
|
||||
|
|
@ -223,6 +240,8 @@ struct esp_node * esp_get_node_by_index(struct esp_pub * epub, u8 index);
|
|||
int esp_get_empty_rxampdu(struct esp_pub * epub, const u8 *addr, u8 tid);
|
||||
int esp_get_exist_rxampdu(struct esp_pub * epub, const u8 *addr, u8 tid);
|
||||
|
||||
void esp_sendup_deauth(struct esp_pub *epub, u8 *sta_addr);
|
||||
|
||||
#ifdef TEST_MODE
|
||||
int test_init_netlink(struct esp_sip *sip);
|
||||
void test_exit_netlink(void);
|
||||
|
|
|
|||
|
|
@ -197,6 +197,9 @@ int sif_lldesc_write_sync(struct esp_pub *epub, u8 *buf, u32 len);
|
|||
int sif_lldesc_read_raw(struct esp_pub *epub, u8 *buf, u32 len, bool noround);
|
||||
int sif_lldesc_write_raw(struct esp_pub *epub, u8 *buf, u32 len);
|
||||
void sif_platform_check_r1_ready(struct esp_pub *epub);
|
||||
|
||||
int esp_sdio_init(void);
|
||||
void esp_sdio_exit(void);
|
||||
#endif
|
||||
|
||||
#ifdef ESP_USE_SPI
|
||||
|
|
@ -232,8 +235,14 @@ void sif_platform_irq_deinit(void);
|
|||
int sif_spi_write_bytes(struct spi_device *spi, unsigned int addr,unsigned char *dst, int count, int check_idle);
|
||||
int sif_spi_read_bytes(struct spi_device *spi, unsigned int addr,unsigned char *dst, int count, int check_idle);
|
||||
struct esp_spi_resp *sif_get_spi_resp(void);
|
||||
|
||||
int esp_spi_init(void);
|
||||
void esp_spi_exit(void);
|
||||
#endif
|
||||
|
||||
int esp_common_init(void);
|
||||
void esp_common_exit(void);
|
||||
|
||||
int esp_common_read(struct esp_pub *epub, u8 *buf, u32 len, int sync, bool noround);
|
||||
int esp_common_write(struct esp_pub *epub, u8 *buf, u32 len, int sync);
|
||||
int esp_common_read_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, u32 len, int sync);
|
||||
|
|
@ -245,7 +254,7 @@ int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, int s
|
|||
int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, unsigned char *value);
|
||||
int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr, unsigned char *value);
|
||||
int sif_ack_target_read_err(struct esp_pub *epub);
|
||||
int sif_had_io_enable(struct esp_pub *epub);
|
||||
int sif_hda_io_enable(struct esp_pub *epub);
|
||||
|
||||
struct slc_host_regs * sif_get_regs(struct esp_pub *epub);
|
||||
|
||||
|
|
@ -280,6 +289,15 @@ int sif_get_retry_config(void);
|
|||
void sif_record_wakeup_gpio_config(int value);
|
||||
int sif_get_wakeup_gpio_config(void);
|
||||
|
||||
#ifdef ESP_CLASS
|
||||
void sif_record_fccmode(int value);
|
||||
int sif_get_fccmode(void);
|
||||
#endif
|
||||
#if (defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)) || defined(ESP_CLASS)
|
||||
void sif_record_esp_run(int value);
|
||||
int sif_get_esp_run(void);
|
||||
#endif
|
||||
|
||||
#ifdef ESP_ACK_INTERRUPT
|
||||
//extern void sif_platform_ack_interrupt(struct mmc_host *mmc);
|
||||
extern void sif_platform_ack_interrupt(struct esp_pub *epub);
|
||||
|
|
|
|||
|
|
@ -38,9 +38,21 @@
|
|||
|
||||
extern struct completion *gl_bootup_cplx;
|
||||
|
||||
static int old_signal = -35;
|
||||
static int avg_signal = 0;
|
||||
static int signal_loop = 0;
|
||||
static int signal_count = 0;
|
||||
void reset_signal_count(void)
|
||||
{
|
||||
signal_count = 0;
|
||||
}
|
||||
|
||||
#define SIGNAL_TOTAL_W_SHIFT 8
|
||||
#define SIGNAL_TOTAL_W (1<<SIGNAL_TOTAL_W_SHIFT)
|
||||
#define SIGNAL_COUNT_LIMIT 100
|
||||
#define SIGNAL_UP_NEW_W_SHIFT 3 /* 8 */
|
||||
#define SIGNAL_UP_NEW_W (1<<SIGNAL_UP_NEW_W_SHIFT) /* 8 */
|
||||
#define SIGNAL_DOWN_NEW_W_SHIFT 0 /* 1 */
|
||||
#define SIGNAL_DOWN_NEW_W (1<<SIGNAL_DOWN_NEW_W_SHIFT) /* 1 */
|
||||
#define SIGNAL_OPT 3
|
||||
|
||||
struct esp_mac_prefix esp_mac_prefix_table[] = {
|
||||
{0,{0x18,0xfe,0x34}},
|
||||
|
|
@ -48,7 +60,6 @@ struct esp_mac_prefix esp_mac_prefix_table[] = {
|
|||
{255,{0x18,0xfe,0x34}},
|
||||
};
|
||||
|
||||
#define SIGNAL_COUNT 300
|
||||
|
||||
#define TID_TO_AC(_tid) ((_tid)== 0||((_tid)==3)?WME_AC_BE:((_tid)<3)?WME_AC_BK:((_tid)<6)?WME_AC_VI:WME_AC_VO)
|
||||
|
||||
|
|
@ -94,7 +105,7 @@ static struct sip_trace str;
|
|||
#define SIP_MIN_DATA_PKT_LEN (sizeof(struct esp_mac_rx_ctrl) + 24) //24 is min 80211hdr
|
||||
|
||||
#ifdef ESP_PREALLOC
|
||||
extern struct sk_buff *esp_get_sip_skb(int size);
|
||||
extern struct sk_buff *esp_get_sip_skb(int size, gfp_t type);
|
||||
extern void esp_put_sip_skb(struct sk_buff **skb);
|
||||
|
||||
extern u8 *esp_get_tx_aggr_buf(void);
|
||||
|
|
@ -675,7 +686,7 @@ int sip_rx(struct esp_pub *epub)
|
|||
*/
|
||||
rx_blksz = sif_get_blksz(epub);
|
||||
#ifdef ESP_PREALLOC
|
||||
first_skb = esp_get_sip_skb(roundup(first_sz, rx_blksz));
|
||||
first_skb = esp_get_sip_skb(roundup(first_sz, rx_blksz), GFP_KERNEL);
|
||||
#else
|
||||
first_skb = __dev_alloc_skb(roundup(first_sz, rx_blksz), GFP_KERNEL);
|
||||
#endif /* ESP_PREALLOC */
|
||||
|
|
@ -820,17 +831,18 @@ int sip_post_init(struct esp_sip *sip, struct sip_evt_bootup2 *bevt)
|
|||
|
||||
/* print out MAC addr... */
|
||||
memcpy(epub->mac_addr, bevt->mac_addr, ETH_ALEN);
|
||||
for(i = 0;i < sizeof(esp_mac_prefix_table)/sizeof(struct esp_mac_prefix);i++) {
|
||||
if(esp_mac_prefix_table[i].mac_index == mac_id) {
|
||||
mac_index = i;
|
||||
break;
|
||||
|
||||
if (bevt->mac_type == 0) { /* 24bit */
|
||||
for(i = 0;i < sizeof(esp_mac_prefix_table)/sizeof(struct esp_mac_prefix);i++) {
|
||||
if(esp_mac_prefix_table[i].mac_index == mac_id) {
|
||||
mac_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
epub->mac_addr[0] = esp_mac_prefix_table[mac_index].mac_addr_prefix[0];
|
||||
epub->mac_addr[1] = esp_mac_prefix_table[mac_index].mac_addr_prefix[1];
|
||||
epub->mac_addr[2] = esp_mac_prefix_table[mac_index].mac_addr_prefix[2];
|
||||
}
|
||||
|
||||
epub->mac_addr[0] = esp_mac_prefix_table[mac_index].mac_addr_prefix[0];
|
||||
epub->mac_addr[1] = esp_mac_prefix_table[mac_index].mac_addr_prefix[1];
|
||||
epub->mac_addr[2] = esp_mac_prefix_table[mac_index].mac_addr_prefix[2];
|
||||
|
||||
#ifdef SELF_MAC
|
||||
epub->mac_addr[0] = 0xff;
|
||||
epub->mac_addr[1] = 0xff;
|
||||
|
|
@ -926,7 +938,7 @@ static int sip_pack_pkt(struct esp_sip *sip, struct sk_buff *skb, int *pm_state)
|
|||
|
||||
/* make room for encrypted pkt */
|
||||
if (itx_info->control.hw_key) {
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
|
||||
shdr->d_enc_flag= itx_info->control.hw_key->alg+1;
|
||||
#else
|
||||
int alg = esp_cipher2alg(itx_info->control.hw_key->cipher);
|
||||
|
|
@ -1201,7 +1213,7 @@ static void sip_tx_status_report(struct esp_sip *sip, struct sk_buff *skb, struc
|
|||
|
||||
} else {
|
||||
tx_info->flags |= IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_ACK;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37))
|
||||
tx_info->status.ampdu_ack_map = 1;
|
||||
#else
|
||||
tx_info->status.ampdu_len = 1;
|
||||
|
|
@ -1562,6 +1574,29 @@ static int esp_add_wmm(struct sk_buff *skb)
|
|||
}
|
||||
#endif /* NO_WMM_DUMMY */
|
||||
|
||||
static int update_sta_time_remain(struct esp_pub *epub, struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_hdr * wh;
|
||||
struct esp_node *enode;
|
||||
|
||||
if (!epub || !skb)
|
||||
return -EINVAL;
|
||||
|
||||
if (epub->master_ifidx == ESP_PUB_MAX_VIF) /* no vif in ap mode */
|
||||
return 0;
|
||||
|
||||
wh = (struct ieee80211_hdr *)skb->data;
|
||||
enode = esp_get_node_by_addr(epub, wh->addr2); /* src addr */
|
||||
|
||||
if (enode && enode->ifidx == epub->master_ifidx) {
|
||||
atomic_set(&enode->time_remain, ESP_ND_TIME_REMAIN_MAX);
|
||||
atomic_set(&enode->sta_state, ESP_STA_STATE_NORM);
|
||||
atomic_set(&enode->loss_count, 0);
|
||||
esp_dbg(ESP_DBG_TRACE, "update %d", enode->index);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* parse mac_rx_ctrl and return length */
|
||||
static int sip_parse_mac_rx_info(struct esp_sip *sip, struct esp_mac_rx_ctrl * mac_ctrl, struct sk_buff *skb)
|
||||
{
|
||||
|
|
@ -1583,17 +1618,17 @@ static int sip_parse_mac_rx_info(struct esp_sip *sip, struct esp_mac_rx_ctrl * m
|
|||
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
if (mac_ctrl->damatch0 == 1 && mac_ctrl->bssidmatch0 == 1 /*match bssid and da, but beacon package contain other bssid*/
|
||||
&& strncmp(hdr->addr2, sip->epub->wl.bssid, ETH_ALEN) == 0) { /* force match addr2 */
|
||||
if (++signal_loop >= SIGNAL_COUNT) {
|
||||
avg_signal += rx_status->signal;
|
||||
avg_signal /= SIGNAL_COUNT;
|
||||
old_signal = rx_status->signal = (avg_signal + 5);
|
||||
signal_loop = 0;
|
||||
avg_signal = 0;
|
||||
&& memcmp(hdr->addr2, sip->epub->wl.bssid, ETH_ALEN) == 0) { /* force match addr2 */
|
||||
if (signal_count >= SIGNAL_COUNT_LIMIT) {
|
||||
if (rx_status->signal < avg_signal)
|
||||
avg_signal = (((avg_signal<<SIGNAL_TOTAL_W_SHIFT)-(avg_signal<<SIGNAL_DOWN_NEW_W_SHIFT)) + (rx_status->signal<<SIGNAL_DOWN_NEW_W_SHIFT))>>SIGNAL_TOTAL_W_SHIFT;
|
||||
else
|
||||
avg_signal = (((avg_signal<<SIGNAL_TOTAL_W_SHIFT)-(avg_signal<<SIGNAL_UP_NEW_W_SHIFT)) + (rx_status->signal<<SIGNAL_UP_NEW_W_SHIFT))>>SIGNAL_TOTAL_W_SHIFT;
|
||||
} else {
|
||||
avg_signal += rx_status->signal;
|
||||
rx_status->signal = old_signal;
|
||||
signal_count++;
|
||||
avg_signal = (avg_signal*(signal_count-1) + rx_status->signal)/signal_count;
|
||||
}
|
||||
rx_status->signal = avg_signal + SIGNAL_OPT;
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35))
|
||||
|
|
@ -1641,6 +1676,8 @@ static int sip_parse_mac_rx_info(struct esp_sip *sip, struct esp_mac_rx_ctrl * m
|
|||
do {
|
||||
struct ieee80211_hdr * wh = (struct ieee80211_hdr *)((u8 *)skb->data);
|
||||
|
||||
update_sta_time_remain(sip->epub, skb);
|
||||
|
||||
#ifndef NO_WMM_DUMMY
|
||||
if (ieee80211_is_mgmt(wh->frame_control))
|
||||
esp_add_wmm(skb);
|
||||
|
|
@ -2177,9 +2214,16 @@ sip_poll_bootup_event(struct esp_sip *sip)
|
|||
esp_dbg(ESP_DBG_ERROR, "bootup event timeout\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
if(sif_get_ate_config() == 0
|
||||
#if defined(CONFIG_DEBUG_FS) && defined(DEBUGFS_BOOTMODE)
|
||||
&& dbgfs_get_bootmode_var(DBGFS_FCC_MODE) == 0
|
||||
|
||||
if(sif_get_ate_config() == 0){
|
||||
ret = esp_register_mac80211(sip->epub);
|
||||
#endif
|
||||
#ifdef ESP_CLASS
|
||||
&& sif_get_fccmode() == 0
|
||||
#endif
|
||||
) {
|
||||
ret = esp_register_mac80211(sip->epub);
|
||||
}
|
||||
|
||||
#ifdef TEST_MODE
|
||||
|
|
@ -2322,6 +2366,15 @@ void sip_tx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb)
|
|||
}
|
||||
|
||||
}
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
|
||||
if(sif_get_ate_config() == 0){
|
||||
ieee80211_queue_work(epub->hw, &epub->tx_work);
|
||||
} else {
|
||||
queue_work(epub->esp_wkq, &epub->tx_work);
|
||||
}
|
||||
#else
|
||||
queue_work(epub->esp_wkq, &epub->tx_work);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FPGA_TXDATA
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ bool esp_wmac_rxsec_error(u8 error)
|
|||
return (error >= RX_SECOV_ERR && error <= RX_SECFIFO_TIMEOUT) || (error >= RX_WEPICV_ERR && error <= RX_WAPIMIC_ERR);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
|
||||
int esp_cipher2alg(int cipher)
|
||||
{
|
||||
if (cipher == WLAN_CIPHER_SUITE_TKIP)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
u32 esp_ieee2mhz(u8 chan);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
|
||||
enum ieee80211_key_alg {
|
||||
ALG_WEP,
|
||||
ALG_TKIP,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
#define DRIVER_VER 0xbdf5087c3debll
|
||||
#define DRIVER_VER 0xafdccfab1d6all
|
||||
|
|
|
|||
1
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/init_data.conf
Executable file
1
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/init_data.conf
Executable file
|
|
@ -0,0 +1 @@
|
|||
crystal_26M_en=0;test_xtal=0;sdio_configure=2;bt_configure=0;bt_protocol=0;dual_ant_configure=0;test_uart_configure=2;share_xtal=0;gpio_wake=0;no_auto_sleep=0;ext_rst=0;wakeup_gpio=12;ate_test=0;speed_suspend=1;$
|
||||
|
|
@ -32,9 +32,6 @@
|
|||
#include "esp_ext.h"
|
||||
#endif /* USE_EXT_GPIO */
|
||||
|
||||
static int /*__init */ esp_sdio_init(void);
|
||||
static void /* __exit */ esp_sdio_exit(void);
|
||||
|
||||
|
||||
#define ESP_DMA_IBUFSZ 2048
|
||||
|
||||
|
|
@ -784,25 +781,15 @@ static struct sdio_driver esp_sdio_dummy_driver = {
|
|||
.remove = esp_sdio_dummy_remove,
|
||||
};
|
||||
|
||||
static int /*__init */ esp_sdio_init(void)
|
||||
int esp_sdio_init(void)
|
||||
{
|
||||
#define ESP_WAIT_UP_TIME_MS 11000
|
||||
int err;
|
||||
u64 ver;
|
||||
int retry = 3;
|
||||
bool powerup = false;
|
||||
int edf_ret = 0;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s \n", __func__);
|
||||
|
||||
#ifdef DRIVER_VER
|
||||
ver = DRIVER_VER;
|
||||
esp_dbg(ESP_SHOW, "\n*****%s %s EAGLE DRIVER VER:%llx*****\n\n", __DATE__, __TIME__, ver);
|
||||
#endif
|
||||
edf_ret = esp_debugfs_init();
|
||||
|
||||
request_init_conf();
|
||||
|
||||
esp_wakelock_init();
|
||||
esp_wake_lock();
|
||||
|
||||
|
|
@ -886,11 +873,9 @@ static int /*__init */ esp_sdio_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
static void /*__exit*/ esp_sdio_exit(void)
|
||||
void esp_sdio_exit(void)
|
||||
{
|
||||
esp_dbg(ESP_SHOW, "%s \n", __func__);
|
||||
|
||||
esp_debugfs_exit();
|
||||
|
||||
esp_unregister_early_suspend();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,19 +18,6 @@ extern int rockchip_wifi_set_carddetect(int val);
|
|||
extern int rk29sdk_wifi_power(int on);
|
||||
extern int rk29sdk_wifi_set_carddetect(int val);
|
||||
|
||||
|
||||
int rockchip_wifi_init_module_esp8089(void)
|
||||
{
|
||||
|
||||
return esp_sdio_init();
|
||||
}
|
||||
|
||||
void rockchip_wifi_exit_module_esp8089(void)
|
||||
{
|
||||
esp_sdio_exit();
|
||||
|
||||
}
|
||||
|
||||
void sif_platform_rescan_card(unsigned insert)
|
||||
{
|
||||
//rk29sdk_wifi_set_carddetect(insert); libing
|
||||
|
|
@ -66,7 +53,7 @@ void sif_platform_target_poweroff(void)
|
|||
printk("=======================================================\n");
|
||||
printk("==== Dislaunching Wi-Fi driver! (Powered by Rockchip) ====\n");
|
||||
printk("=======================================================\n");
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip,Ver %s) init.\n", ESP8089_DRV_VERSION);
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip, Ver1.9.1(01/30/2015),Drv: %s) exit.\n", ESP8089_DRV_VERSION);
|
||||
|
||||
//rk29sdk_wifi_set_carddetect(0);
|
||||
if(sif_get_bt_config() != 1)
|
||||
|
|
@ -79,7 +66,7 @@ void sif_platform_target_poweron(void)
|
|||
printk("=======================================================\n");
|
||||
printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n");
|
||||
printk("=======================================================\n");
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip,Ver1.9(11272014),Drv: %s) init.\n", ESP8089_DRV_VERSION);
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip, Ver1.9.1(01/30/2015),Drv: %s) init.\n", ESP8089_DRV_VERSION);
|
||||
|
||||
if(sif_get_bt_config() == 1){
|
||||
sif_platform_reset_target();
|
||||
|
|
@ -116,7 +103,4 @@ void sif_platform_ack_interrupt(struct esp_pub *epub)
|
|||
|
||||
}
|
||||
#endif //ESP_ACK_INTERRUPT
|
||||
EXPORT_SYMBOL(rockchip_wifi_init_module_esp8089);
|
||||
EXPORT_SYMBOL(rockchip_wifi_exit_module_esp8089);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ enum {
|
|||
SIP_EVT_SLEEP,
|
||||
SIP_EVT_TXIDLE,
|
||||
SIP_EVT_NOISEFLOOR,
|
||||
SIP_EVT_NULLFUNC_REPORT,
|
||||
SIP_EVT_MAX
|
||||
};
|
||||
|
||||
|
|
@ -341,7 +342,8 @@ struct sip_evt_bootup2 {
|
|||
u8 credit_to_reserve;
|
||||
u8 options;
|
||||
s16 noise_floor;
|
||||
u8 resv[2];
|
||||
u8 mac_type;
|
||||
u8 resv[1];
|
||||
/* anything else ? */
|
||||
} __packed;
|
||||
|
||||
|
|
@ -424,6 +426,14 @@ struct sip_evt_noisefloor {
|
|||
s16 noise_floor;
|
||||
u16 pad;
|
||||
} __packed;
|
||||
|
||||
struct sip_evt_nullfunc_report {
|
||||
u8 ifidx;
|
||||
u8 index;
|
||||
u8 status;
|
||||
u8 pad;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* for mblk direct memory access, no need for sip_hdr. tx: first 2k for contrl msg,
|
||||
* rest of 14k for data. rx, same.
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
#include "esp_ext.h"
|
||||
#endif /* USE_EXT_GPIO */
|
||||
|
||||
static int /*__init */ esp_spi_init(void);
|
||||
static void /* __exit */ esp_spi_exit(void);
|
||||
|
||||
#ifdef ESP_PREALLOC
|
||||
extern u8 *esp_get_lspi_buf(void);
|
||||
|
|
@ -2252,14 +2250,12 @@ struct spi_driver esp_spi_dummy_driver = {
|
|||
.remove = esp_spi_dummy_remove,
|
||||
};
|
||||
|
||||
static int __init esp_spi_init(void)
|
||||
int esp_spi_init(void)
|
||||
{
|
||||
#define ESP_WAIT_UP_TIME_MS 11000
|
||||
int err;
|
||||
u64 ver;
|
||||
int retry = 3;
|
||||
bool powerup = false;
|
||||
int edf_ret = 0;
|
||||
|
||||
esp_dbg(ESP_DBG_TRACE, "%s \n", __func__);
|
||||
|
||||
|
|
@ -2267,14 +2263,6 @@ static int __init esp_spi_init(void)
|
|||
sif_platform_register_board_info();
|
||||
#endif
|
||||
|
||||
#ifdef DRIVER_VER
|
||||
ver = DRIVER_VER;
|
||||
esp_dbg(ESP_SHOW, "\n*****%s %s EAGLE DRIVER VER:%llx*****\n\n", __DATE__, __TIME__, ver);
|
||||
#endif
|
||||
edf_ret = esp_debugfs_init();
|
||||
|
||||
request_init_conf();
|
||||
|
||||
esp_wakelock_init();
|
||||
esp_wake_lock();
|
||||
|
||||
|
|
@ -2352,12 +2340,10 @@ static int __init esp_spi_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
static void __exit esp_spi_exit(void)
|
||||
void esp_spi_exit(void)
|
||||
{
|
||||
esp_dbg(ESP_SHOW, "%s \n", __func__);
|
||||
|
||||
esp_debugfs_exit();
|
||||
|
||||
esp_unregister_early_suspend();
|
||||
|
||||
spi_unregister_driver(&esp_spi_driver);
|
||||
|
|
|
|||
|
|
@ -1124,8 +1124,9 @@ void esp_stability_test(char *filename,struct esp_pub *epub)
|
|||
|
||||
}
|
||||
|
||||
#if (!defined(CONFIG_DEBUG_FS) || !defined(DEBUGFS_BOOTMODE)) && !defined(ESP_CLASS)
|
||||
request_init_conf();
|
||||
|
||||
#endif
|
||||
if(sif_get_ate_config() == 0)
|
||||
{
|
||||
|
||||
|
|
@ -1408,7 +1409,7 @@ void esp_test_init(struct esp_pub *epub)
|
|||
sprintf(filename, "%s/%s", mod_eagle_path_get(), "test_results");
|
||||
|
||||
sif_lock_bus(epub);
|
||||
sif_had_io_enable(epub);
|
||||
sif_hda_io_enable(epub);
|
||||
sif_unlock_bus(epub);
|
||||
|
||||
if(sif_get_ate_config() == 2){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
# copyright (c) 2011 - 2012 espressif system
|
||||
|
||||
# linux_sdio
|
||||
#ifneq ($(KERNELRELEASE),)
|
||||
# kbuild part of makefile
|
||||
ARCH := arm
|
||||
CROSS_COMPILE := $(TOOLCHAIN_PREFIX)
|
||||
KSRC := $(KERNEL_DIR)
|
||||
MODPATH := $(shell pwd)
|
||||
DRIVER_NAME := esp_prealloc
|
||||
|
||||
####################### NORMAL OPTION ########################################
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void esp_pre_sip_skb_show(void)
|
|||
EXPORT_SYMBOL(esp_pre_sip_skb_show);
|
||||
#endif
|
||||
|
||||
struct sk_buff *esp_get_sip_skb(int size)
|
||||
struct sk_buff *esp_get_sip_skb(int size, gfp_t type)
|
||||
{
|
||||
int i;
|
||||
int retry = 100;
|
||||
|
|
@ -120,7 +120,11 @@ struct sk_buff *esp_get_sip_skb(int size)
|
|||
break;
|
||||
}
|
||||
|
||||
mdelay(1); /* maybe in multi core cpu */
|
||||
if (type == GFP_KERNEL)
|
||||
msleep(1);
|
||||
else
|
||||
mdelay(1);
|
||||
|
||||
} while (--retry > 0);
|
||||
|
||||
if (retry <= 0)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void esp_pre_free_sip_skb_arr(void);
|
|||
u8 *esp_pre_alloc_tx_aggr_buf(void);
|
||||
void esp_pre_free_tx_aggr_buf(void);
|
||||
|
||||
struct sk_buff *esp_get_sip_skb(int size);
|
||||
struct sk_buff *esp_get_sip_skb(int size, gfp_t type);
|
||||
void esp_put_sip_skb(struct sk_buff **skb);
|
||||
u8* esp_get_tx_aggr_buf(void);
|
||||
void esp_put_tx_aggr_buf(u8 **p);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef __VERSION_H__
|
||||
#define __VERSION_H__
|
||||
|
||||
#define PREALLOC_VERSION "V2.3"
|
||||
#define PREALLOC_VERSION "V2.4"
|
||||
|
||||
#endif /* __VERSION_H__ */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user