Linux 4.18.10
[linux/fpc-iii.git] / drivers / clk / sunxi-ng / ccu_gate.h
blob4466169bd2d77a7694c1c8c5a9a3f46ea480a7cc
1 /*
2 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef _CCU_GATE_H_
15 #define _CCU_GATE_H_
17 #include <linux/clk-provider.h>
19 #include "ccu_common.h"
21 struct ccu_gate {
22 u32 enable;
24 struct ccu_common common;
27 #define SUNXI_CCU_GATE(_struct, _name, _parent, _reg, _gate, _flags) \
28 struct ccu_gate _struct = { \
29 .enable = _gate, \
30 .common = { \
31 .reg = _reg, \
32 .hw.init = CLK_HW_INIT(_name, \
33 _parent, \
34 &ccu_gate_ops, \
35 _flags), \
36 } \
39 static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw)
41 struct ccu_common *common = hw_to_ccu_common(hw);
43 return container_of(common, struct ccu_gate, common);
46 void ccu_gate_helper_disable(struct ccu_common *common, u32 gate);
47 int ccu_gate_helper_enable(struct ccu_common *common, u32 gate);
48 int ccu_gate_helper_is_enabled(struct ccu_common *common, u32 gate);
50 extern const struct clk_ops ccu_gate_ops;
52 #endif /* _CCU_GATE_H_ */