Commit eb06d6bb authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Stephen Boyd

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: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 60cc43fc
...@@ -3556,6 +3556,7 @@ F: drivers/clk/ ...@@ -3556,6 +3556,7 @@ F: drivers/clk/
X: drivers/clk/clkdev.c X: drivers/clk/clkdev.c
F: include/linux/clk-pr* F: include/linux/clk-pr*
F: include/linux/clk/ F: include/linux/clk/
F: include/linux/of_clk.h
COMMON INTERNET FILE SYSTEM (CIFS) COMMON INTERNET FILE SYSTEM (CIFS)
M: Steve French <sfrench@samba.org> M: Steve French <sfrench@samba.org>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_clk.h>
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
...@@ -890,13 +891,10 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, ...@@ -890,13 +891,10 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec,
void *data); void *data);
unsigned int of_clk_get_parent_count(struct device_node *np);
int of_clk_parent_fill(struct device_node *np, const char **parents, int of_clk_parent_fill(struct device_node *np, const char **parents,
unsigned int size); unsigned int size);
const char *of_clk_get_parent_name(struct device_node *np, int index);
int of_clk_detect_critical(struct device_node *np, int index, int of_clk_detect_critical(struct device_node *np, int index,
unsigned long *flags); unsigned long *flags);
void of_clk_init(const struct of_device_id *matches);
#else /* !CONFIG_OF */ #else /* !CONFIG_OF */
...@@ -943,26 +941,16 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) ...@@ -943,26 +941,16 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data)
{ {
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
static inline unsigned int of_clk_get_parent_count(struct device_node *np)
{
return 0;
}
static inline int of_clk_parent_fill(struct device_node *np, static inline int of_clk_parent_fill(struct device_node *np,
const char **parents, unsigned int size) const char **parents, unsigned int size)
{ {
return 0; return 0;
} }
static inline const char *of_clk_get_parent_name(struct device_node *np,
int index)
{
return NULL;
}
static inline int of_clk_detect_critical(struct device_node *np, int index, static inline int of_clk_detect_critical(struct device_node *np, int index,
unsigned long *flags) unsigned long *flags)
{ {
return 0; return 0;
} }
static inline void of_clk_init(const struct of_device_id *matches) {}
#endif /* CONFIG_OF */ #endif /* CONFIG_OF */
/* /*
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* OF clock helpers
*/
#ifndef __LINUX_OF_CLK_H
#define __LINUX_OF_CLK_H
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
unsigned int of_clk_get_parent_count(struct device_node *np);
const char *of_clk_get_parent_name(struct device_node *np, int index);
void of_clk_init(const struct of_device_id *matches);
#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
static inline unsigned int of_clk_get_parent_count(struct device_node *np)
{
return 0;
}
static inline const char *of_clk_get_parent_name(struct device_node *np,
int index)
{
return NULL;
}
static inline void of_clk_init(const struct of_device_id *matches) {}
#endif /* !CONFIG_COMMON_CLK || !CONFIG_OF */
#endif /* __LINUX_OF_CLK_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment