162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2013 Samsung Electronics Co., Ltd.
462306a36Sopenharmony_ci * Copyright (c) 2013 Linaro Ltd.
562306a36Sopenharmony_ci * Author: Thomas Abraham <thomas.ab@samsung.com>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Common Clock Framework support for all Samsung platforms
862306a36Sopenharmony_ci*/
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __SAMSUNG_CLK_H
1162306a36Sopenharmony_ci#define __SAMSUNG_CLK_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/clk-provider.h>
1462306a36Sopenharmony_ci#include "clk-pll.h"
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/**
1762306a36Sopenharmony_ci * struct samsung_clk_provider: information about clock provider
1862306a36Sopenharmony_ci * @reg_base: virtual address for the register base.
1962306a36Sopenharmony_ci * @dev: clock provider device needed for runtime PM.
2062306a36Sopenharmony_ci * @lock: maintains exclusion between callbacks for a given clock-provider.
2162306a36Sopenharmony_ci * @clk_data: holds clock related data like clk_hw* and number of clocks.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_cistruct samsung_clk_provider {
2462306a36Sopenharmony_ci	void __iomem *reg_base;
2562306a36Sopenharmony_ci	struct device *dev;
2662306a36Sopenharmony_ci	spinlock_t lock;
2762306a36Sopenharmony_ci	/* clk_data must be the last entry due to variable length 'hws' array */
2862306a36Sopenharmony_ci	struct clk_hw_onecell_data clk_data;
2962306a36Sopenharmony_ci};
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/**
3262306a36Sopenharmony_ci * struct samsung_clock_alias: information about mux clock
3362306a36Sopenharmony_ci * @id: platform specific id of the clock.
3462306a36Sopenharmony_ci * @dev_name: name of the device to which this clock belongs.
3562306a36Sopenharmony_ci * @alias: optional clock alias name to be assigned to this clock.
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_cistruct samsung_clock_alias {
3862306a36Sopenharmony_ci	unsigned int		id;
3962306a36Sopenharmony_ci	const char		*dev_name;
4062306a36Sopenharmony_ci	const char		*alias;
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define ALIAS(_id, dname, a)	\
4462306a36Sopenharmony_ci	{							\
4562306a36Sopenharmony_ci		.id		= _id,				\
4662306a36Sopenharmony_ci		.dev_name	= dname,			\
4762306a36Sopenharmony_ci		.alias		= a,				\
4862306a36Sopenharmony_ci	}
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define MHZ (1000 * 1000)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/**
5362306a36Sopenharmony_ci * struct samsung_fixed_rate_clock: information about fixed-rate clock
5462306a36Sopenharmony_ci * @id: platform specific id of the clock.
5562306a36Sopenharmony_ci * @name: name of this fixed-rate clock.
5662306a36Sopenharmony_ci * @parent_name: optional parent clock name.
5762306a36Sopenharmony_ci * @flags: optional fixed-rate clock flags.
5862306a36Sopenharmony_ci * @fixed-rate: fixed clock rate of this clock.
5962306a36Sopenharmony_ci */
6062306a36Sopenharmony_cistruct samsung_fixed_rate_clock {
6162306a36Sopenharmony_ci	unsigned int		id;
6262306a36Sopenharmony_ci	char			*name;
6362306a36Sopenharmony_ci	const char		*parent_name;
6462306a36Sopenharmony_ci	unsigned long		flags;
6562306a36Sopenharmony_ci	unsigned long		fixed_rate;
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define FRATE(_id, cname, pname, f, frate)		\
6962306a36Sopenharmony_ci	{						\
7062306a36Sopenharmony_ci		.id		= _id,			\
7162306a36Sopenharmony_ci		.name		= cname,		\
7262306a36Sopenharmony_ci		.parent_name	= pname,		\
7362306a36Sopenharmony_ci		.flags		= f,			\
7462306a36Sopenharmony_ci		.fixed_rate	= frate,		\
7562306a36Sopenharmony_ci	}
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*
7862306a36Sopenharmony_ci * struct samsung_fixed_factor_clock: information about fixed-factor clock
7962306a36Sopenharmony_ci * @id: platform specific id of the clock.
8062306a36Sopenharmony_ci * @name: name of this fixed-factor clock.
8162306a36Sopenharmony_ci * @parent_name: parent clock name.
8262306a36Sopenharmony_ci * @mult: fixed multiplication factor.
8362306a36Sopenharmony_ci * @div: fixed division factor.
8462306a36Sopenharmony_ci * @flags: optional fixed-factor clock flags.
8562306a36Sopenharmony_ci */
8662306a36Sopenharmony_cistruct samsung_fixed_factor_clock {
8762306a36Sopenharmony_ci	unsigned int		id;
8862306a36Sopenharmony_ci	char			*name;
8962306a36Sopenharmony_ci	const char		*parent_name;
9062306a36Sopenharmony_ci	unsigned long		mult;
9162306a36Sopenharmony_ci	unsigned long		div;
9262306a36Sopenharmony_ci	unsigned long		flags;
9362306a36Sopenharmony_ci};
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci#define FFACTOR(_id, cname, pname, m, d, f)		\
9662306a36Sopenharmony_ci	{						\
9762306a36Sopenharmony_ci		.id		= _id,			\
9862306a36Sopenharmony_ci		.name		= cname,		\
9962306a36Sopenharmony_ci		.parent_name	= pname,		\
10062306a36Sopenharmony_ci		.mult		= m,			\
10162306a36Sopenharmony_ci		.div		= d,			\
10262306a36Sopenharmony_ci		.flags		= f,			\
10362306a36Sopenharmony_ci	}
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci/**
10662306a36Sopenharmony_ci * struct samsung_mux_clock: information about mux clock
10762306a36Sopenharmony_ci * @id: platform specific id of the clock.
10862306a36Sopenharmony_ci * @name: name of this mux clock.
10962306a36Sopenharmony_ci * @parent_names: array of pointer to parent clock names.
11062306a36Sopenharmony_ci * @num_parents: number of parents listed in @parent_names.
11162306a36Sopenharmony_ci * @flags: optional flags for basic clock.
11262306a36Sopenharmony_ci * @offset: offset of the register for configuring the mux.
11362306a36Sopenharmony_ci * @shift: starting bit location of the mux control bit-field in @reg.
11462306a36Sopenharmony_ci * @width: width of the mux control bit-field in @reg.
11562306a36Sopenharmony_ci * @mux_flags: flags for mux-type clock.
11662306a36Sopenharmony_ci */
11762306a36Sopenharmony_cistruct samsung_mux_clock {
11862306a36Sopenharmony_ci	unsigned int		id;
11962306a36Sopenharmony_ci	const char		*name;
12062306a36Sopenharmony_ci	const char		*const *parent_names;
12162306a36Sopenharmony_ci	u8			num_parents;
12262306a36Sopenharmony_ci	unsigned long		flags;
12362306a36Sopenharmony_ci	unsigned long		offset;
12462306a36Sopenharmony_ci	u8			shift;
12562306a36Sopenharmony_ci	u8			width;
12662306a36Sopenharmony_ci	u8			mux_flags;
12762306a36Sopenharmony_ci};
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define __MUX(_id, cname, pnames, o, s, w, f, mf)		\
13062306a36Sopenharmony_ci	{							\
13162306a36Sopenharmony_ci		.id		= _id,				\
13262306a36Sopenharmony_ci		.name		= cname,			\
13362306a36Sopenharmony_ci		.parent_names	= pnames,			\
13462306a36Sopenharmony_ci		.num_parents	= ARRAY_SIZE(pnames),		\
13562306a36Sopenharmony_ci		.flags		= (f) | CLK_SET_RATE_NO_REPARENT, \
13662306a36Sopenharmony_ci		.offset		= o,				\
13762306a36Sopenharmony_ci		.shift		= s,				\
13862306a36Sopenharmony_ci		.width		= w,				\
13962306a36Sopenharmony_ci		.mux_flags	= mf,				\
14062306a36Sopenharmony_ci	}
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci#define MUX(_id, cname, pnames, o, s, w)			\
14362306a36Sopenharmony_ci	__MUX(_id, cname, pnames, o, s, w, 0, 0)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define MUX_F(_id, cname, pnames, o, s, w, f, mf)		\
14662306a36Sopenharmony_ci	__MUX(_id, cname, pnames, o, s, w, f, mf)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/**
14962306a36Sopenharmony_ci * @id: platform specific id of the clock.
15062306a36Sopenharmony_ci * struct samsung_div_clock: information about div clock
15162306a36Sopenharmony_ci * @name: name of this div clock.
15262306a36Sopenharmony_ci * @parent_name: name of the parent clock.
15362306a36Sopenharmony_ci * @flags: optional flags for basic clock.
15462306a36Sopenharmony_ci * @offset: offset of the register for configuring the div.
15562306a36Sopenharmony_ci * @shift: starting bit location of the div control bit-field in @reg.
15662306a36Sopenharmony_ci * @div_flags: flags for div-type clock.
15762306a36Sopenharmony_ci */
15862306a36Sopenharmony_cistruct samsung_div_clock {
15962306a36Sopenharmony_ci	unsigned int		id;
16062306a36Sopenharmony_ci	const char		*name;
16162306a36Sopenharmony_ci	const char		*parent_name;
16262306a36Sopenharmony_ci	unsigned long		flags;
16362306a36Sopenharmony_ci	unsigned long		offset;
16462306a36Sopenharmony_ci	u8			shift;
16562306a36Sopenharmony_ci	u8			width;
16662306a36Sopenharmony_ci	u8			div_flags;
16762306a36Sopenharmony_ci	struct clk_div_table	*table;
16862306a36Sopenharmony_ci};
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci#define __DIV(_id, cname, pname, o, s, w, f, df, t)	\
17162306a36Sopenharmony_ci	{							\
17262306a36Sopenharmony_ci		.id		= _id,				\
17362306a36Sopenharmony_ci		.name		= cname,			\
17462306a36Sopenharmony_ci		.parent_name	= pname,			\
17562306a36Sopenharmony_ci		.flags		= f,				\
17662306a36Sopenharmony_ci		.offset		= o,				\
17762306a36Sopenharmony_ci		.shift		= s,				\
17862306a36Sopenharmony_ci		.width		= w,				\
17962306a36Sopenharmony_ci		.div_flags	= df,				\
18062306a36Sopenharmony_ci		.table		= t,				\
18162306a36Sopenharmony_ci	}
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define DIV(_id, cname, pname, o, s, w)				\
18462306a36Sopenharmony_ci	__DIV(_id, cname, pname, o, s, w, 0, 0, NULL)
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci#define DIV_F(_id, cname, pname, o, s, w, f, df)		\
18762306a36Sopenharmony_ci	__DIV(_id, cname, pname, o, s, w, f, df, NULL)
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define DIV_T(_id, cname, pname, o, s, w, t)			\
19062306a36Sopenharmony_ci	__DIV(_id, cname, pname, o, s, w, 0, 0, t)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/**
19362306a36Sopenharmony_ci * struct samsung_gate_clock: information about gate clock
19462306a36Sopenharmony_ci * @id: platform specific id of the clock.
19562306a36Sopenharmony_ci * @name: name of this gate clock.
19662306a36Sopenharmony_ci * @parent_name: name of the parent clock.
19762306a36Sopenharmony_ci * @flags: optional flags for basic clock.
19862306a36Sopenharmony_ci * @offset: offset of the register for configuring the gate.
19962306a36Sopenharmony_ci * @bit_idx: bit index of the gate control bit-field in @reg.
20062306a36Sopenharmony_ci * @gate_flags: flags for gate-type clock.
20162306a36Sopenharmony_ci */
20262306a36Sopenharmony_cistruct samsung_gate_clock {
20362306a36Sopenharmony_ci	unsigned int		id;
20462306a36Sopenharmony_ci	const char		*name;
20562306a36Sopenharmony_ci	const char		*parent_name;
20662306a36Sopenharmony_ci	unsigned long		flags;
20762306a36Sopenharmony_ci	unsigned long		offset;
20862306a36Sopenharmony_ci	u8			bit_idx;
20962306a36Sopenharmony_ci	u8			gate_flags;
21062306a36Sopenharmony_ci};
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci#define __GATE(_id, cname, pname, o, b, f, gf)			\
21362306a36Sopenharmony_ci	{							\
21462306a36Sopenharmony_ci		.id		= _id,				\
21562306a36Sopenharmony_ci		.name		= cname,			\
21662306a36Sopenharmony_ci		.parent_name	= pname,			\
21762306a36Sopenharmony_ci		.flags		= f,				\
21862306a36Sopenharmony_ci		.offset		= o,				\
21962306a36Sopenharmony_ci		.bit_idx	= b,				\
22062306a36Sopenharmony_ci		.gate_flags	= gf,				\
22162306a36Sopenharmony_ci	}
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define GATE(_id, cname, pname, o, b, f, gf)			\
22462306a36Sopenharmony_ci	__GATE(_id, cname, pname, o, b, f, gf)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci#define PNAME(x) static const char * const x[] __initconst
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci/**
22962306a36Sopenharmony_ci * struct samsung_clk_reg_dump: register dump of clock controller registers.
23062306a36Sopenharmony_ci * @offset: clock register offset from the controller base address.
23162306a36Sopenharmony_ci * @value: the value to be register at offset.
23262306a36Sopenharmony_ci */
23362306a36Sopenharmony_cistruct samsung_clk_reg_dump {
23462306a36Sopenharmony_ci	u32	offset;
23562306a36Sopenharmony_ci	u32	value;
23662306a36Sopenharmony_ci};
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci/**
23962306a36Sopenharmony_ci * struct samsung_pll_clock: information about pll clock
24062306a36Sopenharmony_ci * @id: platform specific id of the clock.
24162306a36Sopenharmony_ci * @name: name of this pll clock.
24262306a36Sopenharmony_ci * @parent_name: name of the parent clock.
24362306a36Sopenharmony_ci * @flags: optional flags for basic clock.
24462306a36Sopenharmony_ci * @con_offset: offset of the register for configuring the PLL.
24562306a36Sopenharmony_ci * @lock_offset: offset of the register for locking the PLL.
24662306a36Sopenharmony_ci * @type: Type of PLL to be registered.
24762306a36Sopenharmony_ci */
24862306a36Sopenharmony_cistruct samsung_pll_clock {
24962306a36Sopenharmony_ci	unsigned int		id;
25062306a36Sopenharmony_ci	const char		*name;
25162306a36Sopenharmony_ci	const char		*parent_name;
25262306a36Sopenharmony_ci	unsigned long		flags;
25362306a36Sopenharmony_ci	int			con_offset;
25462306a36Sopenharmony_ci	int			lock_offset;
25562306a36Sopenharmony_ci	enum samsung_pll_type	type;
25662306a36Sopenharmony_ci	const struct samsung_pll_rate_table *rate_table;
25762306a36Sopenharmony_ci};
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci#define __PLL(_typ, _id, _name, _pname, _flags, _lock, _con, _rtable)	\
26062306a36Sopenharmony_ci	{								\
26162306a36Sopenharmony_ci		.id		= _id,					\
26262306a36Sopenharmony_ci		.type		= _typ,					\
26362306a36Sopenharmony_ci		.name		= _name,				\
26462306a36Sopenharmony_ci		.parent_name	= _pname,				\
26562306a36Sopenharmony_ci		.flags		= _flags,				\
26662306a36Sopenharmony_ci		.con_offset	= _con,					\
26762306a36Sopenharmony_ci		.lock_offset	= _lock,				\
26862306a36Sopenharmony_ci		.rate_table	= _rtable,				\
26962306a36Sopenharmony_ci	}
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci#define PLL(_typ, _id, _name, _pname, _lock, _con, _rtable)	\
27262306a36Sopenharmony_ci	__PLL(_typ, _id, _name, _pname, CLK_GET_RATE_NOCACHE, _lock,	\
27362306a36Sopenharmony_ci	      _con, _rtable)
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_cistruct samsung_cpu_clock {
27662306a36Sopenharmony_ci	unsigned int	id;
27762306a36Sopenharmony_ci	const char	*name;
27862306a36Sopenharmony_ci	unsigned int	parent_id;
27962306a36Sopenharmony_ci	unsigned int	alt_parent_id;
28062306a36Sopenharmony_ci	unsigned long	flags;
28162306a36Sopenharmony_ci	int		offset;
28262306a36Sopenharmony_ci	const struct exynos_cpuclk_cfg_data *cfg;
28362306a36Sopenharmony_ci};
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci#define CPU_CLK(_id, _name, _pid, _apid, _flags, _offset, _cfg) \
28662306a36Sopenharmony_ci	{							\
28762306a36Sopenharmony_ci		.id		  = _id,			\
28862306a36Sopenharmony_ci		.name		  = _name,			\
28962306a36Sopenharmony_ci		.parent_id	  = _pid,			\
29062306a36Sopenharmony_ci		.alt_parent_id	  = _apid,			\
29162306a36Sopenharmony_ci		.flags		  = _flags,			\
29262306a36Sopenharmony_ci		.offset		  = _offset,			\
29362306a36Sopenharmony_ci		.cfg		  = _cfg,			\
29462306a36Sopenharmony_ci	}
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_cistruct samsung_clock_reg_cache {
29762306a36Sopenharmony_ci	struct list_head node;
29862306a36Sopenharmony_ci	void __iomem *reg_base;
29962306a36Sopenharmony_ci	struct samsung_clk_reg_dump *rdump;
30062306a36Sopenharmony_ci	unsigned int rd_num;
30162306a36Sopenharmony_ci	const struct samsung_clk_reg_dump *rsuspend;
30262306a36Sopenharmony_ci	unsigned int rsuspend_num;
30362306a36Sopenharmony_ci};
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_cistruct samsung_cmu_info {
30662306a36Sopenharmony_ci	/* list of pll clocks and respective count */
30762306a36Sopenharmony_ci	const struct samsung_pll_clock *pll_clks;
30862306a36Sopenharmony_ci	unsigned int nr_pll_clks;
30962306a36Sopenharmony_ci	/* list of mux clocks and respective count */
31062306a36Sopenharmony_ci	const struct samsung_mux_clock *mux_clks;
31162306a36Sopenharmony_ci	unsigned int nr_mux_clks;
31262306a36Sopenharmony_ci	/* list of div clocks and respective count */
31362306a36Sopenharmony_ci	const struct samsung_div_clock *div_clks;
31462306a36Sopenharmony_ci	unsigned int nr_div_clks;
31562306a36Sopenharmony_ci	/* list of gate clocks and respective count */
31662306a36Sopenharmony_ci	const struct samsung_gate_clock *gate_clks;
31762306a36Sopenharmony_ci	unsigned int nr_gate_clks;
31862306a36Sopenharmony_ci	/* list of fixed clocks and respective count */
31962306a36Sopenharmony_ci	const struct samsung_fixed_rate_clock *fixed_clks;
32062306a36Sopenharmony_ci	unsigned int nr_fixed_clks;
32162306a36Sopenharmony_ci	/* list of fixed factor clocks and respective count */
32262306a36Sopenharmony_ci	const struct samsung_fixed_factor_clock *fixed_factor_clks;
32362306a36Sopenharmony_ci	unsigned int nr_fixed_factor_clks;
32462306a36Sopenharmony_ci	/* total number of clocks with IDs assigned*/
32562306a36Sopenharmony_ci	unsigned int nr_clk_ids;
32662306a36Sopenharmony_ci	/* list of cpu clocks and respective count */
32762306a36Sopenharmony_ci	const struct samsung_cpu_clock *cpu_clks;
32862306a36Sopenharmony_ci	unsigned int nr_cpu_clks;
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci	/* list and number of clocks registers */
33162306a36Sopenharmony_ci	const unsigned long *clk_regs;
33262306a36Sopenharmony_ci	unsigned int nr_clk_regs;
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci	/* list and number of clocks registers to set before suspend */
33562306a36Sopenharmony_ci	const struct samsung_clk_reg_dump *suspend_regs;
33662306a36Sopenharmony_ci	unsigned int nr_suspend_regs;
33762306a36Sopenharmony_ci	/* name of the parent clock needed for CMU register access */
33862306a36Sopenharmony_ci	const char *clk_name;
33962306a36Sopenharmony_ci};
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_cistruct samsung_clk_provider *samsung_clk_init(struct device *dev,
34262306a36Sopenharmony_ci			void __iomem *base, unsigned long nr_clks);
34362306a36Sopenharmony_civoid samsung_clk_of_add_provider(struct device_node *np,
34462306a36Sopenharmony_ci			struct samsung_clk_provider *ctx);
34562306a36Sopenharmony_civoid samsung_clk_of_register_fixed_ext(
34662306a36Sopenharmony_ci			struct samsung_clk_provider *ctx,
34762306a36Sopenharmony_ci			struct samsung_fixed_rate_clock *fixed_rate_clk,
34862306a36Sopenharmony_ci			unsigned int nr_fixed_rate_clk,
34962306a36Sopenharmony_ci			const struct of_device_id *clk_matches);
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_civoid samsung_clk_add_lookup(struct samsung_clk_provider *ctx,
35262306a36Sopenharmony_ci			struct clk_hw *clk_hw, unsigned int id);
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_civoid samsung_clk_register_alias(struct samsung_clk_provider *ctx,
35562306a36Sopenharmony_ci			const struct samsung_clock_alias *list,
35662306a36Sopenharmony_ci			unsigned int nr_clk);
35762306a36Sopenharmony_civoid samsung_clk_register_fixed_rate(
35862306a36Sopenharmony_ci			struct samsung_clk_provider *ctx,
35962306a36Sopenharmony_ci			const struct samsung_fixed_rate_clock *clk_list,
36062306a36Sopenharmony_ci			unsigned int nr_clk);
36162306a36Sopenharmony_civoid samsung_clk_register_fixed_factor(
36262306a36Sopenharmony_ci			struct samsung_clk_provider *ctx,
36362306a36Sopenharmony_ci			const struct samsung_fixed_factor_clock *list,
36462306a36Sopenharmony_ci			unsigned int nr_clk);
36562306a36Sopenharmony_civoid samsung_clk_register_mux(struct samsung_clk_provider *ctx,
36662306a36Sopenharmony_ci			const struct samsung_mux_clock *clk_list,
36762306a36Sopenharmony_ci			unsigned int nr_clk);
36862306a36Sopenharmony_civoid samsung_clk_register_div(struct samsung_clk_provider *ctx,
36962306a36Sopenharmony_ci			const struct samsung_div_clock *clk_list,
37062306a36Sopenharmony_ci			unsigned int nr_clk);
37162306a36Sopenharmony_civoid samsung_clk_register_gate(struct samsung_clk_provider *ctx,
37262306a36Sopenharmony_ci			const struct samsung_gate_clock *clk_list,
37362306a36Sopenharmony_ci			unsigned int nr_clk);
37462306a36Sopenharmony_civoid samsung_clk_register_pll(struct samsung_clk_provider *ctx,
37562306a36Sopenharmony_ci			const struct samsung_pll_clock *pll_list,
37662306a36Sopenharmony_ci			unsigned int nr_clk);
37762306a36Sopenharmony_civoid samsung_clk_register_cpu(struct samsung_clk_provider *ctx,
37862306a36Sopenharmony_ci		const struct samsung_cpu_clock *list, unsigned int nr_clk);
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_civoid samsung_cmu_register_clocks(struct samsung_clk_provider *ctx,
38162306a36Sopenharmony_ci				 const struct samsung_cmu_info *cmu);
38262306a36Sopenharmony_cistruct samsung_clk_provider *samsung_cmu_register_one(
38362306a36Sopenharmony_ci			struct device_node *,
38462306a36Sopenharmony_ci			const struct samsung_cmu_info *);
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
38762306a36Sopenharmony_civoid samsung_clk_extended_sleep_init(void __iomem *reg_base,
38862306a36Sopenharmony_ci			const unsigned long *rdump,
38962306a36Sopenharmony_ci			unsigned long nr_rdump,
39062306a36Sopenharmony_ci			const struct samsung_clk_reg_dump *rsuspend,
39162306a36Sopenharmony_ci			unsigned long nr_rsuspend);
39262306a36Sopenharmony_ci#else
39362306a36Sopenharmony_cistatic inline void samsung_clk_extended_sleep_init(void __iomem *reg_base,
39462306a36Sopenharmony_ci			const unsigned long *rdump,
39562306a36Sopenharmony_ci			unsigned long nr_rdump,
39662306a36Sopenharmony_ci			const struct samsung_clk_reg_dump *rsuspend,
39762306a36Sopenharmony_ci			unsigned long nr_rsuspend) {}
39862306a36Sopenharmony_ci#endif
39962306a36Sopenharmony_ci#define samsung_clk_sleep_init(reg_base, rdump, nr_rdump) \
40062306a36Sopenharmony_ci	samsung_clk_extended_sleep_init(reg_base, rdump, nr_rdump, NULL, 0)
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_civoid samsung_clk_save(void __iomem *base,
40362306a36Sopenharmony_ci			struct samsung_clk_reg_dump *rd,
40462306a36Sopenharmony_ci			unsigned int num_regs);
40562306a36Sopenharmony_civoid samsung_clk_restore(void __iomem *base,
40662306a36Sopenharmony_ci			const struct samsung_clk_reg_dump *rd,
40762306a36Sopenharmony_ci			unsigned int num_regs);
40862306a36Sopenharmony_cistruct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
40962306a36Sopenharmony_ci			const unsigned long *rdump,
41062306a36Sopenharmony_ci			unsigned long nr_rdump);
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci#endif /* __SAMSUNG_CLK_H */
413