Skip to content

Commit f730cc9

Browse files
committed
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2017-10-19 Here's the first bluetooth-next pull request targeting the 4.15 kernel release. - Multiple fixes & improvements to the hci_bcm driver - DT improvements, e.g. new local-bd-address property - Fixes & improvements to ECDH usage. Private key is now generated by the crypto subsystem. - gcc-4.9 warning fixes Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 164a5e7 + fac72b2 commit f730cc9

File tree

20 files changed

+487
-333
lines changed

20 files changed

+487
-333
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The following properties are common to the Bluetooth controllers:
2+
3+
- local-bd-address: array of 6 bytes, specifies the BD address that was
4+
uniquely assigned to the Bluetooth device, formatted with least significant
5+
byte first (little-endian).

Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ The following properties are defined to the bluetooth node:
3737
Definition: must be:
3838
"qcom,wcnss-bt"
3939

40+
- local-bd-address:
41+
Usage: optional
42+
Value type: <u8 array>
43+
Definition: see Documentation/devicetree/bindings/net/bluetooth.txt
44+
4045
== WiFi
4146
The following properties are defined to the WiFi node:
4247

@@ -91,6 +96,9 @@ smd {
9196

9297
bt {
9398
compatible = "qcom,wcnss-bt";
99+
100+
/* BD address 00:11:22:33:44:55 */
101+
local-bd-address = [ 55 44 33 22 11 00 ];
94102
};
95103

96104
wlan {

drivers/bluetooth/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ config BT_HCIBTSDIO
6565

6666
config BT_HCIUART
6767
tristate "HCI UART driver"
68+
depends on SERIAL_DEV_BUS || !SERIAL_DEV_BUS
6869
depends on TTY
6970
help
7071
Bluetooth HCI UART driver.
@@ -79,7 +80,6 @@ config BT_HCIUART
7980
config BT_HCIUART_SERDEV
8081
bool
8182
depends on SERIAL_DEV_BUS && BT_HCIUART
82-
depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
8383
default y
8484

8585
config BT_HCIUART_H4
@@ -169,6 +169,7 @@ config BT_HCIUART_BCM
169169
bool "Broadcom protocol support"
170170
depends on BT_HCIUART
171171
depends on BT_HCIUART_SERDEV
172+
depends on (!ACPI || SERIAL_DEV_CTRL_TTYPORT)
172173
select BT_HCIUART_H4
173174
select BT_BCM
174175
help

drivers/bluetooth/bcm203x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void bcm203x_complete(struct urb *urb)
121121
}
122122

123123
data->state = BCM203X_LOAD_FIRMWARE;
124-
124+
/* fall through */
125125
case BCM203X_LOAD_FIRMWARE:
126126
if (data->fw_sent == data->fw_size) {
127127
usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev, BCM203X_IN_EP),

drivers/bluetooth/bluecard_cs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ static void bluecard_detach(struct pcmcia_device *p_dev);
156156
/* ======================== LED handling routines ======================== */
157157

158158

159-
static void bluecard_activity_led_timeout(u_long arg)
159+
static void bluecard_activity_led_timeout(struct timer_list *t)
160160
{
161-
struct bluecard_info *info = (struct bluecard_info *)arg;
161+
struct bluecard_info *info = from_timer(info, t, timer);
162162
unsigned int iobase = info->p_dev->resource[0]->start;
163163

164164
if (test_bit(CARD_ACTIVITY, &(info->hw_state))) {
@@ -691,8 +691,7 @@ static int bluecard_open(struct bluecard_info *info)
691691

692692
spin_lock_init(&(info->lock));
693693

694-
setup_timer(&(info->timer), &bluecard_activity_led_timeout,
695-
(u_long)info);
694+
timer_setup(&info->timer, bluecard_activity_led_timeout, 0);
696695

697696
skb_queue_head_init(&(info->txq));
698697

drivers/bluetooth/btbcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ static const struct {
327327
{ 0x4406, "BCM4324B3" }, /* 002.004.006 */
328328
{ 0x610c, "BCM4354" }, /* 003.001.012 */
329329
{ 0x2209, "BCM43430A1" }, /* 001.002.009 */
330+
{ 0x6119, "BCM4345C0" }, /* 003.001.025 */
331+
{ 0x230f, "BCM4356A2" }, /* 001.003.015 */
330332
{ }
331333
};
332334

@@ -361,6 +363,7 @@ int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len)
361363
switch ((rev & 0xf000) >> 12) {
362364
case 0:
363365
case 1:
366+
case 2:
364367
case 3:
365368
for (i = 0; bcm_uart_subver_table[i].name; i++) {
366369
if (subver == bcm_uart_subver_table[i].subver) {

drivers/bluetooth/btmrvl_sdio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static irqreturn_t btmrvl_wake_irq_bt(int irq, void *priv)
6464
struct btmrvl_sdio_card *card = priv;
6565
struct btmrvl_plt_wake_cfg *cfg = card->plt_wake_cfg;
6666

67-
pr_info("%s: wake by bt", __func__);
67+
pr_info("%s: wake by bt\n", __func__);
6868
cfg->wake_by_bt = true;
6969
disable_irq_nosync(irq);
7070

@@ -87,7 +87,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
8787

8888
if (!dev->of_node ||
8989
!of_match_node(btmrvl_sdio_of_match_table, dev->of_node)) {
90-
pr_err("sdio platform data not available");
90+
pr_err("sdio platform data not available\n");
9191
return -1;
9292
}
9393

@@ -99,7 +99,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
9999
if (cfg && card->plt_of_node) {
100100
cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0);
101101
if (!cfg->irq_bt) {
102-
dev_err(dev, "fail to parse irq_bt from device tree");
102+
dev_err(dev, "fail to parse irq_bt from device tree\n");
103103
cfg->irq_bt = -1;
104104
} else {
105105
ret = devm_request_irq(dev, cfg->irq_bt,

drivers/bluetooth/btqcomsmd.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <linux/module.h>
1616
#include <linux/slab.h>
1717
#include <linux/rpmsg.h>
18+
#include <linux/of.h>
19+
1820
#include <linux/soc/qcom/wcnss_ctrl.h>
1921
#include <linux/platform_device.h>
2022

@@ -26,6 +28,7 @@
2628
struct btqcomsmd {
2729
struct hci_dev *hdev;
2830

31+
bdaddr_t bdaddr;
2932
struct rpmsg_endpoint *acl_channel;
3033
struct rpmsg_endpoint *cmd_channel;
3134
};
@@ -100,6 +103,38 @@ static int btqcomsmd_close(struct hci_dev *hdev)
100103
return 0;
101104
}
102105

106+
static int btqcomsmd_setup(struct hci_dev *hdev)
107+
{
108+
struct btqcomsmd *btq = hci_get_drvdata(hdev);
109+
struct sk_buff *skb;
110+
int err;
111+
112+
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
113+
if (IS_ERR(skb))
114+
return PTR_ERR(skb);
115+
kfree_skb(skb);
116+
117+
/* Devices do not have persistent storage for BD address. If no
118+
* BD address has been retrieved during probe, mark the device
119+
* as having an invalid BD address.
120+
*/
121+
if (!bacmp(&btq->bdaddr, BDADDR_ANY)) {
122+
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
123+
return 0;
124+
}
125+
126+
/* When setting a configured BD address fails, mark the device
127+
* as having an invalid BD address.
128+
*/
129+
err = qca_set_bdaddr_rome(hdev, &btq->bdaddr);
130+
if (err) {
131+
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
132+
return 0;
133+
}
134+
135+
return 0;
136+
}
137+
103138
static int btqcomsmd_probe(struct platform_device *pdev)
104139
{
105140
struct btqcomsmd *btq;
@@ -123,6 +158,15 @@ static int btqcomsmd_probe(struct platform_device *pdev)
123158
if (IS_ERR(btq->cmd_channel))
124159
return PTR_ERR(btq->cmd_channel);
125160

161+
/* The local-bd-address property is usually injected by the
162+
* bootloader which has access to the allocated BD address.
163+
*/
164+
if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
165+
(u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
166+
dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
167+
&btq->bdaddr);
168+
}
169+
126170
hdev = hci_alloc_dev();
127171
if (!hdev)
128172
return -ENOMEM;
@@ -135,6 +179,7 @@ static int btqcomsmd_probe(struct platform_device *pdev)
135179
hdev->open = btqcomsmd_open;
136180
hdev->close = btqcomsmd_close;
137181
hdev->send = btqcomsmd_send;
182+
hdev->setup = btqcomsmd_setup;
138183
hdev->set_bdaddr = qca_set_bdaddr_rome;
139184

140185
ret = hci_register_dev(hdev);

drivers/bluetooth/btusb.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static struct usb_driver btusb_driver;
6666
#define BTUSB_BCM2045 0x40000
6767
#define BTUSB_IFNUM_2 0x80000
6868
#define BTUSB_CW6622 0x100000
69-
#define BTUSB_BCM_NO_PRODID 0x200000
7069

7170
static const struct usb_device_id btusb_table[] = {
7271
/* Generic Bluetooth USB device */
@@ -171,10 +170,6 @@ static const struct usb_device_id btusb_table[] = {
171170
{ USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01),
172171
.driver_info = BTUSB_BCM_PATCHRAM },
173172

174-
/* Broadcom devices with missing product id */
175-
{ USB_DEVICE_AND_INTERFACE_INFO(0x0000, 0x0000, 0xff, 0x01, 0x01),
176-
.driver_info = BTUSB_BCM_PATCHRAM | BTUSB_BCM_NO_PRODID },
177-
178173
/* Intel Bluetooth USB Bootloader (RAM module) */
179174
{ USB_DEVICE(0x8087, 0x0a5a),
180175
.driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
@@ -2909,19 +2904,6 @@ static int btusb_probe(struct usb_interface *intf,
29092904
if (id->driver_info == BTUSB_IGNORE)
29102905
return -ENODEV;
29112906

2912-
if (id->driver_info & BTUSB_BCM_NO_PRODID) {
2913-
struct usb_device *udev = interface_to_usbdev(intf);
2914-
2915-
/* For the broken Broadcom devices that show 0000:0000
2916-
* as USB vendor and product information, check that the
2917-
* manufacturer string identifies them as Broadcom based
2918-
* devices.
2919-
*/
2920-
if (!udev->manufacturer ||
2921-
strcmp(udev->manufacturer, "Broadcom Corp"))
2922-
return -ENODEV;
2923-
}
2924-
29252907
if (id->driver_info & BTUSB_ATH3012) {
29262908
struct usb_device *udev = interface_to_usbdev(intf);
29272909

0 commit comments

Comments
 (0)