Skip to content

Commit cf1e044

Browse files
Mian Yousaf Kaukabvireshk
authored andcommitted
clk: qoriq: add cpufreq platform device
Add a platform device for qoirq-cpufreq driver for the compatible clockgen blocks. Reviewed-by: Yuantian Tang <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Acked-by: Stephen Boyd <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 157f527 commit cf1e044

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

drivers/clk/clk-qoriq.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct clockgen {
9595
};
9696

9797
static struct clockgen clockgen;
98+
static bool add_cpufreq_dev __initdata;
9899

99100
static void cg_out(struct clockgen *cg, u32 val, u32 __iomem *reg)
100101
{
@@ -1019,7 +1020,7 @@ static void __init create_muxes(struct clockgen *cg)
10191020
}
10201021
}
10211022

1022-
static void __init clockgen_init(struct device_node *np);
1023+
static void __init _clockgen_init(struct device_node *np, bool legacy);
10231024

10241025
/*
10251026
* Legacy nodes may get probed before the parent clockgen node.
@@ -1030,7 +1031,7 @@ static void __init clockgen_init(struct device_node *np);
10301031
static void __init legacy_init_clockgen(struct device_node *np)
10311032
{
10321033
if (!clockgen.node)
1033-
clockgen_init(of_get_parent(np));
1034+
_clockgen_init(of_get_parent(np), true);
10341035
}
10351036

10361037
/* Legacy node */
@@ -1447,7 +1448,7 @@ static bool __init has_erratum_a4510(void)
14471448
}
14481449
#endif
14491450

1450-
static void __init clockgen_init(struct device_node *np)
1451+
static void __init _clockgen_init(struct device_node *np, bool legacy)
14511452
{
14521453
int i, ret;
14531454
bool is_old_ls1021a = false;
@@ -1516,12 +1517,35 @@ static void __init clockgen_init(struct device_node *np)
15161517
__func__, np, ret);
15171518
}
15181519

1520+
/* Don't create cpufreq device for legacy clockgen blocks */
1521+
add_cpufreq_dev = !legacy;
1522+
15191523
return;
15201524
err:
15211525
iounmap(clockgen.regs);
15221526
clockgen.regs = NULL;
15231527
}
15241528

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+
15251549
CLK_OF_DECLARE(qoriq_clockgen_1, "fsl,qoriq-clockgen-1.0", clockgen_init);
15261550
CLK_OF_DECLARE(qoriq_clockgen_2, "fsl,qoriq-clockgen-2.0", clockgen_init);
15271551
CLK_OF_DECLARE(qoriq_clockgen_b4420, "fsl,b4420-clockgen", clockgen_init);

0 commit comments

Comments
 (0)