1 From 97505f4c049fa2e8c86a53411a9e599033898533 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Sat, 31 Dec 2022 00:27:42 +0100
4 Subject: [PATCH] soc: qcom: socinfo: move SMEM item struct and defines to a
7 Move SMEM item struct and related defines to a header in order to be able
8 to reuse them in the Qualcomm NVMEM CPUFreq driver instead of duplicating
11 Signed-off-by: Robert Marko <robimarko@gmail.com>
13 drivers/soc/qcom/socinfo.c | 58 +--------------------------
14 include/linux/soc/qcom/socinfo.h | 67 ++++++++++++++++++++++++++++++++
15 2 files changed, 68 insertions(+), 57 deletions(-)
16 create mode 100644 include/linux/soc/qcom/socinfo.h
18 --- a/drivers/soc/qcom/socinfo.c
19 +++ b/drivers/soc/qcom/socinfo.c
21 #include <linux/random.h>
22 #include <linux/slab.h>
23 #include <linux/soc/qcom/smem.h>
24 +#include <linux/soc/qcom/socinfo.h>
25 #include <linux/string.h>
26 #include <linux/sys_soc.h>
27 #include <linux/types.h>
29 #define SOCINFO_MINOR(ver) ((ver) & 0xffff)
30 #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
32 -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
33 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
36 - * SMEM item id, used to acquire handles to respective
39 -#define SMEM_HW_SW_BUILD_ID 137
41 #ifdef CONFIG_DEBUG_FS
42 #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32
43 #define SMEM_IMAGE_VERSION_SIZE 4096
44 @@ -105,54 +97,6 @@ static const char *const pmic_models[] =
46 #endif /* CONFIG_DEBUG_FS */
48 -/* Socinfo SMEM item structure */
53 - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
62 - __le32 accessory_chip;
64 - __le32 hw_plat_subtype;
67 - __le32 pmic_die_rev;
69 - __le32 pmic_model_1;
70 - __le32 pmic_die_rev_1;
71 - __le32 pmic_model_2;
72 - __le32 pmic_die_rev_2;
79 - __le32 pmic_array_offset;
82 - __le32 raw_device_family;
83 - __le32 raw_device_num;
86 - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
88 - __le32 num_clusters;
89 - __le32 ncluster_array_offset;
90 - __le32 num_defective_parts;
91 - __le32 ndefective_parts_array_offset;
93 - __le32 nmodem_supported;
96 #ifdef CONFIG_DEBUG_FS
97 struct socinfo_params {
98 u32 raw_device_family;
100 +++ b/include/linux/soc/qcom/socinfo.h
102 +// SPDX-License-Identifier: GPL-2.0
104 + * Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
105 + * Copyright (c) 2017-2019, Linaro Ltd.
108 +#ifndef __QCOM_SOCINFO_H__
109 +#define __QCOM_SOCINFO_H__
112 + * SMEM item id, used to acquire handles to respective
115 +#define SMEM_HW_SW_BUILD_ID 137
117 +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
118 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
120 +/* Socinfo SMEM item structure */
125 + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
134 + __le32 accessory_chip;
136 + __le32 hw_plat_subtype;
139 + __le32 pmic_die_rev;
141 + __le32 pmic_model_1;
142 + __le32 pmic_die_rev_1;
143 + __le32 pmic_model_2;
144 + __le32 pmic_die_rev_2;
151 + __le32 pmic_array_offset;
153 + __le32 chip_family;
154 + __le32 raw_device_family;
155 + __le32 raw_device_num;
157 + __le32 nproduct_id;
158 + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
160 + __le32 num_clusters;
161 + __le32 ncluster_array_offset;
162 + __le32 num_defective_parts;
163 + __le32 ndefective_parts_array_offset;
165 + __le32 nmodem_supported;