Commit | Line | Data |
---|---|---|
4fba30f0 MH |
1 | /* |
2 | * | |
3 | * Bluetooth support for Broadcom devices | |
4 | * | |
5 | * Copyright (C) 2015 Intel Corporation | |
6 | * | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | * | |
22 | */ | |
23 | ||
24 | #include <linux/module.h> | |
1c8ba6d0 MH |
25 | #include <linux/firmware.h> |
26 | #include <asm/unaligned.h> | |
4fba30f0 MH |
27 | |
28 | #include <net/bluetooth/bluetooth.h> | |
29 | #include <net/bluetooth/hci_core.h> | |
30 | ||
31 | #include "btbcm.h" | |
32 | ||
33 | #define VERSION "0.1" | |
34 | ||
35 | #define BDADDR_BCM20702A0 (&(bdaddr_t) {{0x00, 0xa0, 0x02, 0x70, 0x20, 0x00}}) | |
92ffe0db | 36 | #define BDADDR_BCM20702A1 (&(bdaddr_t) {{0x00, 0x00, 0xa0, 0x02, 0x70, 0x20}}) |
a8f3b941 | 37 | #define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}}) |
4a546ec3 | 38 | #define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}}) |
4fba30f0 MH |
39 | |
40 | int btbcm_check_bdaddr(struct hci_dev *hdev) | |
41 | { | |
42 | struct hci_rp_read_bd_addr *bda; | |
43 | struct sk_buff *skb; | |
44 | ||
45 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL, | |
46 | HCI_INIT_TIMEOUT); | |
47 | if (IS_ERR(skb)) { | |
48 | int err = PTR_ERR(skb); | |
2064ee33 | 49 | bt_dev_err(hdev, "BCM: Reading device address failed (%d)", err); |
4fba30f0 MH |
50 | return err; |
51 | } | |
52 | ||
53 | if (skb->len != sizeof(*bda)) { | |
2064ee33 | 54 | bt_dev_err(hdev, "BCM: Device address length mismatch"); |
4fba30f0 MH |
55 | kfree_skb(skb); |
56 | return -EIO; | |
57 | } | |
58 | ||
59 | bda = (struct hci_rp_read_bd_addr *)skb->data; | |
4fba30f0 | 60 | |
a8f3b941 FD |
61 | /* Check if the address indicates a controller with either an |
62 | * invalid or default address. In both cases the device needs | |
63 | * to be marked as not having a valid address. | |
64 | * | |
65 | * The address 00:20:70:02:A0:00 indicates a BCM20702A0 controller | |
4fba30f0 | 66 | * with no configured address. |
a8f3b941 | 67 | * |
92ffe0db MR |
68 | * The address 20:70:02:A0:00:00 indicates a BCM20702A1 controller |
69 | * with no configured address. | |
70 | * | |
a8f3b941 FD |
71 | * The address 43:24:B3:00:00:00 indicates a BCM4324B3 controller |
72 | * with waiting for configuration state. | |
4a546ec3 FD |
73 | * |
74 | * The address 43:30:B1:00:00:00 indicates a BCM4330B1 controller | |
75 | * with waiting for configuration state. | |
4fba30f0 | 76 | */ |
a8f3b941 | 77 | if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0) || |
92ffe0db | 78 | !bacmp(&bda->bdaddr, BDADDR_BCM20702A1) || |
4a546ec3 FD |
79 | !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) || |
80 | !bacmp(&bda->bdaddr, BDADDR_BCM4330B1)) { | |
2064ee33 MH |
81 | bt_dev_info(hdev, "BCM: Using default device address (%pMR)", |
82 | &bda->bdaddr); | |
4fba30f0 MH |
83 | set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); |
84 | } | |
85 | ||
86 | kfree_skb(skb); | |
87 | ||
88 | return 0; | |
89 | } | |
90 | EXPORT_SYMBOL_GPL(btbcm_check_bdaddr); | |
91 | ||
92 | int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) | |
93 | { | |
94 | struct sk_buff *skb; | |
95 | int err; | |
96 | ||
97 | skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT); | |
98 | if (IS_ERR(skb)) { | |
99 | err = PTR_ERR(skb); | |
2064ee33 | 100 | bt_dev_err(hdev, "BCM: Change address command failed (%d)", err); |
4fba30f0 MH |
101 | return err; |
102 | } | |
103 | kfree_skb(skb); | |
104 | ||
105 | return 0; | |
106 | } | |
107 | EXPORT_SYMBOL_GPL(btbcm_set_bdaddr); | |
108 | ||
18aeb444 | 109 | int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) |
50862ee5 MH |
110 | { |
111 | const struct hci_command_hdr *cmd; | |
50862ee5 MH |
112 | const u8 *fw_ptr; |
113 | size_t fw_size; | |
114 | struct sk_buff *skb; | |
115 | u16 opcode; | |
18aeb444 | 116 | int err = 0; |
50862ee5 MH |
117 | |
118 | /* Start Download */ | |
119 | skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT); | |
120 | if (IS_ERR(skb)) { | |
121 | err = PTR_ERR(skb); | |
2064ee33 MH |
122 | bt_dev_err(hdev, "BCM: Download Minidrv command failed (%d)", |
123 | err); | |
50862ee5 MH |
124 | goto done; |
125 | } | |
126 | kfree_skb(skb); | |
127 | ||
128 | /* 50 msec delay after Download Minidrv completes */ | |
129 | msleep(50); | |
130 | ||
131 | fw_ptr = fw->data; | |
132 | fw_size = fw->size; | |
133 | ||
134 | while (fw_size >= sizeof(*cmd)) { | |
135 | const u8 *cmd_param; | |
136 | ||
137 | cmd = (struct hci_command_hdr *)fw_ptr; | |
138 | fw_ptr += sizeof(*cmd); | |
139 | fw_size -= sizeof(*cmd); | |
140 | ||
141 | if (fw_size < cmd->plen) { | |
2064ee33 | 142 | bt_dev_err(hdev, "BCM: Patch is corrupted"); |
50862ee5 MH |
143 | err = -EINVAL; |
144 | goto done; | |
145 | } | |
146 | ||
147 | cmd_param = fw_ptr; | |
148 | fw_ptr += cmd->plen; | |
149 | fw_size -= cmd->plen; | |
150 | ||
151 | opcode = le16_to_cpu(cmd->opcode); | |
152 | ||
153 | skb = __hci_cmd_sync(hdev, opcode, cmd->plen, cmd_param, | |
154 | HCI_INIT_TIMEOUT); | |
155 | if (IS_ERR(skb)) { | |
156 | err = PTR_ERR(skb); | |
2064ee33 MH |
157 | bt_dev_err(hdev, "BCM: Patch command %04x failed (%d)", |
158 | opcode, err); | |
50862ee5 MH |
159 | goto done; |
160 | } | |
161 | kfree_skb(skb); | |
162 | } | |
163 | ||
164 | /* 250 msec delay after Launch Ram completes */ | |
165 | msleep(250); | |
166 | ||
167 | done: | |
50862ee5 MH |
168 | return err; |
169 | } | |
170 | EXPORT_SYMBOL(btbcm_patchram); | |
171 | ||
1c8ba6d0 MH |
172 | static int btbcm_reset(struct hci_dev *hdev) |
173 | { | |
174 | struct sk_buff *skb; | |
175 | ||
176 | skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); | |
177 | if (IS_ERR(skb)) { | |
178 | int err = PTR_ERR(skb); | |
2064ee33 | 179 | bt_dev_err(hdev, "BCM: Reset failed (%d)", err); |
1c8ba6d0 MH |
180 | return err; |
181 | } | |
182 | kfree_skb(skb); | |
183 | ||
3af3a594 WJS |
184 | /* 100 msec delay for module to complete reset process */ |
185 | msleep(100); | |
186 | ||
1c8ba6d0 MH |
187 | return 0; |
188 | } | |
189 | ||
9bc63ca0 MH |
190 | static struct sk_buff *btbcm_read_local_name(struct hci_dev *hdev) |
191 | { | |
192 | struct sk_buff *skb; | |
193 | ||
194 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL, | |
195 | HCI_INIT_TIMEOUT); | |
196 | if (IS_ERR(skb)) { | |
2064ee33 MH |
197 | bt_dev_err(hdev, "BCM: Reading local name failed (%ld)", |
198 | PTR_ERR(skb)); | |
9bc63ca0 MH |
199 | return skb; |
200 | } | |
201 | ||
202 | if (skb->len != sizeof(struct hci_rp_read_local_name)) { | |
2064ee33 | 203 | bt_dev_err(hdev, "BCM: Local name length mismatch"); |
9bc63ca0 MH |
204 | kfree_skb(skb); |
205 | return ERR_PTR(-EIO); | |
206 | } | |
207 | ||
208 | return skb; | |
209 | } | |
210 | ||
1c8ba6d0 MH |
211 | static struct sk_buff *btbcm_read_local_version(struct hci_dev *hdev) |
212 | { | |
213 | struct sk_buff *skb; | |
214 | ||
215 | skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, | |
216 | HCI_INIT_TIMEOUT); | |
217 | if (IS_ERR(skb)) { | |
2064ee33 MH |
218 | bt_dev_err(hdev, "BCM: Reading local version info failed (%ld)", |
219 | PTR_ERR(skb)); | |
1c8ba6d0 MH |
220 | return skb; |
221 | } | |
222 | ||
223 | if (skb->len != sizeof(struct hci_rp_read_local_version)) { | |
2064ee33 | 224 | bt_dev_err(hdev, "BCM: Local version length mismatch"); |
1c8ba6d0 MH |
225 | kfree_skb(skb); |
226 | return ERR_PTR(-EIO); | |
227 | } | |
228 | ||
229 | return skb; | |
230 | } | |
231 | ||
232 | static struct sk_buff *btbcm_read_verbose_config(struct hci_dev *hdev) | |
233 | { | |
234 | struct sk_buff *skb; | |
235 | ||
236 | skb = __hci_cmd_sync(hdev, 0xfc79, 0, NULL, HCI_INIT_TIMEOUT); | |
237 | if (IS_ERR(skb)) { | |
2064ee33 MH |
238 | bt_dev_err(hdev, "BCM: Read verbose config info failed (%ld)", |
239 | PTR_ERR(skb)); | |
1c8ba6d0 MH |
240 | return skb; |
241 | } | |
242 | ||
243 | if (skb->len != 7) { | |
2064ee33 | 244 | bt_dev_err(hdev, "BCM: Verbose config length mismatch"); |
1c8ba6d0 MH |
245 | kfree_skb(skb); |
246 | return ERR_PTR(-EIO); | |
247 | } | |
248 | ||
249 | return skb; | |
250 | } | |
251 | ||
4284ecbe MH |
252 | static struct sk_buff *btbcm_read_controller_features(struct hci_dev *hdev) |
253 | { | |
254 | struct sk_buff *skb; | |
255 | ||
256 | skb = __hci_cmd_sync(hdev, 0xfc6e, 0, NULL, HCI_INIT_TIMEOUT); | |
257 | if (IS_ERR(skb)) { | |
2064ee33 MH |
258 | bt_dev_err(hdev, "BCM: Read controller features failed (%ld)", |
259 | PTR_ERR(skb)); | |
4284ecbe MH |
260 | return skb; |
261 | } | |
262 | ||
263 | if (skb->len != 9) { | |
2064ee33 | 264 | bt_dev_err(hdev, "BCM: Controller features length mismatch"); |
4284ecbe MH |
265 | kfree_skb(skb); |
266 | return ERR_PTR(-EIO); | |
267 | } | |
268 | ||
269 | return skb; | |
270 | } | |
271 | ||
1c8ba6d0 MH |
272 | static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) |
273 | { | |
274 | struct sk_buff *skb; | |
275 | ||
276 | skb = __hci_cmd_sync(hdev, 0xfc5a, 0, NULL, HCI_INIT_TIMEOUT); | |
277 | if (IS_ERR(skb)) { | |
2064ee33 MH |
278 | bt_dev_err(hdev, "BCM: Read USB product info failed (%ld)", |
279 | PTR_ERR(skb)); | |
1c8ba6d0 MH |
280 | return skb; |
281 | } | |
282 | ||
283 | if (skb->len != 5) { | |
2064ee33 | 284 | bt_dev_err(hdev, "BCM: USB product length mismatch"); |
1c8ba6d0 MH |
285 | kfree_skb(skb); |
286 | return ERR_PTR(-EIO); | |
287 | } | |
288 | ||
289 | return skb; | |
290 | } | |
291 | ||
e76dc1dd MH |
292 | static int btbcm_read_info(struct hci_dev *hdev) |
293 | { | |
294 | struct sk_buff *skb; | |
295 | ||
296 | /* Read Verbose Config Version Info */ | |
297 | skb = btbcm_read_verbose_config(hdev); | |
298 | if (IS_ERR(skb)) | |
299 | return PTR_ERR(skb); | |
300 | ||
2064ee33 | 301 | bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]); |
e76dc1dd MH |
302 | kfree_skb(skb); |
303 | ||
304 | /* Read Controller Features */ | |
305 | skb = btbcm_read_controller_features(hdev); | |
306 | if (IS_ERR(skb)) | |
307 | return PTR_ERR(skb); | |
308 | ||
2064ee33 | 309 | bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]); |
e76dc1dd MH |
310 | kfree_skb(skb); |
311 | ||
312 | /* Read Local Name */ | |
313 | skb = btbcm_read_local_name(hdev); | |
314 | if (IS_ERR(skb)) | |
315 | return PTR_ERR(skb); | |
316 | ||
2064ee33 | 317 | bt_dev_info(hdev, "%s", (char *)(skb->data + 1)); |
e76dc1dd MH |
318 | kfree_skb(skb); |
319 | ||
320 | return 0; | |
321 | } | |
322 | ||
f7328381 | 323 | struct bcm_subver_table { |
1c8ba6d0 MH |
324 | u16 subver; |
325 | const char *name; | |
f7328381 HG |
326 | }; |
327 | ||
328 | static const struct bcm_subver_table bcm_uart_subver_table[] = { | |
4a546ec3 | 329 | { 0x4103, "BCM4330B1" }, /* 002.001.003 */ |
9a0bb57d | 330 | { 0x410e, "BCM43341B0" }, /* 002.001.014 */ |
a8f3b941 | 331 | { 0x4406, "BCM4324B3" }, /* 002.004.006 */ |
a357ea09 | 332 | { 0x6109, "BCM4335C0" }, /* 003.001.009 */ |
40db5f0e | 333 | { 0x610c, "BCM4354" }, /* 003.001.012 */ |
d456f678 | 334 | { 0x2122, "BCM4343A0" }, /* 001.001.034 */ |
feb16722 | 335 | { 0x2209, "BCM43430A1" }, /* 001.002.009 */ |
18a39b9a | 336 | { 0x6119, "BCM4345C0" }, /* 003.001.025 */ |
b133e0c4 | 337 | { 0x230f, "BCM4356A2" }, /* 001.003.015 */ |
92ffe0db | 338 | { 0x220e, "BCM20702A1" }, /* 001.002.014 */ |
9a0bb57d MH |
339 | { } |
340 | }; | |
341 | ||
fec0de23 HG |
342 | static const struct bcm_subver_table bcm_usb_subver_table[] = { |
343 | { 0x210b, "BCM43142A0" }, /* 001.001.011 */ | |
344 | { 0x2112, "BCM4314A0" }, /* 001.001.018 */ | |
345 | { 0x2118, "BCM20702A0" }, /* 001.001.024 */ | |
346 | { 0x2126, "BCM4335A0" }, /* 001.001.038 */ | |
347 | { 0x220e, "BCM20702A1" }, /* 001.002.014 */ | |
348 | { 0x230f, "BCM4354A2" }, /* 001.003.015 */ | |
349 | { 0x4106, "BCM4335B0" }, /* 002.001.006 */ | |
350 | { 0x410e, "BCM20702B0" }, /* 002.001.014 */ | |
351 | { 0x6109, "BCM4335C0" }, /* 003.001.009 */ | |
352 | { 0x610c, "BCM4354" }, /* 003.001.012 */ | |
353 | { } | |
354 | }; | |
355 | ||
22ac1916 HG |
356 | int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len, |
357 | bool reinit) | |
75e167e6 | 358 | { |
fec0de23 | 359 | u16 subver, rev, pid, vid; |
2cc6d079 | 360 | const char *hw_name = "BCM"; |
75e167e6 FD |
361 | struct sk_buff *skb; |
362 | struct hci_rp_read_local_version *ver; | |
fec0de23 | 363 | const struct bcm_subver_table *bcm_subver_table; |
75e167e6 FD |
364 | int i, err; |
365 | ||
366 | /* Reset */ | |
367 | err = btbcm_reset(hdev); | |
368 | if (err) | |
369 | return err; | |
370 | ||
371 | /* Read Local Version Info */ | |
372 | skb = btbcm_read_local_version(hdev); | |
373 | if (IS_ERR(skb)) | |
374 | return PTR_ERR(skb); | |
375 | ||
376 | ver = (struct hci_rp_read_local_version *)skb->data; | |
377 | rev = le16_to_cpu(ver->hci_rev); | |
378 | subver = le16_to_cpu(ver->lmp_subver); | |
379 | kfree_skb(skb); | |
380 | ||
e76dc1dd | 381 | /* Read controller information */ |
22ac1916 HG |
382 | if (!reinit) { |
383 | err = btbcm_read_info(hdev); | |
384 | if (err) | |
385 | return err; | |
386 | } | |
75e167e6 | 387 | |
fec0de23 HG |
388 | /* Upper nibble of rev should be between 0 and 3? */ |
389 | if (((rev & 0xf000) >> 12) > 3) | |
390 | return 0; | |
391 | ||
392 | bcm_subver_table = (hdev->bus == HCI_USB) ? bcm_usb_subver_table : | |
393 | bcm_uart_subver_table; | |
394 | ||
395 | for (i = 0; bcm_subver_table[i].name; i++) { | |
396 | if (subver == bcm_subver_table[i].subver) { | |
397 | hw_name = bcm_subver_table[i].name; | |
398 | break; | |
75e167e6 | 399 | } |
fec0de23 | 400 | } |
75e167e6 | 401 | |
fec0de23 HG |
402 | if (hdev->bus == HCI_USB) { |
403 | /* Read USB Product Info */ | |
404 | skb = btbcm_read_usb_product(hdev); | |
405 | if (IS_ERR(skb)) | |
406 | return PTR_ERR(skb); | |
407 | ||
408 | vid = get_unaligned_le16(skb->data + 1); | |
409 | pid = get_unaligned_le16(skb->data + 3); | |
410 | kfree_skb(skb); | |
411 | ||
412 | snprintf(fw_name, len, "brcm/%s-%4.4x-%4.4x.hcd", | |
2cc6d079 | 413 | hw_name, vid, pid); |
fec0de23 | 414 | } else { |
2cc6d079 | 415 | snprintf(fw_name, len, "brcm/%s.hcd", hw_name); |
75e167e6 FD |
416 | } |
417 | ||
2064ee33 | 418 | bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u", |
2cc6d079 | 419 | hw_name, (subver & 0xe000) >> 13, |
2064ee33 | 420 | (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff); |
75e167e6 FD |
421 | |
422 | return 0; | |
423 | } | |
424 | EXPORT_SYMBOL_GPL(btbcm_initialize); | |
425 | ||
426 | int btbcm_finalize(struct hci_dev *hdev) | |
427 | { | |
22ac1916 | 428 | char fw_name[64]; |
75e167e6 FD |
429 | int err; |
430 | ||
22ac1916 HG |
431 | /* Re-initialize */ |
432 | err = btbcm_initialize(hdev, fw_name, sizeof(fw_name), true); | |
75e167e6 FD |
433 | if (err) |
434 | return err; | |
435 | ||
75e167e6 FD |
436 | btbcm_check_bdaddr(hdev); |
437 | ||
438 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); | |
439 | ||
440 | return 0; | |
441 | } | |
442 | EXPORT_SYMBOL_GPL(btbcm_finalize); | |
443 | ||
1c8ba6d0 MH |
444 | int btbcm_setup_patchram(struct hci_dev *hdev) |
445 | { | |
1c8ba6d0 | 446 | char fw_name[64]; |
18aeb444 | 447 | const struct firmware *fw; |
1c8ba6d0 | 448 | struct sk_buff *skb; |
59ce5699 | 449 | int err; |
1c8ba6d0 | 450 | |
59ce5699 HG |
451 | /* Initialize */ |
452 | err = btbcm_initialize(hdev, fw_name, sizeof(fw_name), false); | |
e76dc1dd MH |
453 | if (err) |
454 | return err; | |
9bc63ca0 | 455 | |
18aeb444 FD |
456 | err = request_firmware(&fw, fw_name, &hdev->dev); |
457 | if (err < 0) { | |
2064ee33 | 458 | bt_dev_info(hdev, "BCM: Patch %s not found", fw_name); |
ad750fa1 | 459 | goto done; |
18aeb444 FD |
460 | } |
461 | ||
462 | btbcm_patchram(hdev, fw); | |
463 | ||
464 | release_firmware(fw); | |
1c8ba6d0 | 465 | |
59ce5699 HG |
466 | /* Re-initialize */ |
467 | err = btbcm_initialize(hdev, fw_name, sizeof(fw_name), true); | |
1c8ba6d0 | 468 | if (err) |
50862ee5 | 469 | return err; |
1c8ba6d0 | 470 | |
9bc63ca0 MH |
471 | /* Read Local Name */ |
472 | skb = btbcm_read_local_name(hdev); | |
473 | if (IS_ERR(skb)) | |
474 | return PTR_ERR(skb); | |
475 | ||
2064ee33 | 476 | bt_dev_info(hdev, "%s", (char *)(skb->data + 1)); |
9bc63ca0 MH |
477 | kfree_skb(skb); |
478 | ||
ad750fa1 | 479 | done: |
1c8ba6d0 MH |
480 | btbcm_check_bdaddr(hdev); |
481 | ||
941521e2 MH |
482 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
483 | ||
50862ee5 | 484 | return 0; |
1c8ba6d0 MH |
485 | } |
486 | EXPORT_SYMBOL_GPL(btbcm_setup_patchram); | |
487 | ||
488 | int btbcm_setup_apple(struct hci_dev *hdev) | |
489 | { | |
490 | struct sk_buff *skb; | |
b224d3ff MH |
491 | int err; |
492 | ||
493 | /* Reset */ | |
494 | err = btbcm_reset(hdev); | |
495 | if (err) | |
496 | return err; | |
1c8ba6d0 MH |
497 | |
498 | /* Read Verbose Config Version Info */ | |
499 | skb = btbcm_read_verbose_config(hdev); | |
7bee8b08 | 500 | if (!IS_ERR(skb)) { |
2064ee33 MH |
501 | bt_dev_info(hdev, "BCM: chip id %u build %4.4u", |
502 | skb->data[1], get_unaligned_le16(skb->data + 5)); | |
7bee8b08 CM |
503 | kfree_skb(skb); |
504 | } | |
1c8ba6d0 | 505 | |
34cea41e MH |
506 | /* Read USB Product Info */ |
507 | skb = btbcm_read_usb_product(hdev); | |
508 | if (!IS_ERR(skb)) { | |
2064ee33 MH |
509 | bt_dev_info(hdev, "BCM: product %4.4x:%4.4x", |
510 | get_unaligned_le16(skb->data + 1), | |
511 | get_unaligned_le16(skb->data + 3)); | |
34cea41e MH |
512 | kfree_skb(skb); |
513 | } | |
514 | ||
4284ecbe MH |
515 | /* Read Controller Features */ |
516 | skb = btbcm_read_controller_features(hdev); | |
517 | if (!IS_ERR(skb)) { | |
2064ee33 | 518 | bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]); |
4284ecbe MH |
519 | kfree_skb(skb); |
520 | } | |
521 | ||
9bc63ca0 MH |
522 | /* Read Local Name */ |
523 | skb = btbcm_read_local_name(hdev); | |
524 | if (!IS_ERR(skb)) { | |
2064ee33 | 525 | bt_dev_info(hdev, "%s", (char *)(skb->data + 1)); |
9bc63ca0 MH |
526 | kfree_skb(skb); |
527 | } | |
528 | ||
941521e2 MH |
529 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
530 | ||
1c8ba6d0 MH |
531 | return 0; |
532 | } | |
533 | EXPORT_SYMBOL_GPL(btbcm_setup_apple); | |
534 | ||
4fba30f0 MH |
535 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
536 | MODULE_DESCRIPTION("Bluetooth support for Broadcom devices ver " VERSION); | |
537 | MODULE_VERSION(VERSION); | |
538 | MODULE_LICENSE("GPL"); |