Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab6e6724 authored by Yue Ma's avatar Yue Ma
Browse files

cnss2: Add support to populate device memory information



Update WLFW QMI service so firmware is able to send SRAM and CMEM
etc. device memory information using target capability QMI message
to CNSS driver which populates the same to WLAN host driver.

Change-Id: I6a68624dd29c4631dc2c5c9900ddd1d6c7f3fc14
Signed-off-by: default avatarYue Ma <yuem@codeaurora.org>
parent 9f4eebf3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */

#ifndef _CNSS_MAIN_H
#define _CNSS_MAIN_H
@@ -364,6 +364,7 @@ struct cnss_plat_data {
	struct wlfw_rf_board_info board_info;
	struct wlfw_soc_info soc_info;
	struct wlfw_fw_version_info fw_version_info;
	struct cnss_dev_mem_info dev_mem_info[CNSS_MAX_DEV_MEM_NUM];
	char fw_build_id[QMI_WLFW_MAX_BUILD_ID_LEN + 1];
	u32 otp_version;
	u32 fw_mem_seg_len;
+2 −0
Original line number Diff line number Diff line
@@ -3752,6 +3752,8 @@ int cnss_get_soc_info(struct device *dev, struct cnss_soc_info *info)
		sizeof(info->fw_build_timestamp));
	memcpy(&info->device_version, &plat_priv->device_version,
	       sizeof(info->device_version));
	memcpy(&info->dev_mem_info, &plat_priv->dev_mem_info,
	       sizeof(info->dev_mem_info));

	return 0;
}
+13 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */

#include <linux/firmware.h>
#include <linux/module.h>
@@ -375,7 +375,7 @@ int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
	struct wlfw_cap_resp_msg_v01 *resp;
	struct qmi_txn txn;
	char *fw_build_timestamp;
	int ret = 0;
	int ret = 0, i;

	cnss_pr_dbg("Sending target capability message, state: 0x%lx\n",
		    plat_priv->driver_state);
@@ -460,7 +460,17 @@ int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
	}
	if (resp->otp_version_valid)
		plat_priv->otp_version = resp->otp_version;

	if (resp->dev_mem_info_valid) {
		for (i = 0; i < QMI_WLFW_MAX_DEV_MEM_NUM_V01; i++) {
			plat_priv->dev_mem_info[i].start =
				resp->dev_mem_info[i].start;
			plat_priv->dev_mem_info[i].size =
				resp->dev_mem_info[i].size;
			cnss_pr_dbg("Device memory info[%d]: start = 0x%llx, size = 0x%llx\n",
				    i, plat_priv->dev_mem_info[i].start,
				    plat_priv->dev_mem_info[i].size);
		}
	}
	if (resp->fw_caps_valid)
		plat_priv->fw_pcie_gen_switch =
			!!(resp->fw_caps & QMI_WLFW_HOST_PCIE_GEN_SWITCH_V01);
+46 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */

#include "wlan_firmware_service_v01.h"

@@ -501,6 +501,32 @@ static struct qmi_elem_info wlfw_m3_segment_info_s_v01_ei[] = {
	},
};

static struct qmi_elem_info wlfw_dev_mem_info_s_v01_ei[] = {
	{
		.data_type      = QMI_UNSIGNED_8_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(u64),
		.array_type       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct wlfw_dev_mem_info_s_v01,
					   start),
	},
	{
		.data_type      = QMI_UNSIGNED_8_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(u64),
		.array_type       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct wlfw_dev_mem_info_s_v01,
					   size),
	},
	{
		.data_type      = QMI_EOTI,
		.array_type       = NO_ARRAY,
		.tlv_type       = QMI_COMMON_TLV_TYPE,
	},
};

struct qmi_elem_info wlfw_ind_register_req_msg_v01_ei[] = {
	{
		.data_type      = QMI_OPT_FLAG,
@@ -1524,6 +1550,25 @@ struct qmi_elem_info wlfw_cap_resp_msg_v01_ei[] = {
		.offset         = offsetof(struct wlfw_cap_resp_msg_v01,
					   rd_card_chain_cap),
	},
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(u8),
		.array_type       = NO_ARRAY,
		.tlv_type       = 0x1C,
		.offset         = offsetof(struct wlfw_cap_resp_msg_v01,
					   dev_mem_info_valid),
	},
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = QMI_WLFW_MAX_DEV_MEM_NUM_V01,
		.elem_size      = sizeof(struct wlfw_dev_mem_info_s_v01),
		.array_type       = STATIC_ARRAY,
		.tlv_type       = 0x1C,
		.offset         = offsetof(struct wlfw_cap_resp_msg_v01,
					   dev_mem_info),
		.ei_array      = wlfw_dev_mem_info_s_v01_ei,
	},
	{
		.data_type      = QMI_EOTI,
		.array_type       = NO_ARRAY,
+11 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. */

#ifndef WLAN_FIRMWARE_SERVICE_V01_H
#define WLAN_FIRMWARE_SERVICE_V01_H
@@ -115,6 +115,7 @@
#define QMI_WLFW_MAX_NUM_SHADOW_REG_V01 24
#define QMI_WLFW_MAC_ADDR_SIZE_V01 6
#define QMI_WLFW_MAX_NUM_SHADOW_REG_V2_V01 36
#define QMI_WLFW_MAX_DEV_MEM_NUM_V01 4
#define QMI_WLFW_MAX_PLATFORM_NAME_LEN_V01 64
#define QMI_WLFW_MAX_NUM_SVC_V01 24

@@ -348,6 +349,11 @@ struct wlfw_m3_segment_info_s_v01 {
	char name[QMI_WLFW_MAX_STR_LEN_V01 + 1];
};

struct wlfw_dev_mem_info_s_v01 {
	u64 start;
	u64 size;
};

struct wlfw_ind_register_req_msg_v01 {
	u8 fw_ready_enable_valid;
	u8 fw_ready_enable;
@@ -506,9 +512,12 @@ struct wlfw_cap_resp_msg_v01 {
	u64 fw_caps;
	u8 rd_card_chain_cap_valid;
	enum wlfw_rd_card_chain_cap_v01 rd_card_chain_cap;
	u8 dev_mem_info_valid;
	struct wlfw_dev_mem_info_s_v01
		dev_mem_info[QMI_WLFW_MAX_DEV_MEM_NUM_V01];
};

#define WLFW_CAP_RESP_MSG_V01_MAX_MSG_LEN 253
#define WLFW_CAP_RESP_MSG_V01_MAX_MSG_LEN 320
extern struct qmi_elem_info wlfw_cap_resp_msg_v01_ei[];

struct wlfw_bdf_download_req_msg_v01 {
Loading