diff -aurN bluetooth.orig/ath3k.c bluetooth.new/ath3k.c --- bluetooth.orig/ath3k.c 2011-05-24 12:50:00.073891580 +0800 +++ bluetooth.new/ath3k.c 2011-05-24 13:30:55.212893136 +0800 @@ -29,6 +29,8 @@ #include #include +#include "btusb.h" + #define VERSION "1.0" #define ATH3K_DNLOAD 0x01 @@ -56,28 +58,6 @@ unsigned char reserved[0x07]; }; -static struct usb_device_id ath3k_table[] = { - /* Atheros AR3011 */ - { USB_DEVICE(0x0CF3, 0x3000) }, - - /* Atheros AR3011 with sflash firmware*/ - { USB_DEVICE(0x0CF3, 0x3002) }, - { USB_DEVICE(0x13d3, 0x3304) }, - - /* Atheros AR9285 Malbec with sflash firmware */ - { USB_DEVICE(0x03F0, 0x311D) }, - - /* Atheros AR3012 with sflash firmware*/ - { USB_DEVICE(0x0CF3, 0x3004) }, - - /* Atheros AR5BBU12 with sflash firmware */ - { USB_DEVICE(0x0489, 0xE02C) }, - - { } /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, ath3k_table); - #define BTUSB_ATH3012 0x80 /* This table is to load patch and sysconfig files * for AR3012 */ @@ -353,7 +333,7 @@ return ret; } -static int ath3k_probe(struct usb_interface *intf, +int ath3k_dfu_init(struct usb_interface *intf, const struct usb_device_id *id) { const struct firmware *firmware; @@ -404,32 +384,13 @@ return ret; } +EXPORT_SYMBOL_GPL(ath3k_dfu_init); -static void ath3k_disconnect(struct usb_interface *intf) +void ath3k_dfu_deinit(struct usb_interface *intf) { - BT_DBG("ath3k_disconnect intf %p", intf); + BT_DBG("ath3k_dfu_deinit intf %p", intf); } - -static struct usb_driver ath3k_driver = { - .name = "ath3k", - .probe = ath3k_probe, - .disconnect = ath3k_disconnect, - .id_table = ath3k_table, -}; - -static int __init ath3k_init(void) -{ - BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION); - return usb_register(&ath3k_driver); -} - -static void __exit ath3k_exit(void) -{ - usb_deregister(&ath3k_driver); -} - -module_init(ath3k_init); -module_exit(ath3k_exit); +EXPORT_SYMBOL_GPL(ath3k_dfu_deinit); MODULE_AUTHOR("Atheros Communications"); MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); diff -aurN bluetooth.orig/btusb.c bluetooth.new/btusb.c --- bluetooth.orig/btusb.c 2011-05-24 12:50:00.073891580 +0800 +++ bluetooth.new/btusb.c 2011-05-24 14:28:56.077896856 +0800 @@ -35,6 +35,8 @@ #include #include +#include "btusb.h" + #define VERSION "0.6" static int ignore_dga; @@ -54,6 +56,7 @@ #define BTUSB_BCM92035 0x10 #define BTUSB_BROKEN_ISOC 0x20 #define BTUSB_WRONG_SCO_MTU 0x40 +#define BTUSB_AR301X 0x80 static struct usb_device_id btusb_table[] = { /* Generic Bluetooth USB device */ @@ -90,30 +93,29 @@ /* Canyon CN-BTU1 with HID interfaces */ { USB_DEVICE(0x0c10, 0x0000) }, - { } /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, btusb_table); - -static struct usb_device_id blacklist_table[] = { /* CSR BlueCore devices */ { USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR }, /* Broadcom BCM2033 without firmware */ { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, +#ifdef CONFIG_BT_ATH3K + /* Atheros AR3011 */ + { USB_DEVICE(0x0CF3, 0x3000), .driver_info = BTUSB_AR301X }, + /* Atheros 3011 with sflash firmware */ - { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, - { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, + { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_AR301X }, + { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_AR301X }, /* Atheros AR9285 Malbec with sflash firmware */ - { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, + { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_AR301X }, /* Atheros 3012 with sflash firmware */ - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_IGNORE }, + { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_AR301X }, /* Atheros AR5BBU12 with sflash firmware */ - { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, + { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_AR301X }, +#endif /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, @@ -168,6 +170,8 @@ { } /* Terminating entry */ }; +MODULE_DEVICE_TABLE(usb, btusb_table); + #define BTUSB_MAX_ISOC_FRAMES 10 #define BTUSB_INTR_RUNNING 0 @@ -897,7 +901,7 @@ if (!id->driver_info) { const struct usb_device_id *match; - match = usb_match_id(intf, blacklist_table); + match = usb_match_id(intf, btusb_table); if (match) id = match; } @@ -914,6 +918,13 @@ if (ignore_sniffer && id->driver_info & BTUSB_SNIFFER) return -ENODEV; + if (id->driver_info & BTUSB_AR301X) { +#ifdef CONFIG_BT_ATH3K + if(ath3k_dfu_init(intf, id)) + return 0; +#endif + } + data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; diff -aurN bluetooth.orig/btusb.h bluetooth.new/btusb.h --- bluetooth.orig/btusb.h 1970-01-01 08:00:00.000000000 +0800 +++ bluetooth.new/btusb.h 2011-05-24 13:24:00.756916000 +0800 @@ -0,0 +1,29 @@ +/* + * + * Generic Bluetooth USB driver + * + * Copyright (C) 2005-2008 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define CONFIG_BT_ATH3K +#ifdef CONFIG_BT_ATH3K +int ath3k_dfu_init(struct usb_interface *intf, + const struct usb_device_id *id); +void ath3k_dfu_deinit(struct usb_interface *intf); +#endif diff -aurN bluetooth.orig/Kconfig bluetooth.new/Kconfig --- bluetooth.orig/Kconfig 2011-05-24 12:50:00.073891580 +0800 +++ bluetooth.new/Kconfig 2011-05-24 15:27:49.020894851 +0800 @@ -208,7 +208,7 @@ into the kernel or say M to compile it as module. config BT_ATH3K - tristate "Atheros firmware download driver" + bool "Atheros firmware download driver" depends on BT_HCIBTUSB select FW_LOADER help diff -aurN bluetooth.orig/Makefile bluetooth.new/Makefile --- bluetooth.orig/Makefile 2011-05-24 12:50:00.040898322 +0800 +++ bluetooth.new/Makefile 2011-05-24 13:51:03.436420000 +0800 @@ -12,10 +12,12 @@ obj-$(CONFIG_BT_HCIBLUECARD) += bluecard_cs.o obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o -obj-$(CONFIG_BT_HCIBTUSB) += btusb.o +obj-$(CONFIG_BT_HCIBTUSB) += btusb.o +btusb-$(CONFIG_BT_ATH3K) += ath3k.o +btusb-objs := $(btusb-$(CONFIG_BT_HCIBTUSB)) + obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o -obj-$(CONFIG_BT_ATH3K) += ath3k.o obj-$(CONFIG_BT_MRVL) += btmrvl.o obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o obj-$(CONFIG_BT_WILINK) += btwilink.o