@@ -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-
498360static 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 */
0 commit comments