diff options
Diffstat (limited to 'include/linux/clk-provider.h')
-rw-r--r-- | include/linux/clk-provider.h | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7c925e6211f1..f711be6e8c44 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -20,6 +20,8 @@ | |||
20 | * flags used across common struct clk. these flags should only affect the | 20 | * flags used across common struct clk. these flags should only affect the |
21 | * top-level framework. custom flags for dealing with hardware specifics | 21 | * top-level framework. custom flags for dealing with hardware specifics |
22 | * belong in struct clk_foo | 22 | * belong in struct clk_foo |
23 | * | ||
24 | * Please update clk_flags[] in drivers/clk/clk.c when making changes here! | ||
23 | */ | 25 | */ |
24 | #define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */ | 26 | #define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */ |
25 | #define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */ | 27 | #define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */ |
@@ -412,7 +414,7 @@ extern const struct clk_ops clk_divider_ro_ops; | |||
412 | 414 | ||
413 | unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, | 415 | unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, |
414 | unsigned int val, const struct clk_div_table *table, | 416 | unsigned int val, const struct clk_div_table *table, |
415 | unsigned long flags); | 417 | unsigned long flags, unsigned long width); |
416 | long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent, | 418 | long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent, |
417 | unsigned long rate, unsigned long *prate, | 419 | unsigned long rate, unsigned long *prate, |
418 | const struct clk_div_table *table, | 420 | const struct clk_div_table *table, |
@@ -744,6 +746,7 @@ unsigned long clk_hw_get_rate(const struct clk_hw *hw); | |||
744 | unsigned long __clk_get_flags(struct clk *clk); | 746 | unsigned long __clk_get_flags(struct clk *clk); |
745 | unsigned long clk_hw_get_flags(const struct clk_hw *hw); | 747 | unsigned long clk_hw_get_flags(const struct clk_hw *hw); |
746 | bool clk_hw_is_prepared(const struct clk_hw *hw); | 748 | bool clk_hw_is_prepared(const struct clk_hw *hw); |
749 | bool clk_hw_rate_is_protected(const struct clk_hw *hw); | ||
747 | bool clk_hw_is_enabled(const struct clk_hw *hw); | 750 | bool clk_hw_is_enabled(const struct clk_hw *hw); |
748 | bool __clk_is_enabled(struct clk *clk); | 751 | bool __clk_is_enabled(struct clk *clk); |
749 | struct clk *__clk_lookup(const char *name); | 752 | struct clk *__clk_lookup(const char *name); |
@@ -806,6 +809,44 @@ extern struct of_device_id __clk_of_table; | |||
806 | } \ | 809 | } \ |
807 | OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver) | 810 | OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver) |
808 | 811 | ||
812 | #define CLK_HW_INIT(_name, _parent, _ops, _flags) \ | ||
813 | (&(struct clk_init_data) { \ | ||
814 | .flags = _flags, \ | ||
815 | .name = _name, \ | ||
816 | .parent_names = (const char *[]) { _parent }, \ | ||
817 | .num_parents = 1, \ | ||
818 | .ops = _ops, \ | ||
819 | }) | ||
820 | |||
821 | #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ | ||
822 | (&(struct clk_init_data) { \ | ||
823 | .flags = _flags, \ | ||
824 | .name = _name, \ | ||
825 | .parent_names = _parents, \ | ||
826 | .num_parents = ARRAY_SIZE(_parents), \ | ||
827 | .ops = _ops, \ | ||
828 | }) | ||
829 | |||
830 | #define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \ | ||
831 | (&(struct clk_init_data) { \ | ||
832 | .flags = _flags, \ | ||
833 | .name = _name, \ | ||
834 | .parent_names = NULL, \ | ||
835 | .num_parents = 0, \ | ||
836 | .ops = _ops, \ | ||
837 | }) | ||
838 | |||
839 | #define CLK_FIXED_FACTOR(_struct, _name, _parent, \ | ||
840 | _div, _mult, _flags) \ | ||
841 | struct clk_fixed_factor _struct = { \ | ||
842 | .div = _div, \ | ||
843 | .mult = _mult, \ | ||
844 | .hw.init = CLK_HW_INIT(_name, \ | ||
845 | _parent, \ | ||
846 | &clk_fixed_factor_ops, \ | ||
847 | _flags), \ | ||
848 | } | ||
849 | |||
809 | #ifdef CONFIG_OF | 850 | #ifdef CONFIG_OF |
810 | int of_clk_add_provider(struct device_node *np, | 851 | int of_clk_add_provider(struct device_node *np, |
811 | struct clk *(*clk_src_get)(struct of_phandle_args *args, | 852 | struct clk *(*clk_src_get)(struct of_phandle_args *args, |