S3C64XX PLL: EPLL control implemented
Subsystems (3)
PATCH 1/1 S3C64XX PLL: EPLL control implemented
Implemented enable, get_rate and set_rate functions to control the EPLL. Even though the EPLL version is different for 6400 and 6410, their output clock generation equations are exactly same. 6410 recommends values for M, P, S and K coeff for a given XTAL freq(12MHz or 27MHz), the condition on coeffs for 6410 also works for 6400, so we define common control for the two EPLLs.
Signed-off-by Jassi <[email protected]>
--- arch/arm/plat-s3c64xx/include/plat/pll.h | 34 +++++++ arch/arm/plat-s3c64xx/include/plat/regs-clock.h | 3 + arch/arm/plat-s3c64xx/s3c6400-clock.c | 117 +++++++++++++++++++++++ 3 files changed, 154 insertions(+), 0 deletions(-)
arch/arm/plat-s3c64xx/include/plat/pll.h +34 -0
@@ -21,6 +21,33 @@#include <asm/div64.h> +struct epll_divs { +unsigned int m; +unsigned int p; +unsigned int s; +unsigned int k; +}; + +enum xtal_freq { +XTAL_12M =0 , +XTAL_27M +}; + +enum epll_fout_freq { +EPLL_OUT_36000 =0 , +EPLL_OUT_48000 , +EPLL_OUT_60000 , +EPLL_OUT_72000 , +EPLL_OUT_84000 , +EPLL_OUT_96000 , +EPLL_OUT_32768 , +EPLL_OUT_45158 , +EPLL_OUT_49152 , +EPLL_OUT_67738 , +EPLL_OUT_73728 , +EPLL_OUT_LAST +}; +static inline unsigned long s3c6400_get_pll (unsigned long baseclk,u32 pllcon) {
@@ -44,6 +71,13 @@ static inline unsigned long s3c6400_get_pll(unsigned long baseclk,#define S3C6400_EPLL_PDIV_SHIFT (8)#define S3C6400_EPLL_SDIV_SHIFT (0)#define S3C6400_EPLL_KDIV_MASK (0xffff) +#define S3C6400_EPLL_KDIV_SHIFT (0) + +#define S3C6400_EPLL_SET_MPSDIV (m, p, s) (((m)<<S3C6400_EPLL_MDIV_SHIFT) \ + | ((p)<<S3C6400_EPLL_PDIV_SHIFT) \ + | ((s)<<S3C6400_EPLL_SDIV_SHIFT)) + +#define S3C6400_EPLL_SET_KDIV (k) ((k)<<S3C6400_EPLL_KDIV_SHIFT)static inline unsigned long s3c6400_get_epll (unsigned long baseclk) {
arch/arm/plat-s3c64xx/include/plat/regs-clock.h +3 -0
@@ -34,6 +34,9 @@#define S3C_SCLK_GATE S3C_CLKREG(0x38)#define S3C_MEM0_GATE S3C_CLKREG(0x3C) +/* EPLLCON */ +#define S3C6400_EPLL_ENABLE (0x1 << 31) +/* CLKDIV0 */ #define S3C6400_CLKDIV0_MFC_MASK (0xf << 28)#define S3C6400_CLKDIV0_MFC_SHIFT (28)
arch/arm/plat-s3c64xx/s3c6400-clock.c +117 -0
126 lines not on this page · raw message
Signature · 1 line
1.6.2.5