mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
Merge "cnss2: Add prefix to firmware name based on device ID"
This commit is contained in:
commit
3d48305c26
7 changed files with 95 additions and 25 deletions
|
|
@ -95,6 +95,23 @@ void cnss_bus_deinit(struct cnss_plat_data *plat_priv)
|
|||
}
|
||||
}
|
||||
|
||||
void cnss_bus_add_fw_prefix_name(struct cnss_plat_data *plat_priv,
|
||||
char *prefix_name, char *name)
|
||||
{
|
||||
if (!plat_priv)
|
||||
return;
|
||||
|
||||
switch (plat_priv->bus_type) {
|
||||
case CNSS_BUS_PCI:
|
||||
return cnss_pci_add_fw_prefix_name(plat_priv->bus_priv,
|
||||
prefix_name, name);
|
||||
default:
|
||||
cnss_pr_err("Unsupported bus type: %d\n",
|
||||
plat_priv->bus_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int cnss_bus_load_m3(struct cnss_plat_data *plat_priv)
|
||||
{
|
||||
if (!plat_priv)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ void *cnss_bus_dev_to_bus_priv(struct device *dev);
|
|||
struct cnss_plat_data *cnss_bus_dev_to_plat_priv(struct device *dev);
|
||||
int cnss_bus_init(struct cnss_plat_data *plat_priv);
|
||||
void cnss_bus_deinit(struct cnss_plat_data *plat_priv);
|
||||
void cnss_bus_add_fw_prefix_name(struct cnss_plat_data *plat_priv,
|
||||
char *prefix_name, char *name);
|
||||
int cnss_bus_load_m3(struct cnss_plat_data *plat_priv);
|
||||
int cnss_bus_alloc_fw_mem(struct cnss_plat_data *plat_priv);
|
||||
int cnss_bus_alloc_qdss_mem(struct cnss_plat_data *plat_priv);
|
||||
|
|
|
|||
|
|
@ -2434,6 +2434,12 @@ static void cnss_get_wlaon_pwr_ctrl_info(struct cnss_plat_data *plat_priv)
|
|||
plat_priv->set_wlaon_pwr_ctrl);
|
||||
}
|
||||
|
||||
static bool cnss_use_fw_path_with_prefix(struct cnss_plat_data *plat_priv)
|
||||
{
|
||||
return of_property_read_bool(plat_priv->plat_dev->dev.of_node,
|
||||
"qcom,converged-dt");
|
||||
}
|
||||
|
||||
static const struct platform_device_id cnss_platform_id_table[] = {
|
||||
{ .name = "qca6174", .driver_data = QCA6174_DEVICE_ID, },
|
||||
{ .name = "qca6290", .driver_data = QCA6290_DEVICE_ID, },
|
||||
|
|
@ -2499,6 +2505,8 @@ static int cnss_probe(struct platform_device *plat_dev)
|
|||
plat_priv->device_id = device_id->driver_data;
|
||||
plat_priv->bus_type = cnss_get_bus_type(plat_priv->device_id);
|
||||
plat_priv->use_nv_mac = cnss_use_nv_mac(plat_priv);
|
||||
plat_priv->use_fw_path_with_prefix =
|
||||
cnss_use_fw_path_with_prefix(plat_priv);
|
||||
cnss_set_plat_priv(plat_dev, plat_priv);
|
||||
platform_set_drvdata(plat_dev, plat_priv);
|
||||
INIT_LIST_HEAD(&plat_priv->vreg_list);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#define TIME_CLOCK_FREQ_HZ 19200000
|
||||
#define CNSS_RAMDUMP_MAGIC 0x574C414E
|
||||
#define CNSS_RAMDUMP_VERSION 0
|
||||
#define MAX_FIRMWARE_NAME_LEN 20
|
||||
|
||||
#define CNSS_EVENT_SYNC BIT(0)
|
||||
#define CNSS_EVENT_UNINTERRUPTIBLE BIT(1)
|
||||
|
|
@ -401,7 +402,8 @@ struct cnss_plat_data {
|
|||
u8 *diag_reg_read_buf;
|
||||
u8 cal_done;
|
||||
u8 powered_on;
|
||||
char firmware_name[13];
|
||||
u8 use_fw_path_with_prefix;
|
||||
char firmware_name[MAX_FIRMWARE_NAME_LEN];
|
||||
struct completion rddm_complete;
|
||||
struct completion recovery_complete;
|
||||
struct cnss_control_params ctrl_params;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@
|
|||
#define MHI_NODE_NAME "qcom,mhi"
|
||||
#define MHI_MSI_NAME "MHI"
|
||||
|
||||
#define MAX_M3_FILE_NAME_LENGTH 13
|
||||
#define QCA6390_PATH_PREFIX "qca6390/"
|
||||
#define QCA6490_PATH_PREFIX "qca6490/"
|
||||
#define DEFAULT_M3_FILE_NAME "m3.bin"
|
||||
#define DEFAULT_FW_FILE_NAME "amss.bin"
|
||||
#define FW_V2_FILE_NAME "amss20.bin"
|
||||
|
|
@ -3325,12 +3326,13 @@ int cnss_pci_load_m3(struct cnss_pci_data *pci_priv)
|
|||
{
|
||||
struct cnss_plat_data *plat_priv = pci_priv->plat_priv;
|
||||
struct cnss_fw_mem *m3_mem = &plat_priv->m3_mem;
|
||||
char filename[MAX_M3_FILE_NAME_LENGTH];
|
||||
char filename[MAX_FIRMWARE_NAME_LEN];
|
||||
const struct firmware *fw_entry;
|
||||
int ret = 0;
|
||||
|
||||
if (!m3_mem->va && !m3_mem->size) {
|
||||
snprintf(filename, sizeof(filename), DEFAULT_M3_FILE_NAME);
|
||||
cnss_pci_add_fw_prefix_name(pci_priv, filename,
|
||||
DEFAULT_M3_FILE_NAME);
|
||||
|
||||
ret = request_firmware(&fw_entry, filename,
|
||||
&pci_priv->pci_dev->dev);
|
||||
|
|
@ -4282,6 +4284,38 @@ static void cnss_mhi_pm_runtime_put_noidle(struct mhi_controller *mhi_ctrl,
|
|||
cnss_pci_pm_runtime_put_noidle(pci_priv);
|
||||
}
|
||||
|
||||
void cnss_pci_add_fw_prefix_name(struct cnss_pci_data *pci_priv,
|
||||
char *prefix_name, char *name)
|
||||
{
|
||||
struct cnss_plat_data *plat_priv;
|
||||
|
||||
if (!pci_priv)
|
||||
return;
|
||||
|
||||
plat_priv = pci_priv->plat_priv;
|
||||
|
||||
if (!plat_priv->use_fw_path_with_prefix) {
|
||||
scnprintf(prefix_name, MAX_FIRMWARE_NAME_LEN, "%s", name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pci_priv->device_id) {
|
||||
case QCA6390_DEVICE_ID:
|
||||
scnprintf(prefix_name, MAX_FIRMWARE_NAME_LEN,
|
||||
QCA6390_PATH_PREFIX "%s", name);
|
||||
break;
|
||||
case QCA6490_DEVICE_ID:
|
||||
scnprintf(prefix_name, MAX_FIRMWARE_NAME_LEN,
|
||||
QCA6490_PATH_PREFIX "%s", name);
|
||||
break;
|
||||
default:
|
||||
scnprintf(prefix_name, MAX_FIRMWARE_NAME_LEN, "%s", name);
|
||||
break;
|
||||
}
|
||||
|
||||
cnss_pr_dbg("FW name added with prefix: %s\n", prefix_name);
|
||||
}
|
||||
|
||||
static char *cnss_mhi_notify_status_to_str(enum MHI_CB status)
|
||||
{
|
||||
switch (status) {
|
||||
|
|
@ -4434,23 +4468,26 @@ static int cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv)
|
|||
plat_priv->device_version.major_version);
|
||||
return -EINVAL;
|
||||
}
|
||||
scnprintf(plat_priv->firmware_name,
|
||||
sizeof(plat_priv->firmware_name), FW_V2_FILE_NAME);
|
||||
mhi_ctrl->fw_image = plat_priv->firmware_name;
|
||||
cnss_pci_add_fw_prefix_name(pci_priv, plat_priv->firmware_name,
|
||||
FW_V2_FILE_NAME);
|
||||
break;
|
||||
case QCA6490_DEVICE_ID:
|
||||
switch (plat_priv->device_version.major_version) {
|
||||
case FW_V2_NUMBER:
|
||||
scnprintf(plat_priv->firmware_name,
|
||||
sizeof(plat_priv->firmware_name),
|
||||
FW_V2_FILE_NAME);
|
||||
cnss_pci_add_fw_prefix_name(pci_priv,
|
||||
plat_priv->firmware_name,
|
||||
FW_V2_FILE_NAME);
|
||||
break;
|
||||
default:
|
||||
cnss_pci_add_fw_prefix_name(pci_priv,
|
||||
plat_priv->firmware_name,
|
||||
DEFAULT_FW_FILE_NAME);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
cnss_pci_add_fw_prefix_name(pci_priv, plat_priv->firmware_name,
|
||||
DEFAULT_FW_FILE_NAME);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -4642,8 +4679,6 @@ static int cnss_pci_probe(struct pci_dev *pci_dev,
|
|||
cnss_set_pci_priv(pci_dev, pci_priv);
|
||||
plat_priv->device_id = pci_dev->device;
|
||||
plat_priv->bus_priv = pci_priv;
|
||||
snprintf(plat_priv->firmware_name, sizeof(plat_priv->firmware_name),
|
||||
DEFAULT_FW_FILE_NAME);
|
||||
mutex_init(&pci_priv->bus_lock);
|
||||
|
||||
ret = of_reserved_mem_device_init(dev);
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ int cnss_resume_pci_link(struct cnss_pci_data *pci_priv);
|
|||
int cnss_pci_recover_link_down(struct cnss_pci_data *pci_priv);
|
||||
int cnss_pci_init(struct cnss_plat_data *plat_priv);
|
||||
void cnss_pci_deinit(struct cnss_plat_data *plat_priv);
|
||||
void cnss_pci_add_fw_prefix_name(struct cnss_pci_data *pci_priv,
|
||||
char *prefix_name, char *name);
|
||||
int cnss_pci_alloc_fw_mem(struct cnss_pci_data *pci_priv);
|
||||
int cnss_pci_alloc_qdss_mem(struct cnss_pci_data *pci_priv);
|
||||
void cnss_pci_free_qdss_mem(struct cnss_pci_data *pci_priv);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#define WLFW_SERVICE_INS_ID_V01 1
|
||||
#define WLFW_CLIENT_ID 0x4b4e454c
|
||||
#define MAX_BDF_FILE_NAME 13
|
||||
#define BDF_FILE_NAME_PREFIX "bdwlan"
|
||||
#define ELF_BDF_FILE_NAME "bdwlan.elf"
|
||||
#define ELF_BDF_FILE_NAME_PREFIX "bdwlan.e"
|
||||
|
|
@ -480,42 +479,43 @@ static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
|
|||
u32 bdf_type, char *filename,
|
||||
u32 filename_len)
|
||||
{
|
||||
char filename_tmp[MAX_FIRMWARE_NAME_LEN];
|
||||
int ret = 0;
|
||||
|
||||
switch (bdf_type) {
|
||||
case CNSS_BDF_ELF:
|
||||
if (plat_priv->board_info.board_id == 0xFF)
|
||||
snprintf(filename, filename_len, ELF_BDF_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME);
|
||||
else if (plat_priv->board_info.board_id < 0xFF)
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME_PREFIX "%02x",
|
||||
plat_priv->board_info.board_id);
|
||||
else
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BDF_FILE_NAME_PREFIX "%02x.e%02x",
|
||||
plat_priv->board_info.board_id >> 8 & 0xFF,
|
||||
plat_priv->board_info.board_id & 0xFF);
|
||||
break;
|
||||
case CNSS_BDF_BIN:
|
||||
if (plat_priv->board_info.board_id == 0xFF)
|
||||
snprintf(filename, filename_len, BIN_BDF_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, BIN_BDF_FILE_NAME);
|
||||
else if (plat_priv->board_info.board_id < 0xFF)
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BIN_BDF_FILE_NAME_PREFIX "%02x",
|
||||
plat_priv->board_info.board_id);
|
||||
else
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BDF_FILE_NAME_PREFIX "%02x.b%02x",
|
||||
plat_priv->board_info.board_id >> 8 & 0xFF,
|
||||
plat_priv->board_info.board_id & 0xFF);
|
||||
break;
|
||||
case CNSS_BDF_REGDB:
|
||||
snprintf(filename, filename_len, REGDB_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, REGDB_FILE_NAME);
|
||||
break;
|
||||
case CNSS_BDF_DUMMY:
|
||||
cnss_pr_dbg("CNSS_BDF_DUMMY is set, sending dummy BDF\n");
|
||||
snprintf(filename, filename_len, DUMMY_BDF_FILE_NAME);
|
||||
ret = MAX_BDF_FILE_NAME;
|
||||
snprintf(filename_tmp, filename_len, DUMMY_BDF_FILE_NAME);
|
||||
ret = MAX_FIRMWARE_NAME_LEN;
|
||||
break;
|
||||
default:
|
||||
cnss_pr_err("Invalid BDF type: %d\n",
|
||||
|
|
@ -523,6 +523,10 @@ static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
|
|||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret >= 0)
|
||||
cnss_bus_add_fw_prefix_name(plat_priv, filename, filename_tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +536,7 @@ int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
|
|||
struct wlfw_bdf_download_req_msg_v01 *req;
|
||||
struct wlfw_bdf_download_resp_msg_v01 *resp;
|
||||
struct qmi_txn txn;
|
||||
char filename[MAX_BDF_FILE_NAME];
|
||||
char filename[MAX_FIRMWARE_NAME_LEN];
|
||||
const struct firmware *fw_entry = NULL;
|
||||
const u8 *temp;
|
||||
unsigned int remaining;
|
||||
|
|
@ -555,7 +559,7 @@ int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
|
|||
filename, sizeof(filename));
|
||||
if (ret > 0) {
|
||||
temp = DUMMY_BDF_FILE_NAME;
|
||||
remaining = MAX_BDF_FILE_NAME;
|
||||
remaining = MAX_FIRMWARE_NAME_LEN;
|
||||
goto bypass_bdf;
|
||||
} else if (ret < 0) {
|
||||
goto err_req_fw;
|
||||
|
|
|
|||
Loading…
Reference in a new issue