18
18
#include <linux/of.h>
19
19
#include <linux/slab.h>
20
20
#include <linux/smp.h>
21
+ #include <linux/platform_device.h>
21
22
22
23
/**
23
24
* struct cpu_data
@@ -29,12 +30,6 @@ struct cpu_data {
29
30
struct cpufreq_frequency_table * table ;
30
31
};
31
32
32
- /*
33
- * Don't use cpufreq on this SoC -- used when the SoC would have otherwise
34
- * matched a more generic compatible.
35
- */
36
- #define SOC_BLACKLIST 1
37
-
38
33
/**
39
34
* struct soc_data - SoC specific data
40
35
* @flags: SOC_xxx
@@ -264,64 +259,51 @@ static struct cpufreq_driver qoriq_cpufreq_driver = {
264
259
.attr = cpufreq_generic_attr ,
265
260
};
266
261
267
- static const struct soc_data blacklist = {
268
- .flags = SOC_BLACKLIST ,
269
- };
270
-
271
- static const struct of_device_id node_matches [] __initconst = {
262
+ static const struct of_device_id qoriq_cpufreq_blacklist [] = {
272
263
/* e6500 cannot use cpufreq due to erratum A-008083 */
273
- { .compatible = "fsl,b4420-clockgen" , & blacklist },
274
- { .compatible = "fsl,b4860-clockgen" , & blacklist },
275
- { .compatible = "fsl,t2080-clockgen" , & blacklist },
276
- { .compatible = "fsl,t4240-clockgen" , & blacklist },
277
-
278
- { .compatible = "fsl,ls1012a-clockgen" , },
279
- { .compatible = "fsl,ls1021a-clockgen" , },
280
- { .compatible = "fsl,ls1028a-clockgen" , },
281
- { .compatible = "fsl,ls1043a-clockgen" , },
282
- { .compatible = "fsl,ls1046a-clockgen" , },
283
- { .compatible = "fsl,ls1088a-clockgen" , },
284
- { .compatible = "fsl,ls2080a-clockgen" , },
285
- { .compatible = "fsl,lx2160a-clockgen" , },
286
- { .compatible = "fsl,p4080-clockgen" , },
287
- { .compatible = "fsl,qoriq-clockgen-1.0" , },
288
- { .compatible = "fsl,qoriq-clockgen-2.0" , },
264
+ { .compatible = "fsl,b4420-clockgen" , },
265
+ { .compatible = "fsl,b4860-clockgen" , },
266
+ { .compatible = "fsl,t2080-clockgen" , },
267
+ { .compatible = "fsl,t4240-clockgen" , },
289
268
{}
290
269
};
291
270
292
- static int __init qoriq_cpufreq_init ( void )
271
+ static int qoriq_cpufreq_probe ( struct platform_device * pdev )
293
272
{
294
273
int ret ;
295
- struct device_node * np ;
296
- const struct of_device_id * match ;
297
- const struct soc_data * data ;
298
-
299
- np = of_find_matching_node (NULL , node_matches );
300
- if (!np )
301
- return - ENODEV ;
302
-
303
- match = of_match_node (node_matches , np );
304
- data = match -> data ;
305
-
306
- of_node_put (np );
274
+ struct device_node * np ;
307
275
308
- if (data && data -> flags & SOC_BLACKLIST )
276
+ np = of_find_matching_node (NULL , qoriq_cpufreq_blacklist );
277
+ if (np ) {
278
+ dev_info (& pdev -> dev , "Disabling due to erratum A-008083" );
309
279
return - ENODEV ;
280
+ }
310
281
311
282
ret = cpufreq_register_driver (& qoriq_cpufreq_driver );
312
- if (! ret )
313
- pr_info ( "Freescale QorIQ CPU frequency scaling driver\n" ) ;
283
+ if (ret )
284
+ return ret ;
314
285
315
- return ret ;
286
+ dev_info (& pdev -> dev , "Freescale QorIQ CPU frequency scaling driver\n" );
287
+ return 0 ;
316
288
}
317
- module_init (qoriq_cpufreq_init );
318
289
319
- static void __exit qoriq_cpufreq_exit ( void )
290
+ static int qoriq_cpufreq_remove ( struct platform_device * pdev )
320
291
{
321
292
cpufreq_unregister_driver (& qoriq_cpufreq_driver );
293
+
294
+ return 0 ;
322
295
}
323
- module_exit (qoriq_cpufreq_exit );
324
296
297
+ static struct platform_driver qoriq_cpufreq_platform_driver = {
298
+ .driver = {
299
+ .name = "qoriq-cpufreq" ,
300
+ },
301
+ .probe = qoriq_cpufreq_probe ,
302
+ .remove = qoriq_cpufreq_remove ,
303
+ };
304
+ module_platform_driver (qoriq_cpufreq_platform_driver );
305
+
306
+ MODULE_ALIAS ("platform:qoriq-cpufreq" );
325
307
MODULE_LICENSE ("GPL" );
326
308
MODULE_AUTHOR (
"Tang Yuantian <[email protected] >" );
327
309
MODULE_DESCRIPTION ("cpufreq driver for Freescale QorIQ series SoCs" );
0 commit comments