Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2014 MediaTek Inc.
4 * Author: James Liao <jamesjj.liao@mediatek.com>
5 */
6
7#ifndef __DRV_CLK_GATE_H
8#define __DRV_CLK_GATE_H
9
10#include <linux/types.h>
11
12struct clk;
13struct clk_hw_onecell_data;
14struct clk_ops;
15struct device;
16struct device_node;
17
18extern const struct clk_ops mtk_clk_gate_ops_setclr;
19extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
20extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
21extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
22extern const struct clk_ops mtk_clk_gate_hwv_ops_setclr;
23extern const struct clk_ops mtk_clk_gate_hwv_ops_setclr_inv;
24
25struct mtk_gate_regs {
26 u32 sta_ofs;
27 u32 clr_ofs;
28 u32 set_ofs;
29};
30
31struct mtk_gate {
32 int id;
33 const char *name;
34 const char *parent_name;
35 const struct mtk_gate_regs *regs;
36 const struct mtk_gate_regs *hwv_regs;
37 int shift;
38 const struct clk_ops *ops;
39 unsigned long flags;
40};
41
42#define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \
43 _ops, _flags) { \
44 .id = _id, \
45 .name = _name, \
46 .parent_name = _parent, \
47 .regs = _regs, \
48 .shift = _shift, \
49 .ops = _ops, \
50 .flags = _flags, \
51 }
52
53#define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \
54 GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
55
56int mtk_clk_register_gates(struct device *dev, struct device_node *node,
57 const struct mtk_gate *clks, int num,
58 struct clk_hw_onecell_data *clk_data);
59
60void mtk_clk_unregister_gates(const struct mtk_gate *clks, int num,
61 struct clk_hw_onecell_data *clk_data);
62
63#endif /* __DRV_CLK_GATE_H */