summaryrefslogtreecommitdiff
path: root/drivers/clk/sprd/gate.c
diff options
context:
space:
mode:
authorXiaolong Zhang <xiaolong.zhang@unisoc.com>2020-03-04 15:27:24 +0800
committerStephen Boyd <sboyd@kernel.org>2020-03-24 19:03:56 -0700
commit187e5cd2d133771e978e7e4ea6aa684dfd1ce6ab (patch)
treecb09afa67e7e7b1743cd51b76cedad563fc59713 /drivers/clk/sprd/gate.c
parentbb6d3fb354c5ee8d6bde2d576eb7220ea09862b9 (diff)
clk: sprd: add gate for pll clocks
Some sprd's gate clocks are used to the switch of pll, which need to wait a certain time for stable after being enabled. Signed-off-by: Xiaolong Zhang <xiaolong.zhang@unisoc.com> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200304072730.9193-2-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/sprd/gate.c')
-rw-r--r--drivers/clk/sprd/gate.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/clk/sprd/gate.c b/drivers/clk/sprd/gate.c
index f59d1936b412..574cfc116bbc 100644
--- a/drivers/clk/sprd/gate.c
+++ b/drivers/clk/sprd/gate.c
@@ -79,6 +79,17 @@ static int sprd_sc_gate_enable(struct clk_hw *hw)
return 0;
}
+
+static int sprd_pll_sc_gate_prepare(struct clk_hw *hw)
+{
+ struct sprd_gate *sg = hw_to_sprd_gate(hw);
+
+ clk_sc_gate_toggle(sg, true);
+ udelay(sg->udelay);
+
+ return 0;
+}
+
static int sprd_gate_is_enabled(struct clk_hw *hw)
{
struct sprd_gate *sg = hw_to_sprd_gate(hw);
@@ -109,3 +120,9 @@ const struct clk_ops sprd_sc_gate_ops = {
};
EXPORT_SYMBOL_GPL(sprd_sc_gate_ops);
+const struct clk_ops sprd_pll_sc_gate_ops = {
+ .unprepare = sprd_sc_gate_disable,
+ .prepare = sprd_pll_sc_gate_prepare,
+ .is_enabled = sprd_gate_is_enabled,
+};
+EXPORT_SYMBOL_GPL(sprd_pll_sc_gate_ops);