[RFC PATCH 2/3] clk: bd718x7: Enable the possibility to mark the clock as critical

From: Michael Trimarchi
Date: Sun Jun 05 2022 - 12:57:22 EST


If the clock is used to generate the osc_32k, we need to mark
as critical. clock-critical has no binding description at the moment
but it's defined in linux kernel

bd71847: pmic@4b {
...
rohm,reset-snvs-powered;

#clock-cells = <0>;
clock-critical = <1>;
clocks = <&osc_32k 0>;
clock-output-names = "clk-32k-out";
...
}

Signed-off-by: Michael Trimarchi <michael@xxxxxxxxxxxxxxxxxxxx>
---
drivers/clk/clk-bd718x7.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c
index 04cc0beb67df..5088379ec2b7 100644
--- a/drivers/clk/clk-bd718x7.c
+++ b/drivers/clk/clk-bd718x7.c
@@ -83,6 +83,7 @@ static int bd71837_clk_probe(struct platform_device *pdev)
const char *parent_clk;
struct device *dev = &pdev->dev;
struct device *parent = pdev->dev.parent;
+ unsigned long flags;
struct clk_init_data init = {
.name = "bd718xx-32k-out",
.ops = &bd71837_clk_ops,
@@ -100,6 +101,9 @@ static int bd71837_clk_probe(struct platform_device *pdev)

parent_clk = of_clk_get_parent_name(parent->of_node, 0);

+ of_clk_detect_critical(dev->of_node, 0, &flags);
+ init.flags = flags;
+
init.parent_names = &parent_clk;
if (!parent_clk) {
dev_err(dev, "No parent clk found\n");
--
2.25.1