mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 00:24:41 -04:00
qcacld-3.0: Get FW file names from PLD
Get FW file names from PLD. CRs-Fixed: 1014363 Change-Id: I332cba76a3338eed27d37244bd9351ece99dcd97
This commit is contained in:
parent
3e6172f91e
commit
6a313dcb16
6 changed files with 86 additions and 50 deletions
|
|
@ -37,24 +37,6 @@
|
|||
#include "ol_fw.h"
|
||||
#include "pld_common.h"
|
||||
|
||||
#ifdef CONFIG_CNSS
|
||||
#define QCA_FIRMWARE_FILE fw_files->image_file
|
||||
#define QCA_UTF_FIRMWARE_FILE fw_files->utf_file
|
||||
#define QCA_BOARD_DATA_FILE fw_files->board_data
|
||||
#define QCA_UTF_BOARD_DATA_FILE fw_files->utf_board_data
|
||||
#define QCA_OTP_FILE fw_files->otp_data
|
||||
#define QCA_SETUP_FILE NULL
|
||||
#define QCA_FIRMWARE_EPPING_FILE fw_files->epping_file
|
||||
#else
|
||||
#define QCA_FIRMWARE_FILE "athwlan.bin"
|
||||
#define QCA_UTF_FIRMWARE_FILE "utf.bin"
|
||||
#define QCA_BOARD_DATA_FILE "fakeboar.bin"
|
||||
#define QCA_UTF_BOARD_DATA_FILE "fakeboar.bin"
|
||||
#define QCA_OTP_FILE "otp.bin"
|
||||
#define QCA_SETUP_FILE "athsetup.bin"
|
||||
#define QCA_FIRMWARE_EPPING_FILE "epping.bin"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note that not all the register locations are accessible.
|
||||
* A list of accessible target registers are specified with
|
||||
|
|
|
|||
|
|
@ -133,12 +133,6 @@ end:
|
|||
#define SIGNED_SPLIT_BINARY_VALUE false
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CNSS
|
||||
#define CONFIG_CNSS_DEFINED true
|
||||
#else
|
||||
#define CONFIG_CNSS_DEFINED false
|
||||
#endif
|
||||
|
||||
static int
|
||||
__ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
||||
uint32_t address, bool compressed)
|
||||
|
|
@ -155,33 +149,31 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
SIGN_HEADER_T *sign_header;
|
||||
struct hif_target_info *tgt_info = hif_get_target_info_handle(scn);
|
||||
uint32_t target_type = tgt_info->target_type;
|
||||
#if defined(CONFIG_CNSS)
|
||||
/* fw_files variable used in filename assignment macros */
|
||||
struct bmi_info *bmi_ctx = GET_BMI_CONTEXT(ol_ctx);
|
||||
struct cnss_fw_files *fw_files = &bmi_ctx->fw_files;
|
||||
#endif
|
||||
qdf_device_t qdf_dev = ol_ctx->qdf_dev;
|
||||
int ret = 0;
|
||||
|
||||
switch (file) {
|
||||
default:
|
||||
BMI_ERR("%s: Unknown file type", __func__);
|
||||
return -1;
|
||||
ret = -1;
|
||||
return ret;
|
||||
case ATH_OTP_FILE:
|
||||
filename = QCA_OTP_FILE;
|
||||
filename = bmi_ctx->fw_files.otp_data;
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = true;
|
||||
|
||||
break;
|
||||
case ATH_FIRMWARE_FILE:
|
||||
if (QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
|
||||
filename = QCA_FIRMWARE_EPPING_FILE;
|
||||
filename = bmi_ctx->fw_files.epping_file;
|
||||
BMI_INFO("%s: Loading epping firmware file %s",
|
||||
__func__, filename);
|
||||
break;
|
||||
}
|
||||
#ifdef QCA_WIFI_FTM
|
||||
if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) {
|
||||
filename = QCA_UTF_FIRMWARE_FILE;
|
||||
filename = bmi_ctx->fw_files.utf_file;
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = true;
|
||||
BMI_INFO("%s: Loading firmware file %s",
|
||||
|
|
@ -189,7 +181,7 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
filename = QCA_FIRMWARE_FILE;
|
||||
filename = bmi_ctx->fw_files.image_file;
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = true;
|
||||
break;
|
||||
|
|
@ -197,11 +189,9 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
BMI_INFO("%s: no Patch file defined", __func__);
|
||||
return 0;
|
||||
case ATH_BOARD_DATA_FILE:
|
||||
|
||||
#ifdef QCA_WIFI_FTM
|
||||
if (cds_get_conparam() == QDF_GLOBAL_FTM_MODE) {
|
||||
filename = QCA_UTF_BOARD_DATA_FILE;
|
||||
|
||||
filename = bmi_ctx->fw_files.utf_board_data;
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = true;
|
||||
|
||||
|
|
@ -210,26 +200,30 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
break;
|
||||
}
|
||||
#endif /* QCA_WIFI_FTM */
|
||||
filename = QCA_BOARD_DATA_FILE;
|
||||
|
||||
filename = bmi_ctx->fw_files.board_data;
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = false;
|
||||
|
||||
break;
|
||||
case ATH_SETUP_FILE:
|
||||
if (CONFIG_CNSS_DEFINED ||
|
||||
cds_get_conparam() == QDF_GLOBAL_FTM_MODE ||
|
||||
QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
|
||||
BMI_INFO("%s: no Setup file defined", __func__);
|
||||
return -1;
|
||||
} else {
|
||||
filename = QCA_SETUP_FILE;
|
||||
if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE &&
|
||||
!QDF_IS_EPPING_ENABLED(cds_get_conparam())) {
|
||||
filename = bmi_ctx->fw_files.setup_file;
|
||||
if (filename[0] == 0) {
|
||||
BMI_INFO("%s: no Setup file defined", __func__);
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (SIGNED_SPLIT_BINARY_VALUE)
|
||||
bin_sign = true;
|
||||
|
||||
BMI_INFO("%s: Loading setup file %s",
|
||||
__func__, filename);
|
||||
} else {
|
||||
BMI_INFO("%s: no Setup file needed", __func__);
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -240,7 +234,7 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
if (file == ATH_OTP_FILE)
|
||||
return -ENOENT;
|
||||
|
||||
#if defined(QCA_WIFI_FTM) && defined(CONFIG_CNSS)
|
||||
#if defined(QCA_WIFI_FTM)
|
||||
/* Try default board data file if FTM specific
|
||||
* board data file is not present. */
|
||||
if (filename == bmi_ctx->fw_files.utf_board_data) {
|
||||
|
|
@ -251,13 +245,16 @@ __ol_transfer_bin_file(struct ol_context *ol_ctx, ATH_BIN_FILE file,
|
|||
qdf_dev->dev) != 0) {
|
||||
BMI_ERR("%s: Failed to get %s",
|
||||
__func__, filename);
|
||||
return -1;
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return -1;
|
||||
ret = -1;
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/pm.h>
|
||||
|
||||
#define PLD_IMAGE_FILE "athwlan.bin"
|
||||
#define PLD_UTF_FIRMWARE_FILE "utf.bin"
|
||||
#define PLD_BOARD_DATA_FILE "fakeboar.bin"
|
||||
#define PLD_OTP_FILE "otp.bin"
|
||||
#define PLD_SETUP_FILE "athsetup.bin"
|
||||
#define PLD_EPPING_FILE "epping.bin"
|
||||
#define PLD_EVICTED_FILE ""
|
||||
|
||||
/**
|
||||
* enum pld_bus_type - bus type
|
||||
* @PLD_BUS_TYPE_NONE: invalid bus type, only return in error cases
|
||||
|
|
@ -71,6 +79,7 @@ enum pld_bus_width_type {
|
|||
* @utf_board_data: WLAN FW UTF board data file
|
||||
* @epping_file: WLAN FW EPPING mode file
|
||||
* @evicted_data: WLAN FW evicted file
|
||||
* @setup_file: WLAN FW setup file
|
||||
*
|
||||
* pld_fw_files is used to store WLAN FW file names
|
||||
*/
|
||||
|
|
@ -82,6 +91,7 @@ struct pld_fw_files {
|
|||
char utf_board_data[PLD_MAX_FILE_NAME];
|
||||
char epping_file[PLD_MAX_FILE_NAME];
|
||||
char evicted_data[PLD_MAX_FILE_NAME];
|
||||
char setup_file[PLD_MAX_FILE_NAME];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -312,6 +322,7 @@ int pld_wlan_enable(struct device *dev, struct pld_wlan_enable_cfg *config,
|
|||
enum pld_driver_mode mode, const char *host_version);
|
||||
int pld_wlan_disable(struct device *dev, enum pld_driver_mode mode);
|
||||
int pld_set_fw_debug_mode(struct device *dev, bool enablefwlog);
|
||||
void pld_get_default_fw_files(struct pld_fw_files *pfw_files);
|
||||
int pld_get_fw_files_for_target(struct device *dev,
|
||||
struct pld_fw_files *pfw_files,
|
||||
u32 target_type, u32 target_version);
|
||||
|
|
|
|||
|
|
@ -325,6 +325,34 @@ int pld_set_fw_debug_mode(struct device *dev, bool enablefwlog)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* pld_get_default_fw_files() - Get default FW file names
|
||||
* @pfw_files: buffer for FW file names
|
||||
*
|
||||
* Return default FW file names to the buffer.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void pld_get_default_fw_files(struct pld_fw_files *pfw_files)
|
||||
{
|
||||
memset(pfw_files, 0, sizeof(*pfw_files));
|
||||
|
||||
strlcpy(pfw_files->image_file, PLD_IMAGE_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->board_data, PLD_BOARD_DATA_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->otp_data, PLD_OTP_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->utf_file, PLD_UTF_FIRMWARE_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->utf_board_data, PLD_BOARD_DATA_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->epping_file, PLD_EPPING_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->setup_file, PLD_SETUP_FILE,
|
||||
PLD_MAX_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* pld_get_fw_files_for_target() - Get FW file names
|
||||
* @dev: device
|
||||
|
|
|
|||
|
|
@ -463,12 +463,28 @@ int pld_pcie_get_fw_files_for_target(struct pld_fw_files *pfw_files,
|
|||
if (pfw_files == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
memset(pfw_files, 0, sizeof(*pfw_files));
|
||||
|
||||
ret = cnss_get_fw_files_for_target(&cnss_fw_files,
|
||||
target_type, target_version);
|
||||
if (0 != ret)
|
||||
return ret;
|
||||
|
||||
memcpy(pfw_files, &cnss_fw_files, sizeof(*pfw_files));
|
||||
strlcpy(pfw_files->image_file, cnss_fw_files.image_file,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->board_data, cnss_fw_files.board_data,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->otp_data, cnss_fw_files.otp_data,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->utf_file, cnss_fw_files.utf_file,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->utf_board_data, cnss_fw_files.utf_board_data,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->epping_file, cnss_fw_files.epping_file,
|
||||
PLD_MAX_FILE_NAME);
|
||||
strlcpy(pfw_files->evicted_data, cnss_fw_files.evicted_data,
|
||||
PLD_MAX_FILE_NAME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,10 +96,12 @@ static inline int cnss_wlan_pm_control(bool vote)
|
|||
#endif
|
||||
|
||||
#ifndef CONFIG_CNSS
|
||||
|
||||
static inline int
|
||||
pld_pcie_get_fw_files_for_target(struct pld_fw_files *pfw_files,
|
||||
u32 target_type, u32 target_version)
|
||||
{
|
||||
pld_get_default_fw_files(pfw_files);
|
||||
return 0;
|
||||
}
|
||||
static inline int
|
||||
|
|
|
|||
Loading…
Reference in a new issue