diff options
Diffstat (limited to 'drivers/clk/sunxi-ng/ccu_phase.h')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu_phase.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_phase.h b/drivers/clk/sunxi-ng/ccu_phase.h new file mode 100644 index 000000000000..75a091a4c565 --- /dev/null +++ b/drivers/clk/sunxi-ng/ccu_phase.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * 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. | ||
12 | */ | ||
13 | |||
14 | #ifndef _CCU_PHASE_H_ | ||
15 | #define _CCU_PHASE_H_ | ||
16 | |||
17 | #include <linux/clk-provider.h> | ||
18 | |||
19 | #include "ccu_common.h" | ||
20 | |||
21 | struct ccu_phase { | ||
22 | u8 shift; | ||
23 | u8 width; | ||
24 | |||
25 | struct ccu_common common; | ||
26 | }; | ||
27 | |||
28 | #define SUNXI_CCU_PHASE(_struct, _name, _parent, _reg, _shift, _width, _flags) \ | ||
29 | struct ccu_phase _struct = { \ | ||
30 | .shift = _shift, \ | ||
31 | .width = _width, \ | ||
32 | .common = { \ | ||
33 | .reg = _reg, \ | ||
34 | .hw.init = CLK_HW_INIT(_name, \ | ||
35 | _parent, \ | ||
36 | &ccu_phase_ops, \ | ||
37 | _flags), \ | ||
38 | } \ | ||
39 | } | ||
40 | |||
41 | static inline struct ccu_phase *hw_to_ccu_phase(struct clk_hw *hw) | ||
42 | { | ||
43 | struct ccu_common *common = hw_to_ccu_common(hw); | ||
44 | |||
45 | return container_of(common, struct ccu_phase, common); | ||
46 | } | ||
47 | |||
48 | extern const struct clk_ops ccu_phase_ops; | ||
49 | |||
50 | #endif /* _CCU_PHASE_H_ */ | ||