[PATCH 1/6] clk: renesas: mstp: Add critical clock from device tree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow critical clocks to be specified in the Device Tree.

Signed-off-by: Chris Brandt <chris.brandt@xxxxxxxxxxx>
---
 drivers/clk/renesas/clk-mstp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 003e9ce45757..8e28e9671265 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -148,7 +148,7 @@ static const struct clk_ops cpg_mstp_clock_ops = {
 
 static struct clk * __init cpg_mstp_clock_register(const char *name,
 	const char *parent_name, unsigned int index,
-	struct mstp_clock_group *group)
+	struct mstp_clock_group *group, unsigned long flags)
 {
 	struct clk_init_data init;
 	struct mstp_clock *clock;
@@ -160,12 +160,12 @@ static struct clk * __init cpg_mstp_clock_register(const char *name,
 
 	init.name = name;
 	init.ops = &cpg_mstp_clock_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | flags;
 	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
-	if (!strcmp(name, "intc-sys")) {
-		pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
+	if (!strcmp(name, "intc-sys"))
 		init.flags |= CLK_IS_CRITICAL;
-	}
+	if (init.flags & CLK_IS_CRITICAL)
+		pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
 
@@ -187,6 +187,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
 	const char *idxname;
 	struct clk **clks;
 	unsigned int i;
+	unsigned long flags;
 
 	group = kzalloc(struct_size(group, clks, MSTP_MAX_CLOCKS), GFP_KERNEL);
 	if (!group)
@@ -239,8 +240,11 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
 			continue;
 		}
 
+		flags = 0;
+		of_clk_detect_critical(np, i, &flags);
+
 		clks[clkidx] = cpg_mstp_clock_register(name, parent_name,
-						       clkidx, group);
+						       clkidx, group, flags);
 		if (!IS_ERR(clks[clkidx])) {
 			group->data.clk_num = max(group->data.clk_num,
 						  clkidx + 1);
-- 
2.23.0




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux