Skip to content

Commit

Permalink
cw1200: Eliminate the ETF debug/engineering code.
Browse files Browse the repository at this point in the history
This is only really useful for people who are bringing up new hardware
designs and have access to the proprietary vendor tools that interface
with this mode.

It'll live out of tree until it's rewritten to use a less kludgy interface.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Solomon Peachy authored and John W. Linville committed Jun 11, 2013
1 parent fa8eeae commit 19db577
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 349 deletions.
10 changes: 0 additions & 10 deletions drivers/net/wireless/cw1200/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,4 @@ config CW1200_WLAN_SPI
need to add appropriate platform data glue in your board setup
file.

menu "Driver debug features"
depends on CW1200 && DEBUG_FS

config CW1200_ETF
bool "Enable CW1200 Engineering Test Framework hooks"
help
If you don't know what this is, just say N.

endmenu

endif
9 changes: 0 additions & 9 deletions drivers/net/wireless/cw1200/cw1200.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ struct task_struct;
struct cw1200_debug_priv;
struct firmware;

#ifdef CONFIG_CW1200_ETF
extern int etf_mode;
extern char *etf_firmware;
#endif

#define CW1200_MAX_CTRL_FRAME_LEN (0x1000)

#define CW1200_MAX_STA_IN_AP_MODE (5)
Expand Down Expand Up @@ -287,10 +282,6 @@ struct cw1200_common {
struct work_struct linkid_reset_work;
u8 action_frame_sa[ETH_ALEN];
u8 action_linkid;

#ifdef CONFIG_CW1200_ETF
struct sk_buff_head etf_q;
#endif
};

struct cw1200_sta_priv {
Expand Down
236 changes: 0 additions & 236 deletions drivers/net/wireless/cw1200/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,144 +357,6 @@ static const struct file_operations fops_counters = {
.owner = THIS_MODULE,
};

#ifdef CONFIG_CW1200_ETF
static int cw1200_etf_out_show(struct seq_file *seq, void *v)
{
struct cw1200_common *priv = seq->private;
struct sk_buff *skb;
u32 len = 0;

skb = skb_dequeue(&priv->etf_q);

if (skb)
len = skb->len;

seq_write(seq, &len, sizeof(len));

if (skb) {
seq_write(seq, skb->data, len);
kfree_skb(skb);
}

return 0;
}

static int cw1200_etf_out_open(struct inode *inode, struct file *file)
{
return single_open(file, &cw1200_etf_out_show,
inode->i_private);
}

static const struct file_operations fops_etf_out = {
.open = cw1200_etf_out_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};

struct etf_req_msg;
static int etf_request(struct cw1200_common *priv,
struct etf_req_msg *msg, u32 len);

#define MAX_RX_SIZE 2600

struct etf_in_state {
struct cw1200_common *priv;
u16 total_len;
u16 written;
u8 buf[MAX_RX_SIZE];
};

static int cw1200_etf_in_open(struct inode *inode, struct file *file)
{
struct etf_in_state *etf = kmalloc(sizeof(struct etf_in_state),
GFP_KERNEL);

if (!etf)
return -ENOMEM;

etf->written = 0;
etf->total_len = 0;
etf->priv = inode->i_private;

file->private_data = etf;

return 0;
}

static int cw1200_etf_in_release(struct inode *inode, struct file *file)
{
kfree(file->private_data);
return 0;
}

static ssize_t cw1200_etf_in_write(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
struct etf_in_state *etf = file->private_data;

ssize_t written = 0;

if (!etf->total_len) {
if (count < sizeof(etf->total_len)) {
pr_err("count < sizeof(total_len)\n");
return -EINVAL;
}

if (copy_from_user(&etf->total_len, user_buf,
sizeof(etf->total_len))) {
pr_err("copy_from_user (len) failed\n");
return -EFAULT;
}

if (etf->total_len > MAX_RX_SIZE) {
pr_err("requested length > MAX_RX_SIZE\n");
return -EINVAL;
}

written += sizeof(etf->total_len);
count -= sizeof(etf->total_len);
}

if (!count)
goto done;

if (count > (etf->total_len - written)) {
pr_err("Tried to write > MAX_RX_SIZE\n");
return -EINVAL;
}

if (copy_from_user(etf->buf + etf->written, user_buf + written,
count)) {
pr_err("copy_from_user (payload %zu) failed\n", count);
return -EFAULT;
}

written += count;
etf->written += count;

if (etf->written >= etf->total_len) {
if (etf_request(etf->priv, (struct etf_req_msg *)etf->buf,
etf->total_len)) {
pr_err("etf_request failed\n");
return -EIO;
}
}

done:
return written;
}

static const struct file_operations fops_etf_in = {
.open = cw1200_etf_in_open,
.release = cw1200_etf_in_release,
.write = cw1200_etf_in_write,
.llseek = default_llseek,
.owner = THIS_MODULE,
};
#endif /* CONFIG_CW1200_ETF */

static ssize_t cw1200_wsm_dumps(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -542,19 +404,6 @@ int cw1200_debug_init(struct cw1200_common *priv)
priv, &fops_counters))
goto err;

#ifdef CONFIG_CW1200_ETF
if (etf_mode) {
skb_queue_head_init(&priv->etf_q);

if (!debugfs_create_file("etf_out", S_IRUSR, d->debugfs_phy,
priv, &fops_etf_out))
goto err;
if (!debugfs_create_file("etf_in", S_IWUSR, d->debugfs_phy,
priv, &fops_etf_in))
goto err;
}
#endif /* CONFIG_CW1200_ETF */

if (!debugfs_create_file("wsm_dumps", S_IWUSR, d->debugfs_phy,
priv, &fops_wsm_dumps))
goto err;
Expand All @@ -577,88 +426,3 @@ void cw1200_debug_release(struct cw1200_common *priv)
kfree(d);
}
}

#ifdef CONFIG_CW1200_ETF
struct cw1200_sdd {
u8 id;
u8 len;
u8 data[];
};

struct etf_req_msg {
u32 id;
u32 len;
u8 data[];
};

static int parse_sdd_file(struct cw1200_common *priv, u8 *data, u32 length)
{
struct cw1200_sdd *ie;

while (length > 0) {
ie = (struct cw1200_sdd *)data;
if (ie->id == SDD_REFERENCE_FREQUENCY_ELT_ID) {
priv->hw_refclk = cpu_to_le16(*((u16 *)ie->data));
pr_info("Using Reference clock frequency %d KHz\n",
priv->hw_refclk);
break;
}

length -= ie->len + sizeof(*ie);
data += ie->len + sizeof(*ie);
}
return 0;
}

char *etf_firmware;

#define ST90TDS_START_ADAPTER 0x09 /* Loads firmware too */
#define ST90TDS_STOP_ADAPTER 0x0A
#define ST90TDS_CONFIG_ADAPTER 0x0E /* Send configuration params */
#define ST90TDS_SBUS_READ 0x13
#define ST90TDS_SBUS_WRITE 0x14
#define ST90TDS_GET_DEVICE_OPTION 0x19
#define ST90TDS_SET_DEVICE_OPTION 0x1A
#define ST90TDS_SEND_SDD 0x1D /* SDD File used to find DPLL */

#include "fwio.h"

static int etf_request(struct cw1200_common *priv,
struct etf_req_msg *msg,
u32 len)
{
int rval = -1;
switch (msg->id) {
case ST90TDS_START_ADAPTER:
etf_firmware = "cw1200_etf.bin";
pr_info("ETF_START (len %d, '%s')\n", len, etf_firmware);
rval = cw1200_load_firmware(priv);
break;
case ST90TDS_STOP_ADAPTER:
pr_info("ETF_STOP (unhandled)\n");
break;
case ST90TDS_SEND_SDD:
pr_info("ETF_SDD\n");
rval = parse_sdd_file(priv, msg->data, msg->len);
break;
case ST90TDS_CONFIG_ADAPTER:
pr_info("ETF_CONFIG_ADAP (unhandled)\n");
break;
case ST90TDS_SBUS_READ:
pr_info("ETF_SBUS_READ (unhandled)\n");
break;
case ST90TDS_SBUS_WRITE:
pr_info("ETF_SBUS_WRITE (unhandled)\n");
break;
case ST90TDS_SET_DEVICE_OPTION:
pr_info("ETF_SET_DEV_OPT (unhandled)\n");
break;
default:
pr_info("ETF_PASSTHRU (0x%08x)\n", msg->id);
rval = wsm_raw_cmd(priv, (u8 *)msg, len);
break;
}

return rval;
}
#endif /* CONFIG_CW1200_ETF */
5 changes: 0 additions & 5 deletions drivers/net/wireless/cw1200/fwio.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
val32 &= ~ST90TDS_CONFIG_CPU_CLK_DIS_BIT;
REG_WRITE(ST90TDS_CONFIG_REG_ID, val32);

#ifdef CONFIG_CW1200_ETF
if (etf_mode)
fw_path = etf_firmware;
#endif

/* Load a firmware file */
ret = request_firmware(&firmware, fw_path, priv->pdev);
if (ret) {
Expand Down
30 changes: 1 addition & 29 deletions drivers/net/wireless/cw1200/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ int cw1200_power_mode = wsm_power_mode_quiescent;
module_param(cw1200_power_mode, int, 0644);
MODULE_PARM_DESC(cw1200_power_mode, "WSM power mode. 0 == active, 1 == doze, 2 == quiescent (default)");

#ifdef CONFIG_CW1200_ETF
int etf_mode;
module_param(etf_mode, int, 0644);
MODULE_PARM_DESC(etf_mode, "Enable EngineeringTestingFramework operation");
#endif

#define RATETAB_ENT(_rate, _rateid, _flags) \
{ \
.bitrate = (_rate), \
Expand Down Expand Up @@ -418,11 +412,6 @@ static int cw1200_register_common(struct ieee80211_hw *dev)
struct cw1200_common *priv = dev->priv;
int err;

#ifdef CONFIG_CW1200_ETF
if (etf_mode)
goto done;
#endif

#ifdef CONFIG_PM
err = cw1200_pm_init(&priv->pm_state, priv);
if (err) {
Expand All @@ -442,9 +431,6 @@ static int cw1200_register_common(struct ieee80211_hw *dev)
return err;
}

#ifdef CONFIG_CW1200_ETF
done:
#endif
cw1200_debug_init(priv);

pr_info("Registered as '%s'\n", wiphy_name(dev->wiphy));
Expand All @@ -461,13 +447,7 @@ static void cw1200_unregister_common(struct ieee80211_hw *dev)
struct cw1200_common *priv = dev->priv;
int i;

#ifdef CONFIG_CW1200_ETF
if (!etf_mode) {
#endif
ieee80211_unregister_hw(dev);
#ifdef CONFIG_CW1200_ETF
}
#endif
ieee80211_unregister_hw(dev);

del_timer_sync(&priv->mcast_timeout);
cw1200_unregister_bh(priv);
Expand Down Expand Up @@ -568,11 +548,6 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
if (err)
goto err1;

#ifdef CONFIG_CW1200_ETF
if (etf_mode)
goto skip_fw;
#endif

err = cw1200_load_firmware(priv);
if (err)
goto err2;
Expand All @@ -594,9 +569,6 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
/* Enable multi-TX confirmation */
wsm_use_multi_tx_conf(priv, true);

#ifdef CONFIG_CW1200_ETF
skip_fw:
#endif
err = cw1200_register_common(dev);
if (err)
goto err2;
Expand Down
Loading

0 comments on commit 19db577

Please sign in to comment.