diff options
| author | David S. Miller <davem@davemloft.net> | 2015-03-14 14:29:45 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-14 14:29:45 -0400 |
| commit | 5f1764ddfeb038decfe2b2fda030d0bed43fa36a (patch) | |
| tree | a42d36330758ccce3becb22b96c8c748b89a837a /drivers/bluetooth | |
| parent | 2801be4a0ea4cd0965f9c12ff813a91892a8e157 (diff) | |
| parent | b6d595e3f74fe0dd9edc0d5bf30cd6e6fe29f023 (diff) | |
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says:
====================
Here's another set of Bluetooth & ieee802154 patches intended for 4.1:
- Added support for QCA ROME chipset family in the btusb driver
- at86rf230 driver fixes & cleanups
- ieee802154 cleanups
- Refactoring of Bluetooth mgmt API to allow new users
- New setting for static Bluetooth address exposed to user space
- Refactoring of hci_dev flags to remove limit of 32
- Remove unnecessary fast-connectable setting usage restrictions
- Fix behavior to be consistent when trying to pair already paired device
- Service discovery corner-case fixes
Please let me know if there are any issues pulling. Thanks.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/btusb.c | 333 |
1 files changed, 301 insertions, 32 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8c1bf6190533..6fa9338745cf 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -52,6 +52,7 @@ static struct usb_driver btusb_driver; | |||
| 52 | #define BTUSB_SWAVE 0x1000 | 52 | #define BTUSB_SWAVE 0x1000 |
| 53 | #define BTUSB_INTEL_NEW 0x2000 | 53 | #define BTUSB_INTEL_NEW 0x2000 |
| 54 | #define BTUSB_AMP 0x4000 | 54 | #define BTUSB_AMP 0x4000 |
| 55 | #define BTUSB_QCA_ROME 0x8000 | ||
| 55 | 56 | ||
| 56 | static const struct usb_device_id btusb_table[] = { | 57 | static const struct usb_device_id btusb_table[] = { |
| 57 | /* Generic Bluetooth USB device */ | 58 | /* Generic Bluetooth USB device */ |
| @@ -213,6 +214,10 @@ static const struct usb_device_id blacklist_table[] = { | |||
| 213 | { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 }, | 214 | { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 }, |
| 214 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, | 215 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, |
| 215 | 216 | ||
| 217 | /* QCA ROME chipset */ | ||
| 218 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME}, | ||
| 219 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME}, | ||
| 220 | |||
| 216 | /* Broadcom BCM2035 */ | 221 | /* Broadcom BCM2035 */ |
| 217 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 }, | 222 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 }, |
| 218 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, | 223 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
| @@ -338,6 +343,8 @@ struct btusb_data { | |||
| 338 | 343 | ||
| 339 | int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb); | 344 | int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb); |
| 340 | int (*recv_bulk)(struct btusb_data *data, void *buffer, int count); | 345 | int (*recv_bulk)(struct btusb_data *data, void *buffer, int count); |
| 346 | |||
| 347 | int (*setup_on_usb)(struct hci_dev *hdev); | ||
| 341 | }; | 348 | }; |
| 342 | 349 | ||
| 343 | static inline void btusb_free_frags(struct btusb_data *data) | 350 | static inline void btusb_free_frags(struct btusb_data *data) |
| @@ -879,6 +886,15 @@ static int btusb_open(struct hci_dev *hdev) | |||
| 879 | 886 | ||
| 880 | BT_DBG("%s", hdev->name); | 887 | BT_DBG("%s", hdev->name); |
| 881 | 888 | ||
| 889 | /* Patching USB firmware files prior to starting any URBs of HCI path | ||
| 890 | * It is more safe to use USB bulk channel for downloading USB patch | ||
| 891 | */ | ||
| 892 | if (data->setup_on_usb) { | ||
| 893 | err = data->setup_on_usb(hdev); | ||
| 894 | if (err <0) | ||
| 895 | return err; | ||
| 896 | } | ||
| 897 | |||
| 882 | err = usb_autopm_get_interface(data->intf); | 898 | err = usb_autopm_get_interface(data->intf); |
| 883 | if (err < 0) | 899 | if (err < 0) |
| 884 | return err; | 900 | return err; |
| @@ -1254,6 +1270,28 @@ static void btusb_waker(struct work_struct *work) | |||
| 1254 | usb_autopm_put_interface(data->intf); | 1270 | usb_autopm_put_interface(data->intf); |
| 1255 | } | 1271 | } |
| 1256 | 1272 | ||
| 1273 | static struct sk_buff *btusb_read_local_version(struct hci_dev *hdev) | ||
| 1274 | { | ||
| 1275 | struct sk_buff *skb; | ||
| 1276 | |||
| 1277 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, | ||
| 1278 | HCI_INIT_TIMEOUT); | ||
| 1279 | if (IS_ERR(skb)) { | ||
| 1280 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION failed (%ld)", | ||
| 1281 | hdev->name, PTR_ERR(skb)); | ||
| 1282 | return skb; | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | if (skb->len != sizeof(struct hci_rp_read_local_version)) { | ||
| 1286 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION event length mismatch", | ||
| 1287 | hdev->name); | ||
| 1288 | kfree_skb(skb); | ||
| 1289 | return ERR_PTR(-EIO); | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | return skb; | ||
| 1293 | } | ||
| 1294 | |||
| 1257 | static int btusb_setup_bcm92035(struct hci_dev *hdev) | 1295 | static int btusb_setup_bcm92035(struct hci_dev *hdev) |
| 1258 | { | 1296 | { |
| 1259 | struct sk_buff *skb; | 1297 | struct sk_buff *skb; |
| @@ -1278,12 +1316,9 @@ static int btusb_setup_csr(struct hci_dev *hdev) | |||
| 1278 | 1316 | ||
| 1279 | BT_DBG("%s", hdev->name); | 1317 | BT_DBG("%s", hdev->name); |
| 1280 | 1318 | ||
| 1281 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, | 1319 | skb = btusb_read_local_version(hdev); |
| 1282 | HCI_INIT_TIMEOUT); | 1320 | if (IS_ERR(skb)) |
| 1283 | if (IS_ERR(skb)) { | ||
| 1284 | BT_ERR("Reading local version failed (%ld)", -PTR_ERR(skb)); | ||
| 1285 | return -PTR_ERR(skb); | 1321 | return -PTR_ERR(skb); |
| 1286 | } | ||
| 1287 | 1322 | ||
| 1288 | rp = (struct hci_rp_read_local_version *)skb->data; | 1323 | rp = (struct hci_rp_read_local_version *)skb->data; |
| 1289 | 1324 | ||
| @@ -2414,21 +2449,9 @@ static int btusb_setup_bcm_patchram(struct hci_dev *hdev) | |||
| 2414 | kfree_skb(skb); | 2449 | kfree_skb(skb); |
| 2415 | 2450 | ||
| 2416 | /* Read Local Version Info */ | 2451 | /* Read Local Version Info */ |
| 2417 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, | 2452 | skb = btusb_read_local_version(hdev); |
| 2418 | HCI_INIT_TIMEOUT); | 2453 | if (IS_ERR(skb)) |
| 2419 | if (IS_ERR(skb)) { | 2454 | return PTR_ERR(skb); |
| 2420 | ret = PTR_ERR(skb); | ||
| 2421 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION failed (%ld)", | ||
| 2422 | hdev->name, ret); | ||
| 2423 | return ret; | ||
| 2424 | } | ||
| 2425 | |||
| 2426 | if (skb->len != sizeof(*ver)) { | ||
| 2427 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION event length mismatch", | ||
| 2428 | hdev->name); | ||
| 2429 | kfree_skb(skb); | ||
| 2430 | return -EIO; | ||
| 2431 | } | ||
| 2432 | 2455 | ||
| 2433 | ver = (struct hci_rp_read_local_version *)skb->data; | 2456 | ver = (struct hci_rp_read_local_version *)skb->data; |
| 2434 | rev = le16_to_cpu(ver->hci_rev); | 2457 | rev = le16_to_cpu(ver->hci_rev); |
| @@ -2516,20 +2539,9 @@ reset_fw: | |||
| 2516 | kfree_skb(skb); | 2539 | kfree_skb(skb); |
| 2517 | 2540 | ||
| 2518 | /* Read Local Version Info */ | 2541 | /* Read Local Version Info */ |
| 2519 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, | 2542 | skb = btusb_read_local_version(hdev); |
| 2520 | HCI_INIT_TIMEOUT); | ||
| 2521 | if (IS_ERR(skb)) { | 2543 | if (IS_ERR(skb)) { |
| 2522 | ret = PTR_ERR(skb); | 2544 | ret = PTR_ERR(skb); |
| 2523 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION failed (%ld)", | ||
| 2524 | hdev->name, ret); | ||
| 2525 | goto done; | ||
| 2526 | } | ||
| 2527 | |||
| 2528 | if (skb->len != sizeof(*ver)) { | ||
| 2529 | BT_ERR("%s: HCI_OP_READ_LOCAL_VERSION event length mismatch", | ||
| 2530 | hdev->name); | ||
| 2531 | kfree_skb(skb); | ||
| 2532 | ret = -EIO; | ||
| 2533 | goto done; | 2545 | goto done; |
| 2534 | } | 2546 | } |
| 2535 | 2547 | ||
| @@ -2628,6 +2640,258 @@ static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev, | |||
| 2628 | return 0; | 2640 | return 0; |
| 2629 | } | 2641 | } |
| 2630 | 2642 | ||
| 2643 | #define QCA_DFU_PACKET_LEN 4096 | ||
| 2644 | |||
| 2645 | #define QCA_GET_TARGET_VERSION 0x09 | ||
| 2646 | #define QCA_CHECK_STATUS 0x05 | ||
| 2647 | #define QCA_DFU_DOWNLOAD 0x01 | ||
| 2648 | |||
| 2649 | #define QCA_SYSCFG_UPDATED 0x40 | ||
| 2650 | #define QCA_PATCH_UPDATED 0x80 | ||
| 2651 | #define QCA_DFU_TIMEOUT 3000 | ||
| 2652 | |||
| 2653 | struct qca_version { | ||
| 2654 | __le32 rom_version; | ||
| 2655 | __le32 patch_version; | ||
| 2656 | __le32 ram_version; | ||
| 2657 | __le32 ref_clock; | ||
| 2658 | __u8 reserved[4]; | ||
| 2659 | } __packed; | ||
| 2660 | |||
| 2661 | struct qca_rampatch_version { | ||
| 2662 | __le16 rom_version; | ||
| 2663 | __le16 patch_version; | ||
| 2664 | } __packed; | ||
| 2665 | |||
| 2666 | struct qca_device_info { | ||
| 2667 | u32 rom_version; | ||
| 2668 | u8 rampatch_hdr; /* length of header in rampatch */ | ||
| 2669 | u8 nvm_hdr; /* length of header in NVM */ | ||
| 2670 | u8 ver_offset; /* offset of version structure in rampatch */ | ||
| 2671 | }; | ||
| 2672 | |||
