2 * Copyright (c) 2008-2011 Atheros Communications Inc.
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.
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.
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 #include <linux/nl80211.h>
20 #include <linux/pci.h>
21 #include <linux/module.h>
24 extern int ath9k_use_msi
;
26 static const struct pci_device_id ath_pci_id_table
[] = {
27 { PCI_VDEVICE(ATHEROS
, 0x0023) }, /* PCI */
28 { PCI_VDEVICE(ATHEROS
, 0x0024) }, /* PCI-E */
29 { PCI_VDEVICE(ATHEROS
, 0x0027) }, /* PCI */
31 #ifdef CONFIG_ATH9K_PCOEM
32 /* Mini PCI AR9220 MB92 cards: Compex WLM200NX, Wistron DNMA-92 */
33 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
35 PCI_VENDOR_ID_ATHEROS
,
37 .driver_data
= ATH9K_PCI_LED_ACT_HI
},
40 { PCI_VDEVICE(ATHEROS
, 0x0029) }, /* PCI */
42 #ifdef CONFIG_ATH9K_PCOEM
43 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
47 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
48 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
50 PCI_VENDOR_ID_FOXCONN
,
52 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
53 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
57 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
58 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
62 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
63 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
67 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
68 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
72 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
73 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
77 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
78 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
82 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
83 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
87 .driver_data
= ATH9K_PCI_D3_L1_WAR
},
90 { PCI_VDEVICE(ATHEROS
, 0x002A) }, /* PCI-E */
92 #ifdef CONFIG_ATH9K_PCOEM
93 /* AR9285 card for Asus */
94 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
98 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
101 { PCI_VDEVICE(ATHEROS
, 0x002B) }, /* PCI-E */
102 { PCI_VDEVICE(ATHEROS
, 0x002C) }, /* PCI-E 802.11n bonded out */
103 { PCI_VDEVICE(ATHEROS
, 0x002D) }, /* PCI */
104 { PCI_VDEVICE(ATHEROS
, 0x002E) }, /* PCI-E */
106 /* Killer Wireless (3x3) */
107 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
111 .driver_data
= ATH9K_PCI_KILLER
},
112 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
116 .driver_data
= ATH9K_PCI_KILLER
},
118 { PCI_VDEVICE(ATHEROS
, 0x0030) }, /* PCI-E AR9300 */
120 #ifdef CONFIG_ATH9K_PCOEM
122 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
124 PCI_VENDOR_ID_AZWAVE
,
126 .driver_data
= ATH9K_PCI_CUS198
| ATH9K_PCI_BT_ANT_DIV
},
127 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
129 PCI_VENDOR_ID_AZWAVE
,
131 .driver_data
= ATH9K_PCI_CUS198
| ATH9K_PCI_BT_ANT_DIV
},
132 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
134 PCI_VENDOR_ID_AZWAVE
,
136 .driver_data
= ATH9K_PCI_CUS198
| ATH9K_PCI_BT_ANT_DIV
},
137 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
139 PCI_VENDOR_ID_AZWAVE
,
141 .driver_data
= ATH9K_PCI_CUS198
| ATH9K_PCI_BT_ANT_DIV
},
144 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
146 PCI_VENDOR_ID_AZWAVE
,
148 .driver_data
= ATH9K_PCI_CUS230
| ATH9K_PCI_BT_ANT_DIV
},
149 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
151 PCI_VENDOR_ID_FOXCONN
,
153 .driver_data
= ATH9K_PCI_CUS230
| ATH9K_PCI_BT_ANT_DIV
},
156 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
158 PCI_VENDOR_ID_ATHEROS
,
160 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
161 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
163 PCI_VENDOR_ID_ATHEROS
,
165 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
166 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
170 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
171 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
175 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
176 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
178 PCI_VENDOR_ID_SAMSUNG
,
180 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
181 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
183 PCI_VENDOR_ID_SAMSUNG
,
185 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
186 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
188 PCI_VENDOR_ID_SAMSUNG
,
190 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
191 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
193 PCI_VENDOR_ID_SAMSUNG
,
195 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
196 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
198 PCI_VENDOR_ID_SAMSUNG
,
200 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
201 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
203 PCI_VENDOR_ID_SAMSUNG
,
205 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
206 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
208 PCI_VENDOR_ID_SAMSUNG
,
210 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
211 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
213 PCI_VENDOR_ID_SAMSUNG
,
215 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
216 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
218 PCI_VENDOR_ID_LENOVO
,
220 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
221 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
223 PCI_VENDOR_ID_LENOVO
,
225 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
227 /* AR9485 cards with PLL power-save disabled by default. */
228 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
230 PCI_VENDOR_ID_AZWAVE
,
232 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
233 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
235 PCI_VENDOR_ID_AZWAVE
,
237 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
238 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
242 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
243 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
247 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
248 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
252 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
253 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
255 PCI_VENDOR_ID_FOXCONN
,
257 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
258 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
260 PCI_VENDOR_ID_FOXCONN
,
262 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
263 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
267 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
268 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
272 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
273 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
277 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
278 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
280 PCI_VENDOR_ID_AZWAVE
,
282 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
283 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
285 PCI_VENDOR_ID_AZWAVE
,
287 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
288 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
290 PCI_VENDOR_ID_AZWAVE
,
292 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
293 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
295 PCI_VENDOR_ID_AZWAVE
,
297 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
298 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
302 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
303 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
307 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
308 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
310 PCI_VENDOR_ID_ASUSTEK
,
312 .driver_data
= ATH9K_PCI_NO_PLL_PWRSAVE
},
315 { PCI_VDEVICE(ATHEROS
, 0x0032) }, /* PCI-E AR9485 */
316 { PCI_VDEVICE(ATHEROS
, 0x0033) }, /* PCI-E AR9580 */
318 #ifdef CONFIG_ATH9K_PCOEM
320 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
322 PCI_VENDOR_ID_AZWAVE
,
324 .driver_data
= ATH9K_PCI_CUS217
},
325 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
329 .driver_data
= ATH9K_PCI_CUS217
},
331 /* AR9462 with WoW support */
332 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
334 PCI_VENDOR_ID_ATHEROS
,
336 .driver_data
= ATH9K_PCI_WOW
},
337 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
339 PCI_VENDOR_ID_LENOVO
,
341 .driver_data
= ATH9K_PCI_WOW
},
342 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
344 PCI_VENDOR_ID_ATTANSIC
,
346 .driver_data
= ATH9K_PCI_WOW
},
347 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
349 PCI_VENDOR_ID_AZWAVE
,
351 .driver_data
= ATH9K_PCI_WOW
},
352 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
354 PCI_VENDOR_ID_ASUSTEK
,
356 .driver_data
= ATH9K_PCI_WOW
},
357 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
361 .driver_data
= ATH9K_PCI_WOW
},
362 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
366 .driver_data
= ATH9K_PCI_WOW
},
367 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
371 .driver_data
= ATH9K_PCI_WOW
},
372 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
376 .driver_data
= ATH9K_PCI_WOW
},
377 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
381 .driver_data
= ATH9K_PCI_WOW
},
382 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
384 0x10CF, /* Fujitsu */
386 .driver_data
= ATH9K_PCI_WOW
},
387 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
391 .driver_data
= ATH9K_PCI_WOW
},
392 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
396 .driver_data
= ATH9K_PCI_WOW
},
398 /* Killer Wireless (2x2) */
399 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
403 .driver_data
= ATH9K_PCI_KILLER
},
405 { PCI_VDEVICE(ATHEROS
, 0x0034) }, /* PCI-E AR9462 */
406 { PCI_VDEVICE(ATHEROS
, 0x0037) }, /* PCI-E AR1111/AR9485 */
409 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
411 PCI_VENDOR_ID_ATHEROS
,
413 .driver_data
= ATH9K_PCI_CUS252
|
414 ATH9K_PCI_AR9565_2ANT
|
415 ATH9K_PCI_BT_ANT_DIV
},
416 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
418 PCI_VENDOR_ID_AZWAVE
,
420 .driver_data
= ATH9K_PCI_CUS252
|
421 ATH9K_PCI_AR9565_2ANT
|
422 ATH9K_PCI_BT_ANT_DIV
},
425 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
427 PCI_VENDOR_ID_FOXCONN
,
429 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
430 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
434 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
435 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
439 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
440 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
444 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
445 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
449 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
450 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
454 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
455 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
459 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
460 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
464 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
465 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
469 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
470 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
474 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
475 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
479 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
480 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
482 PCI_VENDOR_ID_AZWAVE
,
484 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
485 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
487 PCI_VENDOR_ID_AZWAVE
,
489 .driver_data
= ATH9K_PCI_AR9565_1ANT
},
491 /* WB335 1-ANT / Antenna Diversity */
492 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
494 PCI_VENDOR_ID_ATHEROS
,
496 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
497 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
499 PCI_VENDOR_ID_ATHEROS
,
501 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
502 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
504 PCI_VENDOR_ID_ATHEROS
,
506 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
507 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
509 PCI_VENDOR_ID_FOXCONN
,
511 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
512 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
516 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
517 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
521 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
522 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
526 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
527 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
531 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
532 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
536 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
537 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
541 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
542 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
544 PCI_VENDOR_ID_AZWAVE
,
546 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
547 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
549 PCI_VENDOR_ID_AZWAVE
,
551 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
552 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
556 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
557 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
561 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
562 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
566 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
567 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
571 .driver_data
= ATH9K_PCI_AR9565_1ANT
| ATH9K_PCI_BT_ANT_DIV
},
573 /* WB335 2-ANT / Antenna-Diversity */
574 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
576 PCI_VENDOR_ID_SAMSUNG
,
578 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
579 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
581 PCI_VENDOR_ID_SAMSUNG
,
583 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
584 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
586 PCI_VENDOR_ID_SAMSUNG
,
588 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
589 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
591 PCI_VENDOR_ID_SAMSUNG
,
593 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
594 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
596 PCI_VENDOR_ID_SAMSUNG
,
598 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
599 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
601 PCI_VENDOR_ID_SAMSUNG
,
603 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
604 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
606 PCI_VENDOR_ID_SAMSUNG
,
608 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
609 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
611 PCI_VENDOR_ID_ATHEROS
,
613 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
614 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
616 PCI_VENDOR_ID_ATHEROS
,
618 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
619 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
623 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
624 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
628 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
629 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
633 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
634 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
638 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
639 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
643 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
644 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
648 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
649 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
653 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
654 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
658 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
659 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
661 PCI_VENDOR_ID_AZWAVE
,
663 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
664 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
666 PCI_VENDOR_ID_AZWAVE
,
668 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
669 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
671 PCI_VENDOR_ID_AZWAVE
,
673 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
674 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
676 PCI_VENDOR_ID_AZWAVE
,
678 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
679 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
681 PCI_VENDOR_ID_AZWAVE
,
683 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
684 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
686 PCI_VENDOR_ID_AZWAVE
,
688 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
689 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
693 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
694 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
698 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
699 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
703 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
704 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
708 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
709 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
713 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
714 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
718 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
719 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
723 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
724 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
726 PCI_VENDOR_ID_FOXCONN
,
728 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
729 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
731 PCI_VENDOR_ID_FOXCONN
,
733 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
734 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
736 PCI_VENDOR_ID_FOXCONN
,
738 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
739 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
741 PCI_VENDOR_ID_FOXCONN
,
743 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
744 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
746 PCI_VENDOR_ID_FOXCONN
,
748 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
749 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
751 PCI_VENDOR_ID_LENOVO
,
753 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
754 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
756 PCI_VENDOR_ID_LENOVO
,
758 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
759 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
761 PCI_VENDOR_ID_ASUSTEK
,
763 .driver_data
= ATH9K_PCI_AR9565_2ANT
| ATH9K_PCI_BT_ANT_DIV
},
764 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS
,
768 .driver_data
= ATH9K_PCI_AR9565_2ANT
|
769 ATH9K_PCI_BT_ANT_DIV
|
770 ATH9K_PCI_LED_ACT_HI
},
772 /* PCI-E AR9565 (WB335) */
773 { PCI_VDEVICE(ATHEROS
, 0x0036),
774 .driver_data
= ATH9K_PCI_BT_ANT_DIV
},
781 /* return bus cachesize in 4B word units */
782 static void ath_pci_read_cachesize(struct ath_common
*common
, int *csz
)
784 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
787 pci_read_config_byte(to_pci_dev(sc
->dev
), PCI_CACHE_LINE_SIZE
, &u8tmp
);
791 * This check was put in to avoid "unpleasant" consequences if
792 * the bootrom has not fully initialized all PCI devices.
793 * Sometimes the cache line size register is not set
797 *csz
= DEFAULT_CACHELINE
>> 2; /* Use the default size */
800 static bool ath_pci_eeprom_read(struct ath_common
*common
, u32 off
, u16
*data
)
802 struct ath_hw
*ah
= (struct ath_hw
*) common
->ah
;
804 common
->ops
->read(ah
, AR5416_EEPROM_OFFSET
+ (off
<< AR5416_EEPROM_S
));
806 if (!ath9k_hw_wait(ah
,
807 AR_EEPROM_STATUS_DATA
,
808 AR_EEPROM_STATUS_DATA_BUSY
|
809 AR_EEPROM_STATUS_DATA_PROT_ACCESS
, 0,
814 *data
= MS(common
->ops
->read(ah
, AR_EEPROM_STATUS_DATA
),
815 AR_EEPROM_STATUS_DATA_VAL
);
820 /* Need to be called after we discover btcoex capabilities */
821 static void ath_pci_aspm_init(struct ath_common
*common
)
823 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
824 struct ath_hw
*ah
= sc
->sc_ah
;
825 struct pci_dev
*pdev
= to_pci_dev(sc
->dev
);
826 struct pci_dev
*parent
;
829 if (!ah
->is_pciexpress
)
832 parent
= pdev
->bus
->self
;
836 if ((ath9k_hw_get_btcoex_scheme(ah
) != ATH_BTCOEX_CFG_NONE
) &&
837 (AR_SREV_9285(ah
))) {
838 /* Bluetooth coexistence requires disabling ASPM. */
839 pcie_capability_clear_word(pdev
, PCI_EXP_LNKCTL
,
840 PCI_EXP_LNKCTL_ASPM_L0S
| PCI_EXP_LNKCTL_ASPM_L1
);
843 * Both upstream and downstream PCIe components should
844 * have the same ASPM settings.
846 pcie_capability_clear_word(parent
, PCI_EXP_LNKCTL
,
847 PCI_EXP_LNKCTL_ASPM_L0S
| PCI_EXP_LNKCTL_ASPM_L1
);
849 ath_info(common
, "Disabling ASPM since BTCOEX is enabled\n");
854 * 0x70c - Ack Frequency Register.
856 * Bits 27:29 - DEFAULT_L1_ENTRANCE_LATENCY.
866 if (AR_SREV_9462(ah
))
867 pci_read_config_dword(pdev
, 0x70c, &ah
->config
.aspm_l1_fix
);
869 pcie_capability_read_word(parent
, PCI_EXP_LNKCTL
, &aspm
);
870 if (aspm
& (PCI_EXP_LNKCTL_ASPM_L0S
| PCI_EXP_LNKCTL_ASPM_L1
)) {
871 ah
->aspm_enabled
= true;
872 /* Initialize PCIe PM and SERDES registers. */
873 ath9k_hw_configpcipowersave(ah
, false);
874 ath_info(common
, "ASPM enabled: 0x%x\n", aspm
);
878 static const struct ath_bus_ops ath_pci_bus_ops
= {
879 .ath_bus_type
= ATH_PCI
,
880 .read_cachesize
= ath_pci_read_cachesize
,
881 .eeprom_read
= ath_pci_eeprom_read
,
882 .aspm_init
= ath_pci_aspm_init
,
885 static int ath_pci_probe(struct pci_dev
*pdev
, const struct pci_device_id
*id
)
887 struct ath_softc
*sc
;
888 struct ieee80211_hw
*hw
;
895 if (pcim_enable_device(pdev
))
898 ret
= pci_set_dma_mask(pdev
, DMA_BIT_MASK(32));
900 pr_err("32-bit DMA not available\n");
904 ret
= pci_set_consistent_dma_mask(pdev
, DMA_BIT_MASK(32));
906 pr_err("32-bit DMA consistent DMA enable failed\n");
911 * Cache line size is used to size and align various
912 * structures used to communicate with the hardware.
914 pci_read_config_byte(pdev
, PCI_CACHE_LINE_SIZE
, &csz
);
917 * Linux 2.4.18 (at least) writes the cache line size
918 * register as a 16-bit wide register which is wrong.
919 * We must have this setup properly for rx buffer
920 * DMA to work so force a reasonable value here if it
923 csz
= L1_CACHE_BYTES
/ sizeof(u32
);
924 pci_write_config_byte(pdev
, PCI_CACHE_LINE_SIZE
, csz
);
927 * The default setting of latency timer yields poor results,
928 * set it to the value used by other systems. It may be worth
929 * tweaking this setting more.
931 pci_write_config_byte(pdev
, PCI_LATENCY_TIMER
, 0xa8);
933 pci_set_master(pdev
);
936 * Disable the RETRY_TIMEOUT register (0x41) to keep
937 * PCI Tx retries from interfering with C3 CPU state.
939 pci_read_config_dword(pdev
, 0x40, &val
);
940 if ((val
& 0x0000ff00) != 0)
941 pci_write_config_dword(pdev
, 0x40, val
& 0xffff00ff);
943 ret
= pcim_iomap_regions(pdev
, BIT(0), "ath9k");
945 dev_err(&pdev
->dev
, "PCI memory region reserve error\n");
949 ath9k_fill_chanctx_ops();
950 hw
= ieee80211_alloc_hw(sizeof(struct ath_softc
), &ath9k_ops
);
952 dev_err(&pdev
->dev
, "No memory for ieee80211_hw\n");
956 SET_IEEE80211_DEV(hw
, &pdev
->dev
);
957 pci_set_drvdata(pdev
, hw
);
961 sc
->dev
= &pdev
->dev
;
962 sc
->mem
= pcim_iomap_table(pdev
)[0];
963 sc
->driver_data
= id
->driver_data
;
966 if (pci_enable_msi(pdev
) == 0) {
968 dev_err(&pdev
->dev
, "Using MSI\n");
970 dev_err(&pdev
->dev
, "Using INTx\n");
975 ret
= request_irq(pdev
->irq
, ath_isr
, IRQF_SHARED
, "ath9k", sc
);
977 ret
= request_irq(pdev
->irq
, ath_isr
, 0, "ath9k", sc
);
980 dev_err(&pdev
->dev
, "request_irq failed\n");
986 ret
= ath9k_init_device(id
->device
, sc
, &ath_pci_bus_ops
);
988 dev_err(&pdev
->dev
, "Failed to initialize device\n");
992 sc
->sc_ah
->msi_enabled
= msi_enabled
;
993 sc
->sc_ah
->msi_reg
= 0;
995 ath9k_hw_name(sc
->sc_ah
, hw_name
, sizeof(hw_name
));
996 wiphy_info(hw
->wiphy
, "%s mem=0x%lx, irq=%d\n",
997 hw_name
, (unsigned long)sc
->mem
, pdev
->irq
);
1002 free_irq(sc
->irq
, sc
);
1004 ieee80211_free_hw(hw
);
1008 static void ath_pci_remove(struct pci_dev
*pdev
)
1010 struct ieee80211_hw
*hw
= pci_get_drvdata(pdev
);
1011 struct ath_softc
*sc
= hw
->priv
;
1013 if (!is_ath9k_unloaded
)
1014 sc
->sc_ah
->ah_flags
|= AH_UNPLUGGED
;
1015 ath9k_deinit_device(sc
);
1016 free_irq(sc
->irq
, sc
);
1017 ieee80211_free_hw(sc
->hw
);
1020 #ifdef CONFIG_PM_SLEEP
1022 static int ath_pci_suspend(struct device
*device
)
1024 struct ieee80211_hw
*hw
= dev_get_drvdata(device
);
1025 struct ath_softc
*sc
= hw
->priv
;
1026 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1028 if (test_bit(ATH_OP_WOW_ENABLED
, &common
->op_flags
)) {
1029 dev_info(device
, "WOW is enabled, bypassing PCI suspend\n");
1033 /* The device has to be moved to FULLSLEEP forcibly.
1034 * Otherwise the chip never moved to full sleep,
1035 * when no interface is up.
1037 ath9k_stop_btcoex(sc
);
1038 ath9k_hw_disable(sc
->sc_ah
);
1039 del_timer_sync(&sc
->sleep_timer
);
1040 ath9k_hw_setpower(sc
->sc_ah
, ATH9K_PM_FULL_SLEEP
);
1045 static int ath_pci_resume(struct device
*device
)
1047 struct pci_dev
*pdev
= to_pci_dev(device
);
1048 struct ieee80211_hw
*hw
= pci_get_drvdata(pdev
);
1049 struct ath_softc
*sc
= hw
->priv
;
1050 struct ath_hw
*ah
= sc
->sc_ah
;
1051 struct ath_common
*common
= ath9k_hw_common(ah
);
1055 * Suspend/Resume resets the PCI configuration space, so we have to
1056 * re-disable the RETRY_TIMEOUT register (0x41) to keep
1057 * PCI Tx retries from interfering with C3 CPU state
1059 pci_read_config_dword(pdev
, 0x40, &val
);
1060 if ((val
& 0x0000ff00) != 0)
1061 pci_write_config_dword(pdev
, 0x40, val
& 0xffff00ff);
1063 ath_pci_aspm_init(common
);
1064 ah
->reset_power_on
= false;
1069 static SIMPLE_DEV_PM_OPS(ath9k_pm_ops
, ath_pci_suspend
, ath_pci_resume
);
1071 #define ATH9K_PM_OPS (&ath9k_pm_ops)
1073 #else /* !CONFIG_PM_SLEEP */
1075 #define ATH9K_PM_OPS NULL
1077 #endif /* !CONFIG_PM_SLEEP */
1080 MODULE_DEVICE_TABLE(pci
, ath_pci_id_table
);
1082 static struct pci_driver ath_pci_driver
= {
1084 .id_table
= ath_pci_id_table
,
1085 .probe
= ath_pci_probe
,
1086 .remove
= ath_pci_remove
,
1087 .driver
.pm
= ATH9K_PM_OPS
,
1090 int ath_pci_init(void)
1092 return pci_register_driver(&ath_pci_driver
);
1095 void ath_pci_exit(void)
1097 pci_unregister_driver(&ath_pci_driver
);