clk: add CLK_DEFER_ORPHAN flag to prevent orphans from being used

A patch from »clk: improve handling of orphan clocks« in state Mainline for linux-kernel

From: Heiko Stuebner <heiko@...> Date: Thu, 2 Apr 2015 12:24:53 +0200

Commit-Message

The usage of clocks derived from an orphan can produce issues when trying to set rates etc. So ideally a clk_get to such a clock should defer till the clock hierarchy is complete. But as some arches probably rely on such clocks we can't disable them all. Therefore add a new clk flag where arches can enable this behaviour for their clocks. Signed-off-by: Heiko Stuebner <heiko@...>

Patch-Comment

drivers/clk/clk.c | 6 ++++++ include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+)

Statistics

  • 7 lines added
  • 0 lines removed

Changes

------------------------------ drivers/clk/clk.c -------------------------------
index 476f491..8511c62 100644
@@ -3041,6 +3041,12 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
if (provider->node == clkspec->np)
clk = provider->get(clkspec, provider->data);
if (!IS_ERR(clk)) {
+ if ((__clk_get_flags(clk) & CLK_DEFER_ORPHAN)
+ && clk_is_orphan(clk)) {
+ clk = ERR_PTR(-EPROBE_DEFER);
+ break;
+ }
+
clk = __clk_create_clk(__clk_get_hw(clk), dev_id,
con_id);
------------------------- include/linux/clk-provider.h -------------------------
index 28abf1b..ef8d669 100644
@@ -31,6 +31,7 @@
#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
+#define CLK_DEFER_ORPHAN BIT(9) /* defer clk_get calls for orphans */
struct clk_hw;
struct clk_core;
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...