wl1271: Clear probe-request template after scan
[deliverable/linux.git] / drivers / net / wireless / wl12xx / wl1271_main.c
CommitLineData
f5fc0f86
LC
1/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/interrupt.h>
27#include <linux/firmware.h>
28#include <linux/delay.h>
29#include <linux/irq.h>
30#include <linux/spi/spi.h>
31#include <linux/crc32.h>
32#include <linux/etherdevice.h>
33#include <linux/spi/wl12xx.h>
34
35#include "wl1271.h"
36#include "wl12xx_80211.h"
37#include "wl1271_reg.h"
38#include "wl1271_spi.h"
39#include "wl1271_event.h"
40#include "wl1271_tx.h"
41#include "wl1271_rx.h"
42#include "wl1271_ps.h"
43#include "wl1271_init.h"
44#include "wl1271_debugfs.h"
45#include "wl1271_cmd.h"
46#include "wl1271_boot.h"
47
48static int wl1271_plt_init(struct wl1271 *wl)
49{
50 int ret;
51
52 ret = wl1271_acx_init_mem_config(wl);
53 if (ret < 0)
54 return ret;
55
56 ret = wl1271_cmd_data_path(wl, wl->channel, 1);
57 if (ret < 0)
58 return ret;
59
60 return 0;
61}
62
63static void wl1271_disable_interrupts(struct wl1271 *wl)
64{
65 disable_irq(wl->irq);
66}
67
68static void wl1271_power_off(struct wl1271 *wl)
69{
70 wl->set_power(false);
71}
72
73static void wl1271_power_on(struct wl1271 *wl)
74{
75 wl->set_power(true);
76}
77
78static void wl1271_fw_status(struct wl1271 *wl, struct wl1271_fw_status *status)
79{
80 u32 total = 0;
81 int i;
82
83 /*
84 * FIXME: Reading the FW status directly from the registers seems to
85 * be the right thing to do, but it doesn't work. And in the
86 * reference driver, there is a workaround called
87 * USE_SDIO_24M_WORKAROUND, which reads the status from memory
88 * instead, so we do the same here.
89 */
90
91 wl1271_spi_mem_read(wl, STATUS_MEM_ADDRESS, status, sizeof(*status));
92
93 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, "
94 "drv_rx_counter = %d, tx_results_counter = %d)",
95 status->intr,
96 status->fw_rx_counter,
97 status->drv_rx_counter,
98 status->tx_results_counter);
99
100 /* update number of available TX blocks */
101 for (i = 0; i < NUM_TX_QUEUES; i++) {
102 u32 cnt = status->tx_released_blks[i] - wl->tx_blocks_freed[i];
103 wl->tx_blocks_freed[i] = status->tx_released_blks[i];
104 wl->tx_blocks_available += cnt;
105 total += cnt;
106 }
107
108 /* if more blocks are available now, schedule some tx work */
109 if (total && !skb_queue_empty(&wl->tx_queue))
a64b07e8 110 ieee80211_queue_work(wl->hw, &wl->tx_work);
f5fc0f86
LC
111
112 /* update the host-chipset time offset */
113 wl->time_offset = jiffies_to_usecs(jiffies) - status->fw_localtime;
114}
115
116#define WL1271_IRQ_MAX_LOOPS 10
117static void wl1271_irq_work(struct work_struct *work)
118{
119 u32 intr, ctr = WL1271_IRQ_MAX_LOOPS;
120 int ret;
121 struct wl1271 *wl =
122 container_of(work, struct wl1271, irq_work);
123
124 mutex_lock(&wl->mutex);
125
126 wl1271_debug(DEBUG_IRQ, "IRQ work");
127
128 if (wl->state == WL1271_STATE_OFF)
129 goto out;
130
131 ret = wl1271_ps_elp_wakeup(wl, true);
132 if (ret < 0)
133 goto out;
134
135 wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
136
137 intr = wl1271_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR);
138 if (!intr) {
139 wl1271_debug(DEBUG_IRQ, "Zero interrupt received.");
140 goto out_sleep;
141 }
142
143 intr &= WL1271_INTR_MASK;
144
145 do {
146 wl1271_fw_status(wl, wl->fw_status);
147
148
149 if (intr & (WL1271_ACX_INTR_EVENT_A |
150 WL1271_ACX_INTR_EVENT_B)) {
151 wl1271_debug(DEBUG_IRQ,
152 "WL1271_ACX_INTR_EVENT (0x%x)", intr);
153 if (intr & WL1271_ACX_INTR_EVENT_A)
154 wl1271_event_handle(wl, 0);
155 else
156 wl1271_event_handle(wl, 1);
157 }
158
159 if (intr & WL1271_ACX_INTR_INIT_COMPLETE)
160 wl1271_debug(DEBUG_IRQ,
161 "WL1271_ACX_INTR_INIT_COMPLETE");
162
163 if (intr & WL1271_ACX_INTR_HW_AVAILABLE)
164 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_HW_AVAILABLE");
165
166 if (intr & WL1271_ACX_INTR_DATA) {
167 u8 tx_res_cnt = wl->fw_status->tx_results_counter -
168 wl->tx_results_count;
169
170 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA");
171
172 /* check for tx results */
173 if (tx_res_cnt)
174 wl1271_tx_complete(wl, tx_res_cnt);
175
176 wl1271_rx(wl, wl->fw_status);
177 }
178
179 intr = wl1271_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR);
180 intr &= WL1271_INTR_MASK;
181 } while (intr && --ctr);
182
183out_sleep:
73d0a13c
LC
184 wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK,
185 WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK));
f5fc0f86
LC
186 wl1271_ps_elp_sleep(wl);
187
188out:
189 mutex_unlock(&wl->mutex);
190}
191
192static irqreturn_t wl1271_irq(int irq, void *cookie)
193{
194 struct wl1271 *wl;
195 unsigned long flags;
196
197 wl1271_debug(DEBUG_IRQ, "IRQ");
198
199 wl = cookie;
200
201 /* complete the ELP completion */
202 spin_lock_irqsave(&wl->wl_lock, flags);
203 if (wl->elp_compl) {
204 complete(wl->elp_compl);
205 wl->elp_compl = NULL;
206 }
207
a64b07e8 208 ieee80211_queue_work(wl->hw, &wl->irq_work);
f5fc0f86
LC
209 spin_unlock_irqrestore(&wl->wl_lock, flags);
210
211 return IRQ_HANDLED;
212}
213
214static int wl1271_fetch_firmware(struct wl1271 *wl)
215{
216 const struct firmware *fw;
217 int ret;
218
219 ret = request_firmware(&fw, WL1271_FW_NAME, &wl->spi->dev);
220
221 if (ret < 0) {
222 wl1271_error("could not get firmware: %d", ret);
223 return ret;
224 }
225
226 if (fw->size % 4) {
227 wl1271_error("firmware size is not multiple of 32 bits: %zu",
228 fw->size);
229 ret = -EILSEQ;
230 goto out;
231 }
232
233 wl->fw_len = fw->size;
234 wl->fw = kmalloc(wl->fw_len, GFP_KERNEL);
235
236 if (!wl->fw) {
237 wl1271_error("could not allocate memory for the firmware");
238 ret = -ENOMEM;
239 goto out;
240 }
241
242 memcpy(wl->fw, fw->data, wl->fw_len);
243
244 ret = 0;
245
246out:
247 release_firmware(fw);
248
249 return ret;
250}
251
252static int wl1271_fetch_nvs(struct wl1271 *wl)
253{
254 const struct firmware *fw;
255 int ret;
256
257 ret = request_firmware(&fw, WL1271_NVS_NAME, &wl->spi->dev);
258
259 if (ret < 0) {
260 wl1271_error("could not get nvs file: %d", ret);
261 return ret;
262 }
263
264 if (fw->size % 4) {
265 wl1271_error("nvs size is not multiple of 32 bits: %zu",
266 fw->size);
267 ret = -EILSEQ;
268 goto out;
269 }
270
271 wl->nvs_len = fw->size;
272 wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL);
273
274 if (!wl->nvs) {
275 wl1271_error("could not allocate memory for the nvs file");
276 ret = -ENOMEM;
277 goto out;
278 }
279
280 memcpy(wl->nvs, fw->data, wl->nvs_len);
281
282 ret = 0;
283
284out:
285 release_firmware(fw);
286
287 return ret;
288}
289
290static void wl1271_fw_wakeup(struct wl1271 *wl)
291{
292 u32 elp_reg;
293
294 elp_reg = ELPCTRL_WAKE_UP;
295 wl1271_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg);
296}
297
298static int wl1271_setup(struct wl1271 *wl)
299{
300 wl->fw_status = kmalloc(sizeof(*wl->fw_status), GFP_KERNEL);
301 if (!wl->fw_status)
302 return -ENOMEM;
303
304 wl->tx_res_if = kmalloc(sizeof(*wl->tx_res_if), GFP_KERNEL);
305 if (!wl->tx_res_if) {
306 kfree(wl->fw_status);
307 return -ENOMEM;
308 }
309
310 INIT_WORK(&wl->irq_work, wl1271_irq_work);
311 INIT_WORK(&wl->tx_work, wl1271_tx_work);
312 return 0;
313}
314
315static int wl1271_chip_wakeup(struct wl1271 *wl)
316{
317 int ret = 0;
318
319 wl1271_power_on(wl);
320 msleep(WL1271_POWER_ON_SLEEP);
321 wl1271_spi_reset(wl);
322 wl1271_spi_init(wl);
323
324 /* We don't need a real memory partition here, because we only want
325 * to use the registers at this point. */
326 wl1271_set_partition(wl,
327 0x00000000,
328 0x00000000,
329 REGISTERS_BASE,
330 REGISTERS_DOWN_SIZE);
331
332 /* ELP module wake up */
333 wl1271_fw_wakeup(wl);
334
335 /* whal_FwCtrl_BootSm() */
336
337 /* 0. read chip id from CHIP_ID */
338 wl->chip.id = wl1271_reg_read32(wl, CHIP_ID_B);
339
340 /* 1. check if chip id is valid */
341
342 switch (wl->chip.id) {
343 case CHIP_ID_1271_PG10:
344 wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete",
345 wl->chip.id);
346
347 ret = wl1271_setup(wl);
348 if (ret < 0)
349 goto out;
350 break;
351 case CHIP_ID_1271_PG20:
352 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
353 wl->chip.id);
354
355 ret = wl1271_setup(wl);
356 if (ret < 0)
357 goto out;
358 break;
359 default:
360 wl1271_error("unsupported chip id: 0x%x", wl->chip.id);
361 ret = -ENODEV;
362 goto out;
363 }
364
365 if (wl->fw == NULL) {
366 ret = wl1271_fetch_firmware(wl);
367 if (ret < 0)
368 goto out;
369 }
370
371 /* No NVS from netlink, try to get it from the filesystem */
372 if (wl->nvs == NULL) {
373 ret = wl1271_fetch_nvs(wl);
374 if (ret < 0)
375 goto out;
376 }
377
378out:
379 return ret;
380}
381
382static void wl1271_filter_work(struct work_struct *work)
383{
384 struct wl1271 *wl =
385 container_of(work, struct wl1271, filter_work);
386 int ret;
387
388 mutex_lock(&wl->mutex);
389
390 if (wl->state == WL1271_STATE_OFF)
391 goto out;
392
393 ret = wl1271_ps_elp_wakeup(wl, false);
394 if (ret < 0)
395 goto out;
396
d94cd297 397 ret = wl1271_cmd_join(wl);
f5fc0f86
LC
398 if (ret < 0)
399 goto out_sleep;
400
401out_sleep:
402 wl1271_ps_elp_sleep(wl);
403
404out:
405 mutex_unlock(&wl->mutex);
406}
407
408int wl1271_plt_start(struct wl1271 *wl)
409{
410 int ret;
411
412 mutex_lock(&wl->mutex);
413
414 wl1271_notice("power up");
415
416 if (wl->state != WL1271_STATE_OFF) {
417 wl1271_error("cannot go into PLT state because not "
418 "in off state: %d", wl->state);
419 ret = -EBUSY;
420 goto out;
421 }
422
423 wl->state = WL1271_STATE_PLT;
424
425 ret = wl1271_chip_wakeup(wl);
426 if (ret < 0)
427 goto out;
428
429 ret = wl1271_boot(wl);
430 if (ret < 0)
431 goto out;
432
433 wl1271_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver);
434
435 ret = wl1271_plt_init(wl);
436 if (ret < 0)
437 goto out;
438
439out:
440 mutex_unlock(&wl->mutex);
441
442 return ret;
443}
444
445int wl1271_plt_stop(struct wl1271 *wl)
446{
447 int ret = 0;
448
449 mutex_lock(&wl->mutex);
450
451 wl1271_notice("power down");
452
453 if (wl->state != WL1271_STATE_PLT) {
454 wl1271_error("cannot power down because not in PLT "
455 "state: %d", wl->state);
456 ret = -EBUSY;
457 goto out;
458 }
459
460 wl1271_disable_interrupts(wl);
461 wl1271_power_off(wl);
462
463 wl->state = WL1271_STATE_OFF;
464
465out:
466 mutex_unlock(&wl->mutex);
467
468 return ret;
469}
470
471
472static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
473{
474 struct wl1271 *wl = hw->priv;
475
476 skb_queue_tail(&wl->tx_queue, skb);
477
478 /*
479 * The chip specific setup must run before the first TX packet -
480 * before that, the tx_work will not be initialized!
481 */
482
a64b07e8 483 ieee80211_queue_work(wl->hw, &wl->tx_work);
f5fc0f86
LC
484
485 /*
486 * The workqueue is slow to process the tx_queue and we need stop
487 * the queue here, otherwise the queue will get too long.
488 */
489 if (skb_queue_len(&wl->tx_queue) >= WL1271_TX_QUEUE_MAX_LENGTH) {
490 ieee80211_stop_queues(wl->hw);
491
492 /*
493 * FIXME: this is racy, the variable is not properly
494 * protected. Maybe fix this by removing the stupid
495 * variable altogether and checking the real queue state?
496 */
497 wl->tx_queue_stopped = true;
498 }
499
500 return NETDEV_TX_OK;
501}
502
503static int wl1271_op_start(struct ieee80211_hw *hw)
504{
505 struct wl1271 *wl = hw->priv;
506 int ret = 0;
507
508 wl1271_debug(DEBUG_MAC80211, "mac80211 start");
509
510 mutex_lock(&wl->mutex);
511
512 if (wl->state != WL1271_STATE_OFF) {
513 wl1271_error("cannot start because not in off state: %d",
514 wl->state);
515 ret = -EBUSY;
516 goto out;
517 }
518
519 ret = wl1271_chip_wakeup(wl);
520 if (ret < 0)
521 goto out;
522
523 ret = wl1271_boot(wl);
524 if (ret < 0)
525 goto out;
526
527 ret = wl1271_hw_init(wl);
528 if (ret < 0)
529 goto out;
530
531 wl->state = WL1271_STATE_ON;
532
533 wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
534
535out:
536 if (ret < 0)
537 wl1271_power_off(wl);
538
539 mutex_unlock(&wl->mutex);
540
541 return ret;
542}
543
544static void wl1271_op_stop(struct ieee80211_hw *hw)
545{
546 struct wl1271 *wl = hw->priv;
547 int i;
548
549 wl1271_info("down");
550
551 wl1271_debug(DEBUG_MAC80211, "mac80211 stop");
552
553 mutex_lock(&wl->mutex);
554
555 WARN_ON(wl->state != WL1271_STATE_ON);
556
557 if (wl->scanning) {
558 mutex_unlock(&wl->mutex);
559 ieee80211_scan_completed(wl->hw, true);
560 mutex_lock(&wl->mutex);
561 wl->scanning = false;
562 }
563
564 wl->state = WL1271_STATE_OFF;
565
566 wl1271_disable_interrupts(wl);
567
568 mutex_unlock(&wl->mutex);
569
570 cancel_work_sync(&wl->irq_work);
571 cancel_work_sync(&wl->tx_work);
572 cancel_work_sync(&wl->filter_work);
573
574 mutex_lock(&wl->mutex);
575
576 /* let's notify MAC80211 about the remaining pending TX frames */
577 wl1271_tx_flush(wl);
578 wl1271_power_off(wl);
579
580 memset(wl->bssid, 0, ETH_ALEN);
581 memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1);
582 wl->ssid_len = 0;
583 wl->listen_int = 1;
584 wl->bss_type = MAX_BSS_TYPE;
8a5a37a6 585 wl->band = IEEE80211_BAND_2GHZ;
f5fc0f86
LC
586
587 wl->rx_counter = 0;
588 wl->elp = false;
589 wl->psm = 0;
590 wl->tx_queue_stopped = false;
591 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
592 wl->tx_blocks_available = 0;
593 wl->tx_results_count = 0;
594 wl->tx_packets_count = 0;
ac4e4ce5
JO
595 wl->tx_security_last_seq = 0;
596 wl->tx_security_seq_16 = 0;
597 wl->tx_security_seq_32 = 0;
f5fc0f86
LC
598 wl->time_offset = 0;
599 wl->session_counter = 0;
600 for (i = 0; i < NUM_TX_QUEUES; i++)
601 wl->tx_blocks_freed[i] = 0;
602
603 wl1271_debugfs_reset(wl);
604 mutex_unlock(&wl->mutex);
605}
606
607static int wl1271_op_add_interface(struct ieee80211_hw *hw,
608 struct ieee80211_if_init_conf *conf)
609{
610 struct wl1271 *wl = hw->priv;
f5fc0f86
LC
611 int ret = 0;
612
e5539bcb
JL
613 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
614 conf->type, conf->mac_addr);
f5fc0f86
LC
615
616 mutex_lock(&wl->mutex);
617
618 switch (conf->type) {
619 case NL80211_IFTYPE_STATION:
620 wl->bss_type = BSS_TYPE_STA_BSS;
621 break;
622 case NL80211_IFTYPE_ADHOC:
623 wl->bss_type = BSS_TYPE_IBSS;
624 break;
625 default:
626 ret = -EOPNOTSUPP;
627 goto out;
628 }
629
630 /* FIXME: what if conf->mac_addr changes? */
631
632out:
633 mutex_unlock(&wl->mutex);
634 return ret;
635}
636
637static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
638 struct ieee80211_if_init_conf *conf)
639{
640 wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface");
641}
642
643#if 0
644static int wl1271_op_config_interface(struct ieee80211_hw *hw,
645 struct ieee80211_vif *vif,
646 struct ieee80211_if_conf *conf)
647{
648 struct wl1271 *wl = hw->priv;
649 struct sk_buff *beacon;
f5fc0f86
LC
650 int ret;
651
3264690b
DM
652 wl1271_debug(DEBUG_MAC80211, "mac80211 config_interface bssid %pM",
653 conf->bssid);
f5fc0f86
LC
654 wl1271_dump_ascii(DEBUG_MAC80211, "ssid: ", conf->ssid,
655 conf->ssid_len);
656
657 mutex_lock(&wl->mutex);
658
659 ret = wl1271_ps_elp_wakeup(wl, false);
660 if (ret < 0)
661 goto out;
662
663 memcpy(wl->bssid, conf->bssid, ETH_ALEN);
664
665 ret = wl1271_cmd_build_null_data(wl);
666 if (ret < 0)
667 goto out_sleep;
668
669 wl->ssid_len = conf->ssid_len;
670 if (wl->ssid_len)
671 memcpy(wl->ssid, conf->ssid, wl->ssid_len);
672
673 if (wl->bss_type != BSS_TYPE_IBSS) {
d94cd297 674 ret = wl1271_cmd_join(wl);
f5fc0f86
LC
675 if (ret < 0)
676 goto out_sleep;
677 }
678
679 if (conf->changed & IEEE80211_IFCC_BEACON) {
680 beacon = ieee80211_beacon_get(hw, vif);
681 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
682 beacon->data, beacon->len);
683
684 if (ret < 0) {
685 dev_kfree_skb(beacon);
686 goto out_sleep;
687 }
688
689 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE,
690 beacon->data, beacon->len);
691
692 dev_kfree_skb(beacon);
693
694 if (ret < 0)
695 goto out_sleep;
696
d94cd297 697 ret = wl1271_cmd_join(wl);
f5fc0f86
LC
698
699 if (ret < 0)
700 goto out_sleep;
701 }
702
703out_sleep:
704 wl1271_ps_elp_sleep(wl);
705
706out:
707 mutex_unlock(&wl->mutex);
708
709 return ret;
710}
711#endif
712
713static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
714{
715 struct wl1271 *wl = hw->priv;
716 struct ieee80211_conf *conf = &hw->conf;
717 int channel, ret = 0;
718
719 channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
720
721 wl1271_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
722 channel,
723 conf->flags & IEEE80211_CONF_PS ? "on" : "off",
724 conf->power_level);
725
726 mutex_lock(&wl->mutex);
727
8a5a37a6
JO
728 wl->band = conf->channel->band;
729
f5fc0f86
LC
730 ret = wl1271_ps_elp_wakeup(wl, false);
731 if (ret < 0)
732 goto out;
733
734 if (channel != wl->channel) {
735 u8 old_channel = wl->channel;
736 wl->channel = channel;
737
d94cd297 738 ret = wl1271_cmd_join(wl);
f5fc0f86
LC
739 if (ret < 0) {
740 wl->channel = old_channel;
741 goto out_sleep;
742 }
743 }
744
745 ret = wl1271_cmd_build_null_data(wl);
746 if (ret < 0)
747 goto out_sleep;
748
749 if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
750 wl1271_info("psm enabled");
751
752 wl->psm_requested = true;
753
754 /*
755 * We enter PSM only if we're already associated.
756 * If we're not, we'll enter it when joining an SSID,
757 * through the bss_info_changed() hook.
758 */
759 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
760 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
761 wl->psm_requested) {
762 wl1271_info("psm disabled");
763
764 wl->psm_requested = false;
765
766 if (wl->psm)
767 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE);
768 }
769
770 if (conf->power_level != wl->power_level) {
771 ret = wl1271_acx_tx_power(wl, conf->power_level);
772 if (ret < 0)
773 goto out;
774
775 wl->power_level = conf->power_level;
776 }
777
778out_sleep:
779 wl1271_ps_elp_sleep(wl);
780
781out:
782 mutex_unlock(&wl->mutex);
783
784 return ret;
785}
786
787#define WL1271_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \
788 FIF_ALLMULTI | \
789 FIF_FCSFAIL | \
790 FIF_BCN_PRBRESP_PROMISC | \
791 FIF_CONTROL | \
792 FIF_OTHER_BSS)
793
794static void wl1271_op_configure_filter(struct ieee80211_hw *hw,
795 unsigned int changed,
3ac64bee 796 unsigned int *total,u64 multicast)
f5fc0f86
LC
797{
798 struct wl1271 *wl = hw->priv;
799
800 wl1271_debug(DEBUG_MAC80211, "mac80211 configure filter");
801
802 *total &= WL1271_SUPPORTED_FILTERS;
803 changed &= WL1271_SUPPORTED_FILTERS;
804
805 if (changed == 0)
806 return;
807
808 /* FIXME: wl->rx_config and wl->rx_filter are not protected */
809 wl->rx_config = WL1271_DEFAULT_RX_CONFIG;
810 wl->rx_filter = WL1271_DEFAULT_RX_FILTER;
811
812 /*
813 * FIXME: workqueues need to be properly cancelled on stop(), for
814 * now let's just disable changing the filter settings. They will
815 * be updated any on config().
816 */
817 /* schedule_work(&wl->filter_work); */
818}
819
820static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
821 struct ieee80211_vif *vif,
822 struct ieee80211_sta *sta,
823 struct ieee80211_key_conf *key_conf)
824{
825 struct wl1271 *wl = hw->priv;
826 const u8 *addr;
827 int ret;
ac4e4ce5
JO
828 u32 tx_seq_32 = 0;
829 u16 tx_seq_16 = 0;
f5fc0f86
LC
830 u8 key_type;
831
832 static const u8 bcast_addr[ETH_ALEN] =
833 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
834
835 wl1271_debug(DEBUG_MAC80211, "mac80211 set key");
836
837 addr = sta ? sta->addr : bcast_addr;
838
839 wl1271_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd);
840 wl1271_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN);
841 wl1271_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x",
842 key_conf->alg, key_conf->keyidx,
843 key_conf->keylen, key_conf->flags);
844 wl1271_dump(DEBUG_CRYPT, "KEY: ", key_conf->key, key_conf->keylen);
845
846 if (is_zero_ether_addr(addr)) {
847 /* We dont support TX only encryption */
848 ret = -EOPNOTSUPP;
849 goto out;
850 }
851
852 mutex_lock(&wl->mutex);
853
854 ret = wl1271_ps_elp_wakeup(wl, false);
855 if (ret < 0)
856 goto out_unlock;
857
858 switch (key_conf->alg) {
859 case ALG_WEP:
860 key_type = KEY_WEP;
861
862 key_conf->hw_key_idx = key_conf->keyidx;
863 break;
864 case ALG_TKIP:
865 key_type = KEY_TKIP;
866
867 key_conf->hw_key_idx = key_conf->keyidx;
ac4e4ce5
JO
868 tx_seq_32 = wl->tx_security_seq_32;
869 tx_seq_16 = wl->tx_security_seq_16;
f5fc0f86
LC
870 break;
871 case ALG_CCMP:
872 key_type = KEY_AES;
873
874 key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
ac4e4ce5
JO
875 tx_seq_32 = wl->tx_security_seq_32;
876 tx_seq_16 = wl->tx_security_seq_16;
f5fc0f86
LC
877 break;
878 default:
879 wl1271_error("Unknown key algo 0x%x", key_conf->alg);
880
881 ret = -EOPNOTSUPP;
882 goto out_sleep;
883 }
884
885 switch (cmd) {
886 case SET_KEY:
887 ret = wl1271_cmd_set_key(wl, KEY_ADD_OR_REPLACE,
888 key_conf->keyidx, key_type,
889 key_conf->keylen, key_conf->key,
ac4e4ce5 890 addr, tx_seq_32, tx_seq_16);
f5fc0f86
LC
891 if (ret < 0) {
892 wl1271_error("Could not add or replace key");
893 goto out_sleep;
894 }
895 break;
896
897 case DISABLE_KEY:
898 ret = wl1271_cmd_set_key(wl, KEY_REMOVE,
899 key_conf->keyidx, key_type,
900 key_conf->keylen, key_conf->key,
ac4e4ce5 901 addr, 0, 0);
f5fc0f86
LC
902 if (ret < 0) {
903 wl1271_error("Could not remove key");
904 goto out_sleep;
905 }
906 break;
907
908 default:
909 wl1271_error("Unsupported key cmd 0x%x", cmd);
910 ret = -EOPNOTSUPP;
911 goto out_sleep;
912
913 break;
914 }
915
916out_sleep:
917 wl1271_ps_elp_sleep(wl);
918
919out_unlock:
920 mutex_unlock(&wl->mutex);
921
922out:
923 return ret;
924}
925
926static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
927 struct cfg80211_scan_request *req)
928{
929 struct wl1271 *wl = hw->priv;
930 int ret;
931 u8 *ssid = NULL;
932 size_t ssid_len = 0;
933
934 wl1271_debug(DEBUG_MAC80211, "mac80211 hw scan");
935
936 if (req->n_ssids) {
937 ssid = req->ssids[0].ssid;
938 ssid_len = req->ssids[0].ssid_len;
939 }
940
941 mutex_lock(&wl->mutex);
942
943 ret = wl1271_ps_elp_wakeup(wl, false);
944 if (ret < 0)
945 goto out;
946
947 ret = wl1271_cmd_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
948
949 wl1271_ps_elp_sleep(wl);
950
951out:
952 mutex_unlock(&wl->mutex);
953
954 return ret;
955}
956
957static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
958{
959 struct wl1271 *wl = hw->priv;
960 int ret;
961
962 mutex_lock(&wl->mutex);
963
964 ret = wl1271_ps_elp_wakeup(wl, false);
965 if (ret < 0)
966 goto out;
967
968 ret = wl1271_acx_rts_threshold(wl, (u16) value);
969 if (ret < 0)
970 wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret);
971
972 wl1271_ps_elp_sleep(wl);
973
974out:
975 mutex_unlock(&wl->mutex);
976
977 return ret;
978}
979
8a5a37a6
JO
980static u32 wl1271_enabled_rates_get(struct wl1271 *wl, u64 basic_rate_set)
981{
982 struct ieee80211_supported_band *band;
983 u32 enabled_rates = 0;
984 int bit;
985
986 band = wl->hw->wiphy->bands[wl->band];
987 for (bit = 0; bit < band->n_bitrates; bit++) {
988 if (basic_rate_set & 0x1)
989 enabled_rates |= band->bitrates[bit].hw_value;
990 basic_rate_set >>= 1;
991 }
992
993 return enabled_rates;
994}
995
f5fc0f86
LC
996static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
997 struct ieee80211_vif *vif,
998 struct ieee80211_bss_conf *bss_conf,
999 u32 changed)
1000{
1001 enum wl1271_cmd_ps_mode mode;
1002 struct wl1271 *wl = hw->priv;
1003 int ret;
1004
1005 wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed");
1006
1007 mutex_lock(&wl->mutex);
1008
1009 ret = wl1271_ps_elp_wakeup(wl, false);
1010 if (ret < 0)
1011 goto out;
1012
1013 if (changed & BSS_CHANGED_ASSOC) {
1014 if (bss_conf->assoc) {
d94cd297
JO
1015 wl->beacon_int = bss_conf->beacon_int;
1016 wl->dtim_period = bss_conf->dtim_period;
f5fc0f86
LC
1017 wl->aid = bss_conf->aid;
1018
d94cd297
JO
1019 ret = wl1271_cmd_join(wl);
1020 if (ret < 0) {
1021 wl1271_warning("Association configuration "
1022 "failed %d", ret);
1023 goto out_sleep;
1024 }
1025
f5fc0f86
LC
1026 ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
1027 if (ret < 0)
1028 goto out_sleep;
1029
1030 ret = wl1271_acx_aid(wl, wl->aid);
1031 if (ret < 0)
1032 goto out_sleep;
1033
1034 /* If we want to go in PSM but we're not there yet */
1035 if (wl->psm_requested && !wl->psm) {
1036 mode = STATION_POWER_SAVE_MODE;
1037 ret = wl1271_ps_set_mode(wl, mode);
1038 if (ret < 0)
1039 goto out_sleep;
1040 }
d94cd297
JO
1041 } else {
1042 /* use defaults when not associated */
1043 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1044 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1045 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
1046 wl->aid = 0;
f5fc0f86 1047 }
d94cd297 1048
f5fc0f86 1049 }
8a5a37a6 1050
f5fc0f86
LC
1051 if (changed & BSS_CHANGED_ERP_SLOT) {
1052 if (bss_conf->use_short_slot)
1053 ret = wl1271_acx_slot(wl, SLOT_TIME_SHORT);
1054 else
1055 ret = wl1271_acx_slot(wl, SLOT_TIME_LONG);
1056 if (ret < 0) {
1057 wl1271_warning("Set slot time failed %d", ret);
1058 goto out_sleep;
1059 }
1060 }
1061
1062 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
1063 if (bss_conf->use_short_preamble)
1064 wl1271_acx_set_preamble(wl, ACX_PREAMBLE_SHORT);
1065 else
1066 wl1271_acx_set_preamble(wl, ACX_PREAMBLE_LONG);
1067 }
1068
1069 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
1070 if (bss_conf->use_cts_prot)
1071 ret = wl1271_acx_cts_protect(wl, CTSPROTECT_ENABLE);
1072 else
1073 ret = wl1271_acx_cts_protect(wl, CTSPROTECT_DISABLE);
1074 if (ret < 0) {
1075 wl1271_warning("Set ctsprotect failed %d", ret);
1076 goto out_sleep;
1077 }
1078 }
1079
8a5a37a6 1080 if (changed & BSS_CHANGED_BASIC_RATES) {
d94cd297 1081 wl->basic_rate_set = wl1271_enabled_rates_get(
8a5a37a6 1082 wl, bss_conf->basic_rates);
d94cd297
JO
1083 ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
1084
8a5a37a6
JO
1085 if (ret < 0) {
1086 wl1271_warning("Set rate policies failed %d", ret);
1087 goto out_sleep;
1088 }
d94cd297
JO
1089 ret = wl1271_cmd_join(wl);
1090 if (ret < 0) {
1091 wl1271_warning("Join with new basic rate "
1092 "set failed %d", ret);
1093 goto out_sleep;
1094 }
8a5a37a6
JO
1095 }
1096
f5fc0f86
LC
1097out_sleep:
1098 wl1271_ps_elp_sleep(wl);
1099
1100out:
1101 mutex_unlock(&wl->mutex);
1102}
1103
1104
1105/* can't be const, mac80211 writes to this */
1106static struct ieee80211_rate wl1271_rates[] = {
1107 { .bitrate = 10,
1108 .hw_value = 0x1,
1109 .hw_value_short = 0x1, },
1110 { .bitrate = 20,
1111 .hw_value = 0x2,
1112 .hw_value_short = 0x2,
1113 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1114 { .bitrate = 55,
1115 .hw_value = 0x4,
1116 .hw_value_short = 0x4,
1117 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1118 { .bitrate = 110,
1119 .hw_value = 0x20,
1120 .hw_value_short = 0x20,
1121 .flags = IEEE80211_RATE_SHORT_PREAMBLE },
1122 { .bitrate = 60,
1123 .hw_value = 0x8,
1124 .hw_value_short = 0x8, },
1125 { .bitrate = 90,
1126 .hw_value = 0x10,
1127 .hw_value_short = 0x10, },
1128 { .bitrate = 120,
1129 .hw_value = 0x40,
1130 .hw_value_short = 0x40, },
1131 { .bitrate = 180,
1132 .hw_value = 0x80,
1133 .hw_value_short = 0x80, },
1134 { .bitrate = 240,
1135 .hw_value = 0x200,
1136 .hw_value_short = 0x200, },
1137 { .bitrate = 360,
1138 .hw_value = 0x400,
1139 .hw_value_short = 0x400, },
1140 { .bitrate = 480,
1141 .hw_value = 0x800,
1142 .hw_value_short = 0x800, },
1143 { .bitrate = 540,
1144 .hw_value = 0x1000,
1145 .hw_value_short = 0x1000, },
1146};
1147
1148/* can't be const, mac80211 writes to this */
1149static struct ieee80211_channel wl1271_channels[] = {
1150 { .hw_value = 1, .center_freq = 2412},
1151 { .hw_value = 2, .center_freq = 2417},
1152 { .hw_value = 3, .center_freq = 2422},
1153 { .hw_value = 4, .center_freq = 2427},
1154 { .hw_value = 5, .center_freq = 2432},
1155 { .hw_value = 6, .center_freq = 2437},
1156 { .hw_value = 7, .center_freq = 2442},
1157 { .hw_value = 8, .center_freq = 2447},
1158 { .hw_value = 9, .center_freq = 2452},
1159 { .hw_value = 10, .center_freq = 2457},
1160 { .hw_value = 11, .center_freq = 2462},
1161 { .hw_value = 12, .center_freq = 2467},
1162 { .hw_value = 13, .center_freq = 2472},
1163};
1164
1165/* can't be const, mac80211 writes to this */
1166static struct ieee80211_supported_band wl1271_band_2ghz = {
1167 .channels = wl1271_channels,
1168 .n_channels = ARRAY_SIZE(wl1271_channels),
1169 .bitrates = wl1271_rates,
1170 .n_bitrates = ARRAY_SIZE(wl1271_rates),
1171};
1172
1173static const struct ieee80211_ops wl1271_ops = {
1174 .start = wl1271_op_start,
1175 .stop = wl1271_op_stop,
1176 .add_interface = wl1271_op_add_interface,
1177 .remove_interface = wl1271_op_remove_interface,
1178 .config = wl1271_op_config,
1179/* .config_interface = wl1271_op_config_interface, */
1180 .configure_filter = wl1271_op_configure_filter,
1181 .tx = wl1271_op_tx,
1182 .set_key = wl1271_op_set_key,
1183 .hw_scan = wl1271_op_hw_scan,
1184 .bss_info_changed = wl1271_op_bss_info_changed,
1185 .set_rts_threshold = wl1271_op_set_rts_threshold,
1186};
1187
1188static int wl1271_register_hw(struct wl1271 *wl)
1189{
1190 int ret;
1191
1192 if (wl->mac80211_registered)
1193 return 0;
1194
1195 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
1196
1197 ret = ieee80211_register_hw(wl->hw);
1198 if (ret < 0) {
1199 wl1271_error("unable to register mac80211 hw: %d", ret);
1200 return ret;
1201 }
1202
1203 wl->mac80211_registered = true;
1204
1205 wl1271_notice("loaded");
1206
1207 return 0;
1208}
1209
1210static int wl1271_init_ieee80211(struct wl1271 *wl)
1211{
1e2b7976
JO
1212 /* The tx descriptor buffer and the TKIP space. */
1213 wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE +
1214 sizeof(struct wl1271_tx_hw_descr);
f5fc0f86
LC
1215
1216 /* unit us */
1217 /* FIXME: find a proper value */
1218 wl->hw->channel_change_time = 10000;
1219
1220 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
1221 IEEE80211_HW_NOISE_DBM;
1222
1223 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
1224 wl->hw->wiphy->max_scan_ssids = 1;
1225 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz;
1226
1227 SET_IEEE80211_DEV(wl->hw, &wl->spi->dev);
1228
1229 return 0;
1230}
1231
1232static void wl1271_device_release(struct device *dev)
1233{
1234
1235}
1236
1237static struct platform_device wl1271_device = {
1238 .name = "wl1271",
1239 .id = -1,
1240
1241 /* device model insists to have a release function */
1242 .dev = {
1243 .release = wl1271_device_release,
1244 },
1245};
1246
1247#define WL1271_DEFAULT_CHANNEL 0
1248static int __devinit wl1271_probe(struct spi_device *spi)
1249{
1250 struct wl12xx_platform_data *pdata;
1251 struct ieee80211_hw *hw;
1252 struct wl1271 *wl;
1253 int ret, i;
1254 static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf};
1255
1256 pdata = spi->dev.platform_data;
1257 if (!pdata) {
1258 wl1271_error("no platform data");
1259 return -ENODEV;
1260 }
1261
1262 hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops);
1263 if (!hw) {
1264 wl1271_error("could not alloc ieee80211_hw");
1265 return -ENOMEM;
1266 }
1267
1268 wl = hw->priv;
1269 memset(wl, 0, sizeof(*wl));
1270
1271 wl->hw = hw;
1272 dev_set_drvdata(&spi->dev, wl);
1273 wl->spi = spi;
1274
1275 skb_queue_head_init(&wl->tx_queue);
1276
1277 INIT_WORK(&wl->filter_work, wl1271_filter_work);
37b70a81 1278 INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work);
f5fc0f86
LC
1279 wl->channel = WL1271_DEFAULT_CHANNEL;
1280 wl->scanning = false;
1281 wl->default_key = 0;
1282 wl->listen_int = 1;
1283 wl->rx_counter = 0;
1284 wl->rx_config = WL1271_DEFAULT_RX_CONFIG;
1285 wl->rx_filter = WL1271_DEFAULT_RX_FILTER;
1286 wl->elp = false;
1287 wl->psm = 0;
1288 wl->psm_requested = false;
1289 wl->tx_queue_stopped = false;
1290 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
d94cd297
JO
1291 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1292 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1293 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
8a5a37a6 1294 wl->band = IEEE80211_BAND_2GHZ;
f5fc0f86 1295
be7078c2 1296 for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
f5fc0f86
LC
1297 wl->tx_frames[i] = NULL;
1298
1299 spin_lock_init(&wl->wl_lock);
1300
1301 /*
1302 * In case our MAC address is not correctly set,
1303 * we use a random but Nokia MAC.
1304 */
1305 memcpy(wl->mac_addr, nokia_oui, 3);
1306 get_random_bytes(wl->mac_addr + 3, 3);
1307
1308 wl->state = WL1271_STATE_OFF;
1309 mutex_init(&wl->mutex);
1310
1311 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL);
1312 if (!wl->rx_descriptor) {
1313 wl1271_error("could not allocate memory for rx descriptor");
1314 ret = -ENOMEM;
1315 goto out_free;
1316 }
1317
1318 /* This is the only SPI value that we need to set here, the rest
1319 * comes from the board-peripherals file */
1320 spi->bits_per_word = 32;
1321
1322 ret = spi_setup(spi);
1323 if (ret < 0) {
1324 wl1271_error("spi_setup failed");
1325 goto out_free;
1326 }
1327
1328 wl->set_power = pdata->set_power;
1329 if (!wl->set_power) {
1330 wl1271_error("set power function missing in platform data");
1331 ret = -ENODEV;
1332 goto out_free;
1333 }
1334
1335 wl->irq = spi->irq;
1336 if (wl->irq < 0) {
1337 wl1271_error("irq missing in platform data");
1338 ret = -ENODEV;
1339 goto out_free;
1340 }
1341
1342 ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
1343 if (ret < 0) {
1344 wl1271_error("request_irq() failed: %d", ret);
1345 goto out_free;
1346 }
1347
1348 set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
1349
1350 disable_irq(wl->irq);
1351
1352 ret = platform_device_register(&wl1271_device);
1353 if (ret) {
1354 wl1271_error("couldn't register platform device");
1355 goto out_irq;
1356 }
1357 dev_set_drvdata(&wl1271_device.dev, wl);
1358
1359 ret = wl1271_init_ieee80211(wl);
1360 if (ret)
1361 goto out_platform;
1362
1363 ret = wl1271_register_hw(wl);
1364 if (ret)
1365 goto out_platform;
1366
1367 wl1271_debugfs_init(wl);
1368
1369 wl1271_notice("initialized");
1370
1371 return 0;
1372
1373 out_platform:
1374 platform_device_unregister(&wl1271_device);
1375
1376 out_irq:
1377 free_irq(wl->irq, wl);
1378
1379 out_free:
1380 kfree(wl->rx_descriptor);
1381 wl->rx_descriptor = NULL;
1382
1383 ieee80211_free_hw(hw);
1384
1385 return ret;
1386}
1387
1388static int __devexit wl1271_remove(struct spi_device *spi)
1389{
1390 struct wl1271 *wl = dev_get_drvdata(&spi->dev);
1391
1392 ieee80211_unregister_hw(wl->hw);
1393
1394 wl1271_debugfs_exit(wl);
1395 platform_device_unregister(&wl1271_device);
1396 free_irq(wl->irq, wl);
1397 kfree(wl->target_mem_map);
1398 kfree(wl->fw);
1399 wl->fw = NULL;
1400 kfree(wl->nvs);
1401 wl->nvs = NULL;
1402
1403 kfree(wl->rx_descriptor);
1404 wl->rx_descriptor = NULL;
1405
1406 kfree(wl->fw_status);
1407 kfree(wl->tx_res_if);
1408
1409 ieee80211_free_hw(wl->hw);
1410
1411 return 0;
1412}
1413
1414
1415static struct spi_driver wl1271_spi_driver = {
1416 .driver = {
1417 .name = "wl1271",
1418 .bus = &spi_bus_type,
1419 .owner = THIS_MODULE,
1420 },
1421
1422 .probe = wl1271_probe,
1423 .remove = __devexit_p(wl1271_remove),
1424};
1425
1426static int __init wl1271_init(void)
1427{
1428 int ret;
1429
1430 ret = spi_register_driver(&wl1271_spi_driver);
1431 if (ret < 0) {
1432 wl1271_error("failed to register spi driver: %d", ret);
1433 goto out;
1434 }
1435
1436out:
1437 return ret;
1438}
1439
1440static void __exit wl1271_exit(void)
1441{
1442 spi_unregister_driver(&wl1271_spi_driver);
1443
1444 wl1271_notice("unloaded");
1445}
1446
1447module_init(wl1271_init);
1448module_exit(wl1271_exit);
1449
1450MODULE_LICENSE("GPL");
1451MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>");
2f018725 1452MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
This page took 0.120938 seconds and 5 git commands to generate.