Merge tag 'iwlwifi-for-kalle-2015-07-30' of https://git.kernel.org/pub/scm/linux...
[linux-2.6-microblaze.git] / drivers / clk / mediatek / clk-gate.h
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>
19 #include <linux/clk.h>
20 #include <linux/clk-provider.h>
21
22 struct mtk_clk_gate {
23         struct clk_hw   hw;
24         struct regmap   *regmap;
25         int             set_ofs;
26         int             clr_ofs;
27         int             sta_ofs;
28         u8              bit;
29 };
30
31 static inline struct mtk_clk_gate *to_clk_gate(struct clk_hw *hw)
32 {
33         return container_of(hw, struct mtk_clk_gate, hw);
34 }
35
36 extern const struct clk_ops mtk_clk_gate_ops_setclr;
37 extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
38
39 struct clk *mtk_clk_register_gate(
40                 const char *name,
41                 const char *parent_name,
42                 struct regmap *regmap,
43                 int set_ofs,
44                 int clr_ofs,
45                 int sta_ofs,
46                 u8 bit,
47                 const struct clk_ops *ops);
48
49 #endif /* __DRV_CLK_GATE_H */