1 From ac9a9b1fcf3b0255aebc8e7f4b809f15556d9640 Mon Sep 17 00:00:00 2001
2 From: Lee Jones <lee.jones@linaro.org>
3 Date: Thu, 11 Feb 2016 13:19:09 -0800
4 Subject: [PATCH 348/381] clk: Allow clocks to be marked as CRITICAL
6 Critical clocks are those which must not be gated, else undefined
7 or catastrophic failure would occur. Here we have chosen to
8 ensure the prepare/enable counts are correctly incremented, so as
9 not to confuse users with enabled clocks with no visible users.
11 Signed-off-by: Lee Jones <lee.jones@linaro.org>
12 Signed-off-by: Michael Turquette <mturquette@baylibre.com>
13 Link: lkml.kernel.org/r/1455225554-13267-2-git-send-email-mturquette@baylibre.com
14 (cherry picked from commit 32b9b10961860860268961d9aad0c56a73018c37)
16 drivers/clk/clk.c | 5 +++++
17 include/linux/clk-provider.h | 1 +
18 2 files changed, 6 insertions(+)
20 --- a/drivers/clk/clk.c
21 +++ b/drivers/clk/clk.c
22 @@ -2466,6 +2466,11 @@ static int __clk_init(struct device *dev
24 core->ops->init(core->hw);
26 + if (core->flags & CLK_IS_CRITICAL) {
27 + clk_core_prepare(core);
28 + clk_core_enable(core);
31 kref_init(&core->ref);
34 --- a/include/linux/clk-provider.h
35 +++ b/include/linux/clk-provider.h
37 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
38 #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
39 #define CLK_RECALC_NEW_RATES BIT(9) /* recalc rates after notifications */
40 +#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */