diff options
| author | Geert Uytterhoeven <geert+renesas@glider.be> | 2018-04-18 10:50:01 -0400 |
|---|---|---|
| committer | Stephen Boyd <sboyd@kernel.org> | 2018-05-02 11:31:07 -0400 |
| commit | eb06d6bbc45a7561de78a00fb17bfbb75893ee26 (patch) | |
| tree | a5e299d56b1be6444464fa079076559ee42f74fe /include/linux | |
| parent | 60cc43fc888428bb2f18f08997432d426a243338 (diff) | |
clk: Extract OF clock helpers in <linux/of_clk.h>
The use of of_clk_get_parent_{count,name}() and of_clk_init() is not
limited to clock providers.
Hence move these helpers into their own header file, so callers that are
not clock providers no longer have to include <linux/clk-provider.h>.
Suggested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/clk-provider.h | 14 | ||||
| -rw-r--r-- | include/linux/of_clk.h | 30 |
2 files changed, 31 insertions, 13 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 210a890008f9..61cb4729f22a 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <linux/of_clk.h> | ||
| 16 | 17 | ||
| 17 | #ifdef CONFIG_COMMON_CLK | 18 | #ifdef CONFIG_COMMON_CLK |
| 18 | 19 | ||
| @@ -890,13 +891,10 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, | |||
| 890 | struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); | 891 | struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); |
| 891 | struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, | 892 | struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, |
| 892 | void *data); | 893 | void *data); |
| 893 | unsigned int of_clk_get_parent_count(struct device_node *np); | ||
| 894 | int of_clk_parent_fill(struct device_node *np, const char **parents, | 894 | int of_clk_parent_fill(struct device_node *np, const char **parents, |
| 895 | unsigned int size); | 895 | unsigned int size); |
| 896 | const char *of_clk_get_parent_name(struct device_node *np, int index); | ||
| 897 | int of_clk_detect_critical(struct device_node *np, int index, | 896 | int of_clk_detect_critical(struct device_node *np, int index, |
| 898 | unsigned long *flags); | 897 | unsigned long *flags); |
| 899 | void of_clk_init(const struct of_device_id *matches); | ||
| 900 | 898 | ||
| 901 | #else /* !CONFIG_OF */ | 899 | #else /* !CONFIG_OF */ |
| 902 | 900 | ||
| @@ -943,26 +941,16 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) | |||
| 943 | { | 941 | { |
| 944 | return ERR_PTR(-ENOENT); | 942 | return ERR_PTR(-ENOENT); |
| 945 | } | 943 | } |
| 946 | static inline unsigned int of_clk_get_parent_count(struct device_node *np) | ||
| 947 | { | ||
| 948 | return 0; | ||
| 949 | } | ||
| 950 | static inline int of_clk_parent_fill(struct device_node *np, | 944 | static inline int of_clk_parent_fill(struct device_node *np, |
| 951 | const char **parents, unsigned int size) | 945 | const char **parents, unsigned int size) |
| 952 | { | 946 | { |
| 953 | return 0; | 947 | return 0; |
| 954 | } | 948 | } |
| 955 | static inline const char *of_clk_get_parent_name(struct device_node *np, | ||
| 956 | int index) | ||
| 957 | { | ||
| 958 | return NULL; | ||
| 959 | } | ||
| 960 | static inline int of_clk_detect_critical(struct device_node *np, int index, | 949 | static inline int of_clk_detect_critical(struct device_node *np, int index, |
| 961 | unsigned long *flags) | 950 | unsigned long *flags) |
| 962 | { | 951 | { |
| 963 | return 0; | 952 | return 0; |
| 964 | } | 953 | } |
| 965 | static inline void of_clk_init(const struct of_device_id *matches) {} | ||
| 966 | #endif /* CONFIG_OF */ | 954 | #endif /* CONFIG_OF */ |
| 967 | 955 | ||
| 968 | /* | 956 | /* |
diff --git a/include/linux/of_clk.h b/include/linux/of_clk.h new file mode 100644 index 000000000000..b27da9f164cb --- /dev/null +++ b/include/linux/of_clk.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * OF clock helpers | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __LINUX_OF_CLK_H | ||
| 7 | #define __LINUX_OF_CLK_H | ||
| 8 | |||
| 9 | #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF) | ||
| 10 | |||
| 11 | unsigned int of_clk_get_parent_count(struct device_node *np); | ||
| 12 | const char *of_clk_get_parent_name(struct device_node *np, int index); | ||
| 13 | void of_clk_init(const struct of_device_id *matches); | ||
| 14 | |||
| 15 | #else /* !CONFIG_COMMON_CLK || !CONFIG_OF */ | ||
| 16 | |||
| 17 | static inline unsigned int of_clk_get_parent_count(struct device_node *np) | ||
| 18 | { | ||
| 19 | return 0; | ||
| 20 | } | ||
| 21 | static inline const char *of_clk_get_parent_name(struct device_node *np, | ||
| 22 | int index) | ||
| 23 | { | ||
| 24 | return NULL; | ||
| 25 | } | ||
| 26 | static inline void of_clk_init(const struct of_device_id *matches) {} | ||
| 27 | |||
| 28 | #endif /* !CONFIG_COMMON_CLK || !CONFIG_OF */ | ||
| 29 | |||
| 30 | #endif /* __LINUX_OF_CLK_H */ | ||
