1 /* SPDX-License-Identifier: GPL-2.0+ */
3 // OWL gate clock driver
5 // Copyright (c) 2014 Actions Semi Inc.
6 // Author: David Liu <liuwei@actions-semi.com>
8 // Copyright (c) 2018 Linaro Ltd.
9 // Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
14 #include "owl-common.h"
23 struct owl_gate_hw gate_hw
;
24 struct owl_clk_common common
;
27 #define OWL_GATE_HW(_reg, _bit_idx, _gate_flags) \
30 .bit_idx = _bit_idx, \
31 .gate_flags = _gate_flags, \
34 #define OWL_GATE(_struct, _name, _parent, _reg, \
35 _bit_idx, _gate_flags, _flags) \
36 struct owl_gate _struct = { \
37 .gate_hw = OWL_GATE_HW(_reg, _bit_idx, _gate_flags), \
40 .hw.init = CLK_HW_INIT(_name, \
47 #define OWL_GATE_NO_PARENT(_struct, _name, _reg, \
48 _bit_idx, _gate_flags, _flags) \
49 struct owl_gate _struct = { \
50 .gate_hw = OWL_GATE_HW(_reg, _bit_idx, _gate_flags), \
53 .hw.init = CLK_HW_INIT_NO_PARENT(_name, \
59 static inline struct owl_gate *hw_to_owl_gate(const struct clk_hw *hw)
61 struct owl_clk_common
*common
= hw_to_owl_clk_common(hw
);
63 return container_of(common
, struct owl_gate
, common
);
66 void owl_gate_set(const struct owl_clk_common
*common
,
67 const struct owl_gate_hw
*gate_hw
, bool enable
);
68 int owl_gate_clk_is_enabled(const struct owl_clk_common
*common
,
69 const struct owl_gate_hw
*gate_hw
);
71 extern const struct clk_ops owl_gate_ops
;
73 #endif /* _OWL_GATE_H_ */