Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332376

[PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL

From Michael Turquette <mturquette@baylibre.com>
Newsgroups linux.kernel
Subject [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL
Date 2016-02-11 22:30 +0100
Message-ID <r16Yi-5Zm-3@gated-at.bofh.it> (permalink)
References <r16OB-5Vk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lee Jones <lee.jones@linaro.org>

Critical clocks are those which must not be gated, else undefined
or catastrophic failure would occur.  Here we have chosen to
ensure the prepare/enable counts are correctly incremented, so as
not to confuse users with enabled clocks with no visible users.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
---
Changes in v42:
  * Moved code from clk_register into __clk_init

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

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b4db67a..993f775 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2484,6 +2484,11 @@ static int __clk_init(struct device *dev, struct clk *clk_user)
 	if (core->ops->init)
 		core->ops->init(core->hw);
 
+	if (core->flags & CLK_IS_CRITICAL) {
+		clk_core_prepare(core);
+		clk_core_enable(core);
+	}
+
 	kref_init(&core->ref);
 out:
 	clk_prepare_unlock();
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1143e38..1d986ea 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -32,6 +32,7 @@
 #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
 #define CLK_RECALC_NEW_RATES	BIT(9) /* recalc rates after notifications */
 #define CLK_SET_RATE_UNGATE	BIT(10) /* clock needs to run to set rate */
+#define CLK_IS_CRITICAL		BIT(11) /* do not gate, ever */
 
 struct clk;
 struct clk_hw;
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v42 0/6] critical clocks and handoff clocks Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:20 +0100
  [PATCH v42 6/6] clk: introduce CLK_ENABLE_HAND_OFF flag Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:20 +0100
  [PATCH v42 4/6] clk: per-user clk prepare & enable ref counts Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:30 +0100
    Re: [PATCH v42 4/6] clk: per-user clk prepare & enable ref counts Stephen Boyd <sboyd@codeaurora.org> - 2016-02-13 02:20 +0100
  [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:30 +0100
    Re: [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Lee Jones <lee.jones@linaro.org> - 2016-02-12 09:10 +0100
    Re: [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Stephen Boyd <sboyd@codeaurora.org> - 2016-02-13 02:20 +0100
      Re: [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Stephen Boyd <sboyd@codeaurora.org> - 2016-02-19 03:10 +0100
  [PATCH v42 2/6] clk: WARN_ON about to disable a critical clock Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:30 +0100
    Re: [PATCH v42 2/6] clk: WARN_ON about to disable a critical clock Stephen Boyd <sboyd@codeaurora.org> - 2016-02-13 02:20 +0100
  [PATCH v42 3/6] clk: Provide OF helper to mark clocks as CRITICAL Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:30 +0100
    Re: [PATCH v42 3/6] clk: Provide OF helper to mark clocks as CRITICAL Lee Jones <lee.jones@linaro.org> - 2016-02-12 09:10 +0100
    Re: [PATCH v42 3/6] clk: Provide OF helper to mark clocks as CRITICAL Stephen Boyd <sboyd@codeaurora.org> - 2016-02-13 02:10 +0100
  Re: [PATCH v42 0/6] critical clocks and handoff clocks Lee Jones <lee.jones@linaro.org> - 2016-02-12 09:10 +0100

csiph-web