aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/cw1200/debug.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-06-11 09:49:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-11 12:48:10 -0400
commit19db577868e94c80dc9a569d937109f95c34d0f4 (patch)
treeb6ea03b4f84dcd89b0fce8634a571c57d783cce6 /drivers/net/wireless/cw1200/debug.c
parentfa8eeae102570dfdf3fd14347a0671cff8a2cfe4 (diff)
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 <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/cw1200/debug.c')
-rw-r--r--drivers/net/wireless/cw1200/debug.c236
1 files changed, 0 insertions, 236 deletions
diff --git a/drivers/net/wireless/cw1200/debug.c b/drivers/net/wireless/cw1200/debug.c
index ac9c219c6330..e323b4d54338 100644
--- a/drivers/net/wireless/cw1200/debug.c
+++ b/drivers/net/wireless/cw1200/debug.c
@@ -357,144 +357,6 @@ static const struct file_operations fops_counters = {
357 .owner = THIS_MODULE, 357 .owner = THIS_MODULE,
358}; 358};
359 359
360#ifdef CONFIG_CW1200_ETF
361static 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
382static 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
388static 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
396struct etf_req_msg;
397static int etf_request(struct cw1200_common *priv,
398 struct etf_req_msg *msg, u32 len);
399
400#define MAX_RX_SIZE 2600
401
402struct etf_in_state {
403 struct cw1200_common *priv;
404 u16 total_len;
405 u16 written;
406 u8 buf[MAX_RX_SIZE];
407};
408
409static 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
426static int cw1200_etf_in_release(struct inode *inode, struct file *file)
427{
428 kfree(file->private_data);
429 return 0;
430}
431
432static 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
485done:
486 return written;
487}
488
489static 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
498static ssize_t cw1200_wsm_dumps(struct file *file, 360static ssize_t cw1200_wsm_dumps(struct file *file,
499 const char __user *user_buf, size_t count, loff_t *ppos) 361 const char __user *user_buf, size_t count, loff_t *ppos)
500{ 362{
@@ -542,19 +404,6 @@ int cw1200_debug_init(struct cw1200_common *priv)
542 priv, &fops_counters)) 404 priv, &fops_counters))
543 goto err; 405 goto err;
544 406
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
558 if (!debugfs_create_file("wsm_dumps", S_IWUSR, d->debugfs_phy, 407 if (!debugfs_create_file("wsm_dumps", S_IWUSR, d->debugfs_phy,
559 priv, &fops_wsm_dumps)) 408 priv, &fops_wsm_dumps))
560 goto err; 409 goto err;
@@ -577,88 +426,3 @@ void cw1200_debug_release(struct cw1200_common *priv)
577 kfree(d); 426 kfree(d);
578 } 427 }
579} 428}
580
581#ifdef CONFIG_CW1200_ETF
582struct cw1200_sdd {
583 u8 id;
584 u8 len;
585 u8 data[];
586};
587
588struct etf_req_msg {
589 u32 id;
590 u32 len;
591 u8 data[];
592};
593
594static 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
613char *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
626static 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 */