ath10k: Populate HW params, WMI and HTT versions for WCN3990

firmware-5.bin file for WCN3990 contains just WMI and HTT versions and
firmware is loaded by PIL.

This change, populate the hw params for WCN3990 and parse
firmware-5.bin file for WMI and HTT versions.

CRs-Fixed: 2002151
Change-Id: Ic65d3696e9546fd428e608f4738e9fe53d61338f
Signed-off-by: Rajeev Kumar Sirasanagandla <rsirasan@codeaurora.org>
This commit is contained in:
Rajeev Kumar Sirasanagandla 2017-01-17 18:17:51 +05:30
parent 892e41e7c7
commit aa0bbc8456
4 changed files with 69 additions and 41 deletions

View file

@ -305,6 +305,21 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.hw_ops = &qca99x0_ops,
.decap_align_bytes = 1,
},
{
.id = ATH10K_HW_WCN3990,
.dev_id = 0,
.name = "wcn3990 hw1.0",
.continuous_frag_desc = true,
.tx_chain_mask = 0x7,
.rx_chain_mask = 0x7,
.max_spatial_stream = 4,
.fw = {
.dir = WCN3990_HW_1_0_FW_DIR,
},
.sw_decrypt_mcast_mgmt = true,
.hw_ops = &wcn3990_ops,
.decap_align_bytes = 1,
},
};
static const char *const ath10k_core_fw_feature_str[] = {
@ -1263,12 +1278,14 @@ int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
data += ie_len;
}
if (!fw_file->firmware_data ||
!fw_file->firmware_len) {
ath10k_warn(ar, "No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n",
ar->hw_params.fw.dir, name);
ret = -ENOMEDIUM;
goto err;
if (ar->is_bmi) {
if (!fw_file->firmware_data ||
!fw_file->firmware_len) {
ath10k_warn(ar, "No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n",
ar->hw_params.fw.dir, name);
ret = -ENOMEDIUM;
goto err;
}
}
return 0;
@ -1282,8 +1299,10 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
{
int ret;
/* calibration file is optional, don't check for any errors */
ath10k_fetch_cal_file(ar);
if (ar->is_bmi) {
/* calibration file is optional, don't check for any errors */
ath10k_fetch_cal_file(ar);
}
ar->fw_api = 5;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
@ -1574,8 +1593,6 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
{
struct ath10k_fw_file *fw_file = &ar->normal_mode_fw.fw_file;
init_fw_param(ar, &ar->normal_mode_fw.fw_file);
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) &&
!test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
ath10k_err(ar, "feature bits corrupted: 10.2 feature requires 10.x feature to be set as well");
@ -1797,8 +1814,10 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
lockdep_assert_held(&ar->conf_mutex);
clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
if (!ar->qmi.is_qmi) {
ar->running_fw = fw;
ar->running_fw = fw;
if (ar->is_bmi) {
ath10k_bmi_start(ar);
@ -1846,7 +1865,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
goto err;
}
if (!ar->qmi.is_qmi) {
if (ar->is_bmi) {
status = ath10k_bmi_done(ar);
if (status)
goto err;
@ -2083,38 +2102,37 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
return ret;
}
if (!ar->qmi.is_qmi) {
if (ar->is_bmi) {
memset(&target_info, 0, sizeof(target_info));
ret = ath10k_bmi_get_target_info(ar, &target_info);
if (ret) {
ath10k_err(ar, "could not get target info (%d)\n", ret);
goto err_power_down;
}
ar->target_version = target_info.version;
ar->hw->wiphy->hw_version = target_info.version;
}
ret = ath10k_init_hw_params(ar);
if (ret) {
ath10k_err(ar, "could not get hw params (%d)\n", ret);
goto err_power_down;
}
ret = ath10k_init_hw_params(ar);
if (ret) {
ath10k_err(ar, "could not get hw params (%d)\n", ret);
goto err_power_down;
}
ret = ath10k_core_fetch_firmware_files(ar);
if (ret) {
ath10k_err(ar, "could not fetch firmware files (%d)\n",
ret);
goto err_power_down;
}
ret = ath10k_core_fetch_firmware_files(ar);
if (ret) {
ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
goto err_power_down;
}
BUILD_BUG_ON(sizeof(ar->hw->wiphy->fw_version) !=
sizeof(ar->normal_mode_fw.fw_file.fw_version));
memcpy(ar->hw->wiphy->fw_version,
ar->normal_mode_fw.fw_file.fw_version,
sizeof(ar->hw->wiphy->fw_version));
ath10k_debug_print_hwfw_info(ar);
BUILD_BUG_ON(sizeof(ar->hw->wiphy->fw_version) !=
sizeof(ar->normal_mode_fw.fw_file.fw_version));
memcpy(ar->hw->wiphy->fw_version,
ar->normal_mode_fw.fw_file.fw_version,
sizeof(ar->hw->wiphy->fw_version));
ath10k_debug_print_hwfw_info(ar);
if (ar->is_bmi) {
ret = ath10k_core_pre_cal_download(ar);
if (ret) {
/* pre calibration data download is not necessary
@ -2147,7 +2165,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_free_firmware_files;
}
if (!ar->qmi.is_qmi) {
if (ar->is_bmi) {
ret = ath10k_swap_code_seg_init(ar,
&ar->normal_mode_fw.fw_file);
if (ret) {
@ -2299,6 +2317,12 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
ar->hif.ops = hif_ops;
ar->hif.bus = bus;
/* By default, assume bmi is set, as most of the existing
* chip sets are based on this, set to false explicitly
* when current chip set does not support.
*/
ar->is_bmi = true;
switch (hw_rev) {
case ATH10K_HW_QCA988X:
case ATH10K_HW_QCA9887:
@ -2326,7 +2350,8 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
case ATH10K_HW_WCN3990:
ar->regs = &wcn3990_regs;
ar->hw_values = &wcn3990_values;
ar->qmi.is_qmi = true;
/* WCN3990 chip set is non bmi based */
ar->is_bmi = false;
ar->fw_flags = &wcn3990_fw_flags;
break;
default:

View file

@ -138,11 +138,6 @@ struct ath10k_bmi {
bool done_sent;
};
struct ath10k_qmi {
bool fw_ready;
bool is_qmi;
};
struct ath10k_mem_chunk {
void *vaddr;
dma_addr_t paddr;
@ -745,7 +740,6 @@ struct ath10k {
const struct ath10k_hw_regs *regs;
const struct ath10k_hw_values *hw_values;
struct ath10k_bmi bmi;
struct ath10k_qmi qmi;
struct ath10k_wmi wmi;
struct ath10k_htc htc;
struct ath10k_htt htt;
@ -930,6 +924,8 @@ struct ath10k {
spinlock_t ce_lock; /* lock for CE access */
void *ce_states;
struct fw_flag *fw_flags;
/* set for bmi chip sets */
bool is_bmi;
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
};

View file

@ -271,3 +271,5 @@ static int ath10k_qca99x0_rx_desc_get_l3_pad_bytes(struct htt_rx_desc *rxd)
const struct ath10k_hw_ops qca99x0_ops = {
.rx_desc_get_l3_pad_bytes = ath10k_qca99x0_rx_desc_get_l3_pad_bytes,
};
const struct ath10k_hw_ops wcn3990_ops = {0};

View file

@ -128,6 +128,10 @@ enum qca9377_chip_id_rev {
#define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
#define QCA4019_HW_1_0_PATCH_LOAD_ADDR 0x1234
/* WCN3990 1.0 definitions */
#define WCN3990_HW_1_0_DEV_VERSION ATH10K_HW_WCN3990
#define WCN3990_HW_1_0_FW_DIR "/etc/firmware"
#define ATH10K_FW_API2_FILE "firmware-2.bin"
#define ATH10K_FW_API3_FILE "firmware-3.bin"
@ -434,6 +438,7 @@ struct ath10k_hw_ops {
extern const struct ath10k_hw_ops qca988x_ops;
extern const struct ath10k_hw_ops qca99x0_ops;
extern const struct ath10k_hw_ops wcn3990_ops;
static inline int
ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw,