Skip to content

Commit 19db577

Browse files
speachylinvjw
authored andcommitted
cw1200: Eliminate the ETF debug/engineering code.
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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent fa8eeae commit 19db577

File tree

7 files changed

+2
-349
lines changed

7 files changed

+2
-349
lines changed

drivers/net/wireless/cw1200/Kconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,4 @@ config CW1200_WLAN_SPI
2727
need to add appropriate platform data glue in your board setup
2828
file.
2929

30-
menu "Driver debug features"
31-
depends on CW1200 && DEBUG_FS
32-
33-
config CW1200_ETF
34-
bool "Enable CW1200 Engineering Test Framework hooks"
35-
help
36-
If you don't know what this is, just say N.
37-
38-
endmenu
39-
4030
endif

drivers/net/wireless/cw1200/cw1200.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ struct task_struct;
3535
struct cw1200_debug_priv;
3636
struct firmware;
3737

38-
#ifdef CONFIG_CW1200_ETF
39-
extern int etf_mode;
40-
extern char *etf_firmware;
41-
#endif
42-
4338
#define CW1200_MAX_CTRL_FRAME_LEN (0x1000)
4439

4540
#define CW1200_MAX_STA_IN_AP_MODE (5)
@@ -287,10 +282,6 @@ struct cw1200_common {
287282
struct work_struct linkid_reset_work;
288283
u8 action_frame_sa[ETH_ALEN];
289284
u8 action_linkid;
290-
291-
#ifdef CONFIG_CW1200_ETF
292-
struct sk_buff_head etf_q;
293-
#endif
294285
};
295286

296287
struct cw1200_sta_priv {

drivers/net/wireless/cw1200/debug.c

Lines changed: 0 additions & 236 deletions
Original file line numberDiff line numberDiff line change
@@ -357,144 +357,6 @@ static const struct file_operations fops_counters = {
357357
.owner = THIS_MODULE,
358358
};
359359

360-
#ifdef CONFIG_CW1200_ETF
361-
static int cw1200_etf_out_show(struct seq_file *seq, void *v)
362-
{
363-
struct cw1200_common *priv = seq->private;
364-
struct sk_buff *skb;
365-
u32 len = 0;
366-
367-
skb = skb_dequeue(&priv->etf_q);
368-
369-
if (skb)
370-
len = skb->len;
371-
372-
seq_write(seq, &len, sizeof(len));
373-
374-
if (skb) {
375-
seq_write(seq, skb->data, len);
376-
kfree_skb(skb);
377-
}
378-
379-
return 0;
380-
}
381-
382-
static int cw1200_etf_out_open(struct inode *inode, struct file *file)
383-
{
384-
return single_open(file, &cw1200_etf_out_show,
385-
inode->i_private);
386-
}
387-
388-
static const struct file_operations fops_etf_out = {
389-
.open = cw1200_etf_out_open,
390-
.read = seq_read,
391-
.llseek = seq_lseek,
392-
.release = single_release,
393-
.owner = THIS_MODULE,
394-
};
395-
396-
struct etf_req_msg;
397-
static int etf_request(struct cw1200_common *priv,
398-
struct etf_req_msg *msg, u32 len);
399-
400-
#define MAX_RX_SIZE 2600
401-
402-
struct etf_in_state {
403-
struct cw1200_common *priv;
404-
u16 total_len;
405-
u16 written;
406-
u8 buf[MAX_RX_SIZE];
407-
};
408-
409-
static int cw1200_etf_in_open(struct inode *inode, struct file *file)
410-
{
411-
struct etf_in_state *etf = kmalloc(sizeof(struct etf_in_state),
412-
GFP_KERNEL);
413-
414-
if (!etf)
415-
return -ENOMEM;
416-
417-
etf->written = 0;
418-
etf->total_len = 0;
419-
etf->priv = inode->i_private;
420-
421-
file->private_data = etf;
422-
423-
return 0;
424-
}
425-
426-
static int cw1200_etf_in_release(struct inode *inode, struct file *file)
427-
{
428-
kfree(file->private_data);
429-
return 0;
430-
}
431-
432-
static ssize_t cw1200_etf_in_write(struct file *file,
433-
const char __user *user_buf, size_t count, loff_t *ppos)
434-
{
435-
struct etf_in_state *etf = file->private_data;
436-
437-
ssize_t written = 0;
438-
439-
if (!etf->total_len) {
440-
if (count < sizeof(etf->total_len)) {
441-
pr_err("count < sizeof(total_len)\n");
442-
return -EINVAL;
443-
}
444-
445-
if (copy_from_user(&etf->total_len, user_buf,
446-
sizeof(etf->total_len))) {
447-
pr_err("copy_from_user (len) failed\n");
448-
return -EFAULT;
449-
}
450-
451-
if (etf->total_len > MAX_RX_SIZE) {
452-
pr_err("requested length > MAX_RX_SIZE\n");
453-
return -EINVAL;
454-
}
455-
456-
written += sizeof(etf->total_len);
457-
count -= sizeof(etf->total_len);
458-
}
459-
460-
if (!count)
461-
goto done;
462-
463-
if (count > (etf->total_len - written)) {
464-
pr_err("Tried to write > MAX_RX_SIZE\n");
465-
return -EINVAL;
466-
}
467-
468-
if (copy_from_user(etf->buf + etf->written, user_buf + written,
469-
count)) {
470-
pr_err("copy_from_user (payload %zu) failed\n", count);
471-
return -EFAULT;
472-
}
473-
474-
written += count;
475-
etf->written += count;
476-
477-
if (etf->written >= etf->total_len) {
478-
if (etf_request(etf->priv, (struct etf_req_msg *)etf->buf,
479-
etf->total_len)) {
480-
pr_err("etf_request failed\n");
481-
return -EIO;
482-
}
483-
}
484-
485-
done:
486-
return written;
487-
}
488-
489-
static const struct file_operations fops_etf_in = {
490-
.open = cw1200_etf_in_open,
491-
.release = cw1200_etf_in_release,
492-
.write = cw1200_etf_in_write,
493-
.llseek = default_llseek,
494-
.owner = THIS_MODULE,
495-
};
496-
#endif /* CONFIG_CW1200_ETF */
497-
498360
static ssize_t cw1200_wsm_dumps(struct file *file,
499361
const char __user *user_buf, size_t count, loff_t *ppos)
500362
{
@@ -542,19 +404,6 @@ int cw1200_debug_init(struct cw1200_common *priv)
542404
priv, &fops_counters))
543405
goto err;
544406

545-
#ifdef CONFIG_CW1200_ETF
546-
if (etf_mode) {
547-
skb_queue_head_init(&priv->etf_q);
548-
549-
if (!debugfs_create_file("etf_out", S_IRUSR, d->debugfs_phy,
550-
priv, &fops_etf_out))
551-
goto err;
552-
if (!debugfs_create_file("etf_in", S_IWUSR, d->debugfs_phy,
553-
priv, &fops_etf_in))
554-
goto err;
555-
}
556-
#endif /* CONFIG_CW1200_ETF */
557-
558407
if (!debugfs_create_file("wsm_dumps", S_IWUSR, d->debugfs_phy,
559408
priv, &fops_wsm_dumps))
560409
goto err;
@@ -577,88 +426,3 @@ void cw1200_debug_release(struct cw1200_common *priv)
577426
kfree(d);
578427
}
579428
}
580-
581-
#ifdef CONFIG_CW1200_ETF
582-
struct cw1200_sdd {
583-
u8 id;
584-
u8 len;
585-
u8 data[];
586-
};
587-
588-
struct etf_req_msg {
589-
u32 id;
590-
u32 len;
591-
u8 data[];
592-
};
593-
594-
static int parse_sdd_file(struct cw1200_common *priv, u8 *data, u32 length)
595-
{
596-
struct cw1200_sdd *ie;
597-
598-
while (length > 0) {
599-
ie = (struct cw1200_sdd *)data;
600-
if (ie->id == SDD_REFERENCE_FREQUENCY_ELT_ID) {
601-
priv->hw_refclk = cpu_to_le16(*((u16 *)ie->data));
602-
pr_info("Using Reference clock frequency %d KHz\n",
603-
priv->hw_refclk);
604-
break;
605-
}
606-
607-
length -= ie->len + sizeof(*ie);
608-
data += ie->len + sizeof(*ie);
609-
}
610-
return 0;
611-
}
612-
613-
char *etf_firmware;
614-
615-
#define ST90TDS_START_ADAPTER 0x09 /* Loads firmware too */
616-
#define ST90TDS_STOP_ADAPTER 0x0A
617-
#define ST90TDS_CONFIG_ADAPTER 0x0E /* Send configuration params */
618-
#define ST90TDS_SBUS_READ 0x13
619-
#define ST90TDS_SBUS_WRITE 0x14
620-
#define ST90TDS_GET_DEVICE_OPTION 0x19
621-
#define ST90TDS_SET_DEVICE_OPTION 0x1A
622-
#define ST90TDS_SEND_SDD 0x1D /* SDD File used to find DPLL */
623-
624-
#include "fwio.h"
625-
626-
static int etf_request(struct cw1200_common *priv,
627-
struct etf_req_msg *msg,
628-
u32 len)
629-
{
630-
int rval = -1;
631-
switch (msg->id) {
632-
case ST90TDS_START_ADAPTER:
633-
etf_firmware = "cw1200_etf.bin";
634-
pr_info("ETF_START (len %d, '%s')\n", len, etf_firmware);
635-
rval = cw1200_load_firmware(priv);
636-
break;
637-
case ST90TDS_STOP_ADAPTER:
638-
pr_info("ETF_STOP (unhandled)\n");
639-
break;
640-
case ST90TDS_SEND_SDD:
641-
pr_info("ETF_SDD\n");
642-
rval = parse_sdd_file(priv, msg->data, msg->len);
643-
break;
644-
case ST90TDS_CONFIG_ADAPTER:
645-
pr_info("ETF_CONFIG_ADAP (unhandled)\n");
646-
break;
647-
case ST90TDS_SBUS_READ:
648-
pr_info("ETF_SBUS_READ (unhandled)\n");
649-
break;
650-
case ST90TDS_SBUS_WRITE:
651-
pr_info("ETF_SBUS_WRITE (unhandled)\n");
652-
break;
653-
case ST90TDS_SET_DEVICE_OPTION:
654-
pr_info("ETF_SET_DEV_OPT (unhandled)\n");
655-
break;
656-
default:
657-
pr_info("ETF_PASSTHRU (0x%08x)\n", msg->id);
658-
rval = wsm_raw_cmd(priv, (u8 *)msg, len);
659-
break;
660-
}
661-
662-
return rval;
663-
}
664-
#endif /* CONFIG_CW1200_ETF */

drivers/net/wireless/cw1200/fwio.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
139139
val32 &= ~ST90TDS_CONFIG_CPU_CLK_DIS_BIT;
140140
REG_WRITE(ST90TDS_CONFIG_REG_ID, val32);
141141

142-
#ifdef CONFIG_CW1200_ETF
143-
if (etf_mode)
144-
fw_path = etf_firmware;
145-
#endif
146-
147142
/* Load a firmware file */
148143
ret = request_firmware(&firmware, fw_path, priv->pdev);
149144
if (ret) {

drivers/net/wireless/cw1200/main.c

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ int cw1200_power_mode = wsm_power_mode_quiescent;
6161
module_param(cw1200_power_mode, int, 0644);
6262
MODULE_PARM_DESC(cw1200_power_mode, "WSM power mode. 0 == active, 1 == doze, 2 == quiescent (default)");
6363

64-
#ifdef CONFIG_CW1200_ETF
65-
int etf_mode;
66-
module_param(etf_mode, int, 0644);
67-
MODULE_PARM_DESC(etf_mode, "Enable EngineeringTestingFramework operation");
68-
#endif
69-
7064
#define RATETAB_ENT(_rate, _rateid, _flags) \
7165
{ \
7266
.bitrate = (_rate), \
@@ -418,11 +412,6 @@ static int cw1200_register_common(struct ieee80211_hw *dev)
418412
struct cw1200_common *priv = dev->priv;
419413
int err;
420414

421-
#ifdef CONFIG_CW1200_ETF
422-
if (etf_mode)
423-
goto done;
424-
#endif
425-
426415
#ifdef CONFIG_PM
427416
err = cw1200_pm_init(&priv->pm_state, priv);
428417
if (err) {
@@ -442,9 +431,6 @@ static int cw1200_register_common(struct ieee80211_hw *dev)
442431
return err;
443432
}
444433

445-
#ifdef CONFIG_CW1200_ETF
446-
done:
447-
#endif
448434
cw1200_debug_init(priv);
449435

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

464-
#ifdef CONFIG_CW1200_ETF
465-
if (!etf_mode) {
466-
#endif
467-
ieee80211_unregister_hw(dev);
468-
#ifdef CONFIG_CW1200_ETF
469-
}
470-
#endif
450+
ieee80211_unregister_hw(dev);
471451

472452
del_timer_sync(&priv->mcast_timeout);
473453
cw1200_unregister_bh(priv);
@@ -568,11 +548,6 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
568548
if (err)
569549
goto err1;
570550

571-
#ifdef CONFIG_CW1200_ETF
572-
if (etf_mode)
573-
goto skip_fw;
574-
#endif
575-
576551
err = cw1200_load_firmware(priv);
577552
if (err)
578553
goto err2;
@@ -594,9 +569,6 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
594569
/* Enable multi-TX confirmation */
595570
wsm_use_multi_tx_conf(priv, true);
596571

597-
#ifdef CONFIG_CW1200_ETF
598-
skip_fw:
599-
#endif
600572
err = cw1200_register_common(dev);
601573
if (err)
602574
goto err2;

0 commit comments

Comments
 (0)