3030
3131struct imx8_soc_data {
3232 char * name ;
33- int (* soc_revision )(u32 * socrev );
33+ int (* soc_revision )(u32 * socrev , u64 * socuid );
3434};
3535
36- static u64 soc_uid ;
37-
3836#ifdef CONFIG_HAVE_ARM_SMCCC
3937static u32 imx8mq_soc_revision_from_atf (void )
4038{
@@ -51,7 +49,7 @@ static u32 imx8mq_soc_revision_from_atf(void)
5149static inline u32 imx8mq_soc_revision_from_atf (void ) { return 0 ; };
5250#endif
5351
54- static int imx8mq_soc_revision (u32 * socrev )
52+ static int imx8mq_soc_revision (u32 * socrev , u64 * socuid )
5553{
5654 struct device_node * np ;
5755 void __iomem * ocotp_base ;
@@ -89,9 +87,9 @@ static int imx8mq_soc_revision(u32 *socrev)
8987 rev = REV_B1 ;
9088 }
9189
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 );
9593
9694 * socrev = rev ;
9795
@@ -109,7 +107,7 @@ static int imx8mq_soc_revision(u32 *socrev)
109107 return ret ;
110108}
111109
112- static int imx8mm_soc_uid (void )
110+ static int imx8mm_soc_uid (u64 * socuid )
113111{
114112 void __iomem * ocotp_base ;
115113 struct device_node * np ;
@@ -136,9 +134,9 @@ static int imx8mm_soc_uid(void)
136134
137135 clk_prepare_enable (clk );
138136
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 );
142140
143141 clk_disable_unprepare (clk );
144142 clk_put (clk );
@@ -151,7 +149,7 @@ static int imx8mm_soc_uid(void)
151149 return ret ;
152150}
153151
154- static int imx8mm_soc_revision (u32 * socrev )
152+ static int imx8mm_soc_revision (u32 * socrev , u64 * socuid )
155153{
156154 struct device_node * np ;
157155 void __iomem * anatop_base ;
@@ -172,7 +170,7 @@ static int imx8mm_soc_revision(u32 *socrev)
172170 iounmap (anatop_base );
173171 of_node_put (np );
174172
175- return imx8mm_soc_uid ();
173+ return imx8mm_soc_uid (socuid );
176174
177175err_iomap :
178176 of_node_put (np );
@@ -215,10 +213,11 @@ static __maybe_unused const struct of_device_id imx8_soc_match[] = {
215213static int imx8m_soc_probe (struct platform_device * pdev )
216214{
217215 struct soc_device_attribute * soc_dev_attr ;
218- struct soc_device * soc_dev ;
216+ const struct imx8_soc_data * data ;
219217 const struct of_device_id * id ;
218+ struct soc_device * soc_dev ;
220219 u32 soc_rev = 0 ;
221- const struct imx8_soc_data * data ;
220+ u64 soc_uid = 0 ;
222221 int ret ;
223222
224223 soc_dev_attr = kzalloc (sizeof (* soc_dev_attr ), GFP_KERNEL );
@@ -241,7 +240,7 @@ static int imx8m_soc_probe(struct platform_device *pdev)
241240 if (data ) {
242241 soc_dev_attr -> soc_id = data -> name ;
243242 if (data -> soc_revision ) {
244- ret = data -> soc_revision (& soc_rev );
243+ ret = data -> soc_revision (& soc_rev , & soc_uid );
245244 if (ret )
246245 goto free_soc ;
247246 }
0 commit comments