summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/cw1200/debug.c
blob: b815181802e0105da38f997aa11768d80f0945a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
/*
 * mac80211 glue code for mac80211 ST-Ericsson CW1200 drivers
 * DebugFS code
 *
 * Copyright (c) 2010, ST-Ericsson
 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include "cw1200.h"
#include "debug.h"
#include "fwio.h"

/* join_status */
static const char * const cw1200_debug_join_status[] = {
	"passive",
	"monitor",
	"station (joining)",
	"station (not authenticated yet)",
	"station",
	"adhoc",
	"access point",
};

/* WSM_JOIN_PREAMBLE_... */
static const char * const cw1200_debug_preamble[] = {
	"long",
	"short",
	"long on 1 and 2 Mbps",
};


static const char * const cw1200_debug_link_id[] = {
	"OFF",
	"REQ",
	"SOFT",
	"HARD",
};

static const char *cw1200_debug_mode(int mode)
{
	switch (mode) {
	case NL80211_IFTYPE_UNSPECIFIED:
		return "unspecified";
	case NL80211_IFTYPE_MONITOR:
		return "monitor";
	case NL80211_IFTYPE_STATION:
		return "station";
	case NL80211_IFTYPE_ADHOC:
		return "adhoc";
	case NL80211_IFTYPE_MESH_POINT:
		return "mesh point";
	case NL80211_IFTYPE_AP:
		return "access point";
	case NL80211_IFTYPE_P2P_CLIENT:
		return "p2p client";
	case NL80211_IFTYPE_P2P_GO:
		return "p2p go";
	default:
		return "unsupported";
	}
}

static void cw1200_queue_status_show(struct seq_file *seq,
				     struct cw1200_queue *q)
{
	int i;
	seq_printf(seq, "Queue       %d:\n", q->queue_id);
	seq_printf(seq, "  capacity: %zu\n", q->capacity);
	seq_printf(seq, "  queued:   %zu\n", q->num_queued);
	seq_printf(seq, "  pending:  %zu\n", q->num_pending);
	seq_printf(seq, "  sent:     %zu\n", q->num_sent);
	seq_printf(seq, "  locked:   %s\n", q->tx_locked_cnt ? "yes" : "no");
	seq_printf(seq, "  overfull: %s\n", q->overfull ? "yes" : "no");
	seq_puts(seq,   "  link map: 0-> ");
	for (i = 0; i < q->stats->map_capacity; ++i)
		seq_printf(seq, "%.2d ", q->link_map_cache[i]);
	seq_printf(seq, "<-%zu\n", q->stats->map_capacity);
}

static void cw1200_debug_print_map(struct seq_file *seq,
				   struct cw1200_common *priv,
				   const char *label,
				   u32 map)
{
	int i;
	seq_printf(seq, "%s0-> ", label);
	for (i = 0; i < priv->tx_queue_stats.map_capacity; ++i)
		seq_printf(seq, "%s ", (map & BIT(i)) ? "**" : "..");
	seq_printf(seq, "<-%zu\n", priv->tx_queue_stats.map_capacity - 1);
}

static int cw1200_status_show(struct seq_file *seq, void *v)
{
	int i;
	struct list_head *item;
	struct cw1200_common *priv = seq->private;
	struct cw1200_debug_priv *d = priv->debug;

	seq_puts(seq,   "CW1200 Wireless LAN driver status\n");
	seq_printf(seq, "Hardware:   %d.%d\n",
		   priv->wsm_caps.hw_id,
		   priv->wsm_caps.hw_subid);
	seq_printf(seq, "Firmware:   %s %d.%d\n",
		   cw1200_fw_types[priv->wsm_caps.fw_type],
		   priv->wsm_caps.fw_ver,
		   priv->wsm_caps.fw_build);
	seq_printf(seq, "FW API:     %d\n",
		   priv->wsm_caps.fw_api);
	seq_printf(seq, "FW caps:    0x%.4X\n",
		   priv->wsm_caps.fw_cap);
	seq_printf(seq, "FW label:  '%s'\n",
		   priv->wsm_caps.fw_label);
	seq_printf(seq, "Mode:       %s%s\n",
		   cw1200_debug_mode(priv->mode),
		   priv->listening ? " (listening)" : "");
	seq_printf(seq, "Join state: %s\n",
		   cw1200_debug_join_status[priv->join_status]);
	if (priv->channel)
		seq_printf(seq, "Channel:    %d%s\n",
			   priv->channel->hw_value,
			   priv->channel_switch_in_progress ?
			   " (switching)" : "");
	if (priv->rx_filter.promiscuous)
		seq_puts(seq,   "Filter:     promisc\n");
	else if (priv->rx_filter.fcs)
		seq_puts(seq,   "Filter:     fcs\n");
	if (priv->rx_filter.bssid)
		seq_puts(seq,   "Filter:     bssid\n");
	if (!priv->disable_beacon_filter)
		seq_puts(seq,   "Filter:     beacons\n");

	if (priv->enable_beacon ||
	    priv->mode == NL80211_IFTYPE_AP ||
	    priv->mode == NL80211_IFTYPE_ADHOC ||
	    priv->mode == NL80211_IFTYPE_MESH_POINT ||
	    priv->mode == NL80211_IFTYPE_P2P_GO)
		seq_printf(seq, "Beaconing:  %s\n",
			   priv->enable_beacon ?
			   "enabled" : "disabled");

	for (i = 0; i < 4; ++i)
		seq_printf(seq, "EDCA(%d):    %d, %d, %d, %d, %d\n", i,
			   priv->edca.params[i].cwmin,
			   priv->edca.params[i].cwmax,
			   priv->edca.params[i].aifns,
			   priv->edca.params[i].txop_limit,
			   priv->edca.params[i].max_rx_lifetime);

	if (priv->join_status == CW1200_JOIN_STATUS_STA) {
		static const char *pm_mode = "unknown";
		switch (priv->powersave_mode.mode) {
		case WSM_PSM_ACTIVE:
			pm_mode = "off";
			break;
		case WSM_PSM_PS:
			pm_mode = "on";
			break;
		case WSM_PSM_FAST_PS:
			pm_mode = "dynamic";
			break;
		}
		seq_printf(seq, "Preamble:   %s\n",
			   cw1200_debug_preamble[priv->association_mode.preamble]);
		seq_printf(seq, "AMPDU spcn: %d\n",
			   priv->association_mode.mpdu_start_spacing);
		seq_printf(seq, "Basic rate: 0x%.8X\n",
			   le32_to_cpu(priv->association_mode.basic_rate_set));
		seq_printf(seq, "Bss lost:   %d beacons\n",
			   priv->bss_params.beacon_lost_count);
		seq_printf(seq, "AID:        %d\n",
			   priv->bss_params.aid);
		seq_printf(seq, "Rates:      0x%.8X\n",
			   priv->bss_params.operational_rate_set);
		seq_printf(seq, "Powersave:  %s\n", pm_mode);
	}
	seq_printf(seq, "HT:         %s\n",
		   cw1200_is_ht(&priv->ht_info) ? "on" : "off");
	if (cw1200_is_ht(&priv->ht_info)) {
		seq_printf(seq, "Greenfield: %s\n",
			   cw1200_ht_greenfield(&priv->ht_info) ? "yes" : "no");
		seq_printf(seq, "AMPDU dens: %d\n",
			   cw1200_ht_ampdu_density(&priv->ht_info));
	}
	seq_printf(seq, "RSSI thold: %d\n",
		   priv->cqm_rssi_thold);
	seq_printf(seq, "RSSI hyst:  %d\n",
		   priv->cqm_rssi_hyst);
	seq_printf(seq, "Long retr:  %d\n",
		   priv->long_frame_max_tx_count);
	seq_printf(seq, "Short retr: %d\n",
		   priv->short_frame_max_tx_count);
	spin_lock_bh(&priv->tx_policy_cache.lock);
	i = 0;
	list_for_each(item, &priv->tx_policy_cache.used)
		++i;
	spin_unlock_bh(&priv->tx_policy_cache.lock);
	seq_printf(seq, "RC in use:  %d\n", i);

	seq_puts(seq, "\n");
	for (i = 0; i < 4; ++i) {
		cw1200_queue_status_show(seq, &priv->tx_queue[i]);
		seq_puts(seq, "\n");
	}

	cw1200_debug_print_map(seq, priv, "Link map:   ",
			       priv->link_id_map);
	cw1200_debug_print_map(seq, priv, "Asleep map: ",
			       priv->sta_asleep_mask);
	cw1200_debug_print_map(seq, priv, "PSPOLL map: ",
			       priv->pspoll_mask);

	seq_puts(seq, "\n");

	for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
		if (priv->link_id_db[i].status) {
			seq_printf(seq, "Link %d:     %s, %pM\n",
				   i + 1,
				   cw1200_debug_link_id[priv->link_id_db[i].status],
				   priv->link_id_db[i].mac);
		}
	}

	seq_puts(seq, "\n");

	seq_printf(seq, "BH status:  %s\n",
		   atomic_read(&priv->bh_term) ? "terminated" : "alive");
	seq_printf(seq, "Pending RX: %d\n",
		   atomic_read(&priv->bh_rx));
	seq_printf(seq, "Pending TX: %d\n",
		   atomic_read(&priv->bh_tx));
	if (priv->bh_error)
		seq_printf(seq, "BH errcode: %d\n",
			   priv->bh_error);
	seq_printf(seq, "TX bufs:    %d x %d bytes\n",
		   priv->wsm_caps.input_buffers,
		   priv->wsm_caps.input_buffer_size);
	seq_printf(seq, "Used bufs:  %d\n",
		   priv->hw_bufs_used);
	seq_printf(seq, "Powermgmt:  %s\n",
		   priv->powersave_enabled ? "on" : "off");
	seq_printf(seq, "Device:     %s\n",
		   priv->device_can_sleep ? "asleep" : "awake");

	spin_lock(&priv->wsm_cmd.lock);
	seq_printf(seq, "WSM status: %s\n",
		   priv->wsm_cmd.done ? "idle" : "active");
	seq_printf(seq, "WSM cmd:    0x%.4X (%td bytes)\n",
		   priv->wsm_cmd.cmd, priv->wsm_cmd.len);
	seq_printf(seq, "WSM retval: %d\n",
		   priv->wsm_cmd.ret);
	spin_unlock(&priv->wsm_cmd.lock);

	seq_printf(seq, "Datapath:   %s\n",
		   atomic_read(&priv->tx_lock) ? "locked" : "unlocked");
	if (atomic_read(&priv->tx_lock))
		seq_printf(seq, "TXlock cnt: %d\n",
			   atomic_read(&priv->tx_lock));

	seq_printf(seq, "TXed:       %d\n",
		   d->tx);
	seq_printf(seq, "AGG TXed:   %d\n",
		   d->tx_agg);
	seq_printf(seq, "MULTI TXed: %d (%d)\n",
		   d->tx_multi, d->tx_multi_frames);
	seq_printf(seq, "RXed:       %d\n",
		   d->rx);
	seq_printf(seq, "AGG RXed:   %d\n",
		   d->rx_agg);
	seq_printf(seq, "TX miss:    %d\n",
		   d->tx_cache_miss);
	seq_printf(seq, "TX align:   %d\n",
		   d->tx_align);
	seq_printf(seq, "TX burst:   %d\n",
		   d->tx_burst);
	seq_printf(seq, "TX TTL:     %d\n",
		   d->tx_ttl);
	seq_printf(seq, "Scan:       %s\n",
		   atomic_read(&priv->scan.in_progress) ? "active" : "idle");

	return 0;
}

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

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

static int cw1200_counters_show(struct seq_file *seq, void *v)
{
	int ret;
	struct cw1200_common *priv = seq->private;
	struct wsm_mib_counters_table counters;

	ret = wsm_get_counters_table(priv, &counters);
	if (ret)
		return ret;

#define PUT_COUNTER(tab, name) \
	seq_printf(seq, "%s:" tab "%d\n", #name, \
		__le32_to_cpu(counters.name))

	PUT_COUNTER("\t\t", plcp_errors);
	PUT_COUNTER("\t\t", fcs_errors);
	PUT_COUNTER("\t\t", tx_packets);
	PUT_COUNTER("\t\t", rx_packets);
	PUT_COUNTER("\t\t", rx_packet_errors);
	PUT_COUNTER("\t",   rx_decryption_failures);
	PUT_COUNTER("\t\t", rx_mic_failures);
	PUT_COUNTER("\t",   rx_no_key_failures);
	PUT_COUNTER("\t",   tx_multicast_frames);
	PUT_COUNTER("\t",   tx_frames_success);
	PUT_COUNTER("\t",   tx_frame_failures);
	PUT_COUNTER("\t",   tx_frames_retried);
	PUT_COUNTER("\t",   tx_frames_multi_retried);
	PUT_COUNTER("\t",   rx_frame_duplicates);
	PUT_COUNTER("\t\t", rts_success);
	PUT_COUNTER("\t\t", rts_failures);
	PUT_COUNTER("\t\t", ack_failures);
	PUT_COUNTER("\t",   rx_multicast_frames);
	PUT_COUNTER("\t",   rx_frames_success);
	PUT_COUNTER("\t",   rx_cmac_icv_errors);
	PUT_COUNTER("\t\t", rx_cmac_replays);
	PUT_COUNTER("\t",   rx_mgmt_ccmp_replays);

#undef PUT_COUNTER

	return 0;
}

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

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

static int cw1200_generic_open(struct inode *inode, struct file *file)
{
	file->private_data = inode->i_private;
	return 0;
}

#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_SZE 2600

struct etf_in_state {
	struct cw1200_common *priv;
	u32 total_len;
	u8 buf[MAX_RX_SZE];
	u32 written;
};

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;
		}

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

	if (!count)
		goto done;

	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)
{
	struct cw1200_common *priv = file->private_data;
	char buf[1];

	if (!count)
		return -EINVAL;
	if (copy_from_user(buf, user_buf, 1))
		return -EFAULT;

	if (buf[0] == '1')
		priv->wsm_enable_wsm_dumps = 1;
	else
		priv->wsm_enable_wsm_dumps = 0;

	return count;
}

static const struct file_operations fops_wsm_dumps = {
	.open = cw1200_generic_open,
	.write = cw1200_wsm_dumps,
	.llseek = default_llseek,
};

int cw1200_debug_init(struct cw1200_common *priv)
{
	int ret = -ENOMEM;
	struct cw1200_debug_priv *d = kzalloc(sizeof(struct cw1200_debug_priv),
			GFP_KERNEL);
	priv->debug = d;
	if (!d)
		return ret;

	d->debugfs_phy = debugfs_create_dir("cw1200",
					    priv->hw->wiphy->debugfsdir);
	if (!d->debugfs_phy)
		goto err;

	if (!debugfs_create_file("status", S_IRUSR, d->debugfs_phy,
				 priv, &fops_status))
		goto err;

	if (!debugfs_create_file("counters", S_IRUSR, d->debugfs_phy,
				 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;

	ret = cw1200_itp_init(priv);
	if (ret)
		goto err;

	return 0;

err:
	priv->debug = NULL;
	debugfs_remove_recursive(d->debugfs_phy);
	kfree(d);
	return ret;
}

void cw1200_debug_release(struct cw1200_common *priv)
{
	struct cw1200_debug_priv *d = priv->debug;
	if (d) {
		cw1200_itp_release(priv);
		priv->debug = NULL;
		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 */