@@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
581581
582582 ret = request_firmware (& fw , config -> fwname , & hdev -> dev );
583583 if (ret ) {
584- /* For WCN6750, if mbn file is not present then check for
585- * tlv file.
586- */
587- if (soc_type == QCA_WCN6750 && config -> type == ELF_TYPE_PATCH ) {
588- bt_dev_dbg (hdev , "QCA Failed to request file: %s (%d)" ,
589- config -> fwname , ret );
590- config -> type = TLV_TYPE_PATCH ;
591- snprintf (config -> fwname , sizeof (config -> fwname ),
592- "qca/msbtfw%02x.tlv" , rom_ver );
593- bt_dev_info (hdev , "QCA Downloading %s" , config -> fwname );
594- ret = request_firmware (& fw , config -> fwname , & hdev -> dev );
595- if (ret ) {
596- bt_dev_err (hdev , "QCA Failed to request file: %s (%d)" ,
597- config -> fwname , ret );
598- return ret ;
599- }
600- }
601584 /* If the board-specific file is missing, try loading the default
602585 * one, unless that was attempted already.
603586 */
604- else if (config -> type == TLV_TYPE_NVM &&
605- qca_get_alt_nvm_file (config -> fwname , sizeof (config -> fwname ))) {
587+ if (config -> type == TLV_TYPE_NVM &&
588+ qca_get_alt_nvm_file (config -> fwname , sizeof (config -> fwname ))) {
606589 bt_dev_info (hdev , "QCA Downloading %s" , config -> fwname );
607590 ret = request_firmware (& fw , config -> fwname , & hdev -> dev );
608591 if (ret ) {
@@ -847,8 +830,12 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
847830 "qca/msbtfw%02x.mbn" , rom_ver );
848831 break ;
849832 case QCA_WCN6855 :
833+ /* Due to historical reasons, WCN685x chip has been using firmware
834+ * without the "wcn" prefix. The mapping between the chip and its
835+ * corresponding firmware has now been corrected.
836+ */
850837 snprintf (config .fwname , sizeof (config .fwname ),
851- "qca/hpbtfw %02x.tlv" , rom_ver );
838+ "qca/wcnhpbtfw %02x.tlv" , rom_ver );
852839 break ;
853840 case QCA_WCN7850 :
854841 snprintf (config .fwname , sizeof (config .fwname ),
@@ -861,8 +848,26 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
861848 }
862849
863850 err = qca_download_firmware (hdev , & config , soc_type , rom_ver );
851+ /* For WCN6750, if mbn file is not present then check for
852+ * tlv file.
853+ */
854+ if (err < 0 && soc_type == QCA_WCN6750 ) {
855+ bt_dev_dbg (hdev , "QCA Failed to request file: %s (%d)" ,
856+ config .fwname , err );
857+ config .type = TLV_TYPE_PATCH ;
858+ snprintf (config .fwname , sizeof (config .fwname ),
859+ "qca/msbtfw%02x.tlv" , rom_ver );
860+ bt_dev_info (hdev , "QCA Downloading %s" , config .fwname );
861+ err = qca_download_firmware (hdev , & config , soc_type , rom_ver );
862+ } else if (err < 0 && !rampatch_name && soc_type == QCA_WCN6855 ) {
863+ snprintf (config .fwname , sizeof (config .fwname ),
864+ "qca/hpbtfw%02x.tlv" , rom_ver );
865+ err = qca_download_firmware (hdev , & config , soc_type , rom_ver );
866+ }
867+
864868 if (err < 0 ) {
865- bt_dev_err (hdev , "QCA Failed to download patch (%d)" , err );
869+ bt_dev_err (hdev , "QCA Failed to request file: %s (%d)" ,
870+ config .fwname , err );
866871 return err ;
867872 }
868873
@@ -923,7 +928,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
923928 case QCA_WCN6855 :
924929 qca_read_fw_board_id (hdev , & boardid );
925930 qca_get_nvm_name_by_board (config .fwname , sizeof (config .fwname ),
926- "hpnv " , soc_type , ver , rom_ver , boardid );
931+ "wcnhpnv " , soc_type , ver , rom_ver , boardid );
927932 break ;
928933 case QCA_WCN7850 :
929934 qca_get_nvm_name_by_board (config .fwname , sizeof (config .fwname ),
@@ -936,8 +941,15 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
936941 }
937942
938943 err = qca_download_firmware (hdev , & config , soc_type , rom_ver );
944+ if (err < 0 && !firmware_name && soc_type == QCA_WCN6855 ) {
945+ qca_get_nvm_name_by_board (config .fwname , sizeof (config .fwname ),
946+ "hpnv" , soc_type , ver , rom_ver , boardid );
947+ err = qca_download_firmware (hdev , & config , soc_type , rom_ver );
948+ }
949+
939950 if (err < 0 ) {
940- bt_dev_err (hdev , "QCA Failed to download NVM (%d)" , err );
951+ bt_dev_err (hdev , "QCA Failed to request file: %s (%d)" ,
952+ config .fwname , err );
941953 return err ;
942954 }
943955
0 commit comments