10
10
#include <linux/platform_device.h>
11
11
#include <linux/of.h>
12
12
13
- #define IMX_SCU_SOC_DRIVER_NAME "imx-scu-soc"
14
-
15
- static struct imx_sc_ipc * soc_ipc_handle ;
13
+ static struct imx_sc_ipc * imx_sc_soc_ipc_handle ;
16
14
17
15
struct imx_sc_msg_misc_get_soc_id {
18
16
struct imx_sc_rpc_msg hdr ;
@@ -44,7 +42,7 @@ static int imx_scu_soc_uid(u64 *soc_uid)
44
42
hdr -> func = IMX_SC_MISC_FUNC_UNIQUE_ID ;
45
43
hdr -> size = 1 ;
46
44
47
- ret = imx_scu_call_rpc (soc_ipc_handle , & msg , true);
45
+ ret = imx_scu_call_rpc (imx_sc_soc_ipc_handle , & msg , true);
48
46
if (ret ) {
49
47
pr_err ("%s: get soc uid failed, ret %d\n" , __func__ , ret );
50
48
return ret ;
@@ -71,7 +69,7 @@ static int imx_scu_soc_id(void)
71
69
msg .data .req .control = IMX_SC_C_ID ;
72
70
msg .data .req .resource = IMX_SC_R_SYSTEM ;
73
71
74
- ret = imx_scu_call_rpc (soc_ipc_handle , & msg , true);
72
+ ret = imx_scu_call_rpc (imx_sc_soc_ipc_handle , & msg , true);
75
73
if (ret ) {
76
74
pr_err ("%s: get soc info failed, ret %d\n" , __func__ , ret );
77
75
return ret ;
@@ -80,19 +78,19 @@ static int imx_scu_soc_id(void)
80
78
return msg .data .resp .id ;
81
79
}
82
80
83
- static int imx_scu_soc_probe (struct platform_device * pdev )
81
+ int imx_scu_soc_init (struct device * dev )
84
82
{
85
83
struct soc_device_attribute * soc_dev_attr ;
86
84
struct soc_device * soc_dev ;
87
85
int id , ret ;
88
86
u64 uid = 0 ;
89
87
u32 val ;
90
88
91
- ret = imx_scu_get_handle (& soc_ipc_handle );
89
+ ret = imx_scu_get_handle (& imx_sc_soc_ipc_handle );
92
90
if (ret )
93
91
return ret ;
94
92
95
- soc_dev_attr = devm_kzalloc (& pdev -> dev , sizeof (* soc_dev_attr ),
93
+ soc_dev_attr = devm_kzalloc (dev , sizeof (* soc_dev_attr ),
96
94
GFP_KERNEL );
97
95
if (!soc_dev_attr )
98
96
return - ENOMEM ;
@@ -115,19 +113,19 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
115
113
116
114
/* format soc_id value passed from SCU firmware */
117
115
val = id & 0x1f ;
118
- soc_dev_attr -> soc_id = devm_kasprintf (& pdev -> dev , GFP_KERNEL , "0x%x" , val );
116
+ soc_dev_attr -> soc_id = devm_kasprintf (dev , GFP_KERNEL , "0x%x" , val );
119
117
if (!soc_dev_attr -> soc_id )
120
118
return - ENOMEM ;
121
119
122
120
/* format revision value passed from SCU firmware */
123
121
val = (id >> 5 ) & 0xf ;
124
122
val = (((val >> 2 ) + 1 ) << 4 ) | (val & 0x3 );
125
- soc_dev_attr -> revision = devm_kasprintf (& pdev -> dev , GFP_KERNEL , "%d.%d" ,
123
+ soc_dev_attr -> revision = devm_kasprintf (dev , GFP_KERNEL , "%d.%d" ,
126
124
(val >> 4 ) & 0xf , val & 0xf );
127
125
if (!soc_dev_attr -> revision )
128
126
return - ENOMEM ;
129
127
130
- soc_dev_attr -> serial_number = devm_kasprintf (& pdev -> dev , GFP_KERNEL ,
128
+ soc_dev_attr -> serial_number = devm_kasprintf (dev , GFP_KERNEL ,
131
129
"%016llX" , uid );
132
130
if (!soc_dev_attr -> serial_number )
133
131
return - ENOMEM ;
@@ -138,35 +136,3 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
138
136
139
137
return 0 ;
140
138
}
141
-
142
- static struct platform_driver imx_scu_soc_driver = {
143
- .driver = {
144
- .name = IMX_SCU_SOC_DRIVER_NAME ,
145
- },
146
- .probe = imx_scu_soc_probe ,
147
- };
148
-
149
- static int __init imx_scu_soc_init (void )
150
- {
151
- struct platform_device * pdev ;
152
- struct device_node * np ;
153
- int ret ;
154
-
155
- np = of_find_compatible_node (NULL , NULL , "fsl,imx-scu" );
156
- if (!np )
157
- return - ENODEV ;
158
-
159
- of_node_put (np );
160
-
161
- ret = platform_driver_register (& imx_scu_soc_driver );
162
- if (ret )
163
- return ret ;
164
-
165
- pdev = platform_device_register_simple (IMX_SCU_SOC_DRIVER_NAME ,
166
- -1 , NULL , 0 );
167
- if (IS_ERR (pdev ))
168
- platform_driver_unregister (& imx_scu_soc_driver );
169
-
170
- return PTR_ERR_OR_ZERO (pdev );
171
- }
172
- device_initcall (imx_scu_soc_init );
0 commit comments