2015-04-23 16:35:39 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 MediaTek Inc.
|
|
|
|
* Author: James Liao <jamesjj.liao@mediatek.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_CLK_GATE_H
|
|
|
|
#define __DRV_CLK_GATE_H
|
|
|
|
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
#include <linux/clk-provider.h>
|
|
|
|
|
2015-06-20 06:00:46 +08:00
|
|
|
struct clk;
|
|
|
|
|
2015-04-23 16:35:39 +08: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 23:51:46 +08:00
|
|
|
static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
|
2015-04-23 16:35:39 +08: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 15:43:05 +08: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 16:35:39 +08: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,
|
|
|
|
const struct clk_ops *ops);
|
|
|
|
|
|
|
|
#endif /* __DRV_CLK_GATE_H */
|