Skip to content

Commit

Permalink
wl18xx: add debugfs support to tx_ba_win_size & hw_tx_extra_mem_blk
Browse files Browse the repository at this point in the history
tx_ba_win_size default val is 10
hw_tx_extra_mem_blk default val is 1

signed-off-by: Lior Cohen <liorc@ti.com>
  • Loading branch information
liorc authored and elp committed Dec 14, 2011
1 parent f4e3e67 commit e1d5311
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 20 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/wl12xx/acx.c
Expand Up @@ -1064,7 +1064,7 @@ int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap)

bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap);
bitmap_conf->host_sdio_block_size = cpu_to_le32(WL12XX_BUS_BLOCK_SIZE);
bitmap_conf->extra_mem_blocks = cpu_to_le32(TX_HW_EXTRA_MEM_BLKS_DEF);
bitmap_conf->extra_mem_blocks = cpu_to_le32(wl->conf.hw_tx_extra_mem_blk);
bitmap_conf->length_field_size = cpu_to_le32(HOST_IF_CFG_LEN_FIELD_SIZE);

ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP,
Expand Down
23 changes: 11 additions & 12 deletions drivers/net/wireless/wl12xx/boot.c
Expand Up @@ -473,7 +473,6 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
int loop, ret;
u32 chip_id, intr;

/* Orit - added */
wl1271_set_partition(wl, &part_table[PART_BOOT]);

wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT);
Expand Down Expand Up @@ -512,7 +511,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
return -EIO;
}

wl1271_info("Orit WL18xx - Init Complete!!!");
wl1271_info("WL18xx - Init Complete!!!");

/* get hardware config command mail box */
wl->cmd_box_addr = wl1271_read32(wl, REG_COMMAND_MAILBOX_PTR);
Expand Down Expand Up @@ -761,10 +760,10 @@ static int wl18xx_boot_clk(struct wl1271 *wl, int *selected_clock)
}

/* 2. CLK detection */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - CLK detection");
wl1271_debug(DEBUG_BOOT, "Wl18xx - CLK detection");
/* Read CLK type from detection (for PG2) - TCXO/FREF or XTAL */
osc_en = wl1271_top_reg_read(wl, OSC_EN);
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - osc_en = 0x%x", osc_en);
wl1271_debug(DEBUG_BOOT, "Wl18xx - osc_en = 0x%x", osc_en);

/* Check the clock source in bit 3 from OSC_EN */
if (!(osc_en & PRCM_WLAN_CLK_DETECTION_MASK)) {
Expand All @@ -783,10 +782,10 @@ static int wl18xx_boot_clk(struct wl1271 *wl, int *selected_clock)

/* Read freq from detection */
clk_freq = wl1271_top_reg_read(wl, PRIMARY_CLK_DETECT);
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - Read from addr 0x%x clock freq %d", PRIMARY_CLK_DETECT, clk_freq);
wl1271_debug(DEBUG_BOOT, "Wl18xx - Read from addr 0x%x clock freq %d", PRIMARY_CLK_DETECT, clk_freq);

/* 3. WCS PLL Config */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - WCS PLL Config");
wl1271_debug(DEBUG_BOOT, "Wl18xx - WCS PLL Config");

switch (clk_freq) {
case CLOCK_CONFIG_16_2_M:
Expand Down Expand Up @@ -836,11 +835,11 @@ static int wl18xx_boot_clk(struct wl1271 *wl, int *selected_clock)
}

/* Config N (pre divider) parameters according to the input frequency */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - write to addr 0x%x Config N %d", PLLSH_WCS_PLL_N, pllsh_wcs_pll_N);
wl1271_debug(DEBUG_BOOT, "Wl18xx - write to addr 0x%x Config N %d", PLLSH_WCS_PLL_N, pllsh_wcs_pll_N);
wl1271_top_reg_write(wl, PLLSH_WCS_PLL_N, pllsh_wcs_pll_N);

/* Config M (divider) parameters according to the input frequency */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - write to addr 0x%x Config M %d", PLLSH_WCS_PLL_M, pllsh_wcs_pll_M);
wl1271_debug(DEBUG_BOOT, "Wl18xx - write to addr 0x%x Config M %d", PLLSH_WCS_PLL_M, pllsh_wcs_pll_M);
wl1271_top_reg_write(wl, PLLSH_WCS_PLL_M, pllsh_wcs_pll_M);

/* Swallowing is only needed for the following CLK frequencies:
Expand All @@ -859,17 +858,17 @@ static int wl18xx_boot_clk(struct wl1271 *wl, int *selected_clock)
((pllsh_wcs_pll_P >> REG_16_SHIFT) & PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK));

/* Activate swallowing mechanism if needed */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - Activate swallowing mechanism %d", PLLSH_WCS_PLL_SWALLOW_EN_VAL1);
wl1271_debug(DEBUG_BOOT, "Wl18xx - Activate swallowing mechanism %d", PLLSH_WCS_PLL_SWALLOW_EN_VAL1);
wl1271_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, PLLSH_WCS_PLL_SWALLOW_EN_VAL1);
}
else {
/* Activate swallowing mechanism if needed */
wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - Activate swallowing mechanism %d in addr 0x%x",
wl1271_debug(DEBUG_BOOT, "Wl18xx - Activate swallowing mechanism %d in addr 0x%x",
PLLSH_WCS_PLL_SWALLOW_EN_VAL2, PLLSH_WCS_PLL_SWALLOW_EN);
wl1271_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, PLLSH_WCS_PLL_SWALLOW_EN_VAL2);
}

wl1271_debug(DEBUG_BOOT, "Orit Wl18xx - HW TOP init is done!!!");
wl1271_debug(DEBUG_BOOT, "Wl18xx - HW TOP init is done!!!");
}

return 0;
Expand Down Expand Up @@ -1004,7 +1003,7 @@ int wl1271_load_firmware(struct wl1271 *wl)
}

/* Continue the ELP wake up sequence */
wl1271_info("Orit Wl18xx - write to WELP_ARM_COMMAND 0x%x val 0x%x",
wl1271_info("Wl18xx - write to WELP_ARM_COMMAND 0x%x val 0x%x",
WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
udelay(500);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/wl12xx/conf.h
Expand Up @@ -1388,6 +1388,7 @@ struct conf_drv_settings {
struct conf_hangover_settings hangover;
struct conf_hw_checksum hw_checksum;
u8 sleep_auth;
u8 hw_tx_extra_mem_blk;
/* the structure is 4-bytes aligned due to sdio mem copy constraint */
struct conf_mac_and_phy_params mac_and_phy_params __aligned(4);
};
Expand Down
94 changes: 92 additions & 2 deletions drivers/net/wireless/wl12xx/debugfs.c
Expand Up @@ -33,8 +33,6 @@
#include "tx.h"



/* ****** 888 ********** */
#define DEBUGFS_SINGLE_PARAM_ADD(parent, name, base) \
static ssize_t name ##_read(struct file *file, char __user *user_buf, \
size_t count, loff_t *ppos) \
Expand Down Expand Up @@ -1181,6 +1179,95 @@ static const struct file_operations tx_frag_thld_ops = {
.llseek = default_llseek,
};

static ssize_t tx_ba_win_size_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;

return wl1271_format_buffer(user_buf, count, ppos, "%d\n",
wl->conf.ht.tx_ba_win_size);
}

static ssize_t tx_ba_win_size_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for tx_ba_win_size");
return -EINVAL;
}

mutex_lock(&wl->mutex);
wl->conf.ht.tx_ba_win_size = value;
mutex_unlock(&wl->mutex);

return count;
}

static const struct file_operations tx_ba_win_size_ops = {
.read = tx_ba_win_size_read,
.write = tx_ba_win_size_write,
.open = wl1271_open_file_generic,
.llseek = default_llseek,
};

static ssize_t hw_tx_extra_mem_blk_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;

return wl1271_format_buffer(user_buf, count, ppos, "%d\n",
wl->conf.hw_tx_extra_mem_blk);
}

static ssize_t hw_tx_extra_mem_blk_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
char buf[10];
size_t len;
unsigned long value;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for hw_tx_extra_mem_blk");
return -EINVAL;
}

mutex_lock(&wl->mutex);
wl->conf.hw_tx_extra_mem_blk = value;
mutex_unlock(&wl->mutex);

return count;
}

static const struct file_operations hw_tx_extra_mem_blk_ops = {
.read = hw_tx_extra_mem_blk_read,
.write = hw_tx_extra_mem_blk_write,
.open = wl1271_open_file_generic,
.llseek = default_llseek,
};


static ssize_t tx_compl_timeout_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -1943,6 +2030,9 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
DEBUGFS_ADD(srf2, phy_mac_params)
DEBUGFS_ADD(srf3, phy_mac_params)
DEBUGFS_ADD(hw_board_type, phy_mac_params)
DEBUGFS_ADD(hw_tx_extra_mem_blk, phy_mac_params)
DEBUGFS_ADD(tx_ba_win_size, rootdir);

#endif


Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/wl12xx/main.c
Expand Up @@ -293,7 +293,7 @@ static struct conf_drv_settings default_conf = {
},
},
.ht = {
.tx_ba_win_size = 8,
.tx_ba_win_size = 10,
.inactivity_timeout = 10000,
.tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP,
},
Expand Down Expand Up @@ -437,6 +437,7 @@ static struct conf_drv_settings default_conf = {
.hw_board_type = BOARD_TYPE_HDK_18XX
},
.sleep_auth = WL1271_PSM_CAM,
.hw_tx_extra_mem_blk = TX_HW_BLOCK_SPARE_DEFAULT
};

static char *fwlog_param;
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/wireless/wl12xx/tx.c
Expand Up @@ -201,7 +201,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,

if ((wl->chip.id == CHIP_ID_185x_PG10) ||
(wl->chip.id == CHIP_ID_185x_PG20)) {
spare_blocks = TX_HW_EXTRA_MEM_BLKS_DEF;
spare_blocks = wl->conf.hw_tx_extra_mem_blk;
}
else {
/* we use 1 spare block */
Expand All @@ -224,9 +224,13 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
else
len = wl12xx_calc_packet_alignment(wl, total_len);

/* LiorC: ToDo: verify whether the FW can handle the change in the spare blocks during traffic */
#ifndef TNETW18xx
/* in case of a dummy packet, use default amount of spare mem blocks */
if (unlikely(wl12xx_is_dummy_packet(wl, skb)))
spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
#endif


total_blocks = (len + TX_HW_BLOCK_SIZE - 1) / TX_HW_BLOCK_SIZE +
spare_blocks;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/wl12xx/tx.h
Expand Up @@ -25,9 +25,9 @@
#ifndef __TX_H__
#define __TX_H__

#define TX_HW_BLOCK_SPARE_DEFAULT 1
#define TX_HW_BLOCK_SIZE 268
#define TX_HW_EXTRA_MEM_BLKS_DEF 2
#define TX_HW_BLOCK_SPARE_DEFAULT 1


#define TX_HW_MGMT_PKT_LIFETIME_TU 2000
#define TX_HW_AP_MODE_PKT_LIFETIME_TU 8000
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/wl12xx/wl12xx.h
Expand Up @@ -40,7 +40,7 @@

#define DRIVER_NAME "wl18xx"
#define DRIVER_PREFIX DRIVER_NAME ": "
#define DRIVER_VERSION "WL18XX_A1.12"
#define DRIVER_VERSION "WL18XX_A1.13"

/*
* FW versions support BA 11n
Expand Down

0 comments on commit e1d5311

Please sign in to comment.