[RFC PATCH v2 18/30] drivers/clocksource: sh_tmu clocks property support.

Yoshinori Sato <[email protected]>
Newsgroups gmane.linux.ports.sh.devel
Message-ID <78b37903cfb2cc64f0f09287a3e075d7dda73260.1694596125.git.ysato@users.sourceforge.jp>
Signed-off-by: Yoshinori Sato <[email protected]>
---
 drivers/clocksource/sh_tmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index beffff81c00f..878324986f49 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -537,6 +537,9 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 
 	/* Get hold of clock. */
 	tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+	if (IS_ERR(tmu->clk) && IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
+		/* use DeviceTree clocks property */
+		tmu->clk = devm_clk_get(&tmu->pdev->dev, NULL);
 	if (IS_ERR(tmu->clk)) {
 		dev_err(&tmu->pdev->dev, "cannot get clock\n");
 		return PTR_ERR(tmu->clk);
-- 
2.39.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.