2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2013 Linaro Ltd.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Common Clock Framework support for all PLL's in Samsung platforms
12 #ifndef __SAMSUNG_CLK_PLL_H
13 #define __SAMSUNG_CLK_PLL_H
15 enum samsung_pll_type
{
44 #define PLL_RATE(_fin, _m, _p, _s, _k, _ks) \
45 ((u64)(_fin) * (BIT(_ks) * (_m) + (_k)) / BIT(_ks) / ((_p) << (_s)))
46 #define PLL_VALID_RATE(_fin, _fout, _m, _p, _s, _k, _ks) ((_fout) + \
47 BUILD_BUG_ON_ZERO(PLL_RATE(_fin, _m, _p, _s, _k, _ks) != (_fout)))
49 #define PLL_35XX_RATE(_fin, _rate, _m, _p, _s) \
51 .rate = PLL_VALID_RATE(_fin, _rate, \
58 #define PLL_S3C2410_MPLL_RATE(_fin, _rate, _m, _p, _s) \
60 .rate = PLL_VALID_RATE(_fin, _rate, \
61 _m + 8, _p + 2, _s, 0, 16), \
67 #define PLL_S3C2440_MPLL_RATE(_fin, _rate, _m, _p, _s) \
69 .rate = PLL_VALID_RATE(_fin, _rate, \
70 2 * (_m + 8), _p + 2, _s, 0, 16), \
76 #define PLL_36XX_RATE(_fin, _rate, _m, _p, _s, _k) \
78 .rate = PLL_VALID_RATE(_fin, _rate, \
79 _m, _p, _s, _k, 16), \
86 #define PLL_4508_RATE(_fin, _rate, _m, _p, _s, _afc) \
88 .rate = PLL_VALID_RATE(_fin, _rate, \
89 _m, _p, _s - 1, 0, 16), \
96 #define PLL_4600_RATE(_fin, _rate, _m, _p, _s, _k, _vsel) \
98 .rate = PLL_VALID_RATE(_fin, _rate, \
99 _m, _p, _s, _k, 16), \
107 #define PLL_4650_RATE(_fin, _rate, _m, _p, _s, _k, _mfr, _mrr, _vsel) \
109 .rate = PLL_VALID_RATE(_fin, _rate, \
110 _m, _p, _s, _k, 10), \
120 /* NOTE: Rate table should be kept sorted in descending order. */
122 struct samsung_pll_rate_table
{
134 #endif /* __SAMSUNG_CLK_PLL_H */