forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/clk/sprd/gate.c
....@@ -79,11 +79,29 @@
7979
8080 return 0;
8181 }
82
+
83
+static int sprd_pll_sc_gate_prepare(struct clk_hw *hw)
84
+{
85
+ struct sprd_gate *sg = hw_to_sprd_gate(hw);
86
+
87
+ clk_sc_gate_toggle(sg, true);
88
+ udelay(sg->udelay);
89
+
90
+ return 0;
91
+}
92
+
8293 static int sprd_gate_is_enabled(struct clk_hw *hw)
8394 {
8495 struct sprd_gate *sg = hw_to_sprd_gate(hw);
8596 struct sprd_clk_common *common = &sg->common;
97
+ struct clk_hw *parent;
8698 unsigned int reg;
99
+
100
+ if (sg->flags & SPRD_GATE_NON_AON) {
101
+ parent = clk_hw_get_parent(hw);
102
+ if (!parent || !clk_hw_is_enabled(parent))
103
+ return 0;
104
+ }
87105
88106 regmap_read(common->regmap, common->reg, &reg);
89107
....@@ -109,3 +127,9 @@
109127 };
110128 EXPORT_SYMBOL_GPL(sprd_sc_gate_ops);
111129
130
+const struct clk_ops sprd_pll_sc_gate_ops = {
131
+ .unprepare = sprd_sc_gate_disable,
132
+ .prepare = sprd_pll_sc_gate_prepare,
133
+ .is_enabled = sprd_gate_is_enabled,
134
+};
135
+EXPORT_SYMBOL_GPL(sprd_pll_sc_gate_ops);