|
@@ -48,6 +48,7 @@
|
|
|
#define PHY_UCODE_V2_FILE_NAME "phy_ucode20.elf"
|
|
|
#define DEFAULT_FW_FILE_NAME "amss.bin"
|
|
|
#define FW_V2_FILE_NAME "amss20.bin"
|
|
|
+#define FW_V2_FTM_FILE_NAME "amss20_ftm.bin"
|
|
|
#define DEVICE_MAJOR_VERSION_MASK 0xF
|
|
|
|
|
|
#define WAKE_MSI_NAME "WAKE"
|
|
@@ -631,6 +632,8 @@ static struct cnss_misc_reg syspm_reg_access_seq[] = {
|
|
|
#define WLAON_REG_SIZE ARRAY_SIZE(wlaon_reg_access_seq)
|
|
|
#define SYSPM_REG_SIZE ARRAY_SIZE(syspm_reg_access_seq)
|
|
|
|
|
|
+static int cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv);
|
|
|
+
|
|
|
#if IS_ENABLED(CONFIG_MHI_BUS_MISC)
|
|
|
static void cnss_mhi_debug_reg_dump(struct cnss_pci_data *pci_priv)
|
|
|
{
|
|
@@ -2487,6 +2490,21 @@ static int cnss_qca6174_ramdump(struct cnss_pci_data *pci_priv)
|
|
|
return cnss_do_ramdump(plat_priv);
|
|
|
}
|
|
|
|
|
|
+static void cnss_get_driver_mode_update_fw_name(struct cnss_plat_data *plat_priv)
|
|
|
+{
|
|
|
+ struct cnss_pci_data *pci_priv;
|
|
|
+ struct cnss_wlan_driver *driver_ops;
|
|
|
+
|
|
|
+ pci_priv = plat_priv->bus_priv;
|
|
|
+ driver_ops = pci_priv->driver_ops;
|
|
|
+
|
|
|
+ if (driver_ops && driver_ops->get_driver_mode) {
|
|
|
+ plat_priv->driver_mode = driver_ops->get_driver_mode();
|
|
|
+ cnss_pci_update_fw_name(pci_priv);
|
|
|
+ cnss_pr_dbg("New driver mode is %d", plat_priv->driver_mode);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int cnss_qca6290_powerup(struct cnss_pci_data *pci_priv)
|
|
|
{
|
|
|
int ret = 0;
|
|
@@ -2507,6 +2525,8 @@ static int cnss_qca6290_powerup(struct cnss_pci_data *pci_priv)
|
|
|
pci_priv->qmi_send_usage_count = 0;
|
|
|
|
|
|
plat_priv->power_up_error = 0;
|
|
|
+
|
|
|
+ cnss_get_driver_mode_update_fw_name(plat_priv);
|
|
|
retry:
|
|
|
ret = cnss_power_on_device(plat_priv);
|
|
|
if (ret) {
|
|
@@ -2930,6 +2950,8 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
|
|
|
plat_priv->device_version.major_version);
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
+
|
|
|
+ cnss_get_driver_mode_update_fw_name(plat_priv);
|
|
|
set_bit(CNSS_DRIVER_REGISTER, &plat_priv->driver_state);
|
|
|
|
|
|
if (!plat_priv->cbc_enabled ||
|
|
@@ -5039,15 +5061,63 @@ static int cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv)
|
|
|
FW_V2_FILE_NAME);
|
|
|
break;
|
|
|
case QCA6490_DEVICE_ID:
|
|
|
- case KIWI_DEVICE_ID:
|
|
|
switch (plat_priv->device_version.major_version) {
|
|
|
case FW_V2_NUMBER:
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->firmware_name,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ snprintf(plat_priv->fw_fallback_name,
|
|
|
+ MAX_FIRMWARE_NAME_LEN,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
plat_priv->firmware_name,
|
|
|
- FW_V2_FILE_NAME);
|
|
|
+ DEFAULT_FW_FILE_NAME);
|
|
|
snprintf(plat_priv->fw_fallback_name,
|
|
|
MAX_FIRMWARE_NAME_LEN,
|
|
|
- FW_V2_FILE_NAME);
|
|
|
+ DEFAULT_FW_FILE_NAME);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case KIWI_DEVICE_ID:
|
|
|
+ switch (plat_priv->device_version.major_version) {
|
|
|
+ case FW_V2_NUMBER:
|
|
|
+ /*
|
|
|
+ * kiwiv2 using seprate fw binary for MM and FTM mode,
|
|
|
+ * platform driver loads corresponding binary according
|
|
|
+ * to current mode indicated by wlan driver. Otherwise
|
|
|
+ * use default binary.
|
|
|
+ * Mission mode using same binary name as before,
|
|
|
+ * if seprate binary is not there, fall back to default.
|
|
|
+ */
|
|
|
+ if (plat_priv->driver_mode == CNSS_MISSION) {
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->firmware_name,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->fw_fallback_name,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ } else if (plat_priv->driver_mode == CNSS_FTM) {
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->firmware_name,
|
|
|
+ FW_V2_FTM_FILE_NAME);
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->fw_fallback_name,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ } else {
|
|
|
+ /*
|
|
|
+ * Since during cold boot calibration phase,
|
|
|
+ * wlan driver has not registered, so default
|
|
|
+ * fw binary will be used.
|
|
|
+ */
|
|
|
+ cnss_pci_add_fw_prefix_name(pci_priv,
|
|
|
+ plat_priv->firmware_name,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ snprintf(plat_priv->fw_fallback_name,
|
|
|
+ MAX_FIRMWARE_NAME_LEN,
|
|
|
+ FW_V2_FILE_NAME);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
cnss_pci_add_fw_prefix_name(pci_priv,
|
|
@@ -5216,8 +5286,12 @@ static void cnss_mhi_notify_status(struct mhi_controller *mhi_ctrl,
|
|
|
break;
|
|
|
#if IS_ENABLED(CONFIG_MHI_BUS_MISC)
|
|
|
case MHI_CB_FALLBACK_IMG:
|
|
|
- plat_priv->use_fw_path_with_prefix = false;
|
|
|
- cnss_pci_update_fw_name(pci_priv);
|
|
|
+ /* for kiwi_v2 binary fallback is used, skip path fallback here */
|
|
|
+ if (!(pci_priv->device_id == KIWI_DEVICE_ID &&
|
|
|
+ plat_priv->device_version.major_version == FW_V2_NUMBER)) {
|
|
|
+ plat_priv->use_fw_path_with_prefix = false;
|
|
|
+ cnss_pci_update_fw_name(pci_priv);
|
|
|
+ }
|
|
|
return;
|
|
|
#endif
|
|
|
default:
|