]>
Commit | Line | Data |
---|---|---|
9741b1a6 JL |
1 | /* |
2 | * Copyright (c) 2014 MediaTek Inc. | |
3 | * Author: James Liao <jamesjj.liao@mediatek.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License version 2 as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | */ | |
14 | ||
15 | #ifndef __DRV_CLK_GATE_H | |
16 | #define __DRV_CLK_GATE_H | |
17 | ||
18 | #include <linux/regmap.h> | |
9741b1a6 JL |
19 | #include <linux/clk-provider.h> |
20 | ||
c726639b SB |
21 | struct clk; |
22 | ||
9741b1a6 JL |
23 | struct mtk_clk_gate { |
24 | struct clk_hw hw; | |
25 | struct regmap *regmap; | |
26 | int set_ofs; | |
27 | int clr_ofs; | |
28 | int sta_ofs; | |
29 | u8 bit; | |
30 | }; | |
31 | ||
5fd9c05c | 32 | static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw) |
9741b1a6 JL |
33 | { |
34 | return container_of(hw, struct mtk_clk_gate, hw); | |
35 | } | |
36 | ||
37 | extern const struct clk_ops mtk_clk_gate_ops_setclr; | |
38 | extern const struct clk_ops mtk_clk_gate_ops_setclr_inv; | |
e9862118 SW |
39 | extern const struct clk_ops mtk_clk_gate_ops_no_setclr; |
40 | extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv; | |
9741b1a6 JL |
41 | |
42 | struct clk *mtk_clk_register_gate( | |
43 | const char *name, | |
44 | const char *parent_name, | |
45 | struct regmap *regmap, | |
46 | int set_ofs, | |
47 | int clr_ofs, | |
48 | int sta_ofs, | |
49 | u8 bit, | |
5a1cc4c2 JM |
50 | const struct clk_ops *ops, |
51 | unsigned long flags); | |
9741b1a6 | 52 | |
acddfc2c WL |
53 | #define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \ |
54 | _ops, _flags) { \ | |
55 | .id = _id, \ | |
56 | .name = _name, \ | |
57 | .parent_name = _parent, \ | |
58 | .regs = _regs, \ | |
59 | .shift = _shift, \ | |
60 | .ops = _ops, \ | |
61 | .flags = _flags, \ | |
62 | } | |
63 | ||
64 | #define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \ | |
65 | GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0) | |
66 | ||
9741b1a6 | 67 | #endif /* __DRV_CLK_GATE_H */ |