83e81961 Ben Young Tae Kim 2015-08-10 340
ba493d4f Balakrishna Godavarthi 2018-08-03 341 bt_dev_dbg(hdev,
"QCA setup on UART");
83e81961 Ben Young Tae Kim 2015-08-10 342
83e81961 Ben Young Tae Kim 2015-08-10 343
config.user_baud_rate = baudrate;
83e81961 Ben Young Tae Kim 2015-08-10 344
83e81961 Ben Young Tae Kim 2015-08-10 345 /* Download rampatch
file */
83e81961 Ben Young Tae Kim 2015-08-10 346 config.type =
TLV_TYPE_PATCH;
cc8a70bd Harish Bandi 2019-03-27 347 if
(qca_is_wcn399x(soc_type)) {
4219d468 Balakrishna Godavarthi 2018-08-03 348 /* Firmware files
to download are based on ROM version.
4219d468 Balakrishna Godavarthi 2018-08-03 349 * ROM version is
derived from last two bytes of soc_ver.
4219d468 Balakrishna Godavarthi 2018-08-03 350 */
4219d468 Balakrishna Godavarthi 2018-08-03 351 rom_ver = ((soc_ver
& 0x00000f00) >> 0x04) |
4219d468 Balakrishna Godavarthi 2018-08-03 352 (soc_ver &
0x0000000f);
4219d468 Balakrishna Godavarthi 2018-08-03 353
snprintf(config.fwname, sizeof(config.fwname),
4219d468 Balakrishna Godavarthi 2018-08-03 354
"qca/crbtfw%02x.tlv", rom_ver);
4219d468 Balakrishna Godavarthi 2018-08-03 355 } else {
4219d468 Balakrishna Godavarthi 2018-08-03 356
snprintf(config.fwname, sizeof(config.fwname),
4219d468 Balakrishna Godavarthi 2018-08-03 357
"qca/rampatch_%08x.bin", soc_ver);
4219d468 Balakrishna Godavarthi 2018-08-03 358 }
4219d468 Balakrishna Godavarthi 2018-08-03 359
ba493d4f Balakrishna Godavarthi 2018-08-03 360 err =
qca_download_firmware(hdev, &config);
83e81961 Ben Young Tae Kim 2015-08-10 361 if (err < 0) {
ba493d4f Balakrishna Godavarthi 2018-08-03 362 bt_dev_err(hdev,
"QCA Failed to download patch (%d)", err);
83e81961 Ben Young Tae Kim 2015-08-10 363 return err;
83e81961 Ben Young Tae Kim 2015-08-10 364 }
83e81961 Ben Young Tae Kim 2015-08-10 365
83e81961 Ben Young Tae Kim 2015-08-10 366 /* Download NVM
configuration */
83e81961 Ben Young Tae Kim 2015-08-10 367 config.type =
TLV_TYPE_NVM;
cc8a70bd Harish Bandi 2019-03-27 368 if
(qca_is_wcn399x(soc_type))
4219d468 Balakrishna Godavarthi 2018-08-03 @369
snprintf(config.fwname, sizeof(config.fwname),
4219d468 Balakrishna Godavarthi 2018-08-03 370
"qca/crnv%02x.bin", rom_ver);
4219d468 Balakrishna Godavarthi 2018-08-03 371 else
4219d468 Balakrishna Godavarthi 2018-08-03 372
snprintf(config.fwname, sizeof(config.fwname),
4219d468 Balakrishna Godavarthi 2018-08-03 373
"qca/nvm_%08x.bin", soc_ver);
4219d468 Balakrishna Godavarthi 2018-08-03 374
ba493d4f Balakrishna Godavarthi 2018-08-03 375 err =
qca_download_firmware(hdev, &config);
83e81961 Ben Young Tae Kim 2015-08-10 376 if (err < 0) {
ba493d4f Balakrishna Godavarthi 2018-08-03 377 bt_dev_err(hdev,
"QCA Failed to download NVM (%d)", err);
83e81961 Ben Young Tae Kim 2015-08-10 378 return err;
83e81961 Ben Young Tae Kim 2015-08-10 379 }
83e81961 Ben Young Tae Kim 2015-08-10 380
83e81961 Ben Young Tae Kim 2015-08-10 381 /* Perform HCI reset
*/
ba493d4f Balakrishna Godavarthi 2018-08-03 382 err =
qca_send_reset(hdev);
83e81961 Ben Young Tae Kim 2015-08-10 383 if (err < 0) {
ba493d4f Balakrishna Godavarthi 2018-08-03 384 bt_dev_err(hdev,
"QCA Failed to run HCI_RESET (%d)", err);
83e81961 Ben Young Tae Kim 2015-08-10 385 return err;
83e81961 Ben Young Tae Kim 2015-08-10 386 }
83e81961 Ben Young Tae Kim 2015-08-10 387
ba493d4f Balakrishna Godavarthi 2018-08-03 388 bt_dev_info(hdev,
"QCA setup on UART is completed");
83e81961 Ben Young Tae Kim 2015-08-10 389
83e81961 Ben Young Tae Kim 2015-08-10 390 return 0;
83e81961 Ben Young Tae Kim 2015-08-10 391 }
ba493d4f Balakrishna Godavarthi 2018-08-03 392
EXPORT_SYMBOL_GPL(qca_uart_setup);
83e81961 Ben Young Tae Kim 2015-08-10 393
:::::: The code at line 369 was first introduced by commit
:::::: 4219d4686875fdd83df3da00fda5ff0551e0a2d7 Bluetooth: btqca: Add
wcn3990 firmware download support.
:::::: TO: Balakrishna Godavarthi <bgodavar@xxxxxxxxxxxxxx>
:::::: CC: Marcel Holtmann <marcel@xxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology
Center
https://lists.01.org/pipermail/kbuild-all Intel
Corporation