From 4b044082c19eff716cba9e816fbb1225caaeb8a7 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:28 +0000 Subject: clk: mux: add set parent support Add set parent support for clk mux Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 43a25e9c6a..7e44045c16 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -66,6 +66,8 @@ struct clk_mux { }; #define to_clk_mux(_clk) container_of(_clk, struct clk_mux, clk) +extern const struct clk_ops clk_mux_ops; +u8 clk_mux_get_parent(struct clk *clk); struct clk_div_table { unsigned int val; -- cgit From 1b0d09cddb6d6b4d30f561dc8e4fb2ce904a5b58 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:31 +0000 Subject: clk: export mux/divider ops Export mux/divider ops and divider_recalc_rate for composite usage Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7e44045c16..6d62f862d2 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -96,6 +96,11 @@ struct clk_divider { #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) #define CLK_DIVIDER_READ_ONLY BIT(5) #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) +extern const struct clk_ops clk_divider_ops; +unsigned long divider_recalc_rate(struct clk *hw, unsigned long parent_rate, + unsigned int val, + const struct clk_div_table *table, + unsigned long flags, unsigned long width); struct clk_fixed_factor { struct clk clk; -- cgit From 1c643303187c595eb6782329529d2aec3731e473 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:34 +0000 Subject: clk: add clk-gate support Import clk-gate support from Linux Kernel 5.1-rc5 Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 6d62f862d2..8b04ecd7a5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -69,6 +69,24 @@ struct clk_mux { extern const struct clk_ops clk_mux_ops; u8 clk_mux_get_parent(struct clk *clk); +struct clk_gate { + struct clk clk; + void __iomem *reg; + u8 bit_idx; + u8 flags; +}; + +#define to_clk_gate(_clk) container_of(_clk, struct clk_gate, clk) + +#define CLK_GATE_SET_TO_DISABLE BIT(0) +#define CLK_GATE_HIWORD_MASK BIT(1) + +extern const struct clk_ops clk_gate_ops; +struct clk *clk_register_gate(struct device *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock); + struct clk_div_table { unsigned int val; unsigned int div; -- cgit From 4f305bf1b688ecb9508a2d74fa76ff34e90bc21f Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:39 +0000 Subject: clk: fixed_rate: export clk_fixed_rate Export the structure for others to use. Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8b04ecd7a5..f42df9b90f 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -129,6 +129,13 @@ struct clk_fixed_factor { #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk) +struct clk_fixed_rate { + struct clk clk; + unsigned long fixed_rate; +}; + +#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_platdata(dev)) + int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name); -- cgit From d669d1ae03977c70a4adb8a085cbfd701ae95b28 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:52 +0000 Subject: clk-provider: include clk-uclass.h Because clk-provider use clk_ops, so let's include clk-uclass.h Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index f42df9b90f..522e73e851 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -8,6 +8,7 @@ */ #ifndef __LINUX_CLK_PROVIDER_H #define __LINUX_CLK_PROVIDER_H +#include static inline void clk_dm(ulong id, struct clk *clk) { -- cgit From 00097635888f9104da7f7cceaf1858ec8987e86f Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:54 +0000 Subject: clk: add composite clk support Import clk composite clk support from Linux Kernel 5.1-rc5 Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 522e73e851..b9547736ee 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -137,6 +137,28 @@ struct clk_fixed_rate { #define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_platdata(dev)) +struct clk_composite { + struct clk clk; + struct clk_ops ops; + + struct clk *mux; + struct clk *rate; + struct clk *gate; + + const struct clk_ops *mux_ops; + const struct clk_ops *rate_ops; + const struct clk_ops *gate_ops; +}; + +#define to_clk_composite(_clk) container_of(_clk, struct clk_composite, clk) + +struct clk *clk_register_composite(struct device *dev, const char *name, + const char * const *parent_names, int num_parents, + struct clk *mux_clk, const struct clk_ops *mux_ops, + struct clk *rate_clk, const struct clk_ops *rate_ops, + struct clk *gate_clk, const struct clk_ops *gate_ops, + unsigned long flags); + int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name); -- cgit From 2b12957d01763bf2a52a4727327a7b3b80bc9111 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 31 Jul 2019 07:01:57 +0000 Subject: clk: gate: support sandbox Introduce io_gate_val for sandbox clk gate test usage Signed-off-by: Peng Fan --- include/linux/clk-provider.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index b9547736ee..02ff1a311a 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -75,6 +75,9 @@ struct clk_gate { void __iomem *reg; u8 bit_idx; u8 flags; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + u32 io_gate_val; +#endif }; #define to_clk_gate(_clk) container_of(_clk, struct clk_gate, clk) -- cgit