1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 * Copyright (c) 2013 Linaro Ltd.
6 * Common Clock Framework support for all PLL's in Samsung platforms
9 #ifndef __SAMSUNG_CLK_PLL_H
10 #define __SAMSUNG_CLK_PLL_H
12 enum samsung_pll_type
{
41 #define PLL_RATE(_fin, _m, _p, _s, _k, _ks) \
42 ((u64)(_fin) * (BIT(_ks) * (_m) + (_k)) / BIT(_ks) / ((_p) << (_s)))
43 #define PLL_VALID_RATE(_fin, _fout, _m, _p, _s, _k, _ks) ((_fout) + \
44 BUILD_BUG_ON_ZERO(PLL_RATE(_fin, _m, _p, _s, _k, _ks) != (_fout)))
46 #define PLL_35XX_RATE(_fin, _rate, _m, _p, _s) \
48 .rate = PLL_VALID_RATE(_fin, _rate, \
55 #define PLL_S3C2410_MPLL_RATE(_fin, _rate, _m, _p, _s) \
57 .rate = PLL_VALID_RATE(_fin, _rate, \
58 _m + 8, _p + 2, _s, 0, 16), \
64 #define PLL_S3C2440_MPLL_RATE(_fin, _rate, _m, _p, _s) \
66 .rate = PLL_VALID_RATE(_fin, _rate, \
67 2 * (_m + 8), _p + 2, _s, 0, 16), \
73 #define PLL_36XX_RATE(_fin, _rate, _m, _p, _s, _k) \
75 .rate = PLL_VALID_RATE(_fin, _rate, \
76 _m, _p, _s, _k, 16), \
83 #define PLL_4508_RATE(_fin, _rate, _m, _p, _s, _afc) \
85 .rate = PLL_VALID_RATE(_fin, _rate, \
86 _m, _p, _s - 1, 0, 16), \
93 #define PLL_4600_RATE(_fin, _rate, _m, _p, _s, _k, _vsel) \
95 .rate = PLL_VALID_RATE(_fin, _rate, \
96 _m, _p, _s, _k, 16), \
104 #define PLL_4650_RATE(_fin, _rate, _m, _p, _s, _k, _mfr, _mrr, _vsel) \
106 .rate = PLL_VALID_RATE(_fin, _rate, \
107 _m, _p, _s, _k, 10), \
117 /* NOTE: Rate table should be kept sorted in descending order. */
119 struct samsung_pll_rate_table
{
131 #endif /* __SAMSUNG_CLK_PLL_H */