+ type_len = le32_to_cpu(tlv->type_len);
tlv_patch = (struct tlv_type_patch *)tlv->data;
/* For Rome version 1.1 to 3.1, all segment commands
@@ -218,6 +221,7 @@ static void qca_tlv_check_data(struct
qca_fw_config *config,
config->dnld_mode = tlv_patch->download_mode;
config->dnld_type = config->dnld_mode;
+ BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
BT_DBG("Total Length : %d bytes",
le32_to_cpu(tlv_patch->total_size));
BT_DBG("Patch Data Length : %d bytes",
@@ -243,6 +247,14 @@ static void qca_tlv_check_data(struct
qca_fw_config *config,
break;
case TLV_TYPE_NVM:
+ tlv = (struct tlv_type_hdr *)fw->data;
+
+ type_len = le32_to_cpu(tlv->type_len);
+ length = (type_len >> 8) & 0x00ffffff;
+
+ BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
+ BT_DBG("Length\t\t : %d bytes", length);
+
idx = 0;
data = tlv->data;
while (idx < length) {
@@ -387,7 +399,8 @@ static int qca_inject_cmd_complete_event(struct
hci_dev *hdev)
static int qca_download_firmware(struct hci_dev *hdev,
struct qca_fw_config *config,
- enum qca_btsoc_type soc_type)
+ enum qca_btsoc_type soc_type,
+ u8 rom_ver)
{
const struct firmware *fw;
const u8 *segment;
@@ -397,12 +410,30 @@ static int qca_download_firmware(struct hci_dev
*hdev,
ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
- bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
- config->fwname, ret);
- return ret;
+ /* For WCN6750, if mbn file is not present then check for
+ * tlv file.
+ */
+ if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
+ bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
+ config->fwname, ret);
+ config->type = TLV_TYPE_PATCH;
+ snprintf(config->fwname, sizeof(config->fwname),
+ "qca/msbtfw%02x.tlv", rom_ver);
+ bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
+ ret = request_firmware(&fw, config->fwname, &hdev->dev);
+ if (ret) {
+ bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+ config->fwname, ret);
+ return ret;
+ }
+ } else {
+ bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+ config->fwname, ret);
+ return ret;
+ }
}
- qca_tlv_check_data(config, fw, soc_type);
+ qca_tlv_check_data(hdev, config, fw, soc_type);
segment = fw->data;
remain = fw->size;
@@ -520,14 +551,18 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t
baudrate,
} else if (soc_type == QCA_WCN6750) {
rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
(soc_ver & 0x0000000f);
+ /* Choose mbn file by default.If mbn file is not found
+ * then choose tlv file
+ */
+ config.type = ELF_TYPE_PATCH;
snprintf(config.fwname, sizeof(config.fwname),
- "qca/msbtfw%02x.tlv", rom_ver);
+ "qca/msbtfw%02x.mbn", rom_ver);
} else {
snprintf(config.fwname, sizeof(config.fwname),
"qca/rampatch_%08x.bin", soc_ver);
}
- err = qca_download_firmware(hdev, &config, soc_type);
+ err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
if (err < 0) {
bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
return err;
@@ -560,7 +595,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t
baudrate,
snprintf(config.fwname, sizeof(config.fwname),
"qca/nvm_%08x.bin", soc_ver);
- err = qca_download_firmware(hdev, &config, soc_type);
+ err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
if (err < 0) {
bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);
return err;
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index dd82d2c..5a5e699 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -80,7 +80,8 @@ enum qca_tlv_dnld_mode {
enum qca_tlv_type {
TLV_TYPE_PATCH = 1,
- TLV_TYPE_NVM
+ TLV_TYPE_NVM,
+ ELF_TYPE_PATCH
};