1 /* SPDX-License-Identifier: GPL-2.0 */
3 // Spreadtrum gate clock driver
5 // Copyright (C) 2017 Spreadtrum, Inc.
6 // Author: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
18 struct sprd_clk_common common
;
21 #define SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, _sc_offset, \
22 _enable_mask, _flags, _gate_flags, _ops) \
23 struct sprd_gate _struct = { \
24 .enable_mask = _enable_mask, \
25 .sc_offset = _sc_offset, \
26 .flags = _gate_flags, \
30 .hw.init = CLK_HW_INIT(_name, \
37 #define SPRD_GATE_CLK(_struct, _name, _parent, _reg, \
38 _enable_mask, _flags, _gate_flags) \
39 SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, 0, \
40 _enable_mask, _flags, _gate_flags, \
43 #define SPRD_SC_GATE_CLK(_struct, _name, _parent, _reg, _sc_offset, \
44 _enable_mask, _flags, _gate_flags) \
45 SPRD_SC_GATE_CLK_OPS(_struct, _name, _parent, _reg, _sc_offset, \
46 _enable_mask, _flags, _gate_flags, \
49 static inline struct sprd_gate
*hw_to_sprd_gate(const struct clk_hw
*hw
)
51 struct sprd_clk_common
*common
= hw_to_sprd_clk_common(hw
);
53 return container_of(common
, struct sprd_gate
, common
);
56 extern const struct clk_ops sprd_gate_ops
;
57 extern const struct clk_ops sprd_sc_gate_ops
;
59 #endif /* _SPRD_GATE_H_ */