debug.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. * mac80211 glue code for mac80211 ST-Ericsson CW1200 drivers
  3. * DebugFS code
  4. *
  5. * Copyright (c) 2010, ST-Ericsson
  6. * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/debugfs.h>
  14. #include <linux/seq_file.h>
  15. #include "cw1200.h"
  16. #include "debug.h"
  17. #include "fwio.h"
  18. /* join_status */
  19. static const char * const cw1200_debug_join_status[] = {
  20. "passive",
  21. "monitor",
  22. "station (joining)",
  23. "station (not authenticated yet)",
  24. "station",
  25. "adhoc",
  26. "access point",
  27. };
  28. /* WSM_JOIN_PREAMBLE_... */
  29. static const char * const cw1200_debug_preamble[] = {
  30. "long",
  31. "short",
  32. "long on 1 and 2 Mbps",
  33. };
  34. static const char * const cw1200_debug_link_id[] = {
  35. "OFF",
  36. "REQ",
  37. "SOFT",
  38. "HARD",
  39. };
  40. static const char *cw1200_debug_mode(int mode)
  41. {
  42. switch (mode) {
  43. case NL80211_IFTYPE_UNSPECIFIED:
  44. return "unspecified";
  45. case NL80211_IFTYPE_MONITOR:
  46. return "monitor";
  47. case NL80211_IFTYPE_STATION:
  48. return "station";
  49. case NL80211_IFTYPE_ADHOC:
  50. return "adhoc";
  51. case NL80211_IFTYPE_MESH_POINT:
  52. return "mesh point";
  53. case NL80211_IFTYPE_AP:
  54. return "access point";
  55. case NL80211_IFTYPE_P2P_CLIENT:
  56. return "p2p client";
  57. case NL80211_IFTYPE_P2P_GO:
  58. return "p2p go";
  59. default:
  60. return "unsupported";
  61. }
  62. }
  63. static void cw1200_queue_status_show(struct seq_file *seq,
  64. struct cw1200_queue *q)
  65. {
  66. int i;
  67. seq_printf(seq, "Queue %d:\n", q->queue_id);
  68. seq_printf(seq, " capacity: %zu\n", q->capacity);
  69. seq_printf(seq, " queued: %zu\n", q->num_queued);
  70. seq_printf(seq, " pending: %zu\n", q->num_pending);
  71. seq_printf(seq, " sent: %zu\n", q->num_sent);
  72. seq_printf(seq, " locked: %s\n", q->tx_locked_cnt ? "yes" : "no");
  73. seq_printf(seq, " overfull: %s\n", q->overfull ? "yes" : "no");
  74. seq_puts(seq, " link map: 0-> ");
  75. for (i = 0; i < q->stats->map_capacity; ++i)
  76. seq_printf(seq, "%.2d ", q->link_map_cache[i]);
  77. seq_printf(seq, "<-%zu\n", q->stats->map_capacity);
  78. }
  79. static void cw1200_debug_print_map(struct seq_file *seq,
  80. struct cw1200_common *priv,
  81. const char *label,
  82. u32 map)
  83. {
  84. int i;
  85. seq_printf(seq, "%s0-> ", label);
  86. for (i = 0; i < priv->tx_queue_stats.map_capacity; ++i)
  87. seq_printf(seq, "%s ", (map & BIT(i)) ? "**" : "..");
  88. seq_printf(seq, "<-%zu\n", priv->tx_queue_stats.map_capacity - 1);
  89. }
  90. static int cw1200_status_show(struct seq_file *seq, void *v)
  91. {
  92. int i;
  93. struct list_head *item;
  94. struct cw1200_common *priv = seq->private;
  95. struct cw1200_debug_priv *d = priv->debug;
  96. seq_puts(seq, "CW1200 Wireless LAN driver status\n");
  97. seq_printf(seq, "Hardware: %d.%d\n",
  98. priv->wsm_caps.hw_id,
  99. priv->wsm_caps.hw_subid);
  100. seq_printf(seq, "Firmware: %s %d.%d\n",
  101. cw1200_fw_types[priv->wsm_caps.fw_type],
  102. priv->wsm_caps.fw_ver,
  103. priv->wsm_caps.fw_build);
  104. seq_printf(seq, "FW API: %d\n",
  105. priv->wsm_caps.fw_api);
  106. seq_printf(seq, "FW caps: 0x%.4X\n",
  107. priv->wsm_caps.fw_cap);
  108. seq_printf(seq, "FW label: '%s'\n",
  109. priv->wsm_caps.fw_label);
  110. seq_printf(seq, "Mode: %s%s\n",
  111. cw1200_debug_mode(priv->mode),
  112. priv->listening ? " (listening)" : "");
  113. seq_printf(seq, "Join state: %s\n",
  114. cw1200_debug_join_status[priv->join_status]);
  115. if (priv->channel)
  116. seq_printf(seq, "Channel: %d%s\n",
  117. priv->channel->hw_value,
  118. priv->channel_switch_in_progress ?
  119. " (switching)" : "");
  120. if (priv->rx_filter.promiscuous)
  121. seq_puts(seq, "Filter: promisc\n");
  122. else if (priv->rx_filter.fcs)
  123. seq_puts(seq, "Filter: fcs\n");
  124. if (priv->rx_filter.bssid)
  125. seq_puts(seq, "Filter: bssid\n");
  126. if (!priv->disable_beacon_filter)
  127. seq_puts(seq, "Filter: beacons\n");
  128. if (priv->enable_beacon ||
  129. priv->mode == NL80211_IFTYPE_AP ||
  130. priv->mode == NL80211_IFTYPE_ADHOC ||
  131. priv->mode == NL80211_IFTYPE_MESH_POINT ||
  132. priv->mode == NL80211_IFTYPE_P2P_GO)
  133. seq_printf(seq, "Beaconing: %s\n",
  134. priv->enable_beacon ?
  135. "enabled" : "disabled");
  136. for (i = 0; i < 4; ++i)
  137. seq_printf(seq, "EDCA(%d): %d, %d, %d, %d, %d\n", i,
  138. priv->edca.params[i].cwmin,
  139. priv->edca.params[i].cwmax,
  140. priv->edca.params[i].aifns,
  141. priv->edca.params[i].txop_limit,
  142. priv->edca.params[i].max_rx_lifetime);
  143. if (priv->join_status == CW1200_JOIN_STATUS_STA) {
  144. static const char *pm_mode = "unknown";
  145. switch (priv->powersave_mode.mode) {
  146. case WSM_PSM_ACTIVE:
  147. pm_mode = "off";
  148. break;
  149. case WSM_PSM_PS:
  150. pm_mode = "on";
  151. break;
  152. case WSM_PSM_FAST_PS:
  153. pm_mode = "dynamic";
  154. break;
  155. }
  156. seq_printf(seq, "Preamble: %s\n",
  157. cw1200_debug_preamble[priv->association_mode.preamble]);
  158. seq_printf(seq, "AMPDU spcn: %d\n",
  159. priv->association_mode.mpdu_start_spacing);
  160. seq_printf(seq, "Basic rate: 0x%.8X\n",
  161. le32_to_cpu(priv->association_mode.basic_rate_set));
  162. seq_printf(seq, "Bss lost: %d beacons\n",
  163. priv->bss_params.beacon_lost_count);
  164. seq_printf(seq, "AID: %d\n",
  165. priv->bss_params.aid);
  166. seq_printf(seq, "Rates: 0x%.8X\n",
  167. priv->bss_params.operational_rate_set);
  168. seq_printf(seq, "Powersave: %s\n", pm_mode);
  169. }
  170. seq_printf(seq, "HT: %s\n",
  171. cw1200_is_ht(&priv->ht_info) ? "on" : "off");
  172. if (cw1200_is_ht(&priv->ht_info)) {
  173. seq_printf(seq, "Greenfield: %s\n",
  174. cw1200_ht_greenfield(&priv->ht_info) ? "yes" : "no");
  175. seq_printf(seq, "AMPDU dens: %d\n",
  176. cw1200_ht_ampdu_density(&priv->ht_info));
  177. }
  178. seq_printf(seq, "RSSI thold: %d\n",
  179. priv->cqm_rssi_thold);
  180. seq_printf(seq, "RSSI hyst: %d\n",
  181. priv->cqm_rssi_hyst);
  182. seq_printf(seq, "Long retr: %d\n",
  183. priv->long_frame_max_tx_count);
  184. seq_printf(seq, "Short retr: %d\n",
  185. priv->short_frame_max_tx_count);
  186. spin_lock_bh(&priv->tx_policy_cache.lock);
  187. i = 0;
  188. list_for_each(item, &priv->tx_policy_cache.used)
  189. ++i;
  190. spin_unlock_bh(&priv->tx_policy_cache.lock);
  191. seq_printf(seq, "RC in use: %d\n", i);
  192. seq_puts(seq, "\n");
  193. for (i = 0; i < 4; ++i) {
  194. cw1200_queue_status_show(seq, &priv->tx_queue[i]);
  195. seq_puts(seq, "\n");
  196. }
  197. cw1200_debug_print_map(seq, priv, "Link map: ",
  198. priv->link_id_map);
  199. cw1200_debug_print_map(seq, priv, "Asleep map: ",
  200. priv->sta_asleep_mask);
  201. cw1200_debug_print_map(seq, priv, "PSPOLL map: ",
  202. priv->pspoll_mask);
  203. seq_puts(seq, "\n");
  204. for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
  205. if (priv->link_id_db[i].status) {
  206. seq_printf(seq, "Link %d: %s, %pM\n",
  207. i + 1,
  208. cw1200_debug_link_id[priv->link_id_db[i].status],
  209. priv->link_id_db[i].mac);
  210. }
  211. }
  212. seq_puts(seq, "\n");
  213. seq_printf(seq, "BH status: %s\n",
  214. atomic_read(&priv->bh_term) ? "terminated" : "alive");
  215. seq_printf(seq, "Pending RX: %d\n",
  216. atomic_read(&priv->bh_rx));
  217. seq_printf(seq, "Pending TX: %d\n",
  218. atomic_read(&priv->bh_tx));
  219. if (priv->bh_error)
  220. seq_printf(seq, "BH errcode: %d\n",
  221. priv->bh_error);
  222. seq_printf(seq, "TX bufs: %d x %d bytes\n",
  223. priv->wsm_caps.input_buffers,
  224. priv->wsm_caps.input_buffer_size);
  225. seq_printf(seq, "Used bufs: %d\n",
  226. priv->hw_bufs_used);
  227. seq_printf(seq, "Powermgmt: %s\n",
  228. priv->powersave_enabled ? "on" : "off");
  229. seq_printf(seq, "Device: %s\n",
  230. priv->device_can_sleep ? "asleep" : "awake");
  231. spin_lock(&priv->wsm_cmd.lock);
  232. seq_printf(seq, "WSM status: %s\n",
  233. priv->wsm_cmd.done ? "idle" : "active");
  234. seq_printf(seq, "WSM cmd: 0x%.4X (%td bytes)\n",
  235. priv->wsm_cmd.cmd, priv->wsm_cmd.len);
  236. seq_printf(seq, "WSM retval: %d\n",
  237. priv->wsm_cmd.ret);
  238. spin_unlock(&priv->wsm_cmd.lock);
  239. seq_printf(seq, "Datapath: %s\n",
  240. atomic_read(&priv->tx_lock) ? "locked" : "unlocked");
  241. if (atomic_read(&priv->tx_lock))
  242. seq_printf(seq, "TXlock cnt: %d\n",
  243. atomic_read(&priv->tx_lock));
  244. seq_printf(seq, "TXed: %d\n",
  245. d->tx);
  246. seq_printf(seq, "AGG TXed: %d\n",
  247. d->tx_agg);
  248. seq_printf(seq, "MULTI TXed: %d (%d)\n",
  249. d->tx_multi, d->tx_multi_frames);
  250. seq_printf(seq, "RXed: %d\n",
  251. d->rx);
  252. seq_printf(seq, "AGG RXed: %d\n",
  253. d->rx_agg);
  254. seq_printf(seq, "TX miss: %d\n",
  255. d->tx_cache_miss);
  256. seq_printf(seq, "TX align: %d\n",
  257. d->tx_align);
  258. seq_printf(seq, "TX burst: %d\n",
  259. d->tx_burst);
  260. seq_printf(seq, "TX TTL: %d\n",
  261. d->tx_ttl);
  262. seq_printf(seq, "Scan: %s\n",
  263. atomic_read(&priv->scan.in_progress) ? "active" : "idle");
  264. return 0;
  265. }
  266. static int cw1200_status_open(struct inode *inode, struct file *file)
  267. {
  268. return single_open(file, &cw1200_status_show,
  269. inode->i_private);
  270. }
  271. static const struct file_operations fops_status = {
  272. .open = cw1200_status_open,
  273. .read = seq_read,
  274. .llseek = seq_lseek,
  275. .release = single_release,
  276. .owner = THIS_MODULE,
  277. };
  278. static int cw1200_counters_show(struct seq_file *seq, void *v)
  279. {
  280. int ret;
  281. struct cw1200_common *priv = seq->private;
  282. struct wsm_mib_counters_table counters;
  283. ret = wsm_get_counters_table(priv, &counters);
  284. if (ret)
  285. return ret;
  286. #define PUT_COUNTER(tab, name) \
  287. seq_printf(seq, "%s:" tab "%d\n", #name, \
  288. __le32_to_cpu(counters.name))
  289. PUT_COUNTER("\t\t", plcp_errors);
  290. PUT_COUNTER("\t\t", fcs_errors);
  291. PUT_COUNTER("\t\t", tx_packets);
  292. PUT_COUNTER("\t\t", rx_packets);
  293. PUT_COUNTER("\t\t", rx_packet_errors);
  294. PUT_COUNTER("\t", rx_decryption_failures);
  295. PUT_COUNTER("\t\t", rx_mic_failures);
  296. PUT_COUNTER("\t", rx_no_key_failures);
  297. PUT_COUNTER("\t", tx_multicast_frames);
  298. PUT_COUNTER("\t", tx_frames_success);
  299. PUT_COUNTER("\t", tx_frame_failures);
  300. PUT_COUNTER("\t", tx_frames_retried);
  301. PUT_COUNTER("\t", tx_frames_multi_retried);
  302. PUT_COUNTER("\t", rx_frame_duplicates);
  303. PUT_COUNTER("\t\t", rts_success);
  304. PUT_COUNTER("\t\t", rts_failures);
  305. PUT_COUNTER("\t\t", ack_failures);
  306. PUT_COUNTER("\t", rx_multicast_frames);
  307. PUT_COUNTER("\t", rx_frames_success);
  308. PUT_COUNTER("\t", rx_cmac_icv_errors);
  309. PUT_COUNTER("\t\t", rx_cmac_replays);
  310. PUT_COUNTER("\t", rx_mgmt_ccmp_replays);
  311. #undef PUT_COUNTER
  312. return 0;
  313. }
  314. static int cw1200_counters_open(struct inode *inode, struct file *file)
  315. {
  316. return single_open(file, &cw1200_counters_show,
  317. inode->i_private);
  318. }
  319. static const struct file_operations fops_counters = {
  320. .open = cw1200_counters_open,
  321. .read = seq_read,
  322. .llseek = seq_lseek,
  323. .release = single_release,
  324. .owner = THIS_MODULE,
  325. };
  326. #ifdef CONFIG_CW1200_ETF
  327. static int cw1200_etf_out_show(struct seq_file *seq, void *v)
  328. {
  329. struct cw1200_common *priv = seq->private;
  330. struct sk_buff *skb;
  331. u32 len = 0;
  332. skb = skb_dequeue(&priv->etf_q);
  333. if (skb)
  334. len = skb->len;
  335. seq_write(seq, &len, sizeof(len));
  336. if (skb) {
  337. seq_write(seq, skb->data, len);
  338. kfree_skb(skb);
  339. }
  340. return 0;
  341. }
  342. static int cw1200_etf_out_open(struct inode *inode, struct file *file)
  343. {
  344. return single_open(file, &cw1200_etf_out_show,
  345. inode->i_private);
  346. }
  347. static const struct file_operations fops_etf_out = {
  348. .open = cw1200_etf_out_open,
  349. .read = seq_read,
  350. .llseek = seq_lseek,
  351. .release = single_release,
  352. .owner = THIS_MODULE,
  353. };
  354. struct etf_req_msg;
  355. static int etf_request(struct cw1200_common *priv,
  356. struct etf_req_msg *msg, u32 len);
  357. #define MAX_RX_SIZE 2600
  358. struct etf_in_state {
  359. struct cw1200_common *priv;
  360. u16 total_len;
  361. u16 written;
  362. u8 buf[MAX_RX_SIZE];
  363. };
  364. static int cw1200_etf_in_open(struct inode *inode, struct file *file)
  365. {
  366. struct etf_in_state *etf = kmalloc(sizeof(struct etf_in_state),
  367. GFP_KERNEL);
  368. if (!etf)
  369. return -ENOMEM;
  370. etf->written = 0;
  371. etf->total_len = 0;
  372. etf->priv = inode->i_private;
  373. file->private_data = etf;
  374. return 0;
  375. }
  376. static int cw1200_etf_in_release(struct inode *inode, struct file *file)
  377. {
  378. kfree(file->private_data);
  379. return 0;
  380. }
  381. static ssize_t cw1200_etf_in_write(struct file *file,
  382. const char __user *user_buf, size_t count, loff_t *ppos)
  383. {
  384. struct etf_in_state *etf = file->private_data;
  385. ssize_t written = 0;
  386. if (!etf->total_len) {
  387. if (count < sizeof(etf->total_len)) {
  388. pr_err("count < sizeof(total_len)\n");
  389. return -EINVAL;
  390. }
  391. if (copy_from_user(&etf->total_len, user_buf,
  392. sizeof(etf->total_len))) {
  393. pr_err("copy_from_user (len) failed\n");
  394. return -EFAULT;
  395. }
  396. if (etf->total_len > MAX_RX_SIZE) {
  397. pr_err("requested length > MAX_RX_SIZE\n");
  398. return -EINVAL;
  399. }
  400. written += sizeof(etf->total_len);
  401. count -= sizeof(etf->total_len);
  402. }
  403. if (!count)
  404. goto done;
  405. if (count > (etf->total_len - written)) {
  406. pr_err("Tried to write > MAX_RX_SIZE\n");
  407. return -EINVAL;
  408. }
  409. if (copy_from_user(etf->buf + etf->written, user_buf + written,
  410. count)) {
  411. pr_err("copy_from_user (payload %zu) failed\n", count);
  412. return -EFAULT;
  413. }
  414. written += count;
  415. etf->written += count;
  416. if (etf->written >= etf->total_len) {
  417. if (etf_request(etf->priv, (struct etf_req_msg *)etf->buf,
  418. etf->total_len)) {
  419. pr_err("etf_request failed\n");
  420. return -EIO;
  421. }
  422. }
  423. done:
  424. return written;
  425. }
  426. static const struct file_operations fops_etf_in = {
  427. .open = cw1200_etf_in_open,
  428. .release = cw1200_etf_in_release,
  429. .write = cw1200_etf_in_write,
  430. .llseek = default_llseek,
  431. .owner = THIS_MODULE,
  432. };
  433. #endif /* CONFIG_CW1200_ETF */
  434. static ssize_t cw1200_wsm_dumps(struct file *file,
  435. const char __user *user_buf, size_t count, loff_t *ppos)
  436. {
  437. struct cw1200_common *priv = file->private_data;
  438. char buf[1];
  439. if (!count)
  440. return -EINVAL;
  441. if (copy_from_user(buf, user_buf, 1))
  442. return -EFAULT;
  443. if (buf[0] == '1')
  444. priv->wsm_enable_wsm_dumps = 1;
  445. else
  446. priv->wsm_enable_wsm_dumps = 0;
  447. return count;
  448. }
  449. static const struct file_operations fops_wsm_dumps = {
  450. .open = simple_open,
  451. .write = cw1200_wsm_dumps,
  452. .llseek = default_llseek,
  453. };
  454. int cw1200_debug_init(struct cw1200_common *priv)
  455. {
  456. int ret = -ENOMEM;
  457. struct cw1200_debug_priv *d = kzalloc(sizeof(struct cw1200_debug_priv),
  458. GFP_KERNEL);
  459. priv->debug = d;
  460. if (!d)
  461. return ret;
  462. d->debugfs_phy = debugfs_create_dir("cw1200",
  463. priv->hw->wiphy->debugfsdir);
  464. if (!d->debugfs_phy)
  465. goto err;
  466. if (!debugfs_create_file("status", S_IRUSR, d->debugfs_phy,
  467. priv, &fops_status))
  468. goto err;
  469. if (!debugfs_create_file("counters", S_IRUSR, d->debugfs_phy,
  470. priv, &fops_counters))
  471. goto err;
  472. #ifdef CONFIG_CW1200_ETF
  473. if (etf_mode) {
  474. skb_queue_head_init(&priv->etf_q);
  475. if (!debugfs_create_file("etf_out", S_IRUSR, d->debugfs_phy,
  476. priv, &fops_etf_out))
  477. goto err;
  478. if (!debugfs_create_file("etf_in", S_IWUSR, d->debugfs_phy,
  479. priv, &fops_etf_in))
  480. goto err;
  481. }
  482. #endif /* CONFIG_CW1200_ETF */
  483. if (!debugfs_create_file("wsm_dumps", S_IWUSR, d->debugfs_phy,
  484. priv, &fops_wsm_dumps))
  485. goto err;
  486. return 0;
  487. err:
  488. priv->debug = NULL;
  489. debugfs_remove_recursive(d->debugfs_phy);
  490. kfree(d);
  491. return ret;
  492. }
  493. void cw1200_debug_release(struct cw1200_common *priv)
  494. {
  495. struct cw1200_debug_priv *d = priv->debug;
  496. if (d) {
  497. debugfs_remove_recursive(d->debugfs_phy);
  498. priv->debug = NULL;
  499. kfree(d);
  500. }
  501. }
  502. #ifdef CONFIG_CW1200_ETF
  503. struct cw1200_sdd {
  504. u8 id;
  505. u8 len;
  506. u8 data[];
  507. };
  508. struct etf_req_msg {
  509. u32 id;
  510. u32 len;
  511. u8 data[];
  512. };
  513. static int parse_sdd_file(struct cw1200_common *priv, u8 *data, u32 length)
  514. {
  515. struct cw1200_sdd *ie;
  516. while (length > 0) {
  517. ie = (struct cw1200_sdd *)data;
  518. if (ie->id == SDD_REFERENCE_FREQUENCY_ELT_ID) {
  519. priv->hw_refclk = cpu_to_le16(*((u16 *)ie->data));
  520. pr_info("Using Reference clock frequency %d KHz\n",
  521. priv->hw_refclk);
  522. break;
  523. }
  524. length -= ie->len + sizeof(*ie);
  525. data += ie->len + sizeof(*ie);
  526. }
  527. return 0;
  528. }
  529. char *etf_firmware;
  530. #define ST90TDS_START_ADAPTER 0x09 /* Loads firmware too */
  531. #define ST90TDS_STOP_ADAPTER 0x0A
  532. #define ST90TDS_CONFIG_ADAPTER 0x0E /* Send configuration params */
  533. #define ST90TDS_SBUS_READ 0x13
  534. #define ST90TDS_SBUS_WRITE 0x14
  535. #define ST90TDS_GET_DEVICE_OPTION 0x19
  536. #define ST90TDS_SET_DEVICE_OPTION 0x1A
  537. #define ST90TDS_SEND_SDD 0x1D /* SDD File used to find DPLL */
  538. #include "fwio.h"
  539. static int etf_request(struct cw1200_common *priv,
  540. struct etf_req_msg *msg,
  541. u32 len)
  542. {
  543. int rval = -1;
  544. switch (msg->id) {
  545. case ST90TDS_START_ADAPTER:
  546. etf_firmware = "cw1200_etf.bin";
  547. pr_info("ETF_START (len %d, '%s')\n", len, etf_firmware);
  548. rval = cw1200_load_firmware(priv);
  549. break;
  550. case ST90TDS_STOP_ADAPTER:
  551. pr_info("ETF_STOP (unhandled)\n");
  552. break;
  553. case ST90TDS_SEND_SDD:
  554. pr_info("ETF_SDD\n");
  555. rval = parse_sdd_file(priv, msg->data, msg->len);
  556. break;
  557. case ST90TDS_CONFIG_ADAPTER:
  558. pr_info("ETF_CONFIG_ADAP (unhandled)\n");
  559. break;
  560. case ST90TDS_SBUS_READ:
  561. pr_info("ETF_SBUS_READ (unhandled)\n");
  562. break;
  563. case ST90TDS_SBUS_WRITE:
  564. pr_info("ETF_SBUS_WRITE (unhandled)\n");
  565. break;
  566. case ST90TDS_SET_DEVICE_OPTION:
  567. pr_info("ETF_SET_DEV_OPT (unhandled)\n");
  568. break;
  569. default:
  570. pr_info("ETF_PASSTHRU (0x%08x)\n", msg->id);
  571. rval = wsm_raw_cmd(priv, (u8 *)msg, len);
  572. break;
  573. }
  574. return rval;
  575. }
  576. #endif /* CONFIG_CW1200_ETF */