.. | .. |
---|
79 | 79 | |
---|
80 | 80 | return 0; |
---|
81 | 81 | } |
---|
| 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 | + |
---|
82 | 93 | static int sprd_gate_is_enabled(struct clk_hw *hw) |
---|
83 | 94 | { |
---|
84 | 95 | struct sprd_gate *sg = hw_to_sprd_gate(hw); |
---|
85 | 96 | struct sprd_clk_common *common = &sg->common; |
---|
| 97 | + struct clk_hw *parent; |
---|
86 | 98 | 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 | + } |
---|
87 | 105 | |
---|
88 | 106 | regmap_read(common->regmap, common->reg, ®); |
---|
89 | 107 | |
---|
.. | .. |
---|
109 | 127 | }; |
---|
110 | 128 | EXPORT_SYMBOL_GPL(sprd_sc_gate_ops); |
---|
111 | 129 | |
---|
| 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); |
---|