Skip to content

clk: dt: add support for default rate/parent

Tero Kristo linux-arm-kernel linux-devicetree linux-omap 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 4 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 4 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] clk: dt: add support for default rate/parent
Quoted 5 lines · Mike Turquette

Quoting Tero Kristo (2014-03-05 05:10:17)

Quoted 3 lines

Ping.

Mike, any feedback on this?

Quoted 7 lines

Hi Tero,

Have you seen Sylwester's approach[1]? I prefer it since it is more device-oriented and less "centralized". The clock consumer enumerates the default parent or rate of a consumed clock. This can be made to work like your approach by having the clock driver consume these clocks and set them up with default rates or parents. What do you think?

Just saw the patches yesterday. I think that approach would work in most cases, however I guess there might be cases where you need to setup the rate/parent of a clock very early in boot (basically when you are registering the clock itself) to avoid any race issues with drivers (or the clock framework itself) coming in and using a clock that is not properly setup yet. But well, I guess these can be handled by some init time tweaks.

I just converted the OMAP4 code to the format provided by Sylwester's patches and it seems to work fine. The patch should be changed eventually to probe at the time when the CM/PRM instances are probed. Inlined here as reference:

From 1b05e03bbd3fb5a4f5192444e7d4365f177c1756 Mon Sep 17 00:00:00 2001
From: Tero Kristo <[email protected]>
Date: Fri, 21 Mar 2014 09:52:47 +0200
Subject: [PATCH] CLK: TI: OMAP4: setup default clocks / rates using the clock
consumer approach

---
  arch/arm/boot/dts/omap4.dtsi |    8 ++++++++
  drivers/clk/ti/clk-44xx.c    |   44 
------------------------------------------
  drivers/clk/ti/clk.c         |   41 
+++++++++++++++++++++++++++++++++++++++
  3 files changed, 49 insertions(+), 44 deletions(-)
arch/arm/boot/dts/omap4.dtsi +8 -0
index d3f8a6e..4826168 100644
@@ -88,6 +88,14 @@
  		};
  	};
 
+	default-clocks {
+		compatible = "ti,default-clocks";
+		clocks = <&abe_dpll_refclk_mux_ck>, <&dpll_usb_ck>,
+			<&dpll_abe_ck>;
+		clock-parents = <&sys_32k_ck>;
+		clock-rates = <0>, <960000000>, <98304000>;
+	};
+
  	/*
  	 * XXX: Use a flat representation of the OMAP4 interconnect.
  	 * The real OMAP interconnect network is quite complex.
drivers/clk/ti/clk-44xx.c +0 -44

57 lines not on this page · raw message

drivers/clk/ti/clk.c +2 -0
index b1a6f71..469fd4e 100644
@@ -21,6 +21,8 @@
  #include <linux/of.h>
  #include <linux/of_address.h>
  #include <linux/list.h>
+#include <linux/of_platform.h>
+#include <linux/module.h>
 
  #undef pr_fmt
  #define pr_fmt(fmt) "%s: " fmt, __func__
@@ -165,3 +167,41 @@ void ti_dt_clk_init_provider(struct device_node 

*parent, int index)
kfree(retry);
}
}
+
+static int ti_clk_probe(struct platform_device *pdev) +{
+ return 0;
+}
+
+static int ti_clk_remove(struct platform_device *dev) +{
+ return 0;
+}
+
+static const struct of_device_id ti_clk_match[] = {
+ { .compatible = "ti,default-clocks" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ti_clk_match);
+
+static struct platform_driver ti_clk_driver = {
+ .probe = ti_clk_probe,
+ .remove = ti_clk_remove,
+ .driver = {
+ .name = "ti-clk",
+ .of_match_table = of_match_ptr(ti_clk_match),
+ },
+};
+
+static int __init ti_clk_init(void)
+{
+ return platform_driver_register(&ti_clk_driver);
+}
+
+static void __exit ti_clk_exit(void)
+{
+ platform_driver_unregister(&ti_clk_driver);
+}
+
+module_init(ti_clk_init); +module_exit(ti_clk_exit);

Signature · 1 line
1.7.9.5