blob: c0c8bf0429d10c351f07082bde42cd3db98c8ad4 [file] [log] [blame]
Sujith55624202010-01-08 10:36:02 +05301/*
Sujith Manoharan5b681382011-05-17 13:36:18 +05302 * Copyright (c) 2008-2011 Atheros Communications Inc.
Sujith55624202010-01-08 10:36:02 +05303 *
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
Joe Perches516304b2012-03-18 17:30:52 -070017#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
Alexey Dobriyanb7f080c2011-06-16 11:01:34 +000019#include <linux/dma-mapping.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090020#include <linux/slab.h>
Felix Fietkau6fb1b1e2011-03-19 13:55:39 +010021#include <linux/ath9k_platform.h>
Paul Gortmaker9d9779e2011-07-03 15:21:01 -040022#include <linux/module.h>
Martin Blumenstingl138b4122016-10-16 22:59:07 +020023#include <linux/of.h>
24#include <linux/of_net.h>
Simon Wunderliche93d0832013-01-08 14:48:58 +010025#include <linux/relay.h>
Oleksij Rempelb0a1ae92013-05-24 20:30:59 +020026#include <net/ieee80211_radiotap.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090027
Sujith55624202010-01-08 10:36:02 +053028#include "ath9k.h"
29
Gabor Juhosab5c4f72012-12-10 15:30:28 +010030struct ath9k_eeprom_ctx {
31 struct completion complete;
32 struct ath_hw *ah;
33};
34
Sujith55624202010-01-08 10:36:02 +053035static char *dev_info = "ath9k";
36
37MODULE_AUTHOR("Atheros Communications");
38MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards.");
39MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
40MODULE_LICENSE("Dual BSD/GPL");
41
42static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
43module_param_named(debug, ath9k_debug, uint, 0);
44MODULE_PARM_DESC(debug, "Debugging mask");
45
John W. Linville3e6109c2011-01-05 09:39:17 -050046int ath9k_modparam_nohwcrypt;
47module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444);
Sujith55624202010-01-08 10:36:02 +053048MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
49
Hong Xu0c8a1e42015-01-24 03:34:03 -080050int ath9k_led_blink;
51module_param_named(blink, ath9k_led_blink, int, 0444);
Vivek Natarajan9a75c2f2010-06-22 11:52:37 +053052MODULE_PARM_DESC(blink, "Enable LED blink on activity");
53
Vittorio Gambaletta (VittGam)cd840422016-04-11 04:48:54 +020054static int ath9k_led_active_high = -1;
55module_param_named(led_active_high, ath9k_led_active_high, int, 0444);
56MODULE_PARM_DESC(led_active_high, "Invert LED polarity");
57
Vasanthakumar Thiagarajan8f5dcb12010-11-26 06:10:06 -080058static int ath9k_btcoex_enable;
59module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444);
60MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
61
Sujith Manoharan63081302013-08-04 14:21:55 +053062static int ath9k_bt_ant_diversity;
63module_param_named(bt_ant_diversity, ath9k_bt_ant_diversity, int, 0444);
64MODULE_PARM_DESC(bt_ant_diversity, "Enable WLAN/BT RX antenna diversity");
Sujith Manoharane09f2dc2012-09-16 08:06:56 +053065
Sujith Manoharan82983832014-02-04 08:37:53 +053066static int ath9k_ps_enable;
67module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
68MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
69
Sujith Manoharan499afac2014-08-22 20:39:31 +053070#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
71
Felix Fietkau78b21942014-06-11 16:17:55 +053072int ath9k_use_chanctx;
Rajkumar Manoharan71a5f882014-05-29 15:11:09 +053073module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444);
74MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency");
75
Sujith Manoharan499afac2014-08-22 20:39:31 +053076#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
77
Rajkumar Manoharand5847472010-12-20 14:39:51 +053078bool is_ath9k_unloaded;
Sujith55624202010-01-08 10:36:02 +053079
Felix Fietkau0cf55c22011-02-27 22:26:40 +010080#ifdef CONFIG_MAC80211_LEDS
81static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
82 { .throughput = 0 * 1024, .blink_time = 334 },
83 { .throughput = 1 * 1024, .blink_time = 260 },
84 { .throughput = 5 * 1024, .blink_time = 220 },
85 { .throughput = 10 * 1024, .blink_time = 190 },
86 { .throughput = 20 * 1024, .blink_time = 170 },
87 { .throughput = 50 * 1024, .blink_time = 150 },
88 { .throughput = 70 * 1024, .blink_time = 130 },
89 { .throughput = 100 * 1024, .blink_time = 110 },
90 { .throughput = 200 * 1024, .blink_time = 80 },
91 { .throughput = 300 * 1024, .blink_time = 50 },
92};
93#endif
94
Sujith285f2dd2010-01-08 10:36:07 +053095static void ath9k_deinit_softc(struct ath_softc *sc);
Sujith55624202010-01-08 10:36:02 +053096
kbuild test robotd81f9a02014-11-12 06:19:48 +080097static void ath9k_op_ps_wakeup(struct ath_common *common)
Oleksij Rempel99d22172014-11-06 08:53:25 +010098{
99 ath9k_ps_wakeup((struct ath_softc *) common->priv);
100}
101
kbuild test robotd81f9a02014-11-12 06:19:48 +0800102static void ath9k_op_ps_restore(struct ath_common *common)
Oleksij Rempel99d22172014-11-06 08:53:25 +0100103{
104 ath9k_ps_restore((struct ath_softc *) common->priv);
105}
106
kbuild test robotd81f9a02014-11-12 06:19:48 +0800107static struct ath_ps_ops ath9k_ps_ops = {
Oleksij Rempel99d22172014-11-06 08:53:25 +0100108 .wakeup = ath9k_op_ps_wakeup,
109 .restore = ath9k_op_ps_restore,
110};
111
Sujith55624202010-01-08 10:36:02 +0530112/*
113 * Read and write, they both share the same lock. We do this to serialize
114 * reads and writes on Atheros 802.11n PCI devices only. This is required
115 * as the FIFO on these devices can only accept sanely 2 requests.
116 */
117
118static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
119{
120 struct ath_hw *ah = (struct ath_hw *) hw_priv;
121 struct ath_common *common = ath9k_hw_common(ah);
122 struct ath_softc *sc = (struct ath_softc *) common->priv;
123
Felix Fietkauf3eef642012-03-14 16:40:25 +0100124 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
Sujith55624202010-01-08 10:36:02 +0530125 unsigned long flags;
126 spin_lock_irqsave(&sc->sc_serial_rw, flags);
127 iowrite32(val, sc->mem + reg_offset);
128 spin_unlock_irqrestore(&sc->sc_serial_rw, flags);
129 } else
130 iowrite32(val, sc->mem + reg_offset);
131}
132
133static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset)
134{
135 struct ath_hw *ah = (struct ath_hw *) hw_priv;
136 struct ath_common *common = ath9k_hw_common(ah);
137 struct ath_softc *sc = (struct ath_softc *) common->priv;
138 u32 val;
139
Felix Fietkauf3eef642012-03-14 16:40:25 +0100140 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
Sujith55624202010-01-08 10:36:02 +0530141 unsigned long flags;
142 spin_lock_irqsave(&sc->sc_serial_rw, flags);
143 val = ioread32(sc->mem + reg_offset);
144 spin_unlock_irqrestore(&sc->sc_serial_rw, flags);
145 } else
146 val = ioread32(sc->mem + reg_offset);
147 return val;
148}
149
Oleksij Rempeld55ce0a2015-03-22 19:29:50 +0100150static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
151 u32 *val, u16 count)
152{
153 int i;
154
155 for (i = 0; i < count; i++)
156 val[i] = ath9k_ioread32(hw_priv, addr[i]);
157}
158
159
Rajkumar Manoharan5479de62011-07-17 11:43:02 +0530160static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
161 u32 set, u32 clr)
162{
163 u32 val;
164
165 val = ioread32(sc->mem + reg_offset);
166 val &= ~clr;
167 val |= set;
168 iowrite32(val, sc->mem + reg_offset);
169
170 return val;
171}
172
Felix Fietkau845e03c2011-03-23 20:57:25 +0100173static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
174{
175 struct ath_hw *ah = (struct ath_hw *) hw_priv;
176 struct ath_common *common = ath9k_hw_common(ah);
177 struct ath_softc *sc = (struct ath_softc *) common->priv;
178 unsigned long uninitialized_var(flags);
179 u32 val;
180
Felix Fietkauf3eef642012-03-14 16:40:25 +0100181 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
Felix Fietkau845e03c2011-03-23 20:57:25 +0100182 spin_lock_irqsave(&sc->sc_serial_rw, flags);
Rajkumar Manoharan5479de62011-07-17 11:43:02 +0530183 val = __ath9k_reg_rmw(sc, reg_offset, set, clr);
Felix Fietkau845e03c2011-03-23 20:57:25 +0100184 spin_unlock_irqrestore(&sc->sc_serial_rw, flags);
Rajkumar Manoharan5479de62011-07-17 11:43:02 +0530185 } else
186 val = __ath9k_reg_rmw(sc, reg_offset, set, clr);
Felix Fietkau845e03c2011-03-23 20:57:25 +0100187
188 return val;
189}
190
Sujith55624202010-01-08 10:36:02 +0530191/**************************/
192/* Initialization */
193/**************************/
194
Luis R. Rodriguez0c0280b2013-01-11 18:39:36 +0000195static void ath9k_reg_notifier(struct wiphy *wiphy,
196 struct regulatory_request *request)
Sujith55624202010-01-08 10:36:02 +0530197{
198 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
Felix Fietkau9ac586152011-01-24 19:23:18 +0100199 struct ath_softc *sc = hw->priv;
Rajkumar Manoharan687f5452011-12-08 23:59:25 +0530200 struct ath_hw *ah = sc->sc_ah;
201 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
Sujith55624202010-01-08 10:36:02 +0530202
Luis R. Rodriguez0c0280b2013-01-11 18:39:36 +0000203 ath_reg_notifier_apply(wiphy, request, reg);
Rajkumar Manoharan687f5452011-12-08 23:59:25 +0530204
205 /* Set tx power */
Felix Fietkaud385c5c2014-11-04 16:56:57 +0100206 if (!ah->curchan)
207 return;
208
209 sc->cur_chan->txpower = 2 * ah->curchan->chan->max_power;
210 ath9k_ps_wakeup(sc);
211 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
212 ath9k_cmn_update_txpow(ah, sc->cur_chan->cur_txpower,
213 sc->cur_chan->txpower,
214 &sc->cur_chan->cur_txpower);
215 /* synchronize DFS detector if regulatory domain changed */
216 if (sc->dfs_detector != NULL)
217 sc->dfs_detector->set_dfs_domain(sc->dfs_detector,
218 request->dfs_region);
219 ath9k_ps_restore(sc);
Sujith55624202010-01-08 10:36:02 +0530220}
221
222/*
223 * This function will allocate both the DMA descriptor structure, and the
224 * buffers it contains. These are used to contain the descriptors used
225 * by the system.
226*/
227int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
228 struct list_head *head, const char *name,
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400229 int nbuf, int ndesc, bool is_tx)
Sujith55624202010-01-08 10:36:02 +0530230{
Sujith55624202010-01-08 10:36:02 +0530231 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400232 u8 *ds;
Felix Fietkaub81950b12012-12-12 13:14:22 +0100233 int i, bsize, desc_len;
Sujith55624202010-01-08 10:36:02 +0530234
Joe Perchesd2182b62011-12-15 14:55:53 -0800235 ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n",
Joe Perches226afe62010-12-02 19:12:37 -0800236 name, nbuf, ndesc);
Sujith55624202010-01-08 10:36:02 +0530237
238 INIT_LIST_HEAD(head);
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400239
240 if (is_tx)
241 desc_len = sc->sc_ah->caps.tx_desc_len;
242 else
243 desc_len = sizeof(struct ath_desc);
244
Sujith55624202010-01-08 10:36:02 +0530245 /* ath_desc must be a multiple of DWORDs */
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400246 if ((desc_len % 4) != 0) {
Joe Perches38002762010-12-02 19:12:36 -0800247 ath_err(common, "ath_desc not DWORD aligned\n");
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400248 BUG_ON((desc_len % 4) != 0);
Felix Fietkaub81950b12012-12-12 13:14:22 +0100249 return -ENOMEM;
Sujith55624202010-01-08 10:36:02 +0530250 }
251
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400252 dd->dd_desc_len = desc_len * nbuf * ndesc;
Sujith55624202010-01-08 10:36:02 +0530253
254 /*
255 * Need additional DMA memory because we can't use
256 * descriptors that cross the 4K page boundary. Assume
257 * one skipped descriptor per 4K page.
258 */
259 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) {
260 u32 ndesc_skipped =
261 ATH_DESC_4KB_BOUND_NUM_SKIPPED(dd->dd_desc_len);
262 u32 dma_len;
263
264 while (ndesc_skipped) {
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400265 dma_len = ndesc_skipped * desc_len;
Sujith55624202010-01-08 10:36:02 +0530266 dd->dd_desc_len += dma_len;
267
268 ndesc_skipped = ATH_DESC_4KB_BOUND_NUM_SKIPPED(dma_len);
Joe Perchesee289b62010-05-17 22:47:34 -0700269 }
Sujith55624202010-01-08 10:36:02 +0530270 }
271
272 /* allocate descriptors */
Felix Fietkaub81950b12012-12-12 13:14:22 +0100273 dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len,
274 &dd->dd_desc_paddr, GFP_KERNEL);
275 if (!dd->dd_desc)
276 return -ENOMEM;
277
Vasanthakumar Thiagarajan4adfcde2010-04-15 17:39:33 -0400278 ds = (u8 *) dd->dd_desc;
Joe Perchesd2182b62011-12-15 14:55:53 -0800279 ath_dbg(common, CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n",
Joe Perches226afe62010-12-02 19:12:37 -0800280 name, ds, (u32) dd->dd_desc_len,
281 ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len);
Sujith55624202010-01-08 10:36:02 +0530282
283 /* allocate buffers */
Felix Fietkau1a04d592013-10-11 23:30:52 +0200284 if (is_tx) {
285 struct ath_buf *bf;
Sujith55624202010-01-08 10:36:02 +0530286
Felix Fietkau1a04d592013-10-11 23:30:52 +0200287 bsize = sizeof(struct ath_buf) * nbuf;
288 bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
289 if (!bf)
290 return -ENOMEM;
Sujith55624202010-01-08 10:36:02 +0530291
Felix Fietkau1a04d592013-10-11 23:30:52 +0200292 for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
293 bf->bf_desc = ds;
294 bf->bf_daddr = DS2PHYS(dd, ds);
Sujith55624202010-01-08 10:36:02 +0530295
Felix Fietkau1a04d592013-10-11 23:30:52 +0200296 if (!(sc->sc_ah->caps.hw_caps &
297 ATH9K_HW_CAP_4KB_SPLITTRANS)) {
298 /*
299 * Skip descriptor addresses which can cause 4KB
300 * boundary crossing (addr + length) with a 32 dword
301 * descriptor fetch.
302 */
303 while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
304 BUG_ON((caddr_t) bf->bf_desc >=
305 ((caddr_t) dd->dd_desc +
306 dd->dd_desc_len));
307
308 ds += (desc_len * ndesc);
309 bf->bf_desc = ds;
310 bf->bf_daddr = DS2PHYS(dd, ds);
311 }
Sujith55624202010-01-08 10:36:02 +0530312 }
Felix Fietkau1a04d592013-10-11 23:30:52 +0200313 list_add_tail(&bf->list, head);
Sujith55624202010-01-08 10:36:02 +0530314 }
Felix Fietkau1a04d592013-10-11 23:30:52 +0200315 } else {
316 struct ath_rxbuf *bf;
317
318 bsize = sizeof(struct ath_rxbuf) * nbuf;
319 bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
320 if (!bf)
321 return -ENOMEM;
322
323 for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
324 bf->bf_desc = ds;
325 bf->bf_daddr = DS2PHYS(dd, ds);
326
327 if (!(sc->sc_ah->caps.hw_caps &
328 ATH9K_HW_CAP_4KB_SPLITTRANS)) {
329 /*
330 * Skip descriptor addresses which can cause 4KB
331 * boundary crossing (addr + length) with a 32 dword
332 * descriptor fetch.
333 */
334 while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
335 BUG_ON((caddr_t) bf->bf_desc >=
336 ((caddr_t) dd->dd_desc +
337 dd->dd_desc_len));
338
339 ds += (desc_len * ndesc);
340 bf->bf_desc = ds;
341 bf->bf_daddr = DS2PHYS(dd, ds);
342 }
343 }
344 list_add_tail(&bf->list, head);
345 }
Sujith55624202010-01-08 10:36:02 +0530346 }
347 return 0;
Sujith55624202010-01-08 10:36:02 +0530348}
349
Sujith285f2dd2010-01-08 10:36:07 +0530350static int ath9k_init_queues(struct ath_softc *sc)
351{
Sujith285f2dd2010-01-08 10:36:07 +0530352 int i = 0;
Sujith55624202010-01-08 10:36:02 +0530353
Sujith285f2dd2010-01-08 10:36:07 +0530354 sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah);
Sujith285f2dd2010-01-08 10:36:07 +0530355 sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0);
Sujith285f2dd2010-01-08 10:36:07 +0530356 ath_cabq_update(sc);
357
Felix Fietkauf2c7a792013-06-07 18:12:00 +0200358 sc->tx.uapsdq = ath_txq_setup(sc, ATH9K_TX_QUEUE_UAPSD, 0);
359
Sujith Manoharanbea843c2012-11-21 18:13:10 +0530360 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
Felix Fietkau066dae92010-11-07 14:59:39 +0100361 sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
Ben Greear60f2d1d2011-01-09 23:11:52 -0800362 sc->tx.txq_map[i]->mac80211_qnum = i;
Ben Greear60f2d1d2011-01-09 23:11:52 -0800363 }
Sujith285f2dd2010-01-08 10:36:07 +0530364 return 0;
Sujith285f2dd2010-01-08 10:36:07 +0530365}
366
Sujith285f2dd2010-01-08 10:36:07 +0530367static void ath9k_init_misc(struct ath_softc *sc)
368{
369 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
370 int i = 0;
Sujith Manoharan3d4e20f2012-03-14 14:40:58 +0530371
Sujith285f2dd2010-01-08 10:36:07 +0530372 setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
373
Oleksij Rempel32efb0c2014-02-04 10:27:39 +0100374 common->last_rssi = ATH_RSSI_DUMMY_MARKER;
Felix Fietkau364734f2010-09-14 20:22:44 +0200375 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
Benjamin Berg11b0ac22016-07-04 14:37:24 +0200376 sc->beacon.slottime = 9;
Sujith285f2dd2010-01-08 10:36:07 +0530377
Felix Fietkau7545daf2011-01-24 19:23:16 +0100378 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
Sujith285f2dd2010-01-08 10:36:07 +0530379 sc->beacon.bslot[i] = NULL;
Vasanthakumar Thiagarajan102885a2010-09-02 01:34:43 -0700380
381 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
382 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
Simon Wunderlich04ccd4a2013-01-23 17:38:04 +0100383
Oleksij Rempeldd7657b2014-11-06 08:53:22 +0100384 sc->spec_priv.ah = sc->sc_ah;
Oleksij Rempel21af25d2014-11-06 08:53:20 +0100385 sc->spec_priv.spec_config.enabled = 0;
386 sc->spec_priv.spec_config.short_repeat = true;
387 sc->spec_priv.spec_config.count = 8;
388 sc->spec_priv.spec_config.endless = false;
389 sc->spec_priv.spec_config.period = 0xFF;
390 sc->spec_priv.spec_config.fft_period = 0xF;
Sujith285f2dd2010-01-08 10:36:07 +0530391}
392
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530393static void ath9k_init_pcoem_platform(struct ath_softc *sc)
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530394{
395 struct ath_hw *ah = sc->sc_ah;
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530396 struct ath9k_hw_capabilities *pCap = &ah->caps;
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530397 struct ath_common *common = ath9k_hw_common(ah);
398
Felix Fietkau935477e2014-10-25 17:19:26 +0200399 if (!IS_ENABLED(CONFIG_ATH9K_PCOEM))
400 return;
401
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530402 if (common->bus_ops->ath_bus_type != ATH_PCI)
403 return;
404
Sujith Manoharane861ef52013-06-18 10:13:43 +0530405 if (sc->driver_data & (ATH9K_PCI_CUS198 |
406 ATH9K_PCI_CUS230)) {
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530407 ah->config.xlna_gpio = 9;
408 ah->config.xatten_margin_cfg = true;
Sujith Manoharane083a422013-08-19 11:04:01 +0530409 ah->config.alt_mingainidx = true;
Sujith Manoharan31fd2162013-08-04 14:22:01 +0530410 ah->config.ant_ctrl_comm2g_switch_enable = 0x000BBB88;
Sujith Manoharan3afa6b42013-08-04 14:21:54 +0530411 sc->ant_comb.low_rssi_thresh = 20;
412 sc->ant_comb.fast_div_bias = 3;
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530413
Sujith Manoharane861ef52013-06-18 10:13:43 +0530414 ath_info(common, "Set parameters for %s\n",
415 (sc->driver_data & ATH9K_PCI_CUS198) ?
416 "CUS198" : "CUS230");
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530417 }
418
419 if (sc->driver_data & ATH9K_PCI_CUS217)
Sujith Manoharan12eea642013-06-18 15:42:36 +0530420 ath_info(common, "CUS217 card detected\n");
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530421
Sujith Manoharan10631332013-09-02 13:59:05 +0530422 if (sc->driver_data & ATH9K_PCI_CUS252)
423 ath_info(common, "CUS252 card detected\n");
424
Sujith Manoharan3fcdd0a2013-09-02 13:59:06 +0530425 if (sc->driver_data & ATH9K_PCI_AR9565_1ANT)
426 ath_info(common, "WB335 1-ANT card detected\n");
427
428 if (sc->driver_data & ATH9K_PCI_AR9565_2ANT)
429 ath_info(common, "WB335 2-ANT card detected\n");
430
Sujith Manoharan4dd35642013-10-23 14:26:04 +0530431 if (sc->driver_data & ATH9K_PCI_KILLER)
432 ath_info(common, "Killer Wireless card detected\n");
433
Sujith Manoharan3fcdd0a2013-09-02 13:59:06 +0530434 /*
435 * Some WB335 cards do not support antenna diversity. Since
436 * we use a hardcoded value for AR9565 instead of using the
437 * EEPROM/OTP data, remove the combining feature from
438 * the HW capabilities bitmap.
439 */
440 if (sc->driver_data & (ATH9K_PCI_AR9565_1ANT | ATH9K_PCI_AR9565_2ANT)) {
441 if (!(sc->driver_data & ATH9K_PCI_BT_ANT_DIV))
442 pCap->hw_caps &= ~ATH9K_HW_CAP_ANT_DIV_COMB;
443 }
444
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530445 if (sc->driver_data & ATH9K_PCI_BT_ANT_DIV) {
446 pCap->hw_caps |= ATH9K_HW_CAP_BT_ANT_DIV;
447 ath_info(common, "Set BT/WLAN RX diversity capability\n");
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530448 }
Sujith Manoharand1ae25a2013-08-25 16:30:40 +0530449
450 if (sc->driver_data & ATH9K_PCI_D3_L1_WAR) {
451 ah->config.pcie_waen = 0x0040473b;
452 ath_info(common, "Enable WAR for ASPM D3/L1\n");
453 }
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530454
Sujith Manoharanafa7e6d2015-03-09 14:20:07 +0530455 /*
456 * The default value of pll_pwrsave is 1.
457 * For certain AR9485 cards, it is set to 0.
Sujith Manoharan656cd752015-03-09 14:20:08 +0530458 * For AR9462, AR9565 it's set to 7.
Sujith Manoharanafa7e6d2015-03-09 14:20:07 +0530459 */
460 ah->config.pll_pwrsave = 1;
461
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530462 if (sc->driver_data & ATH9K_PCI_NO_PLL_PWRSAVE) {
Sujith Manoharanafa7e6d2015-03-09 14:20:07 +0530463 ah->config.pll_pwrsave = 0;
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530464 ath_info(common, "Disable PLL PowerSave\n");
465 }
Sujith Manoharanaeeb2062014-11-16 06:11:02 +0530466
467 if (sc->driver_data & ATH9K_PCI_LED_ACT_HI)
468 ah->config.led_active_high = true;
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530469}
470
Gabor Juhosab5c4f72012-12-10 15:30:28 +0100471static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob,
472 void *ctx)
473{
474 struct ath9k_eeprom_ctx *ec = ctx;
475
476 if (eeprom_blob)
477 ec->ah->eeprom_blob = eeprom_blob;
478
479 complete(&ec->complete);
480}
481
482static int ath9k_eeprom_request(struct ath_softc *sc, const char *name)
483{
484 struct ath9k_eeprom_ctx ec;
Colin Ian King47f58b12016-04-10 12:25:31 +0100485 struct ath_hw *ah = sc->sc_ah;
Gabor Juhosab5c4f72012-12-10 15:30:28 +0100486 int err;
487
488 /* try to load the EEPROM content asynchronously */
489 init_completion(&ec.complete);
490 ec.ah = sc->sc_ah;
491
492 err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL,
493 &ec, ath9k_eeprom_request_cb);
494 if (err < 0) {
495 ath_err(ath9k_hw_common(ah),
496 "EEPROM request failed\n");
497 return err;
498 }
499
500 wait_for_completion(&ec.complete);
501
502 if (!ah->eeprom_blob) {
503 ath_err(ath9k_hw_common(ah),
504 "Unable to load EEPROM file %s\n", name);
505 return -EINVAL;
506 }
507
508 return 0;
509}
510
511static void ath9k_eeprom_release(struct ath_softc *sc)
512{
513 release_firmware(sc->sc_ah->eeprom_blob);
514}
515
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200516static int ath9k_init_platform(struct ath_softc *sc)
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530517{
518 struct ath9k_platform_data *pdata = sc->dev->platform_data;
519 struct ath_hw *ah = sc->sc_ah;
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200520 struct ath_common *common = ath9k_hw_common(ah);
521 int ret;
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530522
523 if (!pdata)
524 return 0;
525
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200526 if (!pdata->use_eeprom) {
527 ah->ah_flags &= ~AH_USE_EEPROM;
528 ah->gpio_mask = pdata->gpio_mask;
529 ah->gpio_val = pdata->gpio_val;
530 ah->led_pin = pdata->led_pin;
531 ah->is_clk_25mhz = pdata->is_clk_25mhz;
532 ah->get_mac_revision = pdata->get_mac_revision;
533 ah->external_reset = pdata->external_reset;
534 ah->disable_2ghz = pdata->disable_2ghz;
535 ah->disable_5ghz = pdata->disable_5ghz;
536
537 if (!pdata->endian_check)
538 ah->ah_flags |= AH_NO_EEP_SWAP;
539 }
540
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530541 if (pdata->eeprom_name) {
542 ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
543 if (ret)
544 return ret;
545 }
546
Martin Blumenstingl3467f0d2016-06-23 16:57:09 +0200547 if (pdata->led_active_high)
548 ah->config.led_active_high = true;
549
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530550 if (pdata->tx_gain_buffalo)
551 ah->config.tx_gain_buffalo = true;
552
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200553 if (pdata->macaddr)
554 ether_addr_copy(common->macaddr, pdata->macaddr);
555
556 return 0;
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530557}
558
Martin Blumenstingl138b4122016-10-16 22:59:07 +0200559static int ath9k_of_init(struct ath_softc *sc)
560{
561 struct device_node *np = sc->dev->of_node;
562 struct ath_hw *ah = sc->sc_ah;
563 struct ath_common *common = ath9k_hw_common(ah);
564 enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
565 const char *mac;
566 char eeprom_name[100];
567 int ret;
568
569 if (!of_device_is_available(np))
570 return 0;
571
572 ath_dbg(common, CONFIG, "parsing configuration from OF node\n");
573
574 if (of_property_read_bool(np, "qca,no-eeprom")) {
575 /* ath9k-eeprom-<bus>-<id>.bin */
576 scnprintf(eeprom_name, sizeof(eeprom_name),
577 "ath9k-eeprom-%s-%s.bin",
578 ath_bus_type_to_string(bus_type), dev_name(ah->dev));
579
580 ret = ath9k_eeprom_request(sc, eeprom_name);
581 if (ret)
582 return ret;
583 }
584
585 mac = of_get_mac_address(np);
586 if (mac)
587 ether_addr_copy(common->macaddr, mac);
588
589 ah->ah_flags &= ~AH_USE_EEPROM;
590 ah->ah_flags |= AH_NO_EEP_SWAP;
591
592 return 0;
593}
594
Pavel Roskineb93e892011-07-23 03:55:39 -0400595static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
Sujith285f2dd2010-01-08 10:36:07 +0530596 const struct ath_bus_ops *bus_ops)
597{
Sujith285f2dd2010-01-08 10:36:07 +0530598 struct ath_hw *ah = NULL;
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530599 struct ath9k_hw_capabilities *pCap;
Sujith285f2dd2010-01-08 10:36:07 +0530600 struct ath_common *common;
601 int ret = 0, i;
602 int csz = 0;
603
Felix Fietkaub81950b12012-12-12 13:14:22 +0100604 ah = devm_kzalloc(sc->dev, sizeof(struct ath_hw), GFP_KERNEL);
Sujith285f2dd2010-01-08 10:36:07 +0530605 if (!ah)
606 return -ENOMEM;
607
Felix Fietkauc1b976d2012-12-12 13:14:23 +0100608 ah->dev = sc->dev;
Ben Greear233536e2011-01-09 23:11:44 -0800609 ah->hw = sc->hw;
Sujith285f2dd2010-01-08 10:36:07 +0530610 ah->hw_version.devid = devid;
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200611 ah->ah_flags |= AH_USE_EEPROM;
612 ah->led_pin = -1;
Felix Fietkauf9f84e92011-03-23 20:57:24 +0100613 ah->reg_ops.read = ath9k_ioread32;
Oleksij Rempeld55ce0a2015-03-22 19:29:50 +0100614 ah->reg_ops.multi_read = ath9k_multi_ioread32;
Felix Fietkauf9f84e92011-03-23 20:57:24 +0100615 ah->reg_ops.write = ath9k_iowrite32;
Felix Fietkau845e03c2011-03-23 20:57:25 +0100616 ah->reg_ops.rmw = ath9k_reg_rmw;
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530617 pCap = &ah->caps;
Sujith285f2dd2010-01-08 10:36:07 +0530618
Janusz Dziedzic95a59922013-10-14 11:06:03 +0200619 common = ath9k_hw_common(ah);
Felix Fietkau56bdbe02014-11-30 21:58:30 +0100620
621 /* Will be cleared in ath9k_start() */
622 set_bit(ATH_OP_INVALID, &common->op_flags);
623
624 sc->sc_ah = ah;
Janusz Dziedzic95a59922013-10-14 11:06:03 +0200625 sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET);
Luis R. Rodriguez89f927a2013-10-14 17:42:11 -0700626 sc->tx99_power = MAX_RATE_POWER + 1;
Felix Fietkau10e23182013-11-11 22:23:35 +0100627 init_waitqueue_head(&sc->tx_wait);
Rajkumar Manoharanca900ac2014-06-11 16:18:02 +0530628 sc->cur_chan = &sc->chanctx[0];
Sujith Manoharan499afac2014-08-22 20:39:31 +0530629 if (!ath9k_is_chanctx_enabled())
Rajkumar Manoharan3ad9c382014-06-11 16:18:15 +0530630 sc->cur_chan->hw_queue_base = 0;
Zefir Kurtisi8e92d3f2012-04-03 17:15:50 +0200631
Felix Fietkauf9f84e92011-03-23 20:57:24 +0100632 common->ops = &ah->reg_ops;
Sujith285f2dd2010-01-08 10:36:07 +0530633 common->bus_ops = bus_ops;
Oleksij Rempel99d22172014-11-06 08:53:25 +0100634 common->ps_ops = &ath9k_ps_ops;
Sujith285f2dd2010-01-08 10:36:07 +0530635 common->ah = ah;
636 common->hw = sc->hw;
637 common->priv = sc;
638 common->debug_mask = ath9k_debug;
Vasanthakumar Thiagarajan8f5dcb12010-11-26 06:10:06 -0800639 common->btcoex_enabled = ath9k_btcoex_enable == 1;
Mohammed Shafi Shajakhan05c0be22011-05-26 10:56:15 +0530640 common->disable_ani = false;
Sujith Manoharane09f2dc2012-09-16 08:06:56 +0530641
642 /*
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530643 * Platform quirks.
644 */
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530645 ath9k_init_pcoem_platform(sc);
646
Martin Blumenstingl28755b82016-06-23 16:57:13 +0200647 ret = ath9k_init_platform(sc);
Sujith Manoharan0f978bf2013-12-06 16:28:45 +0530648 if (ret)
649 return ret;
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530650
Martin Blumenstingl138b4122016-10-16 22:59:07 +0200651 ret = ath9k_of_init(sc);
652 if (ret)
653 return ret;
654
Vittorio Gambaletta (VittGam)cd840422016-04-11 04:48:54 +0200655 if (ath9k_led_active_high != -1)
656 ah->config.led_active_high = ath9k_led_active_high == 1;
657
Sujith Manoharan9b60b642013-06-13 22:51:26 +0530658 /*
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530659 * Enable WLAN/BT RX Antenna diversity only when:
660 *
Sujith Manoharan7d845872013-08-07 12:29:27 +0530661 * - BTCOEX is disabled.
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530662 * - the user manually requests the feature.
663 * - the HW cap is set using the platform data.
Sujith Manoharane09f2dc2012-09-16 08:06:56 +0530664 */
Sujith Manoharan7d845872013-08-07 12:29:27 +0530665 if (!common->btcoex_enabled && ath9k_bt_ant_diversity &&
Sujith Manoharan3f2da952013-08-04 14:21:56 +0530666 (pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV))
Sujith Manoharan63081302013-08-04 14:21:55 +0530667 common->bt_ant_diversity = 1;
Sujith Manoharane09f2dc2012-09-16 08:06:56 +0530668
Ben Greear20b257442010-10-15 15:04:09 -0700669 spin_lock_init(&common->cc_lock);
Sujith285f2dd2010-01-08 10:36:07 +0530670 spin_lock_init(&sc->sc_serial_rw);
671 spin_lock_init(&sc->sc_pm_lock);
Felix Fietkaubff11762014-06-11 16:17:52 +0530672 spin_lock_init(&sc->chan_lock);
Sujith285f2dd2010-01-08 10:36:07 +0530673 mutex_init(&sc->mutex);
674 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
Sujith Manoharanfb6e2522012-07-17 17:16:22 +0530675 tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet,
Sujith285f2dd2010-01-08 10:36:07 +0530676 (unsigned long)sc);
677
Felix Fietkaubf3dac52013-11-11 22:23:33 +0100678 setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc);
Sujith Manoharanaaa1ec42012-06-04 16:27:08 +0530679 INIT_WORK(&sc->hw_reset_work, ath_reset_work);
Sujith Manoharanaaa1ec42012-06-04 16:27:08 +0530680 INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
681 INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
Sujith Manoharan705d0bf2014-08-23 13:29:06 +0530682
683 ath9k_init_channel_context(sc);
Sujith Manoharanaaa1ec42012-06-04 16:27:08 +0530684
Sujith285f2dd2010-01-08 10:36:07 +0530685 /*
686 * Cache line size is used to size and align various
687 * structures used to communicate with the hardware.
688 */
689 ath_read_cachesize(common, &csz);
690 common->cachelsz = csz << 2; /* convert to bytes */
691
Luis R. Rodriguezd70357d2010-04-15 17:38:06 -0400692 /* Initializes the hardware for all supported chipsets */
Sujith285f2dd2010-01-08 10:36:07 +0530693 ret = ath9k_hw_init(ah);
Luis R. Rodriguezd70357d2010-04-15 17:38:06 -0400694 if (ret)
Sujith285f2dd2010-01-08 10:36:07 +0530695 goto err_hw;
Sujith285f2dd2010-01-08 10:36:07 +0530696
Sujith285f2dd2010-01-08 10:36:07 +0530697 ret = ath9k_init_queues(sc);
698 if (ret)
699 goto err_queues;
700
701 ret = ath9k_init_btcoex(sc);
702 if (ret)
703 goto err_btcoex;
704
Oleksij Rempel13f71052014-02-25 14:48:50 +0100705 ret = ath9k_cmn_init_channels_rates(common);
Felix Fietkauf209f522010-10-01 01:06:53 +0200706 if (ret)
707 goto err_btcoex;
708
Sujith Manoharanc7dd40c2014-08-22 20:39:30 +0530709 ret = ath9k_init_p2p(sc);
710 if (ret)
Sujith Manoharan4f681692014-08-22 20:39:25 +0530711 goto err_btcoex;
Felix Fietkaud463af42014-04-06 00:37:03 +0200712
Rajkumar Manoharanf82b4bd2011-08-13 10:28:15 +0530713 ath9k_cmn_init_crypto(sc->sc_ah);
Sujith285f2dd2010-01-08 10:36:07 +0530714 ath9k_init_misc(sc);
Felix Fietkaufbbcd142014-06-11 16:17:49 +0530715 ath_chanctx_init(sc);
Sujith Manoharane90e3022014-08-23 13:29:20 +0530716 ath9k_offchannel_init(sc);
Sujith285f2dd2010-01-08 10:36:07 +0530717
Sujith Manoharand09f5f42012-06-04 16:27:14 +0530718 if (common->bus_ops->aspm_init)
719 common->bus_ops->aspm_init(common);
720
Sujith55624202010-01-08 10:36:02 +0530721 return 0;
Sujith285f2dd2010-01-08 10:36:07 +0530722
723err_btcoex:
Sujith55624202010-01-08 10:36:02 +0530724 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
725 if (ATH_TXQ_SETUP(sc, i))
726 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
Sujith285f2dd2010-01-08 10:36:07 +0530727err_queues:
Sujith285f2dd2010-01-08 10:36:07 +0530728 ath9k_hw_deinit(ah);
729err_hw:
Gabor Juhosab5c4f72012-12-10 15:30:28 +0100730 ath9k_eeprom_release(sc);
Luis R. Rodriguez89f927a2013-10-14 17:42:11 -0700731 dev_kfree_skb_any(sc->tx99_skb);
Sujith285f2dd2010-01-08 10:36:07 +0530732 return ret;
Sujith55624202010-01-08 10:36:02 +0530733}
734
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200735static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
736{
737 struct ieee80211_supported_band *sband;
738 struct ieee80211_channel *chan;
739 struct ath_hw *ah = sc->sc_ah;
Oleksij Rempel13f71052014-02-25 14:48:50 +0100740 struct ath_common *common = ath9k_hw_common(ah);
Simon Wunderlich06718942013-08-16 10:46:04 +0200741 struct cfg80211_chan_def chandef;
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200742 int i;
743
Oleksij Rempel13f71052014-02-25 14:48:50 +0100744 sband = &common->sbands[band];
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200745 for (i = 0; i < sband->n_channels; i++) {
746 chan = &sband->channels[i];
747 ah->curchan = &ah->channels[chan->hw_value];
Simon Wunderlich06718942013-08-16 10:46:04 +0200748 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20);
Felix Fietkau2297f1c2013-10-11 23:30:57 +0200749 ath9k_cmn_get_channel(sc->hw, ah, &chandef);
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200750 ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200751 }
752}
753
754static void ath9k_init_txpower_limits(struct ath_softc *sc)
755{
756 struct ath_hw *ah = sc->sc_ah;
757 struct ath9k_channel *curchan = ah->curchan;
758
759 if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
Johannes Berg57fbcce2016-04-12 15:56:15 +0200760 ath9k_init_band_txpower(sc, NL80211_BAND_2GHZ);
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200761 if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
Johannes Berg57fbcce2016-04-12 15:56:15 +0200762 ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200763
764 ah->curchan = curchan;
765}
766
Felix Fietkau20c8e8d2012-04-17 02:40:07 +0200767static const struct ieee80211_iface_limit if_limits[] = {
Rajkumar Manoharan71a5f882014-05-29 15:11:09 +0530768 { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
Felix Fietkau20c8e8d2012-04-17 02:40:07 +0200769 { .max = 8, .types =
770#ifdef CONFIG_MAC80211_MESH
771 BIT(NL80211_IFTYPE_MESH_POINT) |
772#endif
Felix Fietkau95ae4812014-04-06 00:37:02 +0200773 BIT(NL80211_IFTYPE_AP) },
774 { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
Felix Fietkau20c8e8d2012-04-17 02:40:07 +0200775 BIT(NL80211_IFTYPE_P2P_GO) },
776};
777
Rajkumar Manoharan71a5f882014-05-29 15:11:09 +0530778static const struct ieee80211_iface_limit wds_limits[] = {
779 { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) },
780};
781
Sujith Manoharan499afac2014-08-22 20:39:31 +0530782#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
783
Rajkumar Manoharana4068322014-06-11 16:18:16 +0530784static const struct ieee80211_iface_limit if_limits_multi[] = {
Sujith Manoharan86162d42014-08-24 21:16:12 +0530785 { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) |
786 BIT(NL80211_IFTYPE_AP) |
787 BIT(NL80211_IFTYPE_P2P_CLIENT) |
Rajkumar Manoharana4068322014-06-11 16:18:16 +0530788 BIT(NL80211_IFTYPE_P2P_GO) },
Sujith Manoharan86162d42014-08-24 21:16:12 +0530789 { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) },
[email protected]eb61f9f2015-07-21 11:11:40 +0200790 { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) },
Rajkumar Manoharana4068322014-06-11 16:18:16 +0530791};
792
Rajkumar Manoharana4068322014-06-11 16:18:16 +0530793static const struct ieee80211_iface_combination if_comb_multi[] = {
794 {
795 .limits = if_limits_multi,
796 .n_limits = ARRAY_SIZE(if_limits_multi),
[email protected]eb61f9f2015-07-21 11:11:40 +0200797 .max_interfaces = 3,
Rajkumar Manoharana4068322014-06-11 16:18:16 +0530798 .num_different_channels = 2,
799 .beacon_int_infra_match = true,
800 },
801};
802
Sujith Manoharan499afac2014-08-22 20:39:31 +0530803#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
804
Zefir Kurtisie9cdedf2013-04-03 18:31:29 +0200805static const struct ieee80211_iface_combination if_comb[] = {
806 {
807 .limits = if_limits,
808 .n_limits = ARRAY_SIZE(if_limits),
809 .max_interfaces = 2048,
810 .num_different_channels = 1,
811 .beacon_int_infra_match = true,
Felix Fietkau12865582016-01-22 01:56:30 +0100812#ifdef CONFIG_ATH9K_DFS_CERTIFIED
813 .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
814 BIT(NL80211_CHAN_WIDTH_20) |
815 BIT(NL80211_CHAN_WIDTH_40),
816#endif
Zefir Kurtisie9cdedf2013-04-03 18:31:29 +0200817 },
Rajkumar Manoharan71a5f882014-05-29 15:11:09 +0530818 {
819 .limits = wds_limits,
820 .n_limits = ARRAY_SIZE(wds_limits),
821 .max_interfaces = 2048,
822 .num_different_channels = 1,
823 .beacon_int_infra_match = true,
824 },
Felix Fietkau20c8e8d2012-04-17 02:40:07 +0200825};
Felix Fietkau43c35282011-09-03 01:40:27 +0200826
Sujith Manoharan868caae2014-10-21 19:23:02 +0530827#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
828static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
829{
830 struct ath_hw *ah = sc->sc_ah;
831 struct ath_common *common = ath9k_hw_common(ah);
832
833 if (!ath9k_is_chanctx_enabled())
834 return;
835
Johannes Berg30686bf2015-06-02 21:39:54 +0200836 ieee80211_hw_set(hw, QUEUE_CONTROL);
Sujith Manoharan868caae2014-10-21 19:23:02 +0530837 hw->queues = ATH9K_NUM_TX_QUEUES;
838 hw->offchannel_tx_hw_queue = hw->queues - 1;
839 hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS);
840 hw->wiphy->iface_combinations = if_comb_multi;
841 hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi);
842 hw->wiphy->max_scan_ssids = 255;
843 hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
844 hw->wiphy->max_remain_on_channel_duration = 10000;
845 hw->chanctx_data_size = sizeof(void *);
846 hw->extra_beacon_tailroom =
847 sizeof(struct ieee80211_p2p_noa_attr) + 9;
848
849 ath_dbg(common, CHAN_CTX, "Use channel contexts\n");
850}
851#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
852
Sujith Manoharan7b6ef992013-12-18 09:53:19 +0530853static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
Sujith55624202010-01-08 10:36:02 +0530854{
Felix Fietkau43c35282011-09-03 01:40:27 +0200855 struct ath_hw *ah = sc->sc_ah;
856 struct ath_common *common = ath9k_hw_common(ah);
Sujith285f2dd2010-01-08 10:36:07 +0530857
Johannes Berg30686bf2015-06-02 21:39:54 +0200858 ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
859 ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
860 ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
861 ieee80211_hw_set(hw, SPECTRUM_MGMT);
862 ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
863 ieee80211_hw_set(hw, SIGNAL_DBM);
864 ieee80211_hw_set(hw, RX_INCLUDES_FCS);
865 ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
Felix Fietkauf419c5f2015-07-22 13:06:12 +0200866 ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
Pawel Kulakowski50e81e22015-12-18 10:48:57 +0100867 ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS);
Sujith55624202010-01-08 10:36:02 +0530868
Sujith Manoharan82983832014-02-04 08:37:53 +0530869 if (ath9k_ps_enable)
Johannes Berg30686bf2015-06-02 21:39:54 +0200870 ieee80211_hw_set(hw, SUPPORTS_PS);
Sujith Manoharan82983832014-02-04 08:37:53 +0530871
Oleksij Rempelb0a1ae92013-05-24 20:30:59 +0200872 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
Johannes Berg30686bf2015-06-02 21:39:54 +0200873 ieee80211_hw_set(hw, AMPDU_AGGREGATION);
Oleksij Rempelb0a1ae92013-05-24 20:30:59 +0200874
875 if (AR_SREV_9280_20_OR_LATER(ah))
876 hw->radiotap_mcs_details |=
877 IEEE80211_RADIOTAP_MCS_HAVE_STBC;
878 }
Luis R. Rodriguez5ffaf8a2010-02-02 11:58:33 -0500879
John W. Linville3e6109c2011-01-05 09:39:17 -0500880 if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt)
Johannes Berg30686bf2015-06-02 21:39:54 +0200881 ieee80211_hw_set(hw, MFP_CAPABLE);
Sujith55624202010-01-08 10:36:02 +0530882
Sujith Manoharanfdcf1bd2014-09-05 08:03:14 +0530883 hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
884 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
885 NL80211_FEATURE_P2P_GO_CTWIN;
Felix Fietkauec26bcc2013-05-28 13:01:54 +0200886
Masahiro Yamada97f26452016-08-03 13:45:50 -0700887 if (!IS_ENABLED(CONFIG_ATH9K_TX99)) {
Luis R. Rodriguez89f927a2013-10-14 17:42:11 -0700888 hw->wiphy->interface_modes =
889 BIT(NL80211_IFTYPE_P2P_GO) |
890 BIT(NL80211_IFTYPE_P2P_CLIENT) |
891 BIT(NL80211_IFTYPE_AP) |
Luis R. Rodriguez89f927a2013-10-14 17:42:11 -0700892 BIT(NL80211_IFTYPE_STATION) |
893 BIT(NL80211_IFTYPE_ADHOC) |
Sujith Manoharan499afac2014-08-22 20:39:31 +0530894 BIT(NL80211_IFTYPE_MESH_POINT) |
Jan Kaisrlik862a3362015-09-17 14:03:46 +0200895 BIT(NL80211_IFTYPE_WDS) |
896 BIT(NL80211_IFTYPE_OCB);
Sujith Manoharan499afac2014-08-22 20:39:31 +0530897
[email protected]eb61f9f2015-07-21 11:11:40 +0200898 if (ath9k_is_chanctx_enabled())
899 hw->wiphy->interface_modes |=
900 BIT(NL80211_IFTYPE_P2P_DEVICE);
901
Arnd Bergmann362210e2016-03-14 15:18:37 +0100902 hw->wiphy->iface_combinations = if_comb;
903 hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
Luis R. Rodriguez89f927a2013-10-14 17:42:11 -0700904 }
Felix Fietkau20c8e8d2012-04-17 02:40:07 +0200905
Sujith Manoharan531671c2013-06-01 07:08:09 +0530906 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
Sujith55624202010-01-08 10:36:02 +0530907
Jouni Malinencfdc9a82011-03-23 14:52:19 +0200908 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
Jouni Malinenfd656232011-10-27 17:31:50 +0300909 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
Johannes Berg81ddbb52012-03-26 18:47:18 +0200910 hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
Simon Wunderlich6fac8bb2013-08-14 08:01:34 +0200911 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ;
Simon Wunderlichd074e8d2013-08-14 08:01:38 +0200912 hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
Jouni Malinen7b4f6632014-02-18 20:41:08 +0200913 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
Jouni Malinencfdc9a82011-03-23 14:52:19 +0200914
Sujith Manoharan868caae2014-10-21 19:23:02 +0530915 hw->queues = 4;
Sujith55624202010-01-08 10:36:02 +0530916 hw->max_rates = 4;
Rajkumar Manoharan5f2f9e42014-06-26 16:54:41 +0530917 hw->max_listen_interval = 10;
Felix Fietkau65896512010-01-24 03:26:11 +0100918 hw->max_rate_tries = 10;
Sujith55624202010-01-08 10:36:02 +0530919 hw->sta_data_size = sizeof(struct ath_node);
920 hw->vif_data_size = sizeof(struct ath_vif);
Toke Høiland-Jørgensen50f08ed2016-11-09 12:31:49 +0100921 hw->txq_data_size = sizeof(struct ath_atx_tid);
Felix Fietkau029cd032015-09-24 16:59:46 +0200922 hw->extra_tx_headroom = 4;
Sujith55624202010-01-08 10:36:02 +0530923
Felix Fietkau43c35282011-09-03 01:40:27 +0200924 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
925 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
926
927 /* single chain devices with rx diversity */
928 if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
929 hw->wiphy->available_antennas_rx = BIT(0) | BIT(1);
930
931 sc->ant_rx = hw->wiphy->available_antennas_rx;
932 sc->ant_tx = hw->wiphy->available_antennas_tx;
933
Felix Fietkaud4659912010-10-14 16:02:39 +0200934 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
Johannes Berg57fbcce2016-04-12 15:56:15 +0200935 hw->wiphy->bands[NL80211_BAND_2GHZ] =
936 &common->sbands[NL80211_BAND_2GHZ];
Felix Fietkaud4659912010-10-14 16:02:39 +0200937 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
Johannes Berg57fbcce2016-04-12 15:56:15 +0200938 hw->wiphy->bands[NL80211_BAND_5GHZ] =
939 &common->sbands[NL80211_BAND_5GHZ];
Sujith285f2dd2010-01-08 10:36:07 +0530940
Sujith Manoharan868caae2014-10-21 19:23:02 +0530941#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
942 ath9k_set_mcc_capab(sc, hw);
943#endif
Sujith Manoharanbabaa802013-10-28 13:01:28 +0530944 ath9k_init_wow(hw);
Oleksij Rempelb57ba3b2014-02-25 14:48:55 +0100945 ath9k_cmn_reload_chainmask(ah);
Sujith285f2dd2010-01-08 10:36:07 +0530946
947 SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
Sujith55624202010-01-08 10:36:02 +0530948}
949
Pavel Roskineb93e892011-07-23 03:55:39 -0400950int ath9k_init_device(u16 devid, struct ath_softc *sc,
Sujith55624202010-01-08 10:36:02 +0530951 const struct ath_bus_ops *bus_ops)
952{
953 struct ieee80211_hw *hw = sc->hw;
954 struct ath_common *common;
955 struct ath_hw *ah;
Sujith285f2dd2010-01-08 10:36:07 +0530956 int error = 0;
Sujith55624202010-01-08 10:36:02 +0530957 struct ath_regulatory *reg;
958
Sujith285f2dd2010-01-08 10:36:07 +0530959 /* Bring up device */
Pavel Roskineb93e892011-07-23 03:55:39 -0400960 error = ath9k_init_softc(devid, sc, bus_ops);
Felix Fietkaub81950b12012-12-12 13:14:22 +0100961 if (error)
962 return error;
Sujith55624202010-01-08 10:36:02 +0530963
964 ah = sc->sc_ah;
965 common = ath9k_hw_common(ah);
Sujith285f2dd2010-01-08 10:36:07 +0530966 ath9k_set_hw_capab(sc, hw);
Sujith55624202010-01-08 10:36:02 +0530967
Sujith285f2dd2010-01-08 10:36:07 +0530968 /* Initialize regulatory */
Sujith55624202010-01-08 10:36:02 +0530969 error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
970 ath9k_reg_notifier);
971 if (error)
Felix Fietkaub81950b12012-12-12 13:14:22 +0100972 goto deinit;
Sujith55624202010-01-08 10:36:02 +0530973
974 reg = &common->regulatory;
975
Sujith285f2dd2010-01-08 10:36:07 +0530976 /* Setup TX DMA */
Sujith55624202010-01-08 10:36:02 +0530977 error = ath_tx_init(sc, ATH_TXBUF);
978 if (error != 0)
Felix Fietkaub81950b12012-12-12 13:14:22 +0100979 goto deinit;
Sujith55624202010-01-08 10:36:02 +0530980
Sujith285f2dd2010-01-08 10:36:07 +0530981 /* Setup RX DMA */
Sujith55624202010-01-08 10:36:02 +0530982 error = ath_rx_init(sc, ATH_RXBUF);
983 if (error != 0)
Felix Fietkaub81950b12012-12-12 13:14:22 +0100984 goto deinit;
Sujith285f2dd2010-01-08 10:36:07 +0530985
Felix Fietkaubabcbc22010-10-20 02:09:46 +0200986 ath9k_init_txpower_limits(sc);
987
Felix Fietkau0cf55c22011-02-27 22:26:40 +0100988#ifdef CONFIG_MAC80211_LEDS
989 /* must be initialized before ieee80211_register_hw */
990 sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw,
991 IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_tpt_blink,
992 ARRAY_SIZE(ath9k_tpt_blink));
993#endif
994
Sujith285f2dd2010-01-08 10:36:07 +0530995 /* Register with mac80211 */
996 error = ieee80211_register_hw(hw);
997 if (error)
Felix Fietkaub81950b12012-12-12 13:14:22 +0100998 goto rx_cleanup;
Sujith285f2dd2010-01-08 10:36:07 +0530999
Ben Greeareb272442010-11-29 14:13:22 -08001000 error = ath9k_init_debug(ah);
1001 if (error) {
Joe Perches38002762010-12-02 19:12:36 -08001002 ath_err(common, "Unable to create debugfs files\n");
Felix Fietkaub81950b12012-12-12 13:14:22 +01001003 goto unregister;
Ben Greeareb272442010-11-29 14:13:22 -08001004 }
1005
Sujith285f2dd2010-01-08 10:36:07 +05301006 /* Handle world regulatory */
1007 if (!ath_is_world_regd(reg)) {
1008 error = regulatory_hint(hw->wiphy, reg->alpha2);
1009 if (error)
Sujith Manoharanaf690092013-05-10 18:41:06 +05301010 goto debug_cleanup;
Sujith285f2dd2010-01-08 10:36:07 +05301011 }
Sujith55624202010-01-08 10:36:02 +05301012
Sujith55624202010-01-08 10:36:02 +05301013 ath_init_leds(sc);
Sujith55624202010-01-08 10:36:02 +05301014 ath_start_rfkill_poll(sc);
1015
1016 return 0;
1017
Sujith Manoharanaf690092013-05-10 18:41:06 +05301018debug_cleanup:
1019 ath9k_deinit_debug(sc);
Felix Fietkaub81950b12012-12-12 13:14:22 +01001020unregister:
Sujith285f2dd2010-01-08 10:36:07 +05301021 ieee80211_unregister_hw(hw);
Felix Fietkaub81950b12012-12-12 13:14:22 +01001022rx_cleanup:
Sujith285f2dd2010-01-08 10:36:07 +05301023 ath_rx_cleanup(sc);
Felix Fietkaub81950b12012-12-12 13:14:22 +01001024deinit:
Sujith285f2dd2010-01-08 10:36:07 +05301025 ath9k_deinit_softc(sc);
Sujith55624202010-01-08 10:36:02 +05301026 return error;
1027}
1028
1029/*****************************/
1030/* De-Initialization */
1031/*****************************/
1032
Sujith285f2dd2010-01-08 10:36:07 +05301033static void ath9k_deinit_softc(struct ath_softc *sc)
Sujith55624202010-01-08 10:36:02 +05301034{
Sujith285f2dd2010-01-08 10:36:07 +05301035 int i = 0;
Sujith55624202010-01-08 10:36:02 +05301036
Sujith Manoharanc7dd40c2014-08-22 20:39:30 +05301037 ath9k_deinit_p2p(sc);
Sujith Manoharan59081202012-02-22 12:40:21 +05301038 ath9k_deinit_btcoex(sc);
Mohammed Shafi Shajakhan19686dd2011-11-30 10:41:28 +05301039
Sujith285f2dd2010-01-08 10:36:07 +05301040 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
1041 if (ATH_TXQ_SETUP(sc, i))
1042 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
1043
Felix Fietkaubf3dac52013-11-11 22:23:33 +01001044 del_timer_sync(&sc->sleep_timer);
Sujith285f2dd2010-01-08 10:36:07 +05301045 ath9k_hw_deinit(sc->sc_ah);
Zefir Kurtisi8e92d3f2012-04-03 17:15:50 +02001046 if (sc->dfs_detector != NULL)
1047 sc->dfs_detector->exit(sc->dfs_detector);
Sujith285f2dd2010-01-08 10:36:07 +05301048
Gabor Juhosab5c4f72012-12-10 15:30:28 +01001049 ath9k_eeprom_release(sc);
Sujith55624202010-01-08 10:36:02 +05301050}
1051
Sujith285f2dd2010-01-08 10:36:07 +05301052void ath9k_deinit_device(struct ath_softc *sc)
Sujith55624202010-01-08 10:36:02 +05301053{
1054 struct ieee80211_hw *hw = sc->hw;
Sujith55624202010-01-08 10:36:02 +05301055
1056 ath9k_ps_wakeup(sc);
1057
Sujith55624202010-01-08 10:36:02 +05301058 wiphy_rfkill_stop_polling(sc->hw->wiphy);
Sujith285f2dd2010-01-08 10:36:07 +05301059 ath_deinit_leds(sc);
Sujith55624202010-01-08 10:36:02 +05301060
Rajkumar Manoharanc7c18062011-01-27 18:39:38 +05301061 ath9k_ps_restore(sc);
1062
Sujith Manoharanaf690092013-05-10 18:41:06 +05301063 ath9k_deinit_debug(sc);
Sujith Manoharan661d2582015-01-30 19:05:26 +05301064 ath9k_deinit_wow(hw);
Sujith55624202010-01-08 10:36:02 +05301065 ieee80211_unregister_hw(hw);
1066 ath_rx_cleanup(sc);
Sujith285f2dd2010-01-08 10:36:07 +05301067 ath9k_deinit_softc(sc);
Sujith55624202010-01-08 10:36:02 +05301068}
1069
Sujith55624202010-01-08 10:36:02 +05301070/************************/
1071/* Module Hooks */
1072/************************/
1073
1074static int __init ath9k_init(void)
1075{
1076 int error;
1077
Sujith55624202010-01-08 10:36:02 +05301078 error = ath_pci_init();
1079 if (error < 0) {
Joe Perches516304b2012-03-18 17:30:52 -07001080 pr_err("No PCI devices found, driver not installed\n");
Sujith55624202010-01-08 10:36:02 +05301081 error = -ENODEV;
Sujith Manoharan9e495a22014-02-06 10:22:55 +05301082 goto err_out;
Sujith55624202010-01-08 10:36:02 +05301083 }
1084
1085 error = ath_ahb_init();
1086 if (error < 0) {
1087 error = -ENODEV;
1088 goto err_pci_exit;
1089 }
1090
1091 return 0;
1092
1093 err_pci_exit:
1094 ath_pci_exit();
Sujith55624202010-01-08 10:36:02 +05301095 err_out:
1096 return error;
1097}
1098module_init(ath9k_init);
1099
1100static void __exit ath9k_exit(void)
1101{
Rajkumar Manoharand5847472010-12-20 14:39:51 +05301102 is_ath9k_unloaded = true;
Sujith55624202010-01-08 10:36:02 +05301103 ath_ahb_exit();
1104 ath_pci_exit();
Joe Perches516304b2012-03-18 17:30:52 -07001105 pr_info("%s: Driver unloaded\n", dev_info);
Sujith55624202010-01-08 10:36:02 +05301106}
1107module_exit(ath9k_exit);