394087a27a4d5eeee0b241dc89f4d8db1d985492
[openwrt/staging/neocturne.git] /
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
5 header
6
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
9 them.
10
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
15 ---
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
20
21 --- a/drivers/soc/qcom/socinfo.c
22 +++ b/drivers/soc/qcom/socinfo.c
23 @@ -11,6 +11,7 @@
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>
31 @@ -25,15 +26,6 @@
32 #define SOCINFO_MINOR(ver) ((ver) & 0xffff)
33 #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
34
35 -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
36 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
37 -
38 -/*
39 - * SMEM item id, used to acquire handles to respective
40 - * SMEM region.
41 - */
42 -#define SMEM_HW_SW_BUILD_ID 137
43 -
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[] =
48 };
49 #endif /* CONFIG_DEBUG_FS */
50
51 -/* Socinfo SMEM item structure */
52 -struct socinfo {
53 - __le32 fmt;
54 - __le32 id;
55 - __le32 ver;
56 - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
57 - /* Version 2 */
58 - __le32 raw_id;
59 - __le32 raw_ver;
60 - /* Version 3 */
61 - __le32 hw_plat;
62 - /* Version 4 */
63 - __le32 plat_ver;
64 - /* Version 5 */
65 - __le32 accessory_chip;
66 - /* Version 6 */
67 - __le32 hw_plat_subtype;
68 - /* Version 7 */
69 - __le32 pmic_model;
70 - __le32 pmic_die_rev;
71 - /* Version 8 */
72 - __le32 pmic_model_1;
73 - __le32 pmic_die_rev_1;
74 - __le32 pmic_model_2;
75 - __le32 pmic_die_rev_2;
76 - /* Version 9 */
77 - __le32 foundry_id;
78 - /* Version 10 */
79 - __le32 serial_num;
80 - /* Version 11 */
81 - __le32 num_pmics;
82 - __le32 pmic_array_offset;
83 - /* Version 12 */
84 - __le32 chip_family;
85 - __le32 raw_device_family;
86 - __le32 raw_device_num;
87 - /* Version 13 */
88 - __le32 nproduct_id;
89 - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
90 - /* Version 14 */
91 - __le32 num_clusters;
92 - __le32 ncluster_array_offset;
93 - __le32 num_defective_parts;
94 - __le32 ndefective_parts_array_offset;
95 - /* Version 15 */
96 - __le32 nmodem_supported;
97 -};
98 -
99 #ifdef CONFIG_DEBUG_FS
100 struct socinfo_params {
101 u32 raw_device_family;
102 --- /dev/null
103 +++ b/include/linux/soc/qcom/socinfo.h
104 @@ -0,0 +1,67 @@
105 +// SPDX-License-Identifier: GPL-2.0
106 +/*
107 + * Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
108 + * Copyright (c) 2017-2019, Linaro Ltd.
109 + */
110 +
111 +#ifndef __QCOM_SOCINFO_H__
112 +#define __QCOM_SOCINFO_H__
113 +
114 +/*
115 + * SMEM item id, used to acquire handles to respective
116 + * SMEM region.
117 + */
118 +#define SMEM_HW_SW_BUILD_ID 137
119 +
120 +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
121 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
122 +
123 +/* Socinfo SMEM item structure */
124 +struct socinfo {
125 + __le32 fmt;
126 + __le32 id;
127 + __le32 ver;
128 + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
129 + /* Version 2 */
130 + __le32 raw_id;
131 + __le32 raw_ver;
132 + /* Version 3 */
133 + __le32 hw_plat;
134 + /* Version 4 */
135 + __le32 plat_ver;
136 + /* Version 5 */
137 + __le32 accessory_chip;
138 + /* Version 6 */
139 + __le32 hw_plat_subtype;
140 + /* Version 7 */
141 + __le32 pmic_model;
142 + __le32 pmic_die_rev;
143 + /* Version 8 */
144 + __le32 pmic_model_1;
145 + __le32 pmic_die_rev_1;
146 + __le32 pmic_model_2;
147 + __le32 pmic_die_rev_2;
148 + /* Version 9 */
149 + __le32 foundry_id;
150 + /* Version 10 */
151 + __le32 serial_num;
152 + /* Version 11 */
153 + __le32 num_pmics;
154 + __le32 pmic_array_offset;
155 + /* Version 12 */
156 + __le32 chip_family;
157 + __le32 raw_device_family;
158 + __le32 raw_device_num;
159 + /* Version 13 */
160 + __le32 nproduct_id;
161 + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
162 + /* Version 14 */
163 + __le32 num_clusters;
164 + __le32 ncluster_array_offset;
165 + __le32 num_defective_parts;
166 + __le32 ndefective_parts_array_offset;
167 + /* Version 15 */
168 + __le32 nmodem_supported;
169 +};
170 +
171 +#endif