WIP FPC-III support
[linux/fpc-iii.git] / drivers / clk / mediatek / clk-gate.h
blob3c3329ec54b7afc9ca7aaac38a4e8e18a5ac3f57
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2014 MediaTek Inc.
4 * Author: James Liao <jamesjj.liao@mediatek.com>
5 */
7 #ifndef __DRV_CLK_GATE_H
8 #define __DRV_CLK_GATE_H
10 #include <linux/regmap.h>
11 #include <linux/clk-provider.h>
13 struct clk;
15 struct mtk_clk_gate {
16 struct clk_hw hw;
17 struct regmap *regmap;
18 int set_ofs;
19 int clr_ofs;
20 int sta_ofs;
21 u8 bit;
24 static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
26 return container_of(hw, struct mtk_clk_gate, hw);
29 extern const struct clk_ops mtk_clk_gate_ops_setclr;
30 extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
31 extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
32 extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
34 struct clk *mtk_clk_register_gate(
35 const char *name,
36 const char *parent_name,
37 struct regmap *regmap,
38 int set_ofs,
39 int clr_ofs,
40 int sta_ofs,
41 u8 bit,
42 const struct clk_ops *ops,
43 unsigned long flags,
44 struct device *dev);
46 #define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \
47 _ops, _flags) { \
48 .id = _id, \
49 .name = _name, \
50 .parent_name = _parent, \
51 .regs = _regs, \
52 .shift = _shift, \
53 .ops = _ops, \
54 .flags = _flags, \
57 #define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \
58 GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
60 #endif /* __DRV_CLK_GATE_H */