1 From 7cbff3c3f867ff3b24de674f44ca03f54e416a37 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>
12 Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
13 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
14 Link: https://lore.kernel.org/r/20230526204802.3081168-1-robimarko@gmail.com
16 drivers/soc/qcom/socinfo.c | 58 +--------------------------
17 include/linux/soc/qcom/socinfo.h | 67 ++++++++++++++++++++++++++++++++
18 2 files changed, 68 insertions(+), 57 deletions(-)
19 create mode 100644 include/linux/soc/qcom/socinfo.h
21 --- a/drivers/soc/qcom/socinfo.c
22 +++ b/drivers/soc/qcom/socinfo.c
24 #include <linux/random.h>
25 #include <linux/slab.h>
26 #include <linux/soc/qcom/smem.h>
27 +#include <linux/soc/qcom/socinfo.h>
28 #include <linux/string.h>
29 #include <linux/sys_soc.h>
30 #include <linux/types.h>
32 #define SOCINFO_MINOR(ver) ((ver) & 0xffff)
33 #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
35 -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
36 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
39 - * SMEM item id, used to acquire handles to respective
42 -#define SMEM_HW_SW_BUILD_ID 137
44 #ifdef CONFIG_DEBUG_FS
45 #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32
46 #define SMEM_IMAGE_VERSION_SIZE 4096
47 @@ -116,54 +108,6 @@ static const char *const pmic_models[] =
49 #endif /* CONFIG_DEBUG_FS */
51 -/* Socinfo SMEM item structure */
56 - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
65 - __le32 accessory_chip;
67 - __le32 hw_plat_subtype;
70 - __le32 pmic_die_rev;
72 - __le32 pmic_model_1;
73 - __le32 pmic_die_rev_1;
74 - __le32 pmic_model_2;
75 - __le32 pmic_die_rev_2;
82 - __le32 pmic_array_offset;
85 - __le32 raw_device_family;
86 - __le32 raw_device_num;
89 - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
91 - __le32 num_clusters;
92 - __le32 ncluster_array_offset;
93 - __le32 num_defective_parts;
94 - __le32 ndefective_parts_array_offset;
96 - __le32 nmodem_supported;
99 #ifdef CONFIG_DEBUG_FS
100 struct socinfo_params {
101 u32 raw_device_family;
103 +++ b/include/linux/soc/qcom/socinfo.h
105 +// SPDX-License-Identifier: GPL-2.0
107 + * Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
108 + * Copyright (c) 2017-2019, Linaro Ltd.
111 +#ifndef __QCOM_SOCINFO_H__
112 +#define __QCOM_SOCINFO_H__
115 + * SMEM item id, used to acquire handles to respective
118 +#define SMEM_HW_SW_BUILD_ID 137
120 +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
121 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
123 +/* Socinfo SMEM item structure */
128 + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
137 + __le32 accessory_chip;
139 + __le32 hw_plat_subtype;
142 + __le32 pmic_die_rev;
144 + __le32 pmic_model_1;
145 + __le32 pmic_die_rev_1;
146 + __le32 pmic_model_2;
147 + __le32 pmic_die_rev_2;
154 + __le32 pmic_array_offset;
156 + __le32 chip_family;
157 + __le32 raw_device_family;
158 + __le32 raw_device_num;
160 + __le32 nproduct_id;
161 + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
163 + __le32 num_clusters;
164 + __le32 ncluster_array_offset;
165 + __le32 num_defective_parts;
166 + __le32 ndefective_parts_array_offset;
168 + __le32 nmodem_supported;