1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
9 #include <linux/clk-provider.h>
11 #include "ccu_common.h"
16 struct ccu_common common
;
19 #define SUNXI_CCU_GATE(_struct, _name, _parent, _reg, _gate, _flags) \
20 struct ccu_gate _struct = { \
24 .hw.init = CLK_HW_INIT(_name, \
31 #define SUNXI_CCU_GATE_HW(_struct, _name, _parent, _reg, _gate, _flags) \
32 struct ccu_gate _struct = { \
36 .hw.init = CLK_HW_INIT_HW(_name, \
43 #define SUNXI_CCU_GATE_FW(_struct, _name, _parent, _reg, _gate, _flags) \
44 struct ccu_gate _struct = { \
48 .hw.init = CLK_HW_INIT_FW_NAME(_name, \
56 * The following two macros allow the re-use of the data structure
57 * holding the parent info.
59 #define SUNXI_CCU_GATE_HWS(_struct, _name, _parent, _reg, _gate, _flags) \
60 struct ccu_gate _struct = { \
64 .hw.init = CLK_HW_INIT_HWS(_name, \
71 #define SUNXI_CCU_GATE_DATA(_struct, _name, _data, _reg, _gate, _flags) \
72 struct ccu_gate _struct = { \
77 CLK_HW_INIT_PARENTS_DATA(_name, \
84 static inline struct ccu_gate
*hw_to_ccu_gate(struct clk_hw
*hw
)
86 struct ccu_common
*common
= hw_to_ccu_common(hw
);
88 return container_of(common
, struct ccu_gate
, common
);
91 void ccu_gate_helper_disable(struct ccu_common
*common
, u32 gate
);
92 int ccu_gate_helper_enable(struct ccu_common
*common
, u32 gate
);
93 int ccu_gate_helper_is_enabled(struct ccu_common
*common
, u32 gate
);
95 extern const struct clk_ops ccu_gate_ops
;
97 #endif /* _CCU_GATE_H_ */