diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2014-07-18 17:47:06 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-18 20:33:21 -0400 |
commit | ae8df494e9ec9d5c2bd907a0b7de712e050cb533 (patch) | |
tree | f728e56967b31497639dcbec1cf030d39ac648dd /drivers/bluetooth/btusb.c | |
parent | beb19e4c079d626bf0502fbb65bd7c9891a10c2e (diff) |
Bluetooth: add public address configuration for Marvell USB devices
Implemented .set_bdaddr handler provided by bluetooth stack for
Marvell devices for public address configuration.
A reboot restores the bdaddr to its original address.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r-- | drivers/bluetooth/btusb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index ed7b33b06b43..b062bed67aaf 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -48,6 +48,7 @@ static struct usb_driver btusb_driver; | |||
48 | #define BTUSB_INTEL 0x100 | 48 | #define BTUSB_INTEL 0x100 |
49 | #define BTUSB_INTEL_BOOT 0x200 | 49 | #define BTUSB_INTEL_BOOT 0x200 |
50 | #define BTUSB_BCM_PATCHRAM 0x400 | 50 | #define BTUSB_BCM_PATCHRAM 0x400 |
51 | #define BTUSB_MARVELL 0x800 | ||
51 | 52 | ||
52 | static const struct usb_device_id btusb_table[] = { | 53 | static const struct usb_device_id btusb_table[] = { |
53 | /* Generic Bluetooth USB device */ | 54 | /* Generic Bluetooth USB device */ |
@@ -242,6 +243,10 @@ static const struct usb_device_id blacklist_table[] = { | |||
242 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, | 243 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, |
243 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, | 244 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, |
244 | 245 | ||
246 | /* Marvell device */ | ||
247 | { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL }, | ||
248 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | ||
249 | |||
245 | { } /* Terminating entry */ | 250 | { } /* Terminating entry */ |
246 | }; | 251 | }; |
247 | 252 | ||
@@ -1455,6 +1460,29 @@ static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr) | |||
1455 | return 0; | 1460 | return 0; |
1456 | } | 1461 | } |
1457 | 1462 | ||
1463 | static int btusb_set_bdaddr_marvell(struct hci_dev *hdev, | ||
1464 | const bdaddr_t *bdaddr) | ||
1465 | { | ||
1466 | struct sk_buff *skb; | ||
1467 | u8 buf[8]; | ||
1468 | long ret; | ||
1469 | |||
1470 | buf[0] = 0xfe; | ||
1471 | buf[1] = sizeof(bdaddr_t); | ||
1472 | memcpy(buf + 2, bdaddr, sizeof(bdaddr_t)); | ||
1473 | |||
1474 | skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(buf), buf, HCI_INIT_TIMEOUT); | ||
1475 | if (IS_ERR(skb)) { | ||
1476 | ret = PTR_ERR(skb); | ||
1477 | BT_ERR("%s: changing Marvell device address failed (%ld)", | ||
1478 | hdev->name, ret); | ||
1479 | return ret; | ||
1480 | } | ||
1481 | kfree_skb(skb); | ||
1482 | |||
1483 | return 0; | ||
1484 | } | ||
1485 | |||
1458 | #define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) | 1486 | #define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) |
1459 | 1487 | ||
1460 | static int btusb_setup_bcm_patchram(struct hci_dev *hdev) | 1488 | static int btusb_setup_bcm_patchram(struct hci_dev *hdev) |
@@ -1766,6 +1794,9 @@ static int btusb_probe(struct usb_interface *intf, | |||
1766 | hdev->set_bdaddr = btusb_set_bdaddr_intel; | 1794 | hdev->set_bdaddr = btusb_set_bdaddr_intel; |
1767 | } | 1795 | } |
1768 | 1796 | ||
1797 | if (id->driver_info & BTUSB_MARVELL) | ||
1798 | hdev->set_bdaddr = btusb_set_bdaddr_marvell; | ||
1799 | |||
1769 | if (id->driver_info & BTUSB_INTEL_BOOT) | 1800 | if (id->driver_info & BTUSB_INTEL_BOOT) |
1770 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 1801 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); |
1771 | 1802 | ||