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
{
50 #define PLL_RATE(_fin, _m, _p, _s, _k, _ks) \
51 ((u64)(_fin) * (BIT(_ks) * (_m) + (_k)) / BIT(_ks) / ((_p) << (_s)))
52 #define PLL_VALID_RATE(_fin, _fout, _m, _p, _s, _k, _ks) ((_fout) + \
53 BUILD_BUG_ON_ZERO(PLL_RATE(_fin, _m, _p, _s, _k, _ks) != (_fout)))
55 #define PLL_35XX_RATE(_fin, _rate, _m, _p, _s) \
57 .rate = PLL_VALID_RATE(_fin, _rate, \
64 #define PLL_36XX_RATE(_fin, _rate, _m, _p, _s, _k) \
66 .rate = PLL_VALID_RATE(_fin, _rate, \
67 _m, _p, _s, _k, 16), \
74 #define PLL_4508_RATE(_fin, _rate, _m, _p, _s, _afc) \
76 .rate = PLL_VALID_RATE(_fin, _rate, \
77 _m, _p, _s - 1, 0, 16), \
84 #define PLL_4600_RATE(_fin, _rate, _m, _p, _s, _k, _vsel) \
86 .rate = PLL_VALID_RATE(_fin, _rate, \
87 _m, _p, _s, _k, 16), \
95 #define PLL_4650_RATE(_fin, _rate, _m, _p, _s, _k, _mfr, _mrr, _vsel) \
97 .rate = PLL_VALID_RATE(_fin, _rate, \
98 _m, _p, _s, _k, 10), \
108 /* NOTE: Rate table should be kept sorted in descending order. */
110 struct samsung_pll_rate_table
{
122 #endif /* __SAMSUNG_CLK_PLL_H */