Lines Matching +full:wcn6750 +full:- +full:bt
1 // SPDX-License-Identifier: GPL-2.0-only
49 if (skb->len != rlen) { in qca_read_soc_version()
50 bt_dev_err(hdev, "QCA Version size mismatch len %d", skb->len); in qca_read_soc_version()
51 err = -EILSEQ; in qca_read_soc_version()
55 edl = (struct edl_event_hdr *)(skb->data); in qca_read_soc_version()
57 if (edl->cresp != EDL_CMD_REQ_RES_EVT || in qca_read_soc_version()
58 edl->rtype != rtype) { in qca_read_soc_version()
59 bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp, in qca_read_soc_version()
60 edl->rtype); in qca_read_soc_version()
61 err = -EIO; in qca_read_soc_version()
66 memcpy(ver, edl->data + 1, sizeof(*ver)); in qca_read_soc_version()
68 memcpy(ver, &edl->data, sizeof(*ver)); in qca_read_soc_version()
71 le32_to_cpu(ver->product_id)); in qca_read_soc_version()
73 le32_to_cpu(ver->soc_id)); in qca_read_soc_version()
75 le16_to_cpu(ver->rom_ver)); in qca_read_soc_version()
77 le16_to_cpu(ver->patch_ver)); in qca_read_soc_version()
79 if (ver->soc_id == 0 || ver->rom_ver == 0) in qca_read_soc_version()
80 err = -EILSEQ; in qca_read_soc_version()
111 if (skb->len < sizeof(*edl)) { in qca_read_fw_build_info()
112 err = -EILSEQ; in qca_read_fw_build_info()
116 edl = (struct edl_event_hdr *)(skb->data); in qca_read_fw_build_info()
118 if (edl->cresp != EDL_CMD_REQ_RES_EVT || in qca_read_fw_build_info()
119 edl->rtype != EDL_GET_BUILD_INFO_CMD) { in qca_read_fw_build_info()
120 bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp, in qca_read_fw_build_info()
121 edl->rtype); in qca_read_fw_build_info()
122 err = -EIO; in qca_read_fw_build_info()
126 if (skb->len < sizeof(*edl) + 1) { in qca_read_fw_build_info()
127 err = -EILSEQ; in qca_read_fw_build_info()
131 build_lbl_len = edl->data[0]; in qca_read_fw_build_info()
133 if (skb->len < sizeof(*edl) + 1 + build_lbl_len) { in qca_read_fw_build_info()
134 err = -EILSEQ; in qca_read_fw_build_info()
138 build_label = kstrndup(&edl->data[1], build_lbl_len, GFP_KERNEL); in qca_read_fw_build_info()
140 err = -ENOMEM; in qca_read_fw_build_info()
169 if (skb->len != 2) { in qca_send_patch_config_cmd()
170 bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len); in qca_send_patch_config_cmd()
171 err = -EILSEQ; in qca_send_patch_config_cmd()
175 edl = (struct edl_event_hdr *)(skb->data); in qca_send_patch_config_cmd()
177 if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != EDL_PATCH_CONFIG_CMD) { in qca_send_patch_config_cmd()
178 bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp, in qca_send_patch_config_cmd()
179 edl->rtype); in qca_send_patch_config_cmd()
180 err = -EIO; in qca_send_patch_config_cmd()
229 err = -EILSEQ; in qca_read_fw_board_id()
233 if (edl->cresp != EDL_CMD_REQ_RES_EVT || in qca_read_fw_board_id()
234 edl->rtype != EDL_GET_BID_REQ_CMD) { in qca_read_fw_board_id()
235 bt_dev_err(hdev, "QCA Wrong packet: %d %d", edl->cresp, edl->rtype); in qca_read_fw_board_id()
236 err = -EIO; in qca_read_fw_board_id()
240 if (skb->len < 3) { in qca_read_fw_board_id()
241 err = -EILSEQ; in qca_read_fw_board_id()
245 *bid = (edl->data[1] << 8) + edl->data[2]; in qca_read_fw_board_id()
287 uint8_t nvm_baud_rate = config->user_baud_rate; in qca_tlv_check_data()
290 config->dnld_mode = QCA_SKIP_EVT_NONE; in qca_tlv_check_data()
291 config->dnld_type = QCA_SKIP_EVT_NONE; in qca_tlv_check_data()
293 switch (config->type) { in qca_tlv_check_data()
296 return -EINVAL; in qca_tlv_check_data()
298 config->dnld_mode = QCA_SKIP_EVT_VSE_CC; in qca_tlv_check_data()
299 config->dnld_type = QCA_SKIP_EVT_VSE_CC; in qca_tlv_check_data()
307 return -EINVAL; in qca_tlv_check_data()
310 type_len = le32_to_cpu(tlv->type_len); in qca_tlv_check_data()
311 tlv_patch = (struct tlv_type_patch *)tlv->data; in qca_tlv_check_data()
319 config->dnld_mode = tlv_patch->download_mode; in qca_tlv_check_data()
320 config->dnld_type = config->dnld_mode; in qca_tlv_check_data()
324 le32_to_cpu(tlv_patch->total_size)); in qca_tlv_check_data()
326 le32_to_cpu(tlv_patch->data_length)); in qca_tlv_check_data()
328 tlv_patch->format_version); in qca_tlv_check_data()
330 tlv_patch->signature); in qca_tlv_check_data()
332 tlv_patch->download_mode); in qca_tlv_check_data()
334 tlv_patch->reserved1); in qca_tlv_check_data()
336 le16_to_cpu(tlv_patch->product_id)); in qca_tlv_check_data()
338 le16_to_cpu(tlv_patch->rom_build)); in qca_tlv_check_data()
340 le16_to_cpu(tlv_patch->patch_version)); in qca_tlv_check_data()
342 le16_to_cpu(tlv_patch->reserved2)); in qca_tlv_check_data()
344 le32_to_cpu(tlv_patch->entry)); in qca_tlv_check_data()
349 return -EINVAL; in qca_tlv_check_data()
353 type_len = le32_to_cpu(tlv->type_len); in qca_tlv_check_data()
363 return -EINVAL; in qca_tlv_check_data()
367 type_len = le32_to_cpu(tlv->type_len); in qca_tlv_check_data()
378 if (fw_size < length + (tlv->data - fw_data)) in qca_tlv_check_data()
379 return -EINVAL; in qca_tlv_check_data()
382 data = tlv->data; in qca_tlv_check_data()
383 while (idx < length - sizeof(struct tlv_type_nvm)) { in qca_tlv_check_data()
386 tag_id = le16_to_cpu(tlv_nvm->tag_id); in qca_tlv_check_data()
387 tag_len = le16_to_cpu(tlv_nvm->tag_len); in qca_tlv_check_data()
390 return -EINVAL; in qca_tlv_check_data()
396 return -EINVAL; in qca_tlv_check_data()
398 memcpy(&config->bdaddr, tlv_nvm->data, sizeof(bdaddr_t)); in qca_tlv_check_data()
404 return -EINVAL; in qca_tlv_check_data()
410 tlv_nvm->data[0] |= 0x80; in qca_tlv_check_data()
414 tlv_nvm->data[1] = nvm_baud_rate; in qca_tlv_check_data()
416 tlv_nvm->data[2] = nvm_baud_rate; in qca_tlv_check_data()
422 return -EINVAL; in qca_tlv_check_data()
427 tlv_nvm->data[0] |= 0x01; in qca_tlv_check_data()
437 BT_ERR("Unknown TLV type %d", config->type); in qca_tlv_check_data()
438 return -EINVAL; in qca_tlv_check_data()
483 if (skb->len != rlen) { in qca_tlv_send_segment()
485 err = -EILSEQ; in qca_tlv_send_segment()
489 edl = (struct edl_event_hdr *)(skb->data); in qca_tlv_send_segment()
491 if (edl->cresp != EDL_CMD_REQ_RES_EVT || edl->rtype != rtype) { in qca_tlv_send_segment()
493 edl->cresp, edl->rtype); in qca_tlv_send_segment()
494 err = -EIO; in qca_tlv_send_segment()
500 tlv_resp = (struct tlv_seg_resp *)(edl->data); in qca_tlv_send_segment()
501 if (tlv_resp->result) { in qca_tlv_send_segment()
503 edl->cresp, edl->rtype, tlv_resp->result); in qca_tlv_send_segment()
520 return -ENOMEM; in qca_inject_cmd_complete_event()
523 hdr->evt = HCI_EV_CMD_COMPLETE; in qca_inject_cmd_complete_event()
524 hdr->plen = sizeof(*evt) + 1; in qca_inject_cmd_complete_event()
527 evt->ncmd = 1; in qca_inject_cmd_complete_event()
528 evt->opcode = cpu_to_le16(QCA_HCI_CC_OPCODE); in qca_inject_cmd_complete_event()
547 bt_dev_info(hdev, "QCA Downloading %s", config->fwname); in qca_download_firmware()
549 ret = request_firmware(&fw, config->fwname, &hdev->dev); in qca_download_firmware()
551 /* For WCN6750, if mbn file is not present then check for in qca_download_firmware()
554 if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) { in qca_download_firmware()
556 config->fwname, ret); in qca_download_firmware()
557 config->type = TLV_TYPE_PATCH; in qca_download_firmware()
558 snprintf(config->fwname, sizeof(config->fwname), in qca_download_firmware()
560 bt_dev_info(hdev, "QCA Downloading %s", config->fwname); in qca_download_firmware()
561 ret = request_firmware(&fw, config->fwname, &hdev->dev); in qca_download_firmware()
564 config->fwname, ret); in qca_download_firmware()
569 config->fwname, ret); in qca_download_firmware()
574 size = fw->size; in qca_download_firmware()
575 data = vmalloc(fw->size); in qca_download_firmware()
578 config->fwname); in qca_download_firmware()
580 return -ENOMEM; in qca_download_firmware()
583 memcpy(data, fw->data, size); in qca_download_firmware()
597 remain -= segsize; in qca_download_firmware()
600 config->dnld_mode = QCA_SKIP_EVT_NONE; in qca_download_firmware()
603 config->dnld_mode, soc_type); in qca_download_firmware()
613 * decrease the BT in initialization time. Here we will inject a command in qca_download_firmware()
616 if (config->dnld_type == QCA_SKIP_EVT_VSE_CC || in qca_download_firmware()
617 config->dnld_type == QCA_SKIP_EVT_VSE) in qca_download_firmware()
677 if (bacmp(&hdev->public_addr, BDADDR_ANY)) in qca_check_bdaddr()
688 if (skb->len != sizeof(*bda)) { in qca_check_bdaddr()
691 return -EIO; in qca_check_bdaddr()
694 bda = (struct hci_rp_read_bd_addr *)skb->data; in qca_check_bdaddr()
695 if (!bacmp(&bda->bdaddr, &config->bdaddr)) in qca_check_bdaddr()
696 set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); in qca_check_bdaddr()
724 snprintf(cfg->fwname, sizeof(cfg->fwname), "qca/%snv%02x.bin", stem, rom_ver); in qca_get_nvm_name_generic()
726 snprintf(cfg->fwname, sizeof(cfg->fwname), in qca_get_nvm_name_generic()
729 snprintf(cfg->fwname, sizeof(cfg->fwname), in qca_get_nvm_name_generic()
885 /* WCN399x and WCN6750 supports the Microsoft vendor extension with 0xFD70 as the in qca_uart_setup()