2019-05-27 02:55:21 -04:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-04-23 04:35:39 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 MediaTek Inc.
|
|
|
|
* Author: James Liao <jamesjj.liao@mediatek.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_CLK_GATE_H
|
|
|
|
#define __DRV_CLK_GATE_H
|
|
|
|
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
#include <linux/clk-provider.h>
|
|
|
|
|
2015-06-19 18:00:46 -04:00
|
|
|
struct clk;
|
|
|
|
|
2015-04-23 04:35:39 -04:00
|
|
|
struct mtk_clk_gate {
|
|
|
|
struct clk_hw hw;
|
|
|
|
struct regmap *regmap;
|
|
|
|
int set_ofs;
|
|
|
|
int clr_ofs;
|
|
|
|
int sta_ofs;
|
|
|
|
u8 bit;
|
|
|
|
};
|
|
|
|
|
2016-01-08 10:51:46 -05:00
|
|
|
static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
|
2015-04-23 04:35:39 -04:00
|
|
|
{
|
|
|
|
return container_of(hw, struct mtk_clk_gate, hw);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const struct clk_ops mtk_clk_gate_ops_setclr;
|
|
|
|
extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
|
2016-11-04 03:43:05 -04:00
|
|
|
extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
|
|
|
|
extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
|
2015-04-23 04:35:39 -04:00
|
|
|
|
|
|
|
struct clk *mtk_clk_register_gate(
|
|
|
|
const char *name,
|
|
|
|
const char *parent_name,
|
|
|
|
struct regmap *regmap,
|
|
|
|
int set_ofs,
|
|
|
|
int clr_ofs,
|
|
|
|
int sta_ofs,
|
|
|
|
u8 bit,
|
2019-02-14 11:32:30 -05:00
|
|
|
const struct clk_ops *ops,
|
2019-09-02 05:00:57 -04:00
|
|
|
unsigned long flags,
|
|
|
|
struct device *dev);
|
2015-04-23 04:35:39 -04:00
|
|
|
|
2019-03-05 00:05:45 -05:00
|
|
|
#define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \
|
|
|
|
_ops, _flags) { \
|
|
|
|
.id = _id, \
|
|
|
|
.name = _name, \
|
|
|
|
.parent_name = _parent, \
|
|
|
|
.regs = _regs, \
|
|
|
|
.shift = _shift, \
|
|
|
|
.ops = _ops, \
|
|
|
|
.flags = _flags, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \
|
|
|
|
GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
|
|
|
|
|
2015-04-23 04:35:39 -04:00
|
|
|
#endif /* __DRV_CLK_GATE_H */
|