diff options
author | Hsiu-Chang Chen <hsiuchangchen@google.com> | 2022-03-21 17:13:40 +0800 |
---|---|---|
committer | Hsiu-Chang Chen <hsiuchangchen@google.com> | 2022-03-21 17:13:40 +0800 |
commit | 3042f9ced742e22d4167635a394360b6cd46716e (patch) | |
tree | 4400dd2c09382ae512438cbcce5695348612501a | |
parent | 7503f7954c5dc9815b7dd65d17221a1d24985bb9 (diff) | |
download | cnss2-3042f9ced742e22d4167635a394360b6cd46716e.tar.gz |
wcn6740: Update cnss/mhi/qmi/qrtr drivers
Migrate wlan codes to Rel3(Post CS7)
Bug: 222600720
Test: Basic functions
Change-Id: Ib90515b6c2966b90c6f8e6f357749fe52184cd85
-rw-r--r-- | cnss2/main.h | 2 | ||||
-rw-r--r-- | cnss2/pci.c | 24 | ||||
-rw-r--r-- | cnss2/qmi.c | 8 | ||||
-rw-r--r-- | cnss_utils/wlan_firmware_service_v01.c | 72 | ||||
-rw-r--r-- | cnss_utils/wlan_firmware_service_v01.h | 24 | ||||
-rw-r--r-- | inc/cnss2.h | 2 |
6 files changed, 125 insertions, 7 deletions
diff --git a/cnss2/main.h b/cnss2/main.h index 2664435..a44a784 100644 --- a/cnss2/main.h +++ b/cnss2/main.h @@ -540,6 +540,8 @@ struct cnss_plat_data { int current_bw_vote; u16 hang_event_data_len; u32 hang_data_addr_offset; + /* bitmap to detect FEM combination */ + u8 hwid_bitmap; }; #if IS_ENABLED(CONFIG_ARCH_QCOM) && !IS_ENABLED(CONFIG_WCN_GOOGLE) diff --git a/cnss2/pci.c b/cnss2/pci.c index b5543bd..ba82855 100644 --- a/cnss2/pci.c +++ b/cnss2/pci.c @@ -47,6 +47,7 @@ #define KIWI_PATH_PREFIX "kiwi/" #define DEFAULT_PHY_M3_FILE_NAME "m3.bin" #define DEFAULT_PHY_UCODE_FILE_NAME "phy_ucode.elf" +#define PHY_UCODE_V2_FILE_NAME "phy_ucode20.elf" #define DEFAULT_FW_FILE_NAME "amss.bin" #define FW_V2_FILE_NAME "amss20.bin" #define DEVICE_MAJOR_VERSION_MASK 0xF @@ -1699,7 +1700,7 @@ int cnss_pci_start_mhi(struct cnss_pci_data *pci_priv) jiffies + msecs_to_jiffies(BOOT_DEBUG_TIMEOUT_MS)); ret = cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_POWER_ON); - del_timer(&pci_priv->boot_debug_timer); + del_timer_sync(&pci_priv->boot_debug_timer); if (ret == 0) cnss_wlan_adsp_pc_enable(pci_priv, false); @@ -2785,6 +2786,18 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops) return -ENODEV; } #endif + + /* Assume only for those drivers provide chip version explicitly + * need version check. + */ + if (driver_ops->chip_version != CNSS_CHIP_VER_ANY && + driver_ops->chip_version != plat_priv->device_version.major_version) { + cnss_pr_err("Driver built for chip ver 0x%x, enumerated ver 0x%x, reject unsupported driver\n", + driver_ops->chip_version, + plat_priv->device_version.major_version); + return -ENODEV; + } + set_bit(CNSS_DRIVER_REGISTER, &plat_priv->driver_state); if (!plat_priv->cbc_enabled || @@ -3848,6 +3861,15 @@ int cnss_pci_load_m3(struct cnss_pci_data *pci_priv) case QCA6490_DEVICE_ID: phy_filename = DEFAULT_PHY_M3_FILE_NAME; break; + case KIWI_DEVICE_ID: + switch (plat_priv->device_version.major_version) { + case FW_V2_NUMBER: + phy_filename = PHY_UCODE_V2_FILE_NAME; + break; + default: + break; + } + break; default: break; } diff --git a/cnss2/qmi.c b/cnss2/qmi.c index d599565..e8b6797 100644 --- a/cnss2/qmi.c +++ b/cnss2/qmi.c @@ -532,15 +532,19 @@ int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv) else plat_priv->hang_data_addr_offset = 0; + if (resp->hwid_bitmap_valid) + plat_priv->hwid_bitmap = resp->hwid_bitmap; + cnss_pr_dbg("Target capability: chip_id: 0x%x, chip_family: 0x%x, board_id: 0x%x, soc_id: 0x%x, otp_version: 0x%x\n", plat_priv->chip_info.chip_id, plat_priv->chip_info.chip_family, plat_priv->board_info.board_id, plat_priv->soc_info.soc_id, plat_priv->otp_version); - cnss_pr_dbg("fw_version: 0x%x, fw_build_timestamp: %s, fw_build_id: %s\n", + cnss_pr_dbg("fw_version: 0x%x, fw_build_timestamp: %s, fw_build_id: %s, hwid_bitmap:0x%x\n", plat_priv->fw_version_info.fw_version, plat_priv->fw_version_info.fw_build_timestamp, - plat_priv->fw_build_id); + plat_priv->fw_build_id, + plat_priv->hwid_bitmap); cnss_pr_dbg("Hang event params, Length: 0x%x, Offset Address: 0x%x\n", plat_priv->hang_event_data_len, plat_priv->hang_data_addr_offset); diff --git a/cnss_utils/wlan_firmware_service_v01.c b/cnss_utils/wlan_firmware_service_v01.c index 6e5e01d..e03388a 100644 --- a/cnss_utils/wlan_firmware_service_v01.c +++ b/cnss_utils/wlan_firmware_service_v01.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "wlan_firmware_service_v01.h" @@ -1849,6 +1849,26 @@ struct qmi_elem_info wlfw_cap_resp_msg_v01_ei[] = { bdf_dnld_method), }, { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .array_type = NO_ARRAY, + .tlv_type = 0x21, + .offset = offsetof(struct + wlfw_cap_resp_msg_v01, + hwid_bitmap_valid), + }, + { + .data_type = QMI_UNSIGNED_1_BYTE, + .elem_len = 1, + .elem_size = sizeof(u8), + .array_type = NO_ARRAY, + .tlv_type = 0x21, + .offset = offsetof(struct + wlfw_cap_resp_msg_v01, + hwid_bitmap), + }, + { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .tlv_type = QMI_COMMON_TLV_TYPE, @@ -3578,6 +3598,56 @@ struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[] = { wlan_enable_delay), }, { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .array_type = NO_ARRAY, + .tlv_type = 0x2C, + .offset = offsetof(struct + wlfw_host_cap_req_msg_v01, + ddr_type_valid), + }, + { + .data_type = QMI_UNSIGNED_4_BYTE, + .elem_len = 1, + .elem_size = sizeof(u32), + .array_type = NO_ARRAY, + .tlv_type = 0x2C, + .offset = offsetof(struct + wlfw_host_cap_req_msg_v01, + ddr_type), + }, + { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .array_type = NO_ARRAY, + .tlv_type = 0x2D, + .offset = offsetof(struct + wlfw_host_cap_req_msg_v01, + gpio_info_valid), + }, + { + .data_type = QMI_DATA_LEN, + .elem_len = 1, + .elem_size = sizeof(u8), + .array_type = NO_ARRAY, + .tlv_type = 0x2D, + .offset = offsetof(struct + wlfw_host_cap_req_msg_v01, + gpio_info_len), + }, + { + .data_type = QMI_UNSIGNED_4_BYTE, + .elem_len = QMI_WLFW_MAX_NUM_GPIO_INFO_V01, + .elem_size = sizeof(u32), + .array_type = VAR_LEN_ARRAY, + .tlv_type = 0x2D, + .offset = offsetof(struct + wlfw_host_cap_req_msg_v01, + gpio_info), + }, + { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .tlv_type = QMI_COMMON_TLV_TYPE, diff --git a/cnss_utils/wlan_firmware_service_v01.h b/cnss_utils/wlan_firmware_service_v01.h index 1632c3f..5f51b9a 100644 --- a/cnss_utils/wlan_firmware_service_v01.h +++ b/cnss_utils/wlan_firmware_service_v01.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef WLAN_FIRMWARE_SERVICE_V01_H @@ -115,6 +115,7 @@ #define QMI_WLFW_MAX_NUM_SVC_V01 24 #define QMI_WLFW_MAX_NUM_MEMORY_REGIONS_V01 2 #define QMI_WLFW_MAC_ADDR_SIZE_V01 6 +#define QMI_WLFW_MAX_NUM_GPIO_INFO_V01 20 #define QMI_WLFW_MAX_NUM_MEM_CFG_V01 2 #define QMI_WLFW_MAX_NUM_MEM_SEG_V01 52 #define QMI_WLFW_MAX_WFC_CALL_STATUS_DATA_SIZE_V01 256 @@ -269,6 +270,16 @@ enum wlfw_bdf_dnld_method_v01 { WLFW_BDF_DNLD_METHOD_MAX_VAL_V01 = INT_MAX, }; +enum wlfw_gpio_info_type_v01 { + WLFW_GPIO_INFO_TYPE_MIN_VAL_V01 = INT_MIN, + WLAN_EN_GPIO_V01 = 0, + BT_EN_GPIO_V01 = 1, + HOST_SOL_GPIO_V01 = 2, + TARGET_SOL_GPIO_V01 = 3, + GPIO_TYPE_MAX_V01 = 4, + WLFW_GPIO_INFO_TYPE_MAX_VAL_V01 = INT_MAX, +}; + #define QMI_WLFW_CE_ATTR_FLAGS_V01 ((u32)0x00) #define QMI_WLFW_CE_ATTR_NO_SNOOP_V01 ((u32)0x01) #define QMI_WLFW_CE_ATTR_BYTE_SWAP_DATA_V01 ((u32)0x02) @@ -555,9 +566,11 @@ struct wlfw_cap_resp_msg_v01 { u16 hang_data_length; u8 bdf_dnld_method_valid; enum wlfw_bdf_dnld_method_v01 bdf_dnld_method; + u8 hwid_bitmap_valid; + u8 hwid_bitmap; }; -#define WLFW_CAP_RESP_MSG_V01_MAX_MSG_LEN 358 +#define WLFW_CAP_RESP_MSG_V01_MAX_MSG_LEN 362 extern struct qmi_elem_info wlfw_cap_resp_msg_v01_ei[]; struct wlfw_bdf_download_req_msg_v01 { @@ -831,9 +844,14 @@ struct wlfw_host_cap_req_msg_v01 { u32 wake_msi_addr; u8 wlan_enable_delay_valid; u32 wlan_enable_delay; + u8 ddr_type_valid; + u32 ddr_type; + u8 gpio_info_valid; + u32 gpio_info_len; + u32 gpio_info[QMI_WLFW_MAX_NUM_GPIO_INFO_V01]; }; -#define WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN 396 +#define WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN 487 extern struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[]; struct wlfw_host_cap_resp_msg_v01 { diff --git a/inc/cnss2.h b/inc/cnss2.h index c6591dd..c5f180e 100644 --- a/inc/cnss2.h +++ b/inc/cnss2.h @@ -12,6 +12,7 @@ #define CNSS_MAX_FILE_NAME 20 #define CNSS_MAX_TIMESTAMP_LEN 32 #define CNSS_MAX_DEV_MEM_NUM 4 +#define CNSS_CHIP_VER_ANY 0 /* * Temporary change for compilation, will be removed @@ -132,6 +133,7 @@ struct cnss_wlan_driver { struct cnss_uevent_data *uevent); struct cnss_wlan_runtime_ops *runtime_ops; const struct pci_device_id *id_table; + u32 chip_version; }; struct cnss_ce_tgt_pipe_cfg { |