Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2014 MediaTek Inc.
0004  * Author: James Liao <jamesjj.liao@mediatek.com>
0005  */
0006 
0007 #ifndef __DRV_CLK_GATE_H
0008 #define __DRV_CLK_GATE_H
0009 
0010 #include <linux/types.h>
0011 
0012 struct clk;
0013 struct clk_hw_onecell_data;
0014 struct clk_ops;
0015 struct device;
0016 struct device_node;
0017 
0018 extern const struct clk_ops mtk_clk_gate_ops_setclr;
0019 extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
0020 extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
0021 extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
0022 
0023 struct mtk_gate_regs {
0024     u32 sta_ofs;
0025     u32 clr_ofs;
0026     u32 set_ofs;
0027 };
0028 
0029 struct mtk_gate {
0030     int id;
0031     const char *name;
0032     const char *parent_name;
0033     const struct mtk_gate_regs *regs;
0034     int shift;
0035     const struct clk_ops *ops;
0036     unsigned long flags;
0037 };
0038 
0039 #define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift,  \
0040             _ops, _flags) {             \
0041         .id = _id,                  \
0042         .name = _name,                  \
0043         .parent_name = _parent,             \
0044         .regs = _regs,                  \
0045         .shift = _shift,                \
0046         .ops = _ops,                    \
0047         .flags = _flags,                \
0048     }
0049 
0050 #define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops)      \
0051     GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
0052 
0053 int mtk_clk_register_gates(struct device_node *node,
0054                const struct mtk_gate *clks, int num,
0055                struct clk_hw_onecell_data *clk_data);
0056 
0057 int mtk_clk_register_gates_with_dev(struct device_node *node,
0058                     const struct mtk_gate *clks, int num,
0059                     struct clk_hw_onecell_data *clk_data,
0060                     struct device *dev);
0061 
0062 void mtk_clk_unregister_gates(const struct mtk_gate *clks, int num,
0063                   struct clk_hw_onecell_data *clk_data);
0064 
0065 #endif /* __DRV_CLK_GATE_H */