Commit ee488dc9 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Stephen Boyd
Browse files

clk: mediatek: gate: Internalize clk implementation



struct mtk_clk_gate and mtk_clk_register_gate() are not used outside of
the gate clk library. Only the API that handles a list of clks is used
by the individual platform clk drivers.

Internalize the parts that aren't used outside of the implementation.

Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Reviewed-by: default avatarMiles Chen <miles.chen@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220208124034.414635-4-wenst@chromium.org


Reviewed-by: default avatarChun-Jie Chen <chun-jie.chen@mediatek.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 19b8d438
Loading
Loading
Loading
Loading
+23 −12
Original line number Original line Diff line number Diff line
@@ -11,11 +11,28 @@
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/clkdev.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/container_of.h>
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/regmap.h>


#include "clk-gate.h"
#include "clk-gate.h"


struct mtk_clk_gate {
	struct clk_hw	hw;
	struct regmap	*regmap;
	int		set_ofs;
	int		clr_ofs;
	int		sta_ofs;
	u8		bit;
};

static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
{
	return container_of(hw, struct mtk_clk_gate, hw);
}

static u32 mtk_get_clockgating(struct clk_hw *hw)
static u32 mtk_get_clockgating(struct clk_hw *hw)
{
{
	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
@@ -140,17 +157,12 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = {
};
};
EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_no_setclr_inv);
EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_no_setclr_inv);


struct clk *mtk_clk_register_gate(
static struct clk *mtk_clk_register_gate(const char *name,
		const char *name,
					 const char *parent_name,
					 const char *parent_name,
		struct regmap *regmap,
					 struct regmap *regmap, int set_ofs,
		int set_ofs,
					 int clr_ofs, int sta_ofs, u8 bit,
		int clr_ofs,
		int sta_ofs,
		u8 bit,
					 const struct clk_ops *ops,
					 const struct clk_ops *ops,
		unsigned long flags,
					 unsigned long flags, struct device *dev)
		struct device *dev)
{
{
	struct mtk_clk_gate *cg;
	struct mtk_clk_gate *cg;
	struct clk *clk;
	struct clk *clk;
@@ -180,7 +192,6 @@ struct clk *mtk_clk_register_gate(


	return clk;
	return clk;
}
}
EXPORT_SYMBOL_GPL(mtk_clk_register_gate);


int mtk_clk_register_gates_with_dev(struct device_node *node,
int mtk_clk_register_gates_with_dev(struct device_node *node,
				    const struct mtk_gate *clks, int num,
				    const struct mtk_gate *clks, int num,
+2 −29
Original line number Original line Diff line number Diff line
@@ -7,42 +7,15 @@
#ifndef __DRV_CLK_GATE_H
#ifndef __DRV_CLK_GATE_H
#define __DRV_CLK_GATE_H
#define __DRV_CLK_GATE_H


#include <linux/regmap.h>
#include <linux/clk-provider.h>
#include <linux/clk-provider.h>

#include <linux/device.h>
struct clk;
#include <linux/of.h>

struct mtk_clk_gate {
	struct clk_hw	hw;
	struct regmap	*regmap;
	int		set_ofs;
	int		clr_ofs;
	int		sta_ofs;
	u8		bit;
};

static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
{
	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;
extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;


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,
		unsigned long flags,
		struct device *dev);

struct mtk_gate_regs {
struct mtk_gate_regs {
	u32 sta_ofs;
	u32 sta_ofs;
	u32 clr_ofs;
	u32 clr_ofs;