30
30
31
31
struct imx8_soc_data {
32
32
char * name ;
33
- int (* soc_revision )(u32 * socrev );
33
+ int (* soc_revision )(u32 * socrev , u64 * socuid );
34
34
};
35
35
36
- static u64 soc_uid ;
37
-
38
36
#ifdef CONFIG_HAVE_ARM_SMCCC
39
37
static u32 imx8mq_soc_revision_from_atf (void )
40
38
{
@@ -51,7 +49,7 @@ static u32 imx8mq_soc_revision_from_atf(void)
51
49
static inline u32 imx8mq_soc_revision_from_atf (void ) { return 0 ; };
52
50
#endif
53
51
54
- static int imx8mq_soc_revision (u32 * socrev )
52
+ static int imx8mq_soc_revision (u32 * socrev , u64 * socuid )
55
53
{
56
54
struct device_node * np ;
57
55
void __iomem * ocotp_base ;
@@ -89,9 +87,9 @@ static int imx8mq_soc_revision(u32 *socrev)
89
87
rev = REV_B1 ;
90
88
}
91
89
92
- soc_uid = readl_relaxed (ocotp_base + OCOTP_UID_HIGH );
93
- soc_uid <<= 32 ;
94
- soc_uid |= readl_relaxed (ocotp_base + OCOTP_UID_LOW );
90
+ * socuid = readl_relaxed (ocotp_base + OCOTP_UID_HIGH );
91
+ * socuid <<= 32 ;
92
+ * socuid |= readl_relaxed (ocotp_base + OCOTP_UID_LOW );
95
93
96
94
* socrev = rev ;
97
95
@@ -109,7 +107,7 @@ static int imx8mq_soc_revision(u32 *socrev)
109
107
return ret ;
110
108
}
111
109
112
- static int imx8mm_soc_uid (void )
110
+ static int imx8mm_soc_uid (u64 * socuid )
113
111
{
114
112
void __iomem * ocotp_base ;
115
113
struct device_node * np ;
@@ -136,9 +134,9 @@ static int imx8mm_soc_uid(void)
136
134
137
135
clk_prepare_enable (clk );
138
136
139
- soc_uid = readl_relaxed (ocotp_base + OCOTP_UID_HIGH + offset );
140
- soc_uid <<= 32 ;
141
- soc_uid |= readl_relaxed (ocotp_base + OCOTP_UID_LOW + offset );
137
+ * socuid = readl_relaxed (ocotp_base + OCOTP_UID_HIGH + offset );
138
+ * socuid <<= 32 ;
139
+ * socuid |= readl_relaxed (ocotp_base + OCOTP_UID_LOW + offset );
142
140
143
141
clk_disable_unprepare (clk );
144
142
clk_put (clk );
@@ -151,7 +149,7 @@ static int imx8mm_soc_uid(void)
151
149
return ret ;
152
150
}
153
151
154
- static int imx8mm_soc_revision (u32 * socrev )
152
+ static int imx8mm_soc_revision (u32 * socrev , u64 * socuid )
155
153
{
156
154
struct device_node * np ;
157
155
void __iomem * anatop_base ;
@@ -172,7 +170,7 @@ static int imx8mm_soc_revision(u32 *socrev)
172
170
iounmap (anatop_base );
173
171
of_node_put (np );
174
172
175
- return imx8mm_soc_uid ();
173
+ return imx8mm_soc_uid (socuid );
176
174
177
175
err_iomap :
178
176
of_node_put (np );
@@ -215,10 +213,11 @@ static __maybe_unused const struct of_device_id imx8_soc_match[] = {
215
213
static int imx8m_soc_probe (struct platform_device * pdev )
216
214
{
217
215
struct soc_device_attribute * soc_dev_attr ;
218
- struct soc_device * soc_dev ;
216
+ const struct imx8_soc_data * data ;
219
217
const struct of_device_id * id ;
218
+ struct soc_device * soc_dev ;
220
219
u32 soc_rev = 0 ;
221
- const struct imx8_soc_data * data ;
220
+ u64 soc_uid = 0 ;
222
221
int ret ;
223
222
224
223
soc_dev_attr = kzalloc (sizeof (* soc_dev_attr ), GFP_KERNEL );
@@ -241,7 +240,7 @@ static int imx8m_soc_probe(struct platform_device *pdev)
241
240
if (data ) {
242
241
soc_dev_attr -> soc_id = data -> name ;
243
242
if (data -> soc_revision ) {
244
- ret = data -> soc_revision (& soc_rev );
243
+ ret = data -> soc_revision (& soc_rev , & soc_uid );
245
244
if (ret )
246
245
goto free_soc ;
247
246
}
0 commit comments