drivers: net: wireless: cnss2: Import Xiaomi changes
* From dagu-s-oss Change-Id: I5b7bd472d13f79d94b23df8e50a587928aa6ec06
This commit is contained in:
committed by
Sebastiano Barezzi
parent
fef8e9539a
commit
f6bf3bf5a3
@@ -19,6 +19,13 @@ config CNSS2_DEBUG
|
||||
features, enabling kernel panic for certain cases to aid the
|
||||
debugging, and enabling any other debug mechanisms.
|
||||
|
||||
config WIFI_THREE_ANTENNA
|
||||
bool "CNSS2 Platform Driver for Wi-Fi Three Antenna"
|
||||
depends on CNSS2
|
||||
help
|
||||
This option is to enable CNSS2 platform driver to support wifi
|
||||
three antenna.
|
||||
|
||||
config CNSS2_QMI
|
||||
bool "CNSS2 Platform Driver QMI support"
|
||||
select CNSS_QMI_SVC
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#define CNSS_MHI_TIMEOUT_DEFAULT 0
|
||||
#endif
|
||||
#define CNSS_MHI_M2_TIMEOUT_DEFAULT 25
|
||||
#define CNSS_QMI_TIMEOUT_DEFAULT 10000
|
||||
#define CNSS_QMI_TIMEOUT_DEFAULT 20000
|
||||
#define CNSS_BDF_TYPE_DEFAULT CNSS_BDF_ELF
|
||||
#define CNSS_TIME_SYNC_PERIOD_DEFAULT 900000
|
||||
#define CNSS_MIN_TIME_SYNC_PERIOD 2000
|
||||
@@ -66,6 +66,9 @@ struct cnss_driver_event {
|
||||
void *data;
|
||||
};
|
||||
|
||||
static bool disable_nv_mac;
|
||||
module_param(disable_nv_mac, bool, 0444);
|
||||
|
||||
static void cnss_set_plat_priv(struct platform_device *plat_dev,
|
||||
struct cnss_plat_data *plat_priv)
|
||||
{
|
||||
@@ -2609,6 +2612,10 @@ static void cnss_init_control_params(struct cnss_plat_data *plat_priv)
|
||||
"cnss-daemon-support"))
|
||||
plat_priv->ctrl_params.quirks |= BIT(ENABLE_DAEMON_SUPPORT);
|
||||
|
||||
if (of_property_read_bool(plat_priv->plat_dev->dev.of_node,
|
||||
"cnss-enable-self-recovery"))
|
||||
plat_priv->ctrl_params.quirks |= BIT(LINK_DOWN_SELF_RECOVERY);
|
||||
|
||||
plat_priv->ctrl_params.mhi_timeout = CNSS_MHI_TIMEOUT_DEFAULT;
|
||||
plat_priv->ctrl_params.mhi_m2_timeout = CNSS_MHI_M2_TIMEOUT_DEFAULT;
|
||||
plat_priv->ctrl_params.qmi_timeout = CNSS_QMI_TIMEOUT_DEFAULT;
|
||||
@@ -2697,7 +2704,11 @@ static int cnss_probe(struct platform_device *plat_dev)
|
||||
plat_priv->plat_dev = plat_dev;
|
||||
plat_priv->device_id = device_id->driver_data;
|
||||
plat_priv->bus_type = cnss_get_bus_type(plat_priv->device_id);
|
||||
if (disable_nv_mac) {
|
||||
plat_priv->use_nv_mac = false;
|
||||
} else {
|
||||
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);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define TIME_CLOCK_FREQ_HZ 19200000
|
||||
#define CNSS_RAMDUMP_MAGIC 0x574C414E
|
||||
#define CNSS_RAMDUMP_VERSION 0
|
||||
#define MAX_FIRMWARE_NAME_LEN 20
|
||||
#define MAX_FIRMWARE_NAME_LEN 23
|
||||
|
||||
#define CNSS_EVENT_SYNC BIT(0)
|
||||
#define CNSS_EVENT_UNINTERRUPTIBLE BIT(1)
|
||||
|
||||
@@ -1271,10 +1271,13 @@ static int cnss_pci_set_mhi_state(struct cnss_pci_data *pci_priv,
|
||||
break;
|
||||
case CNSS_MHI_RESUME:
|
||||
mutex_lock(&pci_priv->mhi_ctrl->pm_mutex);
|
||||
if (pci_priv->drv_connected_last)
|
||||
if (pci_priv->drv_connected_last) {
|
||||
cnss_pci_prevent_l1(&pci_priv->pci_dev->dev);
|
||||
ret = mhi_pm_fast_resume(pci_priv->mhi_ctrl, true);
|
||||
else
|
||||
cnss_pci_allow_l1(&pci_priv->pci_dev->dev);
|
||||
} else {
|
||||
ret = mhi_pm_resume(pci_priv->mhi_ctrl);
|
||||
}
|
||||
mutex_unlock(&pci_priv->mhi_ctrl->pm_mutex);
|
||||
break;
|
||||
case CNSS_MHI_TRIGGER_RDDM:
|
||||
@@ -1529,7 +1532,9 @@ static void cnss_pci_time_sync_work_hdlr(struct work_struct *work)
|
||||
if (cnss_pci_pm_runtime_get_sync(pci_priv, RTPM_ID_CNSS) < 0)
|
||||
goto runtime_pm_put;
|
||||
|
||||
mutex_lock(&pci_priv->bus_lock);
|
||||
cnss_pci_update_timestamp(pci_priv);
|
||||
mutex_unlock(&pci_priv->bus_lock);
|
||||
schedule_delayed_work(&pci_priv->time_sync_work,
|
||||
msecs_to_jiffies(time_sync_period_ms));
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ static struct cnss_vreg_cfg cnss_vreg_list[] = {
|
||||
{"vdd-wlan-rfa1", 1900000, 1900000, 0, 0, 0},
|
||||
{"vdd-wlan-rfa2", 1350000, 1350000, 0, 0, 0},
|
||||
{"vdd-wlan-en", 0, 0, 0, 10, 0},
|
||||
{"vdd-wlan-3antenna", 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static struct cnss_clk_cfg cnss_clk_list[] = {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/soc/qcom/qmi.h>
|
||||
#include <soc/qcom/socinfo.h>
|
||||
|
||||
#include "bus.h"
|
||||
#include "debug.h"
|
||||
@@ -14,6 +15,42 @@
|
||||
#define WLFW_CLIENT_ID 0x4b4e454c
|
||||
#define BDF_FILE_NAME_PREFIX "bdwlan"
|
||||
#define ELF_BDF_FILE_NAME "bdwlan.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_J11 "bd_j11.elf"
|
||||
#define ELF_BDF_FILE_NAME_J11_B_BOM "bd_j11_b.elf"
|
||||
#define ELF_BDF_FILE_NAME_J11_INDIA "bd_j11in.elf"
|
||||
#define ELF_BDF_FILE_NAME_J11_GLOBAL "bd_j11gl.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_GLOBAL "bd_j1gl.elf"
|
||||
#define ELF_BDF_FILE_NAME_INDIA "bd_j1in.elf"
|
||||
#define ELF_BDF_FILE_NAME_B_BOM "bd_j1_b.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_L3A "bd_l3a.elf"
|
||||
#define ELF_BDF_FILE_NAME_L3A_GLOBAL "bd_l3agl.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_L10A "bd_l10a.elf"
|
||||
#define ELF_BDF_FILE_NAME_L10A_GLOBAL "bd_l10agl.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_L11R "bd_l11r.elf"
|
||||
#define ELF_BDF_FILE_NAME_L11R_GLOBAL "bd_l11rgl.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_J1S "bd_j1s.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_J2S "bd_j2s.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_J3S "bd_j3s.elf"
|
||||
#define ELF_BDF_FILE_NAME_J3S_GLOBAL "bd_j3sgl.elf"
|
||||
#define ELF_BDF_FILE_NAME_J3S_INDIA "bd_j3sin.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_K11A "bd_k11a.elf"
|
||||
#define ELF_BDF_FILE_NAME_K11A_GLOBAL "bd_k11agl.elf"
|
||||
#define ELF_BDF_FILE_NAME_K11A_INDIA "bd_k11ain.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_K81 "bd_k81.elf"
|
||||
#define ELF_BDF_FILE_NAME_K81A "bd_k81a.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_L81A "bd_l81a.elf"
|
||||
|
||||
#define ELF_BDF_FILE_NAME_GF "bdwlang.elf"
|
||||
#define ELF_BDF_FILE_NAME_PREFIX "bdwlan.e"
|
||||
#define ELF_BDF_FILE_NAME_GF_PREFIX "bdwlang.e"
|
||||
@@ -22,6 +59,7 @@
|
||||
#define BIN_BDF_FILE_NAME_PREFIX "bdwlan.b"
|
||||
#define BIN_BDF_FILE_NAME_GF_PREFIX "bdwlang.b"
|
||||
#define REGDB_FILE_NAME "regdb.bin"
|
||||
#define REGDB_FILE_NAME_J11 "regdb_j11.bin"
|
||||
#define DUMMY_BDF_FILE_NAME "bdwlan.dmy"
|
||||
#define CHIP_ID_GF_MASK 0x10
|
||||
|
||||
@@ -215,6 +253,29 @@ static int cnss_wlfw_host_cap_send_sync(struct cnss_plat_data *plat_priv)
|
||||
req->wake_msi_valid = 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIFI_THREE_ANTENNA
|
||||
req->gpios_valid = 1;
|
||||
/* Format of GPIO configuration -
|
||||
*
|
||||
* A_UINT32 default_output_val:1, - GPIO default Output value if direction is output
|
||||
* reserved1:7, - reserved bits
|
||||
* sw_func:4, - GPIO pin software function selection
|
||||
* pull:2, - GPIO Pull, TLMM_GPIO_CFGn.GPIO_PULL
|
||||
* func:4, - GPIO pin function, TLMM_GPIO_CFGn.FUNC_SEL
|
||||
* drive:3, - GPIO Drive, TLMM_GPIO_CFGn.DRV_STRENGTH
|
||||
* dir:1, - GPIO pin direction: PLAT_GPIO_DIR_INPUT/PLAT_GPIO_DIR_OUTPUT, TLMM_GPIO_CFGn.GPIO_OE
|
||||
* reserved0:2, - reserved bits
|
||||
* gpio_num:8; - GPIO pin number
|
||||
*/
|
||||
/* 1st GPIO,set default GPIO config*/
|
||||
req->gpios[0] = 0x38242F01;
|
||||
|
||||
/* The Nth GPIO if any, and update req->gpios_len accordingly
|
||||
* Ensure gpios_len less than QMI_WLFW_MAX_NUM_GPIO_V01
|
||||
*/
|
||||
req->gpios_len = 1;
|
||||
#endif
|
||||
|
||||
req->bdf_support_valid = 1;
|
||||
req->bdf_support = 1;
|
||||
|
||||
@@ -500,6 +561,137 @@ int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cnss_get_xiaomi_bdf_elf_file_name(char *filename_tmp, u32 filename_len)
|
||||
{
|
||||
int hw_platform_ver = -1;
|
||||
uint32_t hw_country_ver = 0;
|
||||
|
||||
hw_platform_ver = get_hw_version_platform();
|
||||
hw_country_ver = get_hw_country_version();
|
||||
|
||||
switch (hw_platform_ver) {
|
||||
case HARDWARE_PLATFORM_LMI:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_GLOBAL);
|
||||
break;
|
||||
case (uint32_t)CountryIndia:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_INDIA);
|
||||
break;
|
||||
default:
|
||||
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
|
||||
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B)) {
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11_B_BOM);
|
||||
} else {
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J11);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HARDWARE_PLATFORM_CAS:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J1S);
|
||||
break;
|
||||
case HARDWARE_PLATFORM_THYME:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J2S);
|
||||
break;
|
||||
case HARDWARE_PLATFORM_APOLLO:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_GLOBAL);
|
||||
break;
|
||||
case (uint32_t)CountryIndia:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S_INDIA);
|
||||
break;
|
||||
default:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_J3S);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HARDWARE_PLATFORM_ALIOTH:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_GLOBAL);
|
||||
break;
|
||||
case (uint32_t)CountryIndia:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A_INDIA);
|
||||
break;
|
||||
default:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K11A);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HARDWARE_PLATFORM_ENUMA:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81);
|
||||
break;
|
||||
case HARDWARE_PLATFORM_ELISH:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_K81A);
|
||||
break;
|
||||
case HARDWARE_PLATFORM_PSYCHE:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L3A_GLOBAL);
|
||||
break;
|
||||
default:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L3A);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HARDWARE_PLATFORM_MUNCH:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R_GLOBAL);
|
||||
break;
|
||||
default:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L11R);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HARDWARE_PLATFORM_DAGU:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_L81A);
|
||||
break;
|
||||
default:
|
||||
switch (hw_country_ver) {
|
||||
case (uint32_t)CountryGlobal:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_GLOBAL);
|
||||
break;
|
||||
case (uint32_t)CountryIndia:
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_INDIA);
|
||||
break;
|
||||
default:
|
||||
if ((get_hw_version_minor() == (uint32_t)HW_MINOR_VERSION_B) &&
|
||||
(get_hw_version_major() == (uint32_t)HW_MAJOR_VERSION_B)) {
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME_B_BOM);
|
||||
} else {
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void cnss_get_xiaomi_bdf_regdb_file_name(char *filename_tmp, u32 filename_len)
|
||||
{
|
||||
int hw_platform_ver = -1;
|
||||
uint32_t hw_country_ver = 0;
|
||||
|
||||
hw_platform_ver = get_hw_version_platform();
|
||||
hw_country_ver = get_hw_country_version();
|
||||
|
||||
switch (hw_platform_ver) {
|
||||
case HARDWARE_PLATFORM_LMI:
|
||||
snprintf(filename_tmp, filename_len, REGDB_FILE_NAME_J11);
|
||||
break;
|
||||
default:
|
||||
snprintf(filename_tmp, filename_len, REGDB_FILE_NAME);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
|
||||
u32 bdf_type, char *filename,
|
||||
u32 filename_len)
|
||||
@@ -511,18 +703,8 @@ static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
|
||||
case CNSS_BDF_ELF:
|
||||
/* Board ID will be equal or less than 0xFF in GF mask case */
|
||||
if (plat_priv->board_info.board_id == 0xFF) {
|
||||
if (plat_priv->chip_info.chip_id & CHIP_ID_GF_MASK)
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME_GF);
|
||||
else
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME);
|
||||
cnss_get_xiaomi_bdf_elf_file_name(filename_tmp, filename_len);
|
||||
} else if (plat_priv->board_info.board_id < 0xFF) {
|
||||
if (plat_priv->chip_info.chip_id & CHIP_ID_GF_MASK)
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME_GF_PREFIX "%02x",
|
||||
plat_priv->board_info.board_id);
|
||||
else
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME_PREFIX "%02x",
|
||||
plat_priv->board_info.board_id);
|
||||
@@ -558,7 +740,7 @@ static int cnss_get_bdf_file_name(struct cnss_plat_data *plat_priv,
|
||||
}
|
||||
break;
|
||||
case CNSS_BDF_REGDB:
|
||||
snprintf(filename_tmp, filename_len, REGDB_FILE_NAME);
|
||||
cnss_get_xiaomi_bdf_regdb_file_name(filename_tmp, filename_len);
|
||||
break;
|
||||
case CNSS_BDF_DUMMY:
|
||||
cnss_pr_dbg("CNSS_BDF_DUMMY is set, sending dummy BDF\n");
|
||||
|
||||
Reference in New Issue
Block a user