i7core_edac: Better describe the supported devices
[pandora-kernel.git] / arch / arm / plat-s5pc1xx / include / plat / pll.h
1 /* arch/arm/plat-s5pc1xx/include/plat/pll.h
2  *
3  * Copyright 2009 Samsung Electronics Co.
4  *      Byungho Min <bhmin@samsung.com>
5  *
6  * S5PC1XX PLL code
7  *
8  * Based on plat-s3c64xx/include/plat/pll.h
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13 */
14
15 #define S5P_PLL_MDIV_MASK       ((1 << (25-16+1)) - 1)
16 #define S5P_PLL_PDIV_MASK       ((1 << (13-8+1)) - 1)
17 #define S5P_PLL_SDIV_MASK       ((1 << (2-0+1)) - 1)
18 #define S5P_PLL_MDIV_SHIFT      (16)
19 #define S5P_PLL_PDIV_SHIFT      (8)
20 #define S5P_PLL_SDIV_SHIFT      (0)
21
22 #include <asm/div64.h>
23
24 static inline unsigned long s5pc1xx_get_pll(unsigned long baseclk,
25                                             u32 pllcon)
26 {
27         u32 mdiv, pdiv, sdiv;
28         u64 fvco = baseclk;
29
30         mdiv = (pllcon >> S5P_PLL_MDIV_SHIFT) & S5P_PLL_MDIV_MASK;
31         pdiv = (pllcon >> S5P_PLL_PDIV_SHIFT) & S5P_PLL_PDIV_MASK;
32         sdiv = (pllcon >> S5P_PLL_SDIV_SHIFT) & S5P_PLL_SDIV_MASK;
33
34         fvco *= mdiv;
35         do_div(fvco, (pdiv << sdiv));
36
37         return (unsigned long)fvco;
38 }