162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2014 Samsung Electronics Co., Ltd.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Common Clock Framework support for all PLL's in Samsung platforms
662306a36Sopenharmony_ci*/
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __SAMSUNG_CLK_CPU_H
962306a36Sopenharmony_ci#define __SAMSUNG_CLK_CPU_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include "clk.h"
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/**
1462306a36Sopenharmony_ci * struct exynos_cpuclk_data: config data to setup cpu clocks.
1562306a36Sopenharmony_ci * @prate: frequency of the primary parent clock (in KHz).
1662306a36Sopenharmony_ci * @div0: value to be programmed in the div_cpu0 register.
1762306a36Sopenharmony_ci * @div1: value to be programmed in the div_cpu1 register.
1862306a36Sopenharmony_ci *
1962306a36Sopenharmony_ci * This structure holds the divider configuration data for dividers in the CPU
2062306a36Sopenharmony_ci * clock domain. The parent frequency at which these divider values are valid is
2162306a36Sopenharmony_ci * specified in @prate. The @prate is the frequency of the primary parent clock.
2262306a36Sopenharmony_ci * For CPU clock domains that do not have a DIV1 register, the @div1 member
2362306a36Sopenharmony_ci * value is not used.
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_cistruct exynos_cpuclk_cfg_data {
2662306a36Sopenharmony_ci	unsigned long	prate;
2762306a36Sopenharmony_ci	unsigned long	div0;
2862306a36Sopenharmony_ci	unsigned long	div1;
2962306a36Sopenharmony_ci};
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/**
3262306a36Sopenharmony_ci * struct exynos_cpuclk: information about clock supplied to a CPU core.
3362306a36Sopenharmony_ci * @hw:	handle between CCF and CPU clock.
3462306a36Sopenharmony_ci * @alt_parent: alternate parent clock to use when switching the speed
3562306a36Sopenharmony_ci *	of the primary parent clock.
3662306a36Sopenharmony_ci * @ctrl_base:	base address of the clock controller.
3762306a36Sopenharmony_ci * @lock: cpu clock domain register access lock.
3862306a36Sopenharmony_ci * @cfg: cpu clock rate configuration data.
3962306a36Sopenharmony_ci * @num_cfgs: number of array elements in @cfg array.
4062306a36Sopenharmony_ci * @clk_nb: clock notifier registered for changes in clock speed of the
4162306a36Sopenharmony_ci *	primary parent clock.
4262306a36Sopenharmony_ci * @flags: configuration flags for the CPU clock.
4362306a36Sopenharmony_ci *
4462306a36Sopenharmony_ci * This structure holds information required for programming the CPU clock for
4562306a36Sopenharmony_ci * various clock speeds.
4662306a36Sopenharmony_ci */
4762306a36Sopenharmony_cistruct exynos_cpuclk {
4862306a36Sopenharmony_ci	struct clk_hw				hw;
4962306a36Sopenharmony_ci	const struct clk_hw			*alt_parent;
5062306a36Sopenharmony_ci	void __iomem				*ctrl_base;
5162306a36Sopenharmony_ci	spinlock_t				*lock;
5262306a36Sopenharmony_ci	const struct exynos_cpuclk_cfg_data	*cfg;
5362306a36Sopenharmony_ci	const unsigned long			num_cfgs;
5462306a36Sopenharmony_ci	struct notifier_block			clk_nb;
5562306a36Sopenharmony_ci	unsigned long				flags;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* The CPU clock registers have DIV1 configuration register */
5862306a36Sopenharmony_ci#define CLK_CPU_HAS_DIV1		(1 << 0)
5962306a36Sopenharmony_ci/* When ALT parent is active, debug clocks need safe divider values */
6062306a36Sopenharmony_ci#define CLK_CPU_NEEDS_DEBUG_ALT_DIV	(1 << 1)
6162306a36Sopenharmony_ci/* The CPU clock registers have Exynos5433-compatible layout */
6262306a36Sopenharmony_ci#define CLK_CPU_HAS_E5433_REGS_LAYOUT	(1 << 2)
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#endif /* __SAMSUNG_CLK_CPU_H */
66