@@ -95,6 +95,7 @@ struct clockgen {
95
95
};
96
96
97
97
static struct clockgen clockgen ;
98
+ static bool add_cpufreq_dev __initdata ;
98
99
99
100
static void cg_out (struct clockgen * cg , u32 val , u32 __iomem * reg )
100
101
{
@@ -1019,7 +1020,7 @@ static void __init create_muxes(struct clockgen *cg)
1019
1020
}
1020
1021
}
1021
1022
1022
- static void __init clockgen_init (struct device_node * np );
1023
+ static void __init _clockgen_init (struct device_node * np , bool legacy );
1023
1024
1024
1025
/*
1025
1026
* Legacy nodes may get probed before the parent clockgen node.
@@ -1030,7 +1031,7 @@ static void __init clockgen_init(struct device_node *np);
1030
1031
static void __init legacy_init_clockgen (struct device_node * np )
1031
1032
{
1032
1033
if (!clockgen .node )
1033
- clockgen_init (of_get_parent (np ));
1034
+ _clockgen_init (of_get_parent (np ), true );
1034
1035
}
1035
1036
1036
1037
/* Legacy node */
@@ -1447,7 +1448,7 @@ static bool __init has_erratum_a4510(void)
1447
1448
}
1448
1449
#endif
1449
1450
1450
- static void __init clockgen_init (struct device_node * np )
1451
+ static void __init _clockgen_init (struct device_node * np , bool legacy )
1451
1452
{
1452
1453
int i , ret ;
1453
1454
bool is_old_ls1021a = false;
@@ -1516,12 +1517,35 @@ static void __init clockgen_init(struct device_node *np)
1516
1517
__func__ , np , ret );
1517
1518
}
1518
1519
1520
+ /* Don't create cpufreq device for legacy clockgen blocks */
1521
+ add_cpufreq_dev = !legacy ;
1522
+
1519
1523
return ;
1520
1524
err :
1521
1525
iounmap (clockgen .regs );
1522
1526
clockgen .regs = NULL ;
1523
1527
}
1524
1528
1529
+ static void __init clockgen_init (struct device_node * np )
1530
+ {
1531
+ _clockgen_init (np , false);
1532
+ }
1533
+
1534
+ static int __init clockgen_cpufreq_init (void )
1535
+ {
1536
+ struct platform_device * pdev ;
1537
+
1538
+ if (add_cpufreq_dev ) {
1539
+ pdev = platform_device_register_simple ("qoriq-cpufreq" , -1 ,
1540
+ NULL , 0 );
1541
+ if (IS_ERR (pdev ))
1542
+ pr_err ("Couldn't register qoriq-cpufreq err=%ld\n" ,
1543
+ PTR_ERR (pdev ));
1544
+ }
1545
+ return 0 ;
1546
+ }
1547
+ device_initcall (clockgen_cpufreq_init );
1548
+
1525
1549
CLK_OF_DECLARE (qoriq_clockgen_1 , "fsl,qoriq-clockgen-1.0" , clockgen_init );
1526
1550
CLK_OF_DECLARE (qoriq_clockgen_2 , "fsl,qoriq-clockgen-2.0" , clockgen_init );
1527
1551
CLK_OF_DECLARE (qoriq_clockgen_b4420 , "fsl,b4420-clockgen" , clockgen_init );
0 commit comments