Skip to content

Commit ec001bb

Browse files
robimarkoandersson
authored andcommitted
soc: qcom: socinfo: move SMEM item struct and defines to a header
Move SMEM item struct and related defines to a header in order to be able to reuse them in the SMEM driver instead of duplicating them. Signed-off-by: Robert Marko <robimarko@gmail.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230526204802.3081168-1-robimarko@gmail.com
1 parent bcb8898 commit ec001bb

2 files changed

Lines changed: 71 additions & 66 deletions

File tree

drivers/soc/qcom/socinfo.c

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/random.h>
1212
#include <linux/slab.h>
1313
#include <linux/soc/qcom/smem.h>
14+
#include <linux/soc/qcom/socinfo.h>
1415
#include <linux/string.h>
1516
#include <linux/stringify.h>
1617
#include <linux/sys_soc.h>
@@ -32,15 +33,6 @@
3233
#define qcom_board_id(id) QCOM_ID_ ## id, __stringify(id)
3334
#define qcom_board_id_named(id, name) QCOM_ID_ ## id, (name)
3435

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-
4436
#ifdef CONFIG_DEBUG_FS
4537
#define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32
4638
#define SMEM_IMAGE_VERSION_SIZE 4096
@@ -126,64 +118,7 @@ static const char *const pmic_models[] = {
126118
[58] = "PM8450",
127119
[65] = "PM8010",
128120
};
129-
#endif /* CONFIG_DEBUG_FS */
130-
131-
/* Socinfo SMEM item structure */
132-
struct socinfo {
133-
__le32 fmt;
134-
__le32 id;
135-
__le32 ver;
136-
char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
137-
/* Version 2 */
138-
__le32 raw_id;
139-
__le32 raw_ver;
140-
/* Version 3 */
141-
__le32 hw_plat;
142-
/* Version 4 */
143-
__le32 plat_ver;
144-
/* Version 5 */
145-
__le32 accessory_chip;
146-
/* Version 6 */
147-
__le32 hw_plat_subtype;
148-
/* Version 7 */
149-
__le32 pmic_model;
150-
__le32 pmic_die_rev;
151-
/* Version 8 */
152-
__le32 pmic_model_1;
153-
__le32 pmic_die_rev_1;
154-
__le32 pmic_model_2;
155-
__le32 pmic_die_rev_2;
156-
/* Version 9 */
157-
__le32 foundry_id;
158-
/* Version 10 */
159-
__le32 serial_num;
160-
/* Version 11 */
161-
__le32 num_pmics;
162-
__le32 pmic_array_offset;
163-
/* Version 12 */
164-
__le32 chip_family;
165-
__le32 raw_device_family;
166-
__le32 raw_device_num;
167-
/* Version 13 */
168-
__le32 nproduct_id;
169-
char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
170-
/* Version 14 */
171-
__le32 num_clusters;
172-
__le32 ncluster_array_offset;
173-
__le32 num_defective_parts;
174-
__le32 ndefective_parts_array_offset;
175-
/* Version 15 */
176-
__le32 nmodem_supported;
177-
/* Version 16 */
178-
__le32 feature_code;
179-
__le32 pcode;
180-
__le32 npartnamemap_offset;
181-
__le32 nnum_partname_mapping;
182-
/* Version 17 */
183-
__le32 oem_variant;
184-
};
185121

186-
#ifdef CONFIG_DEBUG_FS
187122
struct socinfo_params {
188123
u32 raw_device_family;
189124
u32 hw_plat_subtype;

include/linux/soc/qcom/socinfo.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#ifndef __QCOM_SOCINFO_H__
4+
#define __QCOM_SOCINFO_H__
5+
6+
/*
7+
* SMEM item id, used to acquire handles to respective
8+
* SMEM region.
9+
*/
10+
#define SMEM_HW_SW_BUILD_ID 137
11+
12+
#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
13+
#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
14+
15+
/* Socinfo SMEM item structure */
16+
struct socinfo {
17+
__le32 fmt;
18+
__le32 id;
19+
__le32 ver;
20+
char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
21+
/* Version 2 */
22+
__le32 raw_id;
23+
__le32 raw_ver;
24+
/* Version 3 */
25+
__le32 hw_plat;
26+
/* Version 4 */
27+
__le32 plat_ver;
28+
/* Version 5 */
29+
__le32 accessory_chip;
30+
/* Version 6 */
31+
__le32 hw_plat_subtype;
32+
/* Version 7 */
33+
__le32 pmic_model;
34+
__le32 pmic_die_rev;
35+
/* Version 8 */
36+
__le32 pmic_model_1;
37+
__le32 pmic_die_rev_1;
38+
__le32 pmic_model_2;
39+
__le32 pmic_die_rev_2;
40+
/* Version 9 */
41+
__le32 foundry_id;
42+
/* Version 10 */
43+
__le32 serial_num;
44+
/* Version 11 */
45+
__le32 num_pmics;
46+
__le32 pmic_array_offset;
47+
/* Version 12 */
48+
__le32 chip_family;
49+
__le32 raw_device_family;
50+
__le32 raw_device_num;
51+
/* Version 13 */
52+
__le32 nproduct_id;
53+
char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
54+
/* Version 14 */
55+
__le32 num_clusters;
56+
__le32 ncluster_array_offset;
57+
__le32 num_defective_parts;
58+
__le32 ndefective_parts_array_offset;
59+
/* Version 15 */
60+
__le32 nmodem_supported;
61+
/* Version 16 */
62+
__le32 feature_code;
63+
__le32 pcode;
64+
__le32 npartnamemap_offset;
65+
__le32 nnum_partname_mapping;
66+
/* Version 17 */
67+
__le32 oem_variant;
68+
};
69+
70+
#endif

0 commit comments

Comments
 (0)