]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/net/wireless/ath/ath9k/htc_drv_debug.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[karo-tx-linux.git] / drivers / net / wireless / ath / ath9k / htc_drv_debug.c
1 /*
2  * Copyright (c) 2010-2011 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #include "htc.h"
18
19 static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
20                                        size_t count, loff_t *ppos)
21 {
22         struct ath9k_htc_priv *priv = file->private_data;
23         struct ath9k_htc_target_int_stats cmd_rsp;
24         char buf[512];
25         unsigned int len = 0;
26         int ret = 0;
27
28         memset(&cmd_rsp, 0, sizeof(cmd_rsp));
29
30         ath9k_htc_ps_wakeup(priv);
31
32         WMI_CMD(WMI_INT_STATS_CMDID);
33         if (ret) {
34                 ath9k_htc_ps_restore(priv);
35                 return -EINVAL;
36         }
37
38         ath9k_htc_ps_restore(priv);
39
40         len += snprintf(buf + len, sizeof(buf) - len,
41                         "%20s : %10u\n", "RX",
42                         be32_to_cpu(cmd_rsp.rx));
43
44         len += snprintf(buf + len, sizeof(buf) - len,
45                         "%20s : %10u\n", "RXORN",
46                         be32_to_cpu(cmd_rsp.rxorn));
47
48         len += snprintf(buf + len, sizeof(buf) - len,
49                         "%20s : %10u\n", "RXEOL",
50                         be32_to_cpu(cmd_rsp.rxeol));
51
52         len += snprintf(buf + len, sizeof(buf) - len,
53                         "%20s : %10u\n", "TXURN",
54                         be32_to_cpu(cmd_rsp.txurn));
55
56         len += snprintf(buf + len, sizeof(buf) - len,
57                         "%20s : %10u\n", "TXTO",
58                         be32_to_cpu(cmd_rsp.txto));
59
60         len += snprintf(buf + len, sizeof(buf) - len,
61                         "%20s : %10u\n", "CST",
62                         be32_to_cpu(cmd_rsp.cst));
63
64         if (len > sizeof(buf))
65                 len = sizeof(buf);
66
67         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
68 }
69
70 static const struct file_operations fops_tgt_int_stats = {
71         .read = read_file_tgt_int_stats,
72         .open = simple_open,
73         .owner = THIS_MODULE,
74         .llseek = default_llseek,
75 };
76
77 static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
78                                       size_t count, loff_t *ppos)
79 {
80         struct ath9k_htc_priv *priv = file->private_data;
81         struct ath9k_htc_target_tx_stats cmd_rsp;
82         char buf[512];
83         unsigned int len = 0;
84         int ret = 0;
85
86         memset(&cmd_rsp, 0, sizeof(cmd_rsp));
87
88         ath9k_htc_ps_wakeup(priv);
89
90         WMI_CMD(WMI_TX_STATS_CMDID);
91         if (ret) {
92                 ath9k_htc_ps_restore(priv);
93                 return -EINVAL;
94         }
95
96         ath9k_htc_ps_restore(priv);
97
98         len += snprintf(buf + len, sizeof(buf) - len,
99                         "%20s : %10u\n", "Xretries",
100                         be32_to_cpu(cmd_rsp.xretries));
101
102         len += snprintf(buf + len, sizeof(buf) - len,
103                         "%20s : %10u\n", "FifoErr",
104                         be32_to_cpu(cmd_rsp.fifoerr));
105
106         len += snprintf(buf + len, sizeof(buf) - len,
107                         "%20s : %10u\n", "Filtered",
108                         be32_to_cpu(cmd_rsp.filtered));
109
110         len += snprintf(buf + len, sizeof(buf) - len,
111                         "%20s : %10u\n", "TimerExp",
112                         be32_to_cpu(cmd_rsp.timer_exp));
113
114         len += snprintf(buf + len, sizeof(buf) - len,
115                         "%20s : %10u\n", "ShortRetries",
116                         be32_to_cpu(cmd_rsp.shortretries));
117
118         len += snprintf(buf + len, sizeof(buf) - len,
119                         "%20s : %10u\n", "LongRetries",
120                         be32_to_cpu(cmd_rsp.longretries));
121
122         len += snprintf(buf + len, sizeof(buf) - len,
123                         "%20s : %10u\n", "QueueNull",
124                         be32_to_cpu(cmd_rsp.qnull));
125
126         len += snprintf(buf + len, sizeof(buf) - len,
127                         "%20s : %10u\n", "EncapFail",
128                         be32_to_cpu(cmd_rsp.encap_fail));
129
130         len += snprintf(buf + len, sizeof(buf) - len,
131                         "%20s : %10u\n", "NoBuf",
132                         be32_to_cpu(cmd_rsp.nobuf));
133
134         if (len > sizeof(buf))
135                 len = sizeof(buf);
136
137         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
138 }
139
140 static const struct file_operations fops_tgt_tx_stats = {
141         .read = read_file_tgt_tx_stats,
142         .open = simple_open,
143         .owner = THIS_MODULE,
144         .llseek = default_llseek,
145 };
146
147 static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
148                                       size_t count, loff_t *ppos)
149 {
150         struct ath9k_htc_priv *priv = file->private_data;
151         struct ath9k_htc_target_rx_stats cmd_rsp;
152         char buf[512];
153         unsigned int len = 0;
154         int ret = 0;
155
156         memset(&cmd_rsp, 0, sizeof(cmd_rsp));
157
158         ath9k_htc_ps_wakeup(priv);
159
160         WMI_CMD(WMI_RX_STATS_CMDID);
161         if (ret) {
162                 ath9k_htc_ps_restore(priv);
163                 return -EINVAL;
164         }
165
166         ath9k_htc_ps_restore(priv);
167
168         len += snprintf(buf + len, sizeof(buf) - len,
169                         "%20s : %10u\n", "NoBuf",
170                         be32_to_cpu(cmd_rsp.nobuf));
171
172         len += snprintf(buf + len, sizeof(buf) - len,
173                         "%20s : %10u\n", "HostSend",
174                         be32_to_cpu(cmd_rsp.host_send));
175
176         len += snprintf(buf + len, sizeof(buf) - len,
177                         "%20s : %10u\n", "HostDone",
178                         be32_to_cpu(cmd_rsp.host_done));
179
180         if (len > sizeof(buf))
181                 len = sizeof(buf);
182
183         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
184 }
185
186 static const struct file_operations fops_tgt_rx_stats = {
187         .read = read_file_tgt_rx_stats,
188         .open = simple_open,
189         .owner = THIS_MODULE,
190         .llseek = default_llseek,
191 };
192
193 static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
194                               size_t count, loff_t *ppos)
195 {
196         struct ath9k_htc_priv *priv = file->private_data;
197         char buf[512];
198         unsigned int len = 0;
199
200         len += snprintf(buf + len, sizeof(buf) - len,
201                         "%20s : %10u\n", "Buffers queued",
202                         priv->debug.tx_stats.buf_queued);
203         len += snprintf(buf + len, sizeof(buf) - len,
204                         "%20s : %10u\n", "Buffers completed",
205                         priv->debug.tx_stats.buf_completed);
206         len += snprintf(buf + len, sizeof(buf) - len,
207                         "%20s : %10u\n", "SKBs queued",
208                         priv->debug.tx_stats.skb_queued);
209         len += snprintf(buf + len, sizeof(buf) - len,
210                         "%20s : %10u\n", "SKBs success",
211                         priv->debug.tx_stats.skb_success);
212         len += snprintf(buf + len, sizeof(buf) - len,
213                         "%20s : %10u\n", "SKBs failed",
214                         priv->debug.tx_stats.skb_failed);
215         len += snprintf(buf + len, sizeof(buf) - len,
216                         "%20s : %10u\n", "CAB queued",
217                         priv->debug.tx_stats.cab_queued);
218
219         len += snprintf(buf + len, sizeof(buf) - len,
220                         "%20s : %10u\n", "BE queued",
221                         priv->debug.tx_stats.queue_stats[IEEE80211_AC_BE]);
222         len += snprintf(buf + len, sizeof(buf) - len,
223                         "%20s : %10u\n", "BK queued",
224                         priv->debug.tx_stats.queue_stats[IEEE80211_AC_BK]);
225         len += snprintf(buf + len, sizeof(buf) - len,
226                         "%20s : %10u\n", "VI queued",
227                         priv->debug.tx_stats.queue_stats[IEEE80211_AC_VI]);
228         len += snprintf(buf + len, sizeof(buf) - len,
229                         "%20s : %10u\n", "VO queued",
230                         priv->debug.tx_stats.queue_stats[IEEE80211_AC_VO]);
231
232         if (len > sizeof(buf))
233                 len = sizeof(buf);
234
235         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
236 }
237
238 static const struct file_operations fops_xmit = {
239         .read = read_file_xmit,
240         .open = simple_open,
241         .owner = THIS_MODULE,
242         .llseek = default_llseek,
243 };
244
245 void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
246                            struct ath_htc_rx_status *rxs)
247 {
248 #define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++
249
250         if (rxs->rs_status & ATH9K_RXERR_CRC)
251                 priv->debug.rx_stats.err_crc++;
252         if (rxs->rs_status & ATH9K_RXERR_DECRYPT)
253                 priv->debug.rx_stats.err_decrypt_crc++;
254         if (rxs->rs_status & ATH9K_RXERR_MIC)
255                 priv->debug.rx_stats.err_mic++;
256         if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE)
257                 priv->debug.rx_stats.err_pre_delim++;
258         if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST)
259                 priv->debug.rx_stats.err_post_delim++;
260         if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY)
261                 priv->debug.rx_stats.err_decrypt_busy++;
262
263         if (rxs->rs_status & ATH9K_RXERR_PHY) {
264                 priv->debug.rx_stats.err_phy++;
265                 if (rxs->rs_phyerr < ATH9K_PHYERR_MAX)
266                         RX_PHY_ERR_INC(rxs->rs_phyerr);
267         }
268
269 #undef RX_PHY_ERR_INC
270 }
271
272 static ssize_t read_file_recv(struct file *file, char __user *user_buf,
273                               size_t count, loff_t *ppos)
274 {
275 #define PHY_ERR(s, p)                                                   \
276         len += snprintf(buf + len, size - len, "%20s : %10u\n", s,      \
277                         priv->debug.rx_stats.err_phy_stats[p]);
278
279         struct ath9k_htc_priv *priv = file->private_data;
280         char *buf;
281         unsigned int len = 0, size = 1500;
282         ssize_t retval = 0;
283
284         buf = kzalloc(size, GFP_KERNEL);
285         if (buf == NULL)
286                 return -ENOMEM;
287
288         len += snprintf(buf + len, size - len,
289                         "%20s : %10u\n", "SKBs allocated",
290                         priv->debug.rx_stats.skb_allocated);
291         len += snprintf(buf + len, size - len,
292                         "%20s : %10u\n", "SKBs completed",
293                         priv->debug.rx_stats.skb_completed);
294         len += snprintf(buf + len, size - len,
295                         "%20s : %10u\n", "SKBs Dropped",
296                         priv->debug.rx_stats.skb_dropped);
297
298         len += snprintf(buf + len, size - len,
299                         "%20s : %10u\n", "CRC ERR",
300                         priv->debug.rx_stats.err_crc);
301         len += snprintf(buf + len, size - len,
302                         "%20s : %10u\n", "DECRYPT CRC ERR",
303                         priv->debug.rx_stats.err_decrypt_crc);
304         len += snprintf(buf + len, size - len,
305                         "%20s : %10u\n", "MIC ERR",
306                         priv->debug.rx_stats.err_mic);
307         len += snprintf(buf + len, size - len,
308                         "%20s : %10u\n", "PRE-DELIM CRC ERR",
309                         priv->debug.rx_stats.err_pre_delim);
310         len += snprintf(buf + len, size - len,
311                         "%20s : %10u\n", "POST-DELIM CRC ERR",
312                         priv->debug.rx_stats.err_post_delim);
313         len += snprintf(buf + len, size - len,
314                         "%20s : %10u\n", "DECRYPT BUSY ERR",
315                         priv->debug.rx_stats.err_decrypt_busy);
316         len += snprintf(buf + len, size - len,
317                         "%20s : %10u\n", "TOTAL PHY ERR",
318                         priv->debug.rx_stats.err_phy);
319
320
321         PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN);
322         PHY_ERR("TIMING", ATH9K_PHYERR_TIMING);
323         PHY_ERR("PARITY", ATH9K_PHYERR_PARITY);
324         PHY_ERR("RATE", ATH9K_PHYERR_RATE);
325         PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH);
326         PHY_ERR("RADAR", ATH9K_PHYERR_RADAR);
327         PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE);
328         PHY_ERR("TOR", ATH9K_PHYERR_TOR);
329         PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING);
330         PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY);
331         PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL);
332         PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL);
333         PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP);
334         PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE);
335         PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART);
336         PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT);
337         PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING);
338         PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC);
339         PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL);
340         PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE);
341         PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART);
342         PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL);
343         PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP);
344         PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR);
345         PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL);
346         PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL);
347
348         if (len > size)
349                 len = size;
350
351         retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
352         kfree(buf);
353
354         return retval;
355
356 #undef PHY_ERR
357 }
358
359 static const struct file_operations fops_recv = {
360         .read = read_file_recv,
361         .open = simple_open,
362         .owner = THIS_MODULE,
363         .llseek = default_llseek,
364 };
365
366 static ssize_t read_file_slot(struct file *file, char __user *user_buf,
367                               size_t count, loff_t *ppos)
368 {
369         struct ath9k_htc_priv *priv = file->private_data;
370         char buf[512];
371         unsigned int len = 0;
372
373         spin_lock_bh(&priv->tx.tx_lock);
374
375         len += snprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : ");
376
377         len += bitmap_scnprintf(buf + len, sizeof(buf) - len,
378                                priv->tx.tx_slot, MAX_TX_BUF_NUM);
379
380         len += snprintf(buf + len, sizeof(buf) - len, "\n");
381
382         len += snprintf(buf + len, sizeof(buf) - len,
383                         "Used slots     : %d\n",
384                         bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM));
385
386         spin_unlock_bh(&priv->tx.tx_lock);
387
388         if (len > sizeof(buf))
389                 len = sizeof(buf);
390
391         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
392 }
393
394 static const struct file_operations fops_slot = {
395         .read = read_file_slot,
396         .open = simple_open,
397         .owner = THIS_MODULE,
398         .llseek = default_llseek,
399 };
400
401 static ssize_t read_file_queue(struct file *file, char __user *user_buf,
402                                size_t count, loff_t *ppos)
403 {
404         struct ath9k_htc_priv *priv = file->private_data;
405         char buf[512];
406         unsigned int len = 0;
407
408         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
409                         "Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue));
410
411         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
412                         "Cab endpoint", skb_queue_len(&priv->tx.cab_ep_queue));
413
414         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
415                         "Data BE endpoint", skb_queue_len(&priv->tx.data_be_queue));
416
417         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
418                         "Data BK endpoint", skb_queue_len(&priv->tx.data_bk_queue));
419
420         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
421                         "Data VI endpoint", skb_queue_len(&priv->tx.data_vi_queue));
422
423         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
424                         "Data VO endpoint", skb_queue_len(&priv->tx.data_vo_queue));
425
426         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
427                         "Failed queue", skb_queue_len(&priv->tx.tx_failed));
428
429         spin_lock_bh(&priv->tx.tx_lock);
430         len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
431                         "Queued count", priv->tx.queued_cnt);
432         spin_unlock_bh(&priv->tx.tx_lock);
433
434         if (len > sizeof(buf))
435                 len = sizeof(buf);
436
437         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
438
439 }
440
441 static const struct file_operations fops_queue = {
442         .read = read_file_queue,
443         .open = simple_open,
444         .owner = THIS_MODULE,
445         .llseek = default_llseek,
446 };
447
448 static ssize_t read_file_debug(struct file *file, char __user *user_buf,
449                                size_t count, loff_t *ppos)
450 {
451         struct ath9k_htc_priv *priv = file->private_data;
452         struct ath_common *common = ath9k_hw_common(priv->ah);
453         char buf[32];
454         unsigned int len;
455
456         len = sprintf(buf, "0x%08x\n", common->debug_mask);
457         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
458 }
459
460 static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
461                                 size_t count, loff_t *ppos)
462 {
463         struct ath9k_htc_priv *priv = file->private_data;
464         struct ath_common *common = ath9k_hw_common(priv->ah);
465         unsigned long mask;
466         char buf[32];
467         ssize_t len;
468
469         len = min(count, sizeof(buf) - 1);
470         if (copy_from_user(buf, user_buf, len))
471                 return -EFAULT;
472
473         buf[len] = '\0';
474         if (kstrtoul(buf, 0, &mask))
475                 return -EINVAL;
476
477         common->debug_mask = mask;
478         return count;
479 }
480
481 static const struct file_operations fops_debug = {
482         .read = read_file_debug,
483         .write = write_file_debug,
484         .open = simple_open,
485         .owner = THIS_MODULE,
486         .llseek = default_llseek,
487 };
488
489 static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
490                                      size_t count, loff_t *ppos)
491 {
492         struct ath9k_htc_priv *priv = file->private_data;
493         struct ath_common *common = ath9k_hw_common(priv->ah);
494         struct base_eep_header *pBase = NULL;
495         unsigned int len = 0, size = 1500;
496         ssize_t retval = 0;
497         char *buf;
498
499         pBase = ath9k_htc_get_eeprom_base(priv);
500
501         if (pBase == NULL) {
502                 ath_err(common, "Unknown EEPROM type\n");
503                 return 0;
504         }
505
506         buf = kzalloc(size, GFP_KERNEL);
507         if (buf == NULL)
508                 return -ENOMEM;
509
510         len += snprintf(buf + len, size - len,
511                         "%20s : %10d\n", "Major Version",
512                         pBase->version >> 12);
513         len += snprintf(buf + len, size - len,
514                         "%20s : %10d\n", "Minor Version",
515                         pBase->version & 0xFFF);
516         len += snprintf(buf + len, size - len,
517                         "%20s : %10d\n", "Checksum",
518                         pBase->checksum);
519         len += snprintf(buf + len, size - len,
520                         "%20s : %10d\n", "Length",
521                         pBase->length);
522         len += snprintf(buf + len, size - len,
523                         "%20s : %10d\n", "RegDomain1",
524                         pBase->regDmn[0]);
525         len += snprintf(buf + len, size - len,
526                         "%20s : %10d\n", "RegDomain2",
527                         pBase->regDmn[1]);
528         len += snprintf(buf + len, size - len,
529                         "%20s : %10d\n",
530                         "TX Mask", pBase->txMask);
531         len += snprintf(buf + len, size - len,
532                         "%20s : %10d\n",
533                         "RX Mask", pBase->rxMask);
534         len += snprintf(buf + len, size - len,
535                         "%20s : %10d\n",
536                         "Allow 5GHz",
537                         !!(pBase->opCapFlags & AR5416_OPFLAGS_11A));
538         len += snprintf(buf + len, size - len,
539                         "%20s : %10d\n",
540                         "Allow 2GHz",
541                         !!(pBase->opCapFlags & AR5416_OPFLAGS_11G));
542         len += snprintf(buf + len, size - len,
543                         "%20s : %10d\n",
544                         "Disable 2GHz HT20",
545                         !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20));
546         len += snprintf(buf + len, size - len,
547                         "%20s : %10d\n",
548                         "Disable 2GHz HT40",
549                         !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40));
550         len += snprintf(buf + len, size - len,
551                         "%20s : %10d\n",
552                         "Disable 5Ghz HT20",
553                         !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20));
554         len += snprintf(buf + len, size - len,
555                         "%20s : %10d\n",
556                         "Disable 5Ghz HT40",
557                         !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40));
558         len += snprintf(buf + len, size - len,
559                         "%20s : %10d\n",
560                         "Big Endian",
561                         !!(pBase->eepMisc & 0x01));
562         len += snprintf(buf + len, size - len,
563                         "%20s : %10d\n",
564                         "Cal Bin Major Ver",
565                         (pBase->binBuildNumber >> 24) & 0xFF);
566         len += snprintf(buf + len, size - len,
567                         "%20s : %10d\n",
568                         "Cal Bin Minor Ver",
569                         (pBase->binBuildNumber >> 16) & 0xFF);
570         len += snprintf(buf + len, size - len,
571                         "%20s : %10d\n",
572                         "Cal Bin Build",
573                         (pBase->binBuildNumber >> 8) & 0xFF);
574
575         /*
576          * UB91 specific data.
577          */
578         if (AR_SREV_9271(priv->ah)) {
579                 struct base_eep_header_4k *pBase4k =
580                         &priv->ah->eeprom.map4k.baseEepHeader;
581
582                 len += snprintf(buf + len, size - len,
583                                 "%20s : %10d\n",
584                                 "TX Gain type",
585                                 pBase4k->txGainType);
586         }
587
588         /*
589          * UB95 specific data.
590          */
591         if (priv->ah->hw_version.usbdev == AR9287_USB) {
592                 struct base_eep_ar9287_header *pBase9287 =
593                         &priv->ah->eeprom.map9287.baseEepHeader;
594
595                 len += snprintf(buf + len, size - len,
596                                 "%20s : %10ddB\n",
597                                 "Power Table Offset",
598                                 pBase9287->pwrTableOffset);
599
600                 len += snprintf(buf + len, size - len,
601                                 "%20s : %10d\n",
602                                 "OpenLoop Power Ctrl",
603                                 pBase9287->openLoopPwrCntl);
604         }
605
606         len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
607                         pBase->macAddr);
608         if (len > size)
609                 len = size;
610
611         retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
612         kfree(buf);
613
614         return retval;
615 }
616
617 static const struct file_operations fops_base_eeprom = {
618         .read = read_file_base_eeprom,
619         .open = simple_open,
620         .owner = THIS_MODULE,
621         .llseek = default_llseek,
622 };
623
624 static ssize_t read_4k_modal_eeprom(struct file *file,
625                                     char __user *user_buf,
626                                     size_t count, loff_t *ppos)
627 {
628 #define PR_EEP(_s, _val)                                                \
629         do {                                                            \
630                 len += snprintf(buf + len, size - len, "%20s : %10d\n", \
631                                 _s, (_val));                            \
632         } while (0)
633
634         struct ath9k_htc_priv *priv = file->private_data;
635         struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader;
636         unsigned int len = 0, size = 2048;
637         ssize_t retval = 0;
638         char *buf;
639
640         buf = kzalloc(size, GFP_KERNEL);
641         if (buf == NULL)
642                 return -ENOMEM;
643
644         PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
645         PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
646         PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
647         PR_EEP("Switch Settle", pModal->switchSettling);
648         PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
649         PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
650         PR_EEP("ADC Desired size", pModal->adcDesiredSize);
651         PR_EEP("PGA Desired size", pModal->pgaDesiredSize);
652         PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]);
653         PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
654         PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
655         PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
656         PR_EEP("CCA Threshold)", pModal->thresh62);
657         PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
658         PR_EEP("xpdGain", pModal->xpdGain);
659         PR_EEP("External PD", pModal->xpd);
660         PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
661         PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
662         PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
663         PR_EEP("O/D Bias Version", pModal->version);
664         PR_EEP("CCK OutputBias", pModal->ob_0);
665         PR_EEP("BPSK OutputBias", pModal->ob_1);
666         PR_EEP("QPSK OutputBias", pModal->ob_2);
667         PR_EEP("16QAM OutputBias", pModal->ob_3);
668         PR_EEP("64QAM OutputBias", pModal->ob_4);
669         PR_EEP("CCK Driver1_Bias", pModal->db1_0);
670         PR_EEP("BPSK Driver1_Bias", pModal->db1_1);
671         PR_EEP("QPSK Driver1_Bias", pModal->db1_2);
672         PR_EEP("16QAM Driver1_Bias", pModal->db1_3);
673         PR_EEP("64QAM Driver1_Bias", pModal->db1_4);
674         PR_EEP("CCK Driver2_Bias", pModal->db2_0);
675         PR_EEP("BPSK Driver2_Bias", pModal->db2_1);
676         PR_EEP("QPSK Driver2_Bias", pModal->db2_2);
677         PR_EEP("16QAM Driver2_Bias", pModal->db2_3);
678         PR_EEP("64QAM Driver2_Bias", pModal->db2_4);
679         PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
680         PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
681         PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
682         PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
683         PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
684         PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
685         PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
686         PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]);
687         PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]);
688         PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1);
689         PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2);
690         PR_EEP("TX Diversity", pModal->tx_diversity);
691
692         if (len > size)
693                 len = size;
694
695         retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
696         kfree(buf);
697
698         return retval;
699
700 #undef PR_EEP
701 }
702
703 static ssize_t read_def_modal_eeprom(struct file *file,
704                                      char __user *user_buf,
705                                      size_t count, loff_t *ppos)
706 {
707 #define PR_EEP(_s, _val)                                                \
708         do {                                                            \
709                 if (pBase->opCapFlags & AR5416_OPFLAGS_11G) {           \
710                         pModal = &priv->ah->eeprom.def.modalHeader[1];  \
711                         len += snprintf(buf + len, size - len, "%20s : %8d%7s", \
712                                         _s, (_val), "|");               \
713                 }                                                       \
714                 if (pBase->opCapFlags & AR5416_OPFLAGS_11A) {           \
715                         pModal = &priv->ah->eeprom.def.modalHeader[0];  \
716                         len += snprintf(buf + len, size - len, "%9d\n", \
717                                         (_val));                        \
718                 }                                                       \
719         } while (0)
720
721         struct ath9k_htc_priv *priv = file->private_data;
722         struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader;
723         struct modal_eep_header *pModal = NULL;
724         unsigned int len = 0, size = 3500;
725         ssize_t retval = 0;
726         char *buf;
727
728         buf = kzalloc(size, GFP_KERNEL);
729         if (buf == NULL)
730                 return -ENOMEM;
731
732         len += snprintf(buf + len, size - len,
733                         "%31s %15s\n", "2G", "5G");
734         len += snprintf(buf + len, size - len,
735                         "%32s %16s\n", "====", "====\n");
736
737         PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
738         PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
739         PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]);
740         PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
741         PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
742         PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
743         PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]);
744         PR_EEP("Switch Settle", pModal->switchSettling);
745         PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
746         PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
747         PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]);
748         PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
749         PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
750         PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]);
751         PR_EEP("ADC Desired size", pModal->adcDesiredSize);
752         PR_EEP("PGA Desired size", pModal->pgaDesiredSize);
753         PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]);
754         PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]);
755         PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]);
756         PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
757         PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
758         PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
759         PR_EEP("CCA Threshold)", pModal->thresh62);
760         PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
761         PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
762         PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]);
763         PR_EEP("xpdGain", pModal->xpdGain);
764         PR_EEP("External PD", pModal->xpd);
765         PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
766         PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
767         PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]);
768         PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
769         PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
770         PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]);
771         PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
772         PR_EEP("Chain0 OutputBias", pModal->ob);
773         PR_EEP("Chain0 DriverBias", pModal->db);
774         PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
775         PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain);
776         PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain);
777         PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
778         PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
779         PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
780         PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
781         PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
782         PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]);
783         PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
784         PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
785         PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]);
786         PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
787         PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]);
788         PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]);
789         PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]);
790         PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]);
791         PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]);
792         PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]);
793         PR_EEP("Chain1 OutputBias", pModal->ob_ch1);
794         PR_EEP("Chain1 DriverBias", pModal->db_ch1);
795         PR_EEP("LNA Control", pModal->lna_ctl);
796         PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]);
797         PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]);
798         PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]);
799
800         if (len > size)
801                 len = size;
802
803         retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
804         kfree(buf);
805
806         return retval;
807
808 #undef PR_EEP
809 }
810
811 static ssize_t read_9287_modal_eeprom(struct file *file,
812                                       char __user *user_buf,
813                                       size_t count, loff_t *ppos)
814 {
815 #define PR_EEP(_s, _val)                                                \
816         do {                                                            \
817                 len += snprintf(buf + len, size - len, "%20s : %10d\n", \
818                                 _s, (_val));                            \
819         } while (0)
820
821         struct ath9k_htc_priv *priv = file->private_data;
822         struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader;
823         unsigned int len = 0, size = 3000;
824         ssize_t retval = 0;
825         char *buf;
826
827         buf = kzalloc(size, GFP_KERNEL);
828         if (buf == NULL)
829                 return -ENOMEM;
830
831         PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
832         PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
833         PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
834         PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
835         PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
836         PR_EEP("Switch Settle", pModal->switchSettling);
837         PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
838         PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
839         PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
840         PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
841         PR_EEP("ADC Desired size", pModal->adcDesiredSize);
842         PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
843         PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
844         PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
845         PR_EEP("CCA Threshold)", pModal->thresh62);
846         PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
847         PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
848         PR_EEP("xpdGain", pModal->xpdGain);
849         PR_EEP("External PD", pModal->xpd);
850         PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
851         PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
852         PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
853         PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
854         PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
855         PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
856         PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
857         PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
858         PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
859         PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
860         PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
861         PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
862         PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
863         PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
864         PR_EEP("AR92x7 Version", pModal->version);
865         PR_EEP("DriverBias1", pModal->db1);
866         PR_EEP("DriverBias2", pModal->db1);
867         PR_EEP("CCK OutputBias", pModal->ob_cck);
868         PR_EEP("PSK OutputBias", pModal->ob_psk);
869         PR_EEP("QAM OutputBias", pModal->ob_qam);
870         PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off);
871
872         if (len > size)
873                 len = size;
874
875         retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
876         kfree(buf);
877
878         return retval;
879
880 #undef PR_EEP
881 }
882
883 static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
884                                       size_t count, loff_t *ppos)
885 {
886         struct ath9k_htc_priv *priv = file->private_data;
887
888         if (AR_SREV_9271(priv->ah))
889                 return read_4k_modal_eeprom(file, user_buf, count, ppos);
890         else if (priv->ah->hw_version.usbdev == AR9280_USB)
891                 return read_def_modal_eeprom(file, user_buf, count, ppos);
892         else if (priv->ah->hw_version.usbdev == AR9287_USB)
893                 return read_9287_modal_eeprom(file, user_buf, count, ppos);
894
895         return 0;
896 }
897
898 static const struct file_operations fops_modal_eeprom = {
899         .read = read_file_modal_eeprom,
900         .open = simple_open,
901         .owner = THIS_MODULE,
902         .llseek = default_llseek,
903 };
904
905
906 /* Ethtool support for get-stats */
907 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
908 static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = {
909         "tx_pkts_nic",
910         "tx_bytes_nic",
911         "rx_pkts_nic",
912         "rx_bytes_nic",
913
914         AMKSTR(d_tx_pkts),
915
916         "d_rx_crc_err",
917         "d_rx_decrypt_crc_err",
918         "d_rx_phy_err",
919         "d_rx_mic_err",
920         "d_rx_pre_delim_crc_err",
921         "d_rx_post_delim_crc_err",
922         "d_rx_decrypt_busy_err",
923
924         "d_rx_phyerr_radar",
925         "d_rx_phyerr_ofdm_timing",
926         "d_rx_phyerr_cck_timing",
927
928 };
929 #define ATH9K_HTC_SSTATS_LEN ARRAY_SIZE(ath9k_htc_gstrings_stats)
930
931 void ath9k_htc_get_et_strings(struct ieee80211_hw *hw,
932                               struct ieee80211_vif *vif,
933                               u32 sset, u8 *data)
934 {
935         if (sset == ETH_SS_STATS)
936                 memcpy(data, *ath9k_htc_gstrings_stats,
937                        sizeof(ath9k_htc_gstrings_stats));
938 }
939
940 int ath9k_htc_get_et_sset_count(struct ieee80211_hw *hw,
941                                 struct ieee80211_vif *vif, int sset)
942 {
943         if (sset == ETH_SS_STATS)
944                 return ATH9K_HTC_SSTATS_LEN;
945         return 0;
946 }
947
948 #define STXBASE priv->debug.tx_stats
949 #define SRXBASE priv->debug.rx_stats
950 #define ASTXQ(a)                                        \
951         data[i++] = STXBASE.a[IEEE80211_AC_BE];         \
952         data[i++] = STXBASE.a[IEEE80211_AC_BK];         \
953         data[i++] = STXBASE.a[IEEE80211_AC_VI];         \
954         data[i++] = STXBASE.a[IEEE80211_AC_VO]
955
956 void ath9k_htc_get_et_stats(struct ieee80211_hw *hw,
957                             struct ieee80211_vif *vif,
958                             struct ethtool_stats *stats, u64 *data)
959 {
960         struct ath9k_htc_priv *priv = hw->priv;
961         int i = 0;
962
963         data[i++] = STXBASE.skb_success;
964         data[i++] = STXBASE.skb_success_bytes;
965         data[i++] = SRXBASE.skb_completed;
966         data[i++] = SRXBASE.skb_completed_bytes;
967
968         ASTXQ(queue_stats);
969
970         data[i++] = SRXBASE.err_crc;
971         data[i++] = SRXBASE.err_decrypt_crc;
972         data[i++] = SRXBASE.err_phy;
973         data[i++] = SRXBASE.err_mic;
974         data[i++] = SRXBASE.err_pre_delim;
975         data[i++] = SRXBASE.err_post_delim;
976         data[i++] = SRXBASE.err_decrypt_busy;
977
978         data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_RADAR];
979         data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_OFDM_TIMING];
980         data[i++] = SRXBASE.err_phy_stats[ATH9K_PHYERR_CCK_TIMING];
981
982         WARN_ON(i != ATH9K_HTC_SSTATS_LEN);
983 }
984
985
986 int ath9k_htc_init_debug(struct ath_hw *ah)
987 {
988         struct ath_common *common = ath9k_hw_common(ah);
989         struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
990
991         priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
992                                              priv->hw->wiphy->debugfsdir);
993         if (!priv->debug.debugfs_phy)
994                 return -ENOMEM;
995
996         debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy,
997                             priv, &fops_tgt_int_stats);
998         debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy,
999                             priv, &fops_tgt_tx_stats);
1000         debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy,
1001                             priv, &fops_tgt_rx_stats);
1002         debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy,
1003                             priv, &fops_xmit);
1004         debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy,
1005                             priv, &fops_recv);
1006         debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy,
1007                             priv, &fops_slot);
1008         debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy,
1009                             priv, &fops_queue);
1010         debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy,
1011                             priv, &fops_debug);
1012         debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy,
1013                             priv, &fops_base_eeprom);
1014         debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy,
1015                             priv, &fops_modal_eeprom);
1016
1017         return 0;
1018 }