hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/clk/sunxi-ng/ccu_gate.h
....@@ -1,14 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
3
- *
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.
7
- *
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.
124 */
135
146 #ifndef _CCU_GATE_H_
....@@ -36,6 +28,59 @@
3628 } \
3729 }
3830
31
+#define SUNXI_CCU_GATE_HW(_struct, _name, _parent, _reg, _gate, _flags) \
32
+ struct ccu_gate _struct = { \
33
+ .enable = _gate, \
34
+ .common = { \
35
+ .reg = _reg, \
36
+ .hw.init = CLK_HW_INIT_HW(_name, \
37
+ _parent, \
38
+ &ccu_gate_ops, \
39
+ _flags), \
40
+ } \
41
+ }
42
+
43
+#define SUNXI_CCU_GATE_FW(_struct, _name, _parent, _reg, _gate, _flags) \
44
+ struct ccu_gate _struct = { \
45
+ .enable = _gate, \
46
+ .common = { \
47
+ .reg = _reg, \
48
+ .hw.init = CLK_HW_INIT_FW_NAME(_name, \
49
+ _parent, \
50
+ &ccu_gate_ops, \
51
+ _flags), \
52
+ } \
53
+ }
54
+
55
+/*
56
+ * The following two macros allow the re-use of the data structure
57
+ * holding the parent info.
58
+ */
59
+#define SUNXI_CCU_GATE_HWS(_struct, _name, _parent, _reg, _gate, _flags) \
60
+ struct ccu_gate _struct = { \
61
+ .enable = _gate, \
62
+ .common = { \
63
+ .reg = _reg, \
64
+ .hw.init = CLK_HW_INIT_HWS(_name, \
65
+ _parent, \
66
+ &ccu_gate_ops, \
67
+ _flags), \
68
+ } \
69
+ }
70
+
71
+#define SUNXI_CCU_GATE_DATA(_struct, _name, _data, _reg, _gate, _flags) \
72
+ struct ccu_gate _struct = { \
73
+ .enable = _gate, \
74
+ .common = { \
75
+ .reg = _reg, \
76
+ .hw.init = \
77
+ CLK_HW_INIT_PARENTS_DATA(_name, \
78
+ _data, \
79
+ &ccu_gate_ops, \
80
+ _flags), \
81
+ } \
82
+ }
83
+
3984 static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw)
4085 {
4186 struct ccu_common *common = hw_to_ccu_common(hw);