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 {
43 #define PLL_RATE(_fin, _m, _p, _s, _k, _ks) \
44 ((u64)(_fin) * (BIT(_ks) * (_m) + (_k)) / BIT(_ks) / ((_p) << (_s)))
45 #define PLL_VALID_RATE(_fin, _fout, _m, _p, _s, _k, _ks) ((_fout) + \
46 BUILD_BUG_ON_ZERO(PLL_RATE(_fin, _m, _p, _s, _k, _ks) != (_fout)))
48 #define PLL_35XX_RATE(_fin, _rate, _m, _p, _s) \
50 .rate = PLL_VALID_RATE(_fin, _rate, \
57 #define PLL_36XX_RATE(_fin, _rate, _m, _p, _s, _k) \
59 .rate = PLL_VALID_RATE(_fin, _rate, \
60 _m, _p, _s, _k, 16), \
67 #define PLL_4508_RATE(_fin, _rate, _m, _p, _s, _afc) \
69 .rate = PLL_VALID_RATE(_fin, _rate, \
70 _m, _p, _s - 1, 0, 16), \
77 #define PLL_4600_RATE(_fin, _rate, _m, _p, _s, _k, _vsel) \
79 .rate = PLL_VALID_RATE(_fin, _rate, \
80 _m, _p, _s, _k, 16), \
88 #define PLL_4650_RATE(_fin, _rate, _m, _p, _s, _k, _mfr, _mrr, _vsel) \
90 .rate = PLL_VALID_RATE(_fin, _rate, \
91 _m, _p, _s, _k, 10), \
101 /* NOTE: Rate table should be kept sorted in descending order. */
103 struct samsung_pll_rate_table {
115 #endif /* __SAMSUNG_CLK_PLL_H */