lantiq: move lantiq_board_detect() to 03_preinit_board.sh
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 8236-clk-add-API-of-clks.patch
1 From df2373ca941741f3f66750241a048ad4e2ff2c91 Mon Sep 17 00:00:00 2001
2 From: Zhao Qiang <qiang.zhao@nxp.com>
3 Date: Thu, 24 Nov 2016 11:47:45 +0800
4 Subject: [PATCH 236/238] clk: add API of clks
5
6 Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
7 ---
8 drivers/clk/clk.c | 19 +++++++++++++++++++
9 include/linux/clk-provider.h | 1 +
10 include/linux/clk.h | 9 +++++++++
11 3 files changed, 29 insertions(+)
12
13 --- a/drivers/clk/clk.c
14 +++ b/drivers/clk/clk.c
15 @@ -359,6 +359,19 @@ static struct clk_core *clk_core_get_par
16 return core->parents[index];
17 }
18
19 +struct clk *clk_get_parent_by_index(struct clk *clk, u8 index)
20 +{
21 + struct clk_core *parent;
22 +
23 + if (!clk)
24 + return NULL;
25 +
26 + parent = clk_core_get_parent_by_index(clk->core, index);
27 +
28 + return !parent ? NULL : parent->hw->clk;
29 +}
30 +EXPORT_SYMBOL_GPL(clk_get_parent_by_index);
31 +
32 struct clk_hw *
33 clk_hw_get_parent_by_index(const struct clk_hw *hw, unsigned int index)
34 {
35 @@ -2033,6 +2046,12 @@ static const struct file_operations clk_
36 .release = single_release,
37 };
38
39 +unsigned int clk_get_num_parents(struct clk *clk)
40 +{
41 + return !clk ? 0 : clk->core->num_parents;
42 +}
43 +EXPORT_SYMBOL_GPL(clk_get_num_parents);
44 +
45 static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
46 {
47 if (!c)
48 --- a/include/linux/clk-provider.h
49 +++ b/include/linux/clk-provider.h
50 @@ -656,6 +656,7 @@ unsigned int clk_hw_get_num_parents(cons
51 struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw);
52 struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
53 unsigned int index);
54 +struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
55 unsigned int __clk_get_enable_count(struct clk *clk);
56 unsigned long clk_hw_get_rate(const struct clk_hw *hw);
57 unsigned long __clk_get_flags(struct clk *clk);
58 --- a/include/linux/clk.h
59 +++ b/include/linux/clk.h
60 @@ -392,6 +392,15 @@ int clk_set_parent(struct clk *clk, stru
61 struct clk *clk_get_parent(struct clk *clk);
62
63 /**
64 + * clk_get_num_parents - get number of possible parents
65 + * @clk: clock source
66 + *
67 + * Returns the number of possible parents of this clock,
68 + * which can then be enumerated using clk_get_parent_by_index().
69 + */
70 +unsigned int clk_get_num_parents(struct clk *clk);
71 +
72 +/**
73 * clk_get_sys - get a clock based upon the device name
74 * @dev_id: device name
75 * @con_id: connection ID