Commit f02a5373 authored by Naman Jain's avatar Naman Jain Committed by Bjorn Andersson
Browse files

soc: qcom: socinfo: Add support for new fields in revision 16



Add support for new fields coming with socinfo structure under v16 to get
SKU information, product code and name and type of different parts present
in the SoC. Also, add debugfs nodes to read feature and product codes to
allow user to get SKU and other SoC details. Support for SoC parts name
and type parsing will be added separately. Details of fields added:
* feature_code: mapped to qcom internal and external SKU IDs
* pcode: product code
* npartnamemap_offset: parts name map array offset from socinfo base ptr
* nnum_partname_mapping: number of part mappings

Signed-off-by: default avatarNaman Jain <quic_namajain@quicinc.com>
Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20221125103533.2960-1-quic_namajain@quicinc.com
parent 40ebfbec
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -169,6 +169,11 @@ struct socinfo {
	__le32 ndefective_parts_array_offset;
	/* Version 15 */
	__le32 nmodem_supported;
	/* Version 16 */
	__le32  feature_code;
	__le32  pcode;
	__le32  npartnamemap_offset;
	__le32  nnum_partname_mapping;
};

#ifdef CONFIG_DEBUG_FS
@@ -189,6 +194,8 @@ struct socinfo_params {
	u32 num_defective_parts;
	u32 ndefective_parts_array_offset;
	u32 nmodem_supported;
	u32 feature_code;
	u32 pcode;
};

struct smem_image_version {
@@ -512,6 +519,15 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
			   &qcom_socinfo->info.fmt);

	switch (qcom_socinfo->info.fmt) {
	case SOCINFO_VERSION(0, 16):
		qcom_socinfo->info.feature_code = __le32_to_cpu(info->feature_code);
		qcom_socinfo->info.pcode = __le32_to_cpu(info->pcode);

		debugfs_create_u32("feature_code", 0444, qcom_socinfo->dbg_root,
				   &qcom_socinfo->info.feature_code);
		debugfs_create_u32("pcode", 0444, qcom_socinfo->dbg_root,
				   &qcom_socinfo->info.pcode);
		fallthrough;
	case SOCINFO_VERSION(0, 15):
		qcom_socinfo->info.nmodem_supported = __le32_to_cpu(info->nmodem_supported);