diff options
author | Tomasz Figa <t.figa@samsung.com> | 2014-07-02 13:42:03 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2014-07-18 15:24:59 -0400 |
commit | 32726d2d5502302ba5753854f5f2f12ba22681c4 (patch) | |
tree | e432c5599c79ea3bdf7304477cdebb39e3a82c26 /arch/arm/plat-samsung/include | |
parent | f73d4cb681d2ede6d31974dde3ecce7a3ae8e8ff (diff) |
ARM: SAMSUNG: Remove legacy clock code
Since S5PV210 now has a complete clock driver using Common Clock
Framework, there is no reason to keep the old code. Remove it together
with the whole legacy Samsung-specific clock framework which no longer
has any users.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung/include')
-rw-r--r-- | arch/arm/plat-samsung/include/plat/clock-clksrc.h | 83 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/clock.h | 152 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/cpu-freq-core.h | 3 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/pll.h | 323 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/s5p-clock.h | 65 |
5 files changed, 0 insertions, 626 deletions
diff --git a/arch/arm/plat-samsung/include/plat/clock-clksrc.h b/arch/arm/plat-samsung/include/plat/clock-clksrc.h deleted file mode 100644 index 50a8ca7c3760..000000000000 --- a/arch/arm/plat-samsung/include/plat/clock-clksrc.h +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/clock-clksrc.h | ||
2 | * | ||
3 | * Parts taken from arch/arm/plat-s3c64xx/clock.c | ||
4 | * Copyright 2008 Openmoko, Inc. | ||
5 | * Copyright 2008 Simtec Electronics | ||
6 | * Ben Dooks <ben@simtec.co.uk> | ||
7 | * http://armlinux.simtec.co.uk/ | ||
8 | * | ||
9 | * Copyright 2009 Ben Dooks <ben-linux@fluff.org> | ||
10 | * Copyright 2009 Harald Welte | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * struct clksrc_sources - list of sources for a given clock | ||
19 | * @sources: array of pointers to clocks | ||
20 | * @nr_sources: The size of @sources | ||
21 | */ | ||
22 | struct clksrc_sources { | ||
23 | unsigned int nr_sources; | ||
24 | struct clk **sources; | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * struct clksrc_reg - register definition for clock control bits | ||
29 | * @reg: pointer to the register in virtual memory. | ||
30 | * @shift: the shift in bits to where the bitfield is. | ||
31 | * @size: the size in bits of the bitfield. | ||
32 | * | ||
33 | * This specifies the size and position of the bits we are interested | ||
34 | * in within the register specified by @reg. | ||
35 | */ | ||
36 | struct clksrc_reg { | ||
37 | void __iomem *reg; | ||
38 | unsigned short shift; | ||
39 | unsigned short size; | ||
40 | }; | ||
41 | |||
42 | /** | ||
43 | * struct clksrc_clk - class of clock for newer style samsung devices. | ||
44 | * @clk: the standard clock representation | ||
45 | * @sources: the sources for this clock | ||
46 | * @reg_src: the register definition for selecting the clock's source | ||
47 | * @reg_div: the register definition for the clock's output divisor | ||
48 | * | ||
49 | * This clock implements the features required by the newer SoCs where | ||
50 | * the standard clock block provides an input mux and a post-mux divisor | ||
51 | * to provide the periperhal's clock. | ||
52 | * | ||
53 | * The array of @sources provides the mapping of mux position to the | ||
54 | * clock, and @reg_src shows the code where to modify to change the mux | ||
55 | * position. The @reg_div defines how to change the divider settings on | ||
56 | * the output. | ||
57 | */ | ||
58 | struct clksrc_clk { | ||
59 | struct clk clk; | ||
60 | struct clksrc_sources *sources; | ||
61 | |||
62 | struct clksrc_reg reg_src; | ||
63 | struct clksrc_reg reg_div; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * s3c_set_clksrc() - setup the clock from the register settings | ||
68 | * @clk: The clock to setup. | ||
69 | * @announce: true to announce the setting to printk(). | ||
70 | * | ||
71 | * Setup the clock from the current register settings, for when the | ||
72 | * kernel boots or if it is resuming from a possibly unknown state. | ||
73 | */ | ||
74 | extern void s3c_set_clksrc(struct clksrc_clk *clk, bool announce); | ||
75 | |||
76 | /** | ||
77 | * s3c_register_clksrc() register clocks from an array of clksrc clocks | ||
78 | * @srcs: The array of clocks to register | ||
79 | * @size: The size of the @srcs array. | ||
80 | * | ||
81 | * Initialise and register the array of clocks described by @srcs. | ||
82 | */ | ||
83 | extern void s3c_register_clksrc(struct clksrc_clk *srcs, int size); | ||
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h deleted file mode 100644 index 63239f409807..000000000000 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/include/plat/clock.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
5 | * Written by Ben Dooks, <ben@simtec.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_PLAT_CLOCK_H | ||
13 | #define __ASM_PLAT_CLOCK_H __FILE__ | ||
14 | |||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/clkdev.h> | ||
17 | |||
18 | struct clk; | ||
19 | |||
20 | /** | ||
21 | * struct clk_ops - standard clock operations | ||
22 | * @set_rate: set the clock rate, see clk_set_rate(). | ||
23 | * @get_rate: get the clock rate, see clk_get_rate(). | ||
24 | * @round_rate: round a given clock rate, see clk_round_rate(). | ||
25 | * @set_parent: set the clock's parent, see clk_set_parent(). | ||
26 | * | ||
27 | * Group the common clock implementations together so that we | ||
28 | * don't have to keep setting the same fields again. We leave | ||
29 | * enable in struct clk. | ||
30 | * | ||
31 | * Adding an extra layer of indirection into the process should | ||
32 | * not be a problem as it is unlikely these operations are going | ||
33 | * to need to be called quickly. | ||
34 | */ | ||
35 | struct clk_ops { | ||
36 | int (*set_rate)(struct clk *c, unsigned long rate); | ||
37 | unsigned long (*get_rate)(struct clk *c); | ||
38 | unsigned long (*round_rate)(struct clk *c, unsigned long rate); | ||
39 | int (*set_parent)(struct clk *c, struct clk *parent); | ||
40 | }; | ||
41 | |||
42 | struct clk { | ||
43 | struct list_head list; | ||
44 | struct module *owner; | ||
45 | struct clk *parent; | ||
46 | const char *name; | ||
47 | const char *devname; | ||
48 | int id; | ||
49 | int usage; | ||
50 | unsigned long rate; | ||
51 | unsigned long ctrlbit; | ||
52 | |||
53 | struct clk_ops *ops; | ||
54 | int (*enable)(struct clk *, int enable); | ||
55 | struct clk_lookup lookup; | ||
56 | #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | ||
57 | struct dentry *dent; /* For visible tree hierarchy */ | ||
58 | #endif | ||
59 | }; | ||
60 | |||
61 | /* other clocks which may be registered by board support */ | ||
62 | |||
63 | extern struct clk s3c24xx_dclk0; | ||
64 | extern struct clk s3c24xx_dclk1; | ||
65 | extern struct clk s3c24xx_clkout0; | ||
66 | extern struct clk s3c24xx_clkout1; | ||
67 | extern struct clk s3c24xx_uclk; | ||
68 | |||
69 | extern struct clk clk_usb_bus; | ||
70 | |||
71 | /* core clock support */ | ||
72 | |||
73 | extern struct clk clk_f; | ||
74 | extern struct clk clk_h; | ||
75 | extern struct clk clk_p; | ||
76 | extern struct clk clk_mpll; | ||
77 | extern struct clk clk_upll; | ||
78 | extern struct clk clk_epll; | ||
79 | extern struct clk clk_xtal; | ||
80 | extern struct clk clk_ext; | ||
81 | |||
82 | /* S3C2443/S3C2416 specific clocks */ | ||
83 | extern struct clksrc_clk clk_epllref; | ||
84 | extern struct clksrc_clk clk_esysclk; | ||
85 | |||
86 | /* S3C24XX UART clocks */ | ||
87 | extern struct clk s3c24xx_clk_uart0; | ||
88 | extern struct clk s3c24xx_clk_uart1; | ||
89 | extern struct clk s3c24xx_clk_uart2; | ||
90 | |||
91 | /* S3C64XX specific clocks */ | ||
92 | extern struct clk clk_h2; | ||
93 | extern struct clk clk_27m; | ||
94 | extern struct clk clk_48m; | ||
95 | extern struct clk clk_xusbxti; | ||
96 | |||
97 | extern int clk_default_setrate(struct clk *clk, unsigned long rate); | ||
98 | extern struct clk_ops clk_ops_def_setrate; | ||
99 | |||
100 | /* exports for arch/arm/mach-s3c2410 | ||
101 | * | ||
102 | * Please DO NOT use these outside of arch/arm/mach-s3c2410 | ||
103 | */ | ||
104 | |||
105 | extern spinlock_t clocks_lock; | ||
106 | |||
107 | extern int s3c2410_clkcon_enable(struct clk *clk, int enable); | ||
108 | |||
109 | extern int s3c24xx_register_clock(struct clk *clk); | ||
110 | extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks); | ||
111 | |||
112 | extern void s3c_register_clocks(struct clk *clk, int nr_clks); | ||
113 | extern void s3c_disable_clocks(struct clk *clkp, int nr_clks); | ||
114 | |||
115 | extern int s3c24xx_register_baseclocks(unsigned long xtal); | ||
116 | |||
117 | extern void s5p_register_clocks(unsigned long xtal_freq); | ||
118 | |||
119 | extern void s3c24xx_setup_clocks(unsigned long fclk, | ||
120 | unsigned long hclk, | ||
121 | unsigned long pclk); | ||
122 | |||
123 | extern void s3c2410_setup_clocks(void); | ||
124 | extern void s3c2412_setup_clocks(void); | ||
125 | extern void s3c244x_setup_clocks(void); | ||
126 | |||
127 | /* S3C2410 specific clock functions */ | ||
128 | |||
129 | extern int s3c2410_baseclk_add(void); | ||
130 | |||
131 | /* S3C2443/S3C2416 specific clock functions */ | ||
132 | |||
133 | typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); | ||
134 | |||
135 | extern void s3c2443_common_setup_clocks(pll_fn get_mpll); | ||
136 | extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | ||
137 | unsigned int *divs, int nr_divs, | ||
138 | int divmask); | ||
139 | |||
140 | extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); | ||
141 | extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); | ||
142 | extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable); | ||
143 | |||
144 | /* S3C64XX specific functions and clocks */ | ||
145 | |||
146 | extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable); | ||
147 | |||
148 | /* Global watchdog clock used by arch_wtd_reset() callback */ | ||
149 | |||
150 | extern struct clk *s3c2410_wdtclk; | ||
151 | |||
152 | #endif /* __ASM_PLAT_CLOCK_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h index 72d4178ad23b..317c52303288 100644 --- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h +++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h | |||
@@ -140,7 +140,6 @@ struct s3c_cpufreq_config { | |||
140 | * any frequency changes. This is really only need by devices like the | 140 | * any frequency changes. This is really only need by devices like the |
141 | * S3C2410 where there is no or limited divider between the PLL and the | 141 | * S3C2410 where there is no or limited divider between the PLL and the |
142 | * ARMCLK. | 142 | * ARMCLK. |
143 | * @resume_clocks: Update the clocks on resume. | ||
144 | * @get_iotiming: Get the current IO timing data, mainly for use at start. | 143 | * @get_iotiming: Get the current IO timing data, mainly for use at start. |
145 | * @set_iotiming: Update the IO timings from the cached copies calculated | 144 | * @set_iotiming: Update the IO timings from the cached copies calculated |
146 | * from the @calc_iotiming entry when changing the frequency. | 145 | * from the @calc_iotiming entry when changing the frequency. |
@@ -169,8 +168,6 @@ struct s3c_cpufreq_info { | |||
169 | 168 | ||
170 | /* driver routines */ | 169 | /* driver routines */ |
171 | 170 | ||
172 | void (*resume_clocks)(void); | ||
173 | |||
174 | int (*get_iotiming)(struct s3c_cpufreq_config *cfg, | 171 | int (*get_iotiming)(struct s3c_cpufreq_config *cfg, |
175 | struct s3c_iotimings *timings); | 172 | struct s3c_iotimings *timings); |
176 | 173 | ||
diff --git a/arch/arm/plat-samsung/include/plat/pll.h b/arch/arm/plat-samsung/include/plat/pll.h deleted file mode 100644 index 357af7c1c664..000000000000 --- a/arch/arm/plat-samsung/include/plat/pll.h +++ /dev/null | |||
@@ -1,323 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/pll.h | ||
2 | * | ||
3 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * Samsung PLL codes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <asm/div64.h> | ||
19 | |||
20 | #define S3C24XX_PLL_MDIV_MASK (0xFF) | ||
21 | #define S3C24XX_PLL_PDIV_MASK (0x1F) | ||
22 | #define S3C24XX_PLL_SDIV_MASK (0x3) | ||
23 | #define S3C24XX_PLL_MDIV_SHIFT (12) | ||
24 | #define S3C24XX_PLL_PDIV_SHIFT (4) | ||
25 | #define S3C24XX_PLL_SDIV_SHIFT (0) | ||
26 | |||
27 | static inline unsigned int s3c24xx_get_pll(unsigned int pllval, | ||
28 | unsigned int baseclk) | ||
29 | { | ||
30 | unsigned int mdiv, pdiv, sdiv; | ||
31 | uint64_t fvco; | ||
32 | |||
33 | mdiv = (pllval >> S3C24XX_PLL_MDIV_SHIFT) & S3C24XX_PLL_MDIV_MASK; | ||
34 | pdiv = (pllval >> S3C24XX_PLL_PDIV_SHIFT) & S3C24XX_PLL_PDIV_MASK; | ||
35 | sdiv = (pllval >> S3C24XX_PLL_SDIV_SHIFT) & S3C24XX_PLL_SDIV_MASK; | ||
36 | |||
37 | fvco = (uint64_t)baseclk * (mdiv + 8); | ||
38 | do_div(fvco, (pdiv + 2) << sdiv); | ||
39 | |||
40 | return (unsigned int)fvco; | ||
41 | } | ||
42 | |||
43 | #define S3C2416_PLL_MDIV_MASK (0x3FF) | ||
44 | #define S3C2416_PLL_PDIV_MASK (0x3F) | ||
45 | #define S3C2416_PLL_SDIV_MASK (0x7) | ||
46 | #define S3C2416_PLL_MDIV_SHIFT (14) | ||
47 | #define S3C2416_PLL_PDIV_SHIFT (5) | ||
48 | #define S3C2416_PLL_SDIV_SHIFT (0) | ||
49 | |||
50 | static inline unsigned int s3c2416_get_pll(unsigned int pllval, | ||
51 | unsigned int baseclk) | ||
52 | { | ||
53 | unsigned int mdiv, pdiv, sdiv; | ||
54 | uint64_t fvco; | ||
55 | |||
56 | mdiv = (pllval >> S3C2416_PLL_MDIV_SHIFT) & S3C2416_PLL_MDIV_MASK; | ||
57 | pdiv = (pllval >> S3C2416_PLL_PDIV_SHIFT) & S3C2416_PLL_PDIV_MASK; | ||
58 | sdiv = (pllval >> S3C2416_PLL_SDIV_SHIFT) & S3C2416_PLL_SDIV_MASK; | ||
59 | |||
60 | fvco = (uint64_t)baseclk * mdiv; | ||
61 | do_div(fvco, (pdiv << sdiv)); | ||
62 | |||
63 | return (unsigned int)fvco; | ||
64 | } | ||
65 | |||
66 | #define S3C6400_PLL_MDIV_MASK (0x3FF) | ||
67 | #define S3C6400_PLL_PDIV_MASK (0x3F) | ||
68 | #define S3C6400_PLL_SDIV_MASK (0x7) | ||
69 | #define S3C6400_PLL_MDIV_SHIFT (16) | ||
70 | #define S3C6400_PLL_PDIV_SHIFT (8) | ||
71 | #define S3C6400_PLL_SDIV_SHIFT (0) | ||
72 | |||
73 | static inline unsigned long s3c6400_get_pll(unsigned long baseclk, | ||
74 | u32 pllcon) | ||
75 | { | ||
76 | u32 mdiv, pdiv, sdiv; | ||
77 | u64 fvco = baseclk; | ||
78 | |||
79 | mdiv = (pllcon >> S3C6400_PLL_MDIV_SHIFT) & S3C6400_PLL_MDIV_MASK; | ||
80 | pdiv = (pllcon >> S3C6400_PLL_PDIV_SHIFT) & S3C6400_PLL_PDIV_MASK; | ||
81 | sdiv = (pllcon >> S3C6400_PLL_SDIV_SHIFT) & S3C6400_PLL_SDIV_MASK; | ||
82 | |||
83 | fvco *= mdiv; | ||
84 | do_div(fvco, (pdiv << sdiv)); | ||
85 | |||
86 | return (unsigned long)fvco; | ||
87 | } | ||
88 | |||
89 | #define PLL6553X_MDIV_MASK (0x7F) | ||
90 | #define PLL6553X_PDIV_MASK (0x1F) | ||
91 | #define PLL6553X_SDIV_MASK (0x3) | ||
92 | #define PLL6553X_KDIV_MASK (0xFFFF) | ||
93 | #define PLL6553X_MDIV_SHIFT (16) | ||
94 | #define PLL6553X_PDIV_SHIFT (8) | ||
95 | #define PLL6553X_SDIV_SHIFT (0) | ||
96 | |||
97 | static inline unsigned long s3c_get_pll6553x(unsigned long baseclk, | ||
98 | u32 pll_con0, u32 pll_con1) | ||
99 | { | ||
100 | unsigned long result; | ||
101 | u32 mdiv, pdiv, sdiv, kdiv; | ||
102 | u64 tmp; | ||
103 | |||
104 | mdiv = (pll_con0 >> PLL6553X_MDIV_SHIFT) & PLL6553X_MDIV_MASK; | ||
105 | pdiv = (pll_con0 >> PLL6553X_PDIV_SHIFT) & PLL6553X_PDIV_MASK; | ||
106 | sdiv = (pll_con0 >> PLL6553X_SDIV_SHIFT) & PLL6553X_SDIV_MASK; | ||
107 | kdiv = pll_con1 & PLL6553X_KDIV_MASK; | ||
108 | |||
109 | /* | ||
110 | * We need to multiple baseclk by mdiv (the integer part) and kdiv | ||
111 | * which is in 2^16ths, so shift mdiv up (does not overflow) and | ||
112 | * add kdiv before multiplying. The use of tmp is to avoid any | ||
113 | * overflows before shifting bac down into result when multipling | ||
114 | * by the mdiv and kdiv pair. | ||
115 | */ | ||
116 | |||
117 | tmp = baseclk; | ||
118 | tmp *= (mdiv << 16) + kdiv; | ||
119 | do_div(tmp, (pdiv << sdiv)); | ||
120 | result = tmp >> 16; | ||
121 | |||
122 | return result; | ||
123 | } | ||
124 | |||
125 | #define PLL35XX_MDIV_MASK (0x3FF) | ||
126 | #define PLL35XX_PDIV_MASK (0x3F) | ||
127 | #define PLL35XX_SDIV_MASK (0x7) | ||
128 | #define PLL35XX_MDIV_SHIFT (16) | ||
129 | #define PLL35XX_PDIV_SHIFT (8) | ||
130 | #define PLL35XX_SDIV_SHIFT (0) | ||
131 | |||
132 | static inline unsigned long s5p_get_pll35xx(unsigned long baseclk, u32 pll_con) | ||
133 | { | ||
134 | u32 mdiv, pdiv, sdiv; | ||
135 | u64 fvco = baseclk; | ||
136 | |||
137 | mdiv = (pll_con >> PLL35XX_MDIV_SHIFT) & PLL35XX_MDIV_MASK; | ||
138 | pdiv = (pll_con >> PLL35XX_PDIV_SHIFT) & PLL35XX_PDIV_MASK; | ||
139 | sdiv = (pll_con >> PLL35XX_SDIV_SHIFT) & PLL35XX_SDIV_MASK; | ||
140 | |||
141 | fvco *= mdiv; | ||
142 | do_div(fvco, (pdiv << sdiv)); | ||
143 | |||
144 | return (unsigned long)fvco; | ||
145 | } | ||
146 | |||
147 | #define PLL36XX_KDIV_MASK (0xFFFF) | ||
148 | #define PLL36XX_MDIV_MASK (0x1FF) | ||
149 | #define PLL36XX_PDIV_MASK (0x3F) | ||
150 | #define PLL36XX_SDIV_MASK (0x7) | ||
151 | #define PLL36XX_MDIV_SHIFT (16) | ||
152 | #define PLL36XX_PDIV_SHIFT (8) | ||
153 | #define PLL36XX_SDIV_SHIFT (0) | ||
154 | |||
155 | static inline unsigned long s5p_get_pll36xx(unsigned long baseclk, | ||
156 | u32 pll_con0, u32 pll_con1) | ||
157 | { | ||
158 | unsigned long result; | ||
159 | u32 mdiv, pdiv, sdiv, kdiv; | ||
160 | u64 tmp; | ||
161 | |||
162 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; | ||
163 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; | ||
164 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; | ||
165 | kdiv = pll_con1 & PLL36XX_KDIV_MASK; | ||
166 | |||
167 | tmp = baseclk; | ||
168 | |||
169 | tmp *= (mdiv << 16) + kdiv; | ||
170 | do_div(tmp, (pdiv << sdiv)); | ||
171 | result = tmp >> 16; | ||
172 | |||
173 | return result; | ||
174 | } | ||
175 | |||
176 | #define PLL45XX_MDIV_MASK (0x3FF) | ||
177 | #define PLL45XX_PDIV_MASK (0x3F) | ||
178 | #define PLL45XX_SDIV_MASK (0x7) | ||
179 | #define PLL45XX_MDIV_SHIFT (16) | ||
180 | #define PLL45XX_PDIV_SHIFT (8) | ||
181 | #define PLL45XX_SDIV_SHIFT (0) | ||
182 | |||
183 | enum pll45xx_type_t { | ||
184 | pll_4500, | ||
185 | pll_4502, | ||
186 | pll_4508 | ||
187 | }; | ||
188 | |||
189 | static inline unsigned long s5p_get_pll45xx(unsigned long baseclk, u32 pll_con, | ||
190 | enum pll45xx_type_t pll_type) | ||
191 | { | ||
192 | u32 mdiv, pdiv, sdiv; | ||
193 | u64 fvco = baseclk; | ||
194 | |||
195 | mdiv = (pll_con >> PLL45XX_MDIV_SHIFT) & PLL45XX_MDIV_MASK; | ||
196 | pdiv = (pll_con >> PLL45XX_PDIV_SHIFT) & PLL45XX_PDIV_MASK; | ||
197 | sdiv = (pll_con >> PLL45XX_SDIV_SHIFT) & PLL45XX_SDIV_MASK; | ||
198 | |||
199 | if (pll_type == pll_4508) | ||
200 | sdiv = sdiv - 1; | ||
201 | |||
202 | fvco *= mdiv; | ||
203 | do_div(fvco, (pdiv << sdiv)); | ||
204 | |||
205 | return (unsigned long)fvco; | ||
206 | } | ||
207 | |||
208 | /* CON0 bit-fields */ | ||
209 | #define PLL46XX_MDIV_MASK (0x1FF) | ||
210 | #define PLL46XX_PDIV_MASK (0x3F) | ||
211 | #define PLL46XX_SDIV_MASK (0x7) | ||
212 | #define PLL46XX_LOCKED_SHIFT (29) | ||
213 | #define PLL46XX_MDIV_SHIFT (16) | ||
214 | #define PLL46XX_PDIV_SHIFT (8) | ||
215 | #define PLL46XX_SDIV_SHIFT (0) | ||
216 | |||
217 | /* CON1 bit-fields */ | ||
218 | #define PLL46XX_MRR_MASK (0x1F) | ||
219 | #define PLL46XX_MFR_MASK (0x3F) | ||
220 | #define PLL46XX_KDIV_MASK (0xFFFF) | ||
221 | #define PLL4650C_KDIV_MASK (0xFFF) | ||
222 | #define PLL46XX_MRR_SHIFT (24) | ||
223 | #define PLL46XX_MFR_SHIFT (16) | ||
224 | #define PLL46XX_KDIV_SHIFT (0) | ||
225 | |||
226 | enum pll46xx_type_t { | ||
227 | pll_4600, | ||
228 | pll_4650, | ||
229 | pll_4650c, | ||
230 | }; | ||
231 | |||
232 | static inline unsigned long s5p_get_pll46xx(unsigned long baseclk, | ||
233 | u32 pll_con0, u32 pll_con1, | ||
234 | enum pll46xx_type_t pll_type) | ||
235 | { | ||
236 | unsigned long result; | ||
237 | u32 mdiv, pdiv, sdiv, kdiv; | ||
238 | u64 tmp; | ||
239 | |||
240 | mdiv = (pll_con0 >> PLL46XX_MDIV_SHIFT) & PLL46XX_MDIV_MASK; | ||
241 | pdiv = (pll_con0 >> PLL46XX_PDIV_SHIFT) & PLL46XX_PDIV_MASK; | ||
242 | sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK; | ||
243 | kdiv = pll_con1 & PLL46XX_KDIV_MASK; | ||
244 | |||
245 | if (pll_type == pll_4650c) | ||
246 | kdiv = pll_con1 & PLL4650C_KDIV_MASK; | ||
247 | else | ||
248 | kdiv = pll_con1 & PLL46XX_KDIV_MASK; | ||
249 | |||
250 | tmp = baseclk; | ||
251 | |||
252 | if (pll_type == pll_4600) { | ||
253 | tmp *= (mdiv << 16) + kdiv; | ||
254 | do_div(tmp, (pdiv << sdiv)); | ||
255 | result = tmp >> 16; | ||
256 | } else { | ||
257 | tmp *= (mdiv << 10) + kdiv; | ||
258 | do_div(tmp, (pdiv << sdiv)); | ||
259 | result = tmp >> 10; | ||
260 | } | ||
261 | |||
262 | return result; | ||
263 | } | ||
264 | |||
265 | #define PLL90XX_MDIV_MASK (0xFF) | ||
266 | #define PLL90XX_PDIV_MASK (0x3F) | ||
267 | #define PLL90XX_SDIV_MASK (0x7) | ||
268 | #define PLL90XX_KDIV_MASK (0xffff) | ||
269 | #define PLL90XX_LOCKED_SHIFT (29) | ||
270 | #define PLL90XX_MDIV_SHIFT (16) | ||
271 | #define PLL90XX_PDIV_SHIFT (8) | ||
272 | #define PLL90XX_SDIV_SHIFT (0) | ||
273 | #define PLL90XX_KDIV_SHIFT (0) | ||
274 | |||
275 | static inline unsigned long s5p_get_pll90xx(unsigned long baseclk, | ||
276 | u32 pll_con, u32 pll_conk) | ||
277 | { | ||
278 | unsigned long result; | ||
279 | u32 mdiv, pdiv, sdiv, kdiv; | ||
280 | u64 tmp; | ||
281 | |||
282 | mdiv = (pll_con >> PLL90XX_MDIV_SHIFT) & PLL90XX_MDIV_MASK; | ||
283 | pdiv = (pll_con >> PLL90XX_PDIV_SHIFT) & PLL90XX_PDIV_MASK; | ||
284 | sdiv = (pll_con >> PLL90XX_SDIV_SHIFT) & PLL90XX_SDIV_MASK; | ||
285 | kdiv = pll_conk & PLL90XX_KDIV_MASK; | ||
286 | |||
287 | /* | ||
288 | * We need to multiple baseclk by mdiv (the integer part) and kdiv | ||
289 | * which is in 2^16ths, so shift mdiv up (does not overflow) and | ||
290 | * add kdiv before multiplying. The use of tmp is to avoid any | ||
291 | * overflows before shifting bac down into result when multipling | ||
292 | * by the mdiv and kdiv pair. | ||
293 | */ | ||
294 | |||
295 | tmp = baseclk; | ||
296 | tmp *= (mdiv << 16) + kdiv; | ||
297 | do_div(tmp, (pdiv << sdiv)); | ||
298 | result = tmp >> 16; | ||
299 | |||
300 | return result; | ||
301 | } | ||
302 | |||
303 | #define PLL65XX_MDIV_MASK (0x3FF) | ||
304 | #define PLL65XX_PDIV_MASK (0x3F) | ||
305 | #define PLL65XX_SDIV_MASK (0x7) | ||
306 | #define PLL65XX_MDIV_SHIFT (16) | ||
307 | #define PLL65XX_PDIV_SHIFT (8) | ||
308 | #define PLL65XX_SDIV_SHIFT (0) | ||
309 | |||
310 | static inline unsigned long s5p_get_pll65xx(unsigned long baseclk, u32 pll_con) | ||
311 | { | ||
312 | u32 mdiv, pdiv, sdiv; | ||
313 | u64 fvco = baseclk; | ||
314 | |||
315 | mdiv = (pll_con >> PLL65XX_MDIV_SHIFT) & PLL65XX_MDIV_MASK; | ||
316 | pdiv = (pll_con >> PLL65XX_PDIV_SHIFT) & PLL65XX_PDIV_MASK; | ||
317 | sdiv = (pll_con >> PLL65XX_SDIV_SHIFT) & PLL65XX_SDIV_MASK; | ||
318 | |||
319 | fvco *= mdiv; | ||
320 | do_div(fvco, (pdiv << sdiv)); | ||
321 | |||
322 | return (unsigned long)fvco; | ||
323 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p-clock.h b/arch/arm/plat-samsung/include/plat/s5p-clock.h deleted file mode 100644 index acacc4b88a39..000000000000 --- a/arch/arm/plat-samsung/include/plat/s5p-clock.h +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Header file for s5p clock support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_PLAT_S5P_CLOCK_H | ||
14 | #define __ASM_PLAT_S5P_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <linux/clk.h> | ||
17 | |||
18 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | ||
19 | |||
20 | #define clk_fin_apll clk_ext_xtal_mux | ||
21 | #define clk_fin_bpll clk_ext_xtal_mux | ||
22 | #define clk_fin_cpll clk_ext_xtal_mux | ||
23 | #define clk_fin_mpll clk_ext_xtal_mux | ||
24 | #define clk_fin_epll clk_ext_xtal_mux | ||
25 | #define clk_fin_dpll clk_ext_xtal_mux | ||
26 | #define clk_fin_vpll clk_ext_xtal_mux | ||
27 | #define clk_fin_hpll clk_ext_xtal_mux | ||
28 | |||
29 | extern struct clk clk_ext_xtal_mux; | ||
30 | extern struct clk clk_xusbxti; | ||
31 | extern struct clk clk_48m; | ||
32 | extern struct clk s5p_clk_27m; | ||
33 | extern struct clk clk_fout_apll; | ||
34 | extern struct clk clk_fout_bpll; | ||
35 | extern struct clk clk_fout_bpll_div2; | ||
36 | extern struct clk clk_fout_cpll; | ||
37 | extern struct clk clk_fout_mpll; | ||
38 | extern struct clk clk_fout_mpll_div2; | ||
39 | extern struct clk clk_fout_epll; | ||
40 | extern struct clk clk_fout_dpll; | ||
41 | extern struct clk clk_fout_vpll; | ||
42 | extern struct clk clk_arm; | ||
43 | extern struct clk clk_vpll; | ||
44 | |||
45 | extern struct clksrc_sources clk_src_apll; | ||
46 | extern struct clksrc_sources clk_src_bpll; | ||
47 | extern struct clksrc_sources clk_src_bpll_fout; | ||
48 | extern struct clksrc_sources clk_src_cpll; | ||
49 | extern struct clksrc_sources clk_src_mpll; | ||
50 | extern struct clksrc_sources clk_src_mpll_fout; | ||
51 | extern struct clksrc_sources clk_src_epll; | ||
52 | extern struct clksrc_sources clk_src_dpll; | ||
53 | |||
54 | extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable); | ||
55 | |||
56 | /* Common EPLL operations for S5P platform */ | ||
57 | extern int s5p_epll_enable(struct clk *clk, int enable); | ||
58 | extern unsigned long s5p_epll_get_rate(struct clk *clk); | ||
59 | |||
60 | /* SPDIF clk operations common for S5PV210/C110 and Exynos4 */ | ||
61 | extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate); | ||
62 | extern unsigned long s5p_spdif_get_rate(struct clk *clk); | ||
63 | |||
64 | extern struct clk_ops s5p_sclk_spdif_ops; | ||
65 | #endif /* __ASM_PLAT_S5P_CLOCK_H */ | ||