2 * Atheros AR9170 driver
6 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2009, Christian Lamparter <chunkeey@web.de>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; see the file COPYING. If not, see
21 * http://www.gnu.org/licenses/.
23 * This file incorporates work covered by the following copyright and
25 * Copyright (c) 2007-2008 Atheros Communications, Inc.
27 * Permission to use, copy, modify, and/or distribute this software for any
28 * purpose with or without fee is hereby granted, provided that the above
29 * copyright notice and this permission notice appear in all copies.
31 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
32 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
33 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
34 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
35 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
36 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
37 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40 #include <linux/module.h>
41 #include <linux/slab.h>
42 #include <linux/usb.h>
43 #include <linux/firmware.h>
44 #include <linux/etherdevice.h>
45 #include <net/mac80211.h>
51 MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
52 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
53 MODULE_LICENSE("GPL");
54 MODULE_DESCRIPTION("Atheros AR9170 802.11n USB wireless");
55 MODULE_FIRMWARE("ar9170.fw");
56 MODULE_FIRMWARE("ar9170-1.fw");
57 MODULE_FIRMWARE("ar9170-2.fw");
59 enum ar9170_requirements {
60 AR9170_REQ_FW1_ONLY = 1,
63 static struct usb_device_id ar9170_usb_ids[] = {
65 { USB_DEVICE(0x0cf3, 0x9170) },
67 { USB_DEVICE(0x0cf3, 0x1001) },
68 /* TP-Link TL-WN821N v2 */
69 { USB_DEVICE(0x0cf3, 0x1002) },
71 { USB_DEVICE(0xcace, 0x0300) },
72 /* D-Link DWA 160 A1 */
73 { USB_DEVICE(0x07d1, 0x3c10) },
74 /* D-Link DWA 160 A2 */
75 { USB_DEVICE(0x07d1, 0x3a09) },
76 /* Netgear WNDA3100 */
77 { USB_DEVICE(0x0846, 0x9010) },
78 /* Netgear WN111 v2 */
79 { USB_DEVICE(0x0846, 0x9001) },
81 { USB_DEVICE(0x0ace, 0x1221) },
83 { USB_DEVICE(0x0586, 0x3417) },
85 { USB_DEVICE(0x0cde, 0x0023) },
87 { USB_DEVICE(0x0cde, 0x0026) },
88 /* Sphairon Homelink 1202 */
89 { USB_DEVICE(0x0cde, 0x0027) },
91 { USB_DEVICE(0x083a, 0xf522) },
93 { USB_DEVICE(0x2019, 0x5304) },
94 /* IO-Data WNGDNUS2 */
95 { USB_DEVICE(0x04bb, 0x093f) },
96 /* AVM FRITZ!WLAN USB Stick N */
97 { USB_DEVICE(0x057C, 0x8401) },
99 { USB_DEVICE(0x0409, 0x0249) },
100 /* AVM FRITZ!WLAN USB Stick N 2.4 */
101 { USB_DEVICE(0x057C, 0x8402), .driver_info = AR9170_REQ_FW1_ONLY },
106 MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
108 static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
114 if (unlikely(!IS_STARTED(&aru->common)))
117 spin_lock_irqsave(&aru->tx_urb_lock, flags);
118 if (atomic_read(&aru->tx_submitted_urbs) >= AR9170_NUM_TX_URBS) {
119 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
122 atomic_inc(&aru->tx_submitted_urbs);
124 urb = usb_get_from_anchor(&aru->tx_pending);
126 atomic_dec(&aru->tx_submitted_urbs);
127 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
131 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
133 aru->tx_pending_urbs--;
134 usb_anchor_urb(urb, &aru->tx_submitted);
136 err = usb_submit_urb(urb, GFP_ATOMIC);
138 if (ar9170_nag_limiter(&aru->common))
139 dev_err(&aru->udev->dev, "submit_urb failed (%d).\n",
142 usb_unanchor_urb(urb);
143 atomic_dec(&aru->tx_submitted_urbs);
144 ar9170_tx_callback(&aru->common, urb->context);
150 static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
152 struct sk_buff *skb = urb->context;
153 struct ar9170_usb *aru = (struct ar9170_usb *)
154 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
156 if (unlikely(!aru)) {
157 dev_kfree_skb_irq(skb);
161 atomic_dec(&aru->tx_submitted_urbs);
163 ar9170_tx_callback(&aru->common, skb);
165 ar9170_usb_submit_urb(aru);
168 static void ar9170_usb_tx_urb_complete(struct urb *urb)
172 static void ar9170_usb_irq_completed(struct urb *urb)
174 struct ar9170_usb *aru = urb->context;
176 switch (urb->status) {
177 /* everything is fine */
192 ar9170_handle_command_response(&aru->common, urb->transfer_buffer,
196 usb_anchor_urb(urb, &aru->rx_submitted);
197 if (usb_submit_urb(urb, GFP_ATOMIC)) {
198 usb_unanchor_urb(urb);
205 usb_buffer_free(aru->udev, 64, urb->transfer_buffer, urb->transfer_dma);
208 static void ar9170_usb_rx_completed(struct urb *urb)
210 struct sk_buff *skb = urb->context;
211 struct ar9170_usb *aru = (struct ar9170_usb *)
212 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
218 switch (urb->status) {
219 /* everything is fine */
234 skb_put(skb, urb->actual_length);
235 ar9170_rx(&aru->common, skb);
238 skb_reset_tail_pointer(skb);
241 usb_anchor_urb(urb, &aru->rx_submitted);
242 err = usb_submit_urb(urb, GFP_ATOMIC);
244 usb_unanchor_urb(urb);
251 dev_kfree_skb_irq(skb);
254 static int ar9170_usb_prep_rx_urb(struct ar9170_usb *aru,
255 struct urb *urb, gfp_t gfp)
259 skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE + 32, gfp);
263 /* reserve some space for mac80211's radiotap */
264 skb_reserve(skb, 32);
266 usb_fill_bulk_urb(urb, aru->udev,
267 usb_rcvbulkpipe(aru->udev, AR9170_EP_RX),
268 skb->data, min(skb_tailroom(skb),
269 AR9170_MAX_RX_BUFFER_SIZE),
270 ar9170_usb_rx_completed, skb);
275 static int ar9170_usb_alloc_rx_irq_urb(struct ar9170_usb *aru)
277 struct urb *urb = NULL;
281 /* initialize interrupt endpoint */
282 urb = usb_alloc_urb(0, GFP_KERNEL);
286 ibuf = usb_buffer_alloc(aru->udev, 64, GFP_KERNEL, &urb->transfer_dma);
290 usb_fill_int_urb(urb, aru->udev,
291 usb_rcvintpipe(aru->udev, AR9170_EP_IRQ), ibuf,
292 64, ar9170_usb_irq_completed, aru, 1);
293 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
295 usb_anchor_urb(urb, &aru->rx_submitted);
296 err = usb_submit_urb(urb, GFP_KERNEL);
298 usb_unanchor_urb(urb);
299 usb_buffer_free(aru->udev, 64, urb->transfer_buffer,
308 static int ar9170_usb_alloc_rx_bulk_urbs(struct ar9170_usb *aru)
314 for (i = 0; i < AR9170_NUM_RX_URBS; i++) {
316 urb = usb_alloc_urb(0, GFP_KERNEL);
320 err = ar9170_usb_prep_rx_urb(aru, urb, GFP_KERNEL);
326 usb_anchor_urb(urb, &aru->rx_submitted);
327 err = usb_submit_urb(urb, GFP_KERNEL);
329 usb_unanchor_urb(urb);
330 dev_kfree_skb_any((void *) urb->transfer_buffer);
337 /* the device now waiting for a firmware. */
338 aru->common.state = AR9170_IDLE;
343 usb_kill_anchored_urbs(&aru->rx_submitted);
347 static int ar9170_usb_flush(struct ar9170 *ar)
349 struct ar9170_usb *aru = (void *) ar;
354 aru->common.state = AR9170_IDLE;
356 usb_wait_anchor_empty_timeout(&aru->tx_pending,
357 msecs_to_jiffies(800));
358 while ((urb = usb_get_from_anchor(&aru->tx_pending))) {
359 ar9170_tx_callback(&aru->common, (void *) urb->context);
363 /* lets wait a while until the tx - queues are dried out */
364 ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
365 msecs_to_jiffies(100));
369 usb_kill_anchored_urbs(&aru->tx_submitted);
371 if (IS_ACCEPTING_CMD(ar))
372 aru->common.state = AR9170_STARTED;
377 static void ar9170_usb_cancel_urbs(struct ar9170_usb *aru)
381 aru->common.state = AR9170_UNKNOWN_STATE;
383 err = ar9170_usb_flush(&aru->common);
385 dev_err(&aru->udev->dev, "stuck tx urbs!\n");
387 usb_poison_anchored_urbs(&aru->tx_submitted);
388 usb_poison_anchored_urbs(&aru->rx_submitted);
391 static int ar9170_usb_exec_cmd(struct ar9170 *ar, enum ar9170_cmd cmd,
392 unsigned int plen, void *payload,
393 unsigned int outlen, void *out)
395 struct ar9170_usb *aru = (void *) ar;
396 struct urb *urb = NULL;
400 if (unlikely(!IS_ACCEPTING_CMD(ar)))
403 if (WARN_ON(plen > AR9170_MAX_CMD_LEN - 4))
406 urb = usb_alloc_urb(0, GFP_ATOMIC);
410 ar->cmdbuf[0] = cpu_to_le32(plen);
411 ar->cmdbuf[0] |= cpu_to_le32(cmd << 8);
412 /* writing multiple regs fills this buffer already */
413 if (plen && payload != (u8 *)(&ar->cmdbuf[1]))
414 memcpy(&ar->cmdbuf[1], payload, plen);
416 spin_lock_irqsave(&aru->common.cmdlock, flags);
417 aru->readbuf = (u8 *)out;
418 aru->readlen = outlen;
419 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
421 usb_fill_int_urb(urb, aru->udev,
422 usb_sndintpipe(aru->udev, AR9170_EP_CMD),
423 aru->common.cmdbuf, plen + 4,
424 ar9170_usb_tx_urb_complete, NULL, 1);
426 usb_anchor_urb(urb, &aru->tx_submitted);
427 err = usb_submit_urb(urb, GFP_ATOMIC);
429 usb_unanchor_urb(urb);
435 err = wait_for_completion_timeout(&aru->cmd_wait, HZ);
441 if (aru->readlen != outlen) {
449 /* Maybe the device was removed in the second we were waiting? */
450 if (IS_STARTED(ar)) {
451 dev_err(&aru->udev->dev, "no command feedback "
452 "received (%d).\n", err);
454 /* provide some maybe useful debug information */
455 print_hex_dump_bytes("ar9170 cmd: ", DUMP_PREFIX_NONE,
456 aru->common.cmdbuf, plen + 4);
460 /* invalidate to avoid completing the next prematurely */
461 spin_lock_irqsave(&aru->common.cmdlock, flags);
464 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
471 static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb)
473 struct ar9170_usb *aru = (struct ar9170_usb *) ar;
476 if (unlikely(!IS_STARTED(ar))) {
477 /* Seriously, what were you drink... err... thinking!? */
481 urb = usb_alloc_urb(0, GFP_ATOMIC);
485 usb_fill_bulk_urb(urb, aru->udev,
486 usb_sndbulkpipe(aru->udev, AR9170_EP_TX),
488 ar9170_usb_tx_urb_complete_frame, skb);
489 urb->transfer_flags |= URB_ZERO_PACKET;
491 usb_anchor_urb(urb, &aru->tx_pending);
492 aru->tx_pending_urbs++;
496 ar9170_usb_submit_urb(aru);
500 static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer)
502 struct ar9170_usb *aru = (void *) ar;
506 if (unlikely(!buffer))
509 in = le32_to_cpup((__le32 *)buffer);
510 out = le32_to_cpu(ar->cmdbuf[0]);
512 /* mask off length byte */
515 if (aru->readlen >= 0) {
516 /* add expected length */
519 /* add obtained length */
524 * Some commands (e.g: AR9170_CMD_FREQUENCY) have a variable response
525 * length and we cannot predict the correct length in advance.
526 * So we only check if we provided enough space for the data.
528 if (unlikely(out < in)) {
529 dev_warn(&aru->udev->dev, "received invalid command response "
530 "got %d bytes, instead of %d bytes "
531 "and the resp length is %d bytes\n",
533 print_hex_dump_bytes("ar9170 invalid resp: ",
534 DUMP_PREFIX_OFFSET, buffer, len);
536 * Do not complete, then the command times out,
537 * and we get a stack trace from there.
542 spin_lock_irqsave(&aru->common.cmdlock, flags);
543 if (aru->readbuf && len > 0) {
544 memcpy(aru->readbuf, buffer + 4, len - 4);
547 complete(&aru->cmd_wait);
548 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
551 static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
552 size_t len, u32 addr, bool complete)
555 u8 *buf = kmalloc(4096, GFP_KERNEL);
561 transfer = min_t(int, len, 4096);
562 memcpy(buf, data, transfer);
564 err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
565 0x30 /* FW DL */, 0x40 | USB_DIR_OUT,
566 addr >> 8, 0, buf, transfer, 1000);
580 err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
581 0x31 /* FW DL COMPLETE */,
582 0x40 | USB_DIR_OUT, 0, 0, NULL, 0, 5000);
588 static int ar9170_usb_reset(struct ar9170_usb *aru)
590 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
593 ret = usb_lock_device_for_reset(aru->udev, aru->intf);
595 dev_err(&aru->udev->dev, "unable to lock device "
596 "for reset (%d).\n", ret);
601 ret = usb_reset_device(aru->udev);
603 usb_unlock_device(aru->udev);
605 /* let it rest - for a second - */
611 static int ar9170_usb_upload_firmware(struct ar9170_usb *aru)
615 if (!aru->init_values)
616 goto upload_fw_start;
618 /* First, upload initial values to device RAM */
619 err = ar9170_usb_upload(aru, aru->init_values->data,
620 aru->init_values->size, 0x102800, false);
622 dev_err(&aru->udev->dev, "firmware part 1 "
623 "upload failed (%d).\n", err);
629 /* Then, upload the firmware itself and start it */
630 return ar9170_usb_upload(aru, aru->firmware->data, aru->firmware->size,
634 static int ar9170_usb_init_transport(struct ar9170_usb *aru)
636 struct ar9170 *ar = (void *) &aru->common;
639 ar9170_regwrite_begin(ar);
641 /* Set USB Rx stream mode MAX packet number to 2 */
642 ar9170_regwrite(AR9170_USB_REG_MAX_AGG_UPLOAD, 0x4);
644 /* Set USB Rx stream mode timeout to 10us */
645 ar9170_regwrite(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80);
647 ar9170_regwrite_finish();
649 err = ar9170_regwrite_result();
651 dev_err(&aru->udev->dev, "USB setup failed (%d).\n", err);
656 static void ar9170_usb_stop(struct ar9170 *ar)
658 struct ar9170_usb *aru = (void *) ar;
661 if (IS_ACCEPTING_CMD(ar))
662 aru->common.state = AR9170_STOPPED;
664 ret = ar9170_usb_flush(ar);
666 dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
668 usb_poison_anchored_urbs(&aru->tx_submitted);
672 * So far we freed all tx urbs, but we won't dare to touch any rx urbs.
673 * Else we would end up with a unresponsive device...
677 static int ar9170_usb_open(struct ar9170 *ar)
679 struct ar9170_usb *aru = (void *) ar;
682 usb_unpoison_anchored_urbs(&aru->tx_submitted);
683 err = ar9170_usb_init_transport(aru);
685 usb_poison_anchored_urbs(&aru->tx_submitted);
689 aru->common.state = AR9170_IDLE;
693 static int ar9170_usb_init_device(struct ar9170_usb *aru)
697 err = ar9170_usb_alloc_rx_irq_urb(aru);
701 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
705 err = ar9170_usb_upload_firmware(aru);
707 err = ar9170_echo_test(&aru->common, 0x60d43110);
709 /* force user invention, by disabling the device */
710 err = usb_driver_set_configuration(aru->udev, -1);
711 dev_err(&aru->udev->dev, "device is in a bad state. "
712 "please reconnect it!\n");
720 ar9170_usb_cancel_urbs(aru);
726 static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
728 struct device *parent = aru->udev->dev.parent;
730 complete(&aru->firmware_loading_complete);
732 /* unbind anything failed */
735 device_release_driver(&aru->udev->dev);
739 usb_put_dev(aru->udev);
742 static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
744 struct ar9170_usb *aru = context;
750 dev_err(&aru->udev->dev, "firmware file not found.\n");
754 err = ar9170_usb_init_device(aru);
758 err = ar9170_usb_open(&aru->common);
762 err = ar9170_register(&aru->common, &aru->udev->dev);
764 ar9170_usb_stop(&aru->common);
768 complete(&aru->firmware_loading_complete);
769 usb_put_dev(aru->udev);
773 ar9170_usb_cancel_urbs(aru);
776 ar9170_usb_firmware_failed(aru);
779 static void ar9170_usb_firmware_inits(const struct firmware *fw,
782 struct ar9170_usb *aru = context;
786 dev_err(&aru->udev->dev, "file with init values not found.\n");
787 ar9170_usb_firmware_failed(aru);
791 aru->init_values = fw;
793 /* ok so we have the init values -- get code for two-stage */
795 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-2.fw",
796 &aru->udev->dev, GFP_KERNEL, aru,
797 ar9170_usb_firmware_finish);
799 ar9170_usb_firmware_failed(aru);
802 static void ar9170_usb_firmware_step2(const struct firmware *fw, void *context)
804 struct ar9170_usb *aru = context;
808 ar9170_usb_firmware_finish(fw, context);
812 if (aru->req_one_stage_fw) {
813 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
814 "not found and is required for this device\n");
815 ar9170_usb_firmware_failed(aru);
819 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
820 "not found, trying old firmware...\n");
822 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-1.fw",
823 &aru->udev->dev, GFP_KERNEL, aru,
824 ar9170_usb_firmware_inits);
826 ar9170_usb_firmware_failed(aru);
829 static bool ar9170_requires_one_stage(const struct usb_device_id *id)
831 if (!id->driver_info)
833 if (id->driver_info == AR9170_REQ_FW1_ONLY)
838 static int ar9170_usb_probe(struct usb_interface *intf,
839 const struct usb_device_id *id)
841 struct ar9170_usb *aru;
843 struct usb_device *udev;
846 aru = ar9170_alloc(sizeof(*aru));
852 udev = interface_to_usbdev(intf);
858 aru->req_one_stage_fw = ar9170_requires_one_stage(id);
860 usb_set_intfdata(intf, aru);
861 SET_IEEE80211_DEV(ar->hw, &intf->dev);
863 init_usb_anchor(&aru->rx_submitted);
864 init_usb_anchor(&aru->tx_pending);
865 init_usb_anchor(&aru->tx_submitted);
866 init_completion(&aru->cmd_wait);
867 init_completion(&aru->firmware_loading_complete);
868 spin_lock_init(&aru->tx_urb_lock);
870 aru->tx_pending_urbs = 0;
871 atomic_set(&aru->tx_submitted_urbs, 0);
873 aru->common.stop = ar9170_usb_stop;
874 aru->common.flush = ar9170_usb_flush;
875 aru->common.open = ar9170_usb_open;
876 aru->common.tx = ar9170_usb_tx;
877 aru->common.exec_cmd = ar9170_usb_exec_cmd;
878 aru->common.callback_cmd = ar9170_usb_callback_cmd;
881 udev->reset_resume = 1;
882 #endif /* CONFIG_PM */
883 err = ar9170_usb_reset(aru);
887 usb_get_dev(aru->udev);
888 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
889 &aru->udev->dev, GFP_KERNEL, aru,
890 ar9170_usb_firmware_step2);
892 usb_set_intfdata(intf, NULL);
894 ieee80211_free_hw(ar->hw);
899 static void ar9170_usb_disconnect(struct usb_interface *intf)
901 struct ar9170_usb *aru = usb_get_intfdata(intf);
906 aru->common.state = AR9170_IDLE;
908 wait_for_completion(&aru->firmware_loading_complete);
910 ar9170_unregister(&aru->common);
911 ar9170_usb_cancel_urbs(aru);
913 usb_put_dev(aru->udev);
914 usb_set_intfdata(intf, NULL);
915 ieee80211_free_hw(aru->common.hw);
917 release_firmware(aru->init_values);
918 release_firmware(aru->firmware);
922 static int ar9170_suspend(struct usb_interface *intf,
923 pm_message_t message)
925 struct ar9170_usb *aru = usb_get_intfdata(intf);
930 aru->common.state = AR9170_IDLE;
931 ar9170_usb_cancel_urbs(aru);
936 static int ar9170_resume(struct usb_interface *intf)
938 struct ar9170_usb *aru = usb_get_intfdata(intf);
944 usb_unpoison_anchored_urbs(&aru->rx_submitted);
945 usb_unpoison_anchored_urbs(&aru->tx_submitted);
947 err = ar9170_usb_init_device(aru);
951 err = ar9170_usb_open(&aru->common);
958 aru->common.state = AR9170_IDLE;
959 ar9170_usb_cancel_urbs(aru);
963 #endif /* CONFIG_PM */
965 static struct usb_driver ar9170_driver = {
967 .probe = ar9170_usb_probe,
968 .disconnect = ar9170_usb_disconnect,
969 .id_table = ar9170_usb_ids,
972 .suspend = ar9170_suspend,
973 .resume = ar9170_resume,
974 .reset_resume = ar9170_resume,
975 #endif /* CONFIG_PM */
978 static int __init ar9170_init(void)
980 return usb_register(&ar9170_driver);
983 static void __exit ar9170_exit(void)
985 usb_deregister(&ar9170_driver);
988 module_init(ar9170_init);
989 module_exit(ar9170_exit);