61 lines · c
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_H8#define __DRV_CLK_GATE_H9 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;22 23struct mtk_gate_regs {24 u32 sta_ofs;25 u32 clr_ofs;26 u32 set_ofs;27};28 29struct mtk_gate {30 int id;31 const char *name;32 const char *parent_name;33 const struct mtk_gate_regs *regs;34 int shift;35 const struct clk_ops *ops;36 unsigned long flags;37};38 39#define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \40 _ops, _flags) { \41 .id = _id, \42 .name = _name, \43 .parent_name = _parent, \44 .regs = _regs, \45 .shift = _shift, \46 .ops = _ops, \47 .flags = _flags, \48 }49 50#define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \51 GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)52 53int mtk_clk_register_gates(struct device *dev, struct device_node *node,54 const struct mtk_gate *clks, int num,55 struct clk_hw_onecell_data *clk_data);56 57void mtk_clk_unregister_gates(const struct mtk_gate *clks, int num,58 struct clk_hw_onecell_data *clk_data);59 60#endif /* __DRV_CLK_GATE_H */61