diff options
author | Hartley Sweeten <hartleys@visionengravers.com> | 2009-10-08 18:44:41 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-10-10 07:45:13 -0400 |
commit | ebd00c08e28a0ab4dcb715d222214625fff6d62a (patch) | |
tree | 424dfc1197daa21a6403a373575dfeb5113e215f /arch | |
parent | 6531a991f95f2f34fc00cf0a030b1cdd5e19dc02 (diff) |
ARM: 5756/1: ep93xx: introduce clk parent
The clock generation system in the ep93xx uses two external oscillator's
and two internal PLLs to derive all the internal clocks. Many of these
internal clocks can be stopped to save power.
This introduces a "parent" hierarchy for the clocks so that the users
count can be correctly tracked for power management.
The "parent" for the video clock can either be one of the PLL outputs
or the external oscillator. In order to correctly track the "parent"
for the video clock calc_clk_div() needed to be modified. It now
returns an error code if the desired rate cannot be generated.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ep93xx/clock.c | 166 |
1 files changed, 119 insertions, 47 deletions
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index dda19cd76194..1d0f9d8aff2e 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c | |||
@@ -16,13 +16,16 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/spinlock.h> | ||
20 | |||
21 | #include <mach/hardware.h> | ||
19 | 22 | ||
20 | #include <asm/clkdev.h> | 23 | #include <asm/clkdev.h> |
21 | #include <asm/div64.h> | 24 | #include <asm/div64.h> |
22 | #include <mach/hardware.h> | ||
23 | 25 | ||
24 | 26 | ||
25 | struct clk { | 27 | struct clk { |
28 | struct clk *parent; | ||
26 | unsigned long rate; | 29 | unsigned long rate; |
27 | int users; | 30 | int users; |
28 | int sw_locked; | 31 | int sw_locked; |
@@ -39,40 +42,60 @@ static unsigned long get_uart_rate(struct clk *clk); | |||
39 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); | 42 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); |
40 | static int set_div_rate(struct clk *clk, unsigned long rate); | 43 | static int set_div_rate(struct clk *clk, unsigned long rate); |
41 | 44 | ||
45 | |||
46 | static struct clk clk_xtali = { | ||
47 | .rate = EP93XX_EXT_CLK_RATE, | ||
48 | }; | ||
42 | static struct clk clk_uart1 = { | 49 | static struct clk clk_uart1 = { |
50 | .parent = &clk_xtali, | ||
43 | .sw_locked = 1, | 51 | .sw_locked = 1, |
44 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 52 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
45 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, | 53 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, |
46 | .get_rate = get_uart_rate, | 54 | .get_rate = get_uart_rate, |
47 | }; | 55 | }; |
48 | static struct clk clk_uart2 = { | 56 | static struct clk clk_uart2 = { |
57 | .parent = &clk_xtali, | ||
49 | .sw_locked = 1, | 58 | .sw_locked = 1, |
50 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 59 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
51 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, | 60 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, |
52 | .get_rate = get_uart_rate, | 61 | .get_rate = get_uart_rate, |
53 | }; | 62 | }; |
54 | static struct clk clk_uart3 = { | 63 | static struct clk clk_uart3 = { |
64 | .parent = &clk_xtali, | ||
55 | .sw_locked = 1, | 65 | .sw_locked = 1, |
56 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 66 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
57 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, | 67 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, |
58 | .get_rate = get_uart_rate, | 68 | .get_rate = get_uart_rate, |
59 | }; | 69 | }; |
60 | static struct clk clk_pll1; | 70 | static struct clk clk_pll1 = { |
61 | static struct clk clk_f; | 71 | .parent = &clk_xtali, |
62 | static struct clk clk_h; | 72 | }; |
63 | static struct clk clk_p; | 73 | static struct clk clk_f = { |
64 | static struct clk clk_pll2; | 74 | .parent = &clk_pll1, |
75 | }; | ||
76 | static struct clk clk_h = { | ||
77 | .parent = &clk_pll1, | ||
78 | }; | ||
79 | static struct clk clk_p = { | ||
80 | .parent = &clk_pll1, | ||
81 | }; | ||
82 | static struct clk clk_pll2 = { | ||
83 | .parent = &clk_xtali, | ||
84 | }; | ||
65 | static struct clk clk_usb_host = { | 85 | static struct clk clk_usb_host = { |
86 | .parent = &clk_pll2, | ||
66 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 87 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
67 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, | 88 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, |
68 | }; | 89 | }; |
69 | static struct clk clk_keypad = { | 90 | static struct clk clk_keypad = { |
91 | .parent = &clk_xtali, | ||
70 | .sw_locked = 1, | 92 | .sw_locked = 1, |
71 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, | 93 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, |
72 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, | 94 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, |
73 | .set_rate = set_keytchclk_rate, | 95 | .set_rate = set_keytchclk_rate, |
74 | }; | 96 | }; |
75 | static struct clk clk_pwm = { | 97 | static struct clk clk_pwm = { |
98 | .parent = &clk_xtali, | ||
76 | .rate = EP93XX_EXT_CLK_RATE, | 99 | .rate = EP93XX_EXT_CLK_RATE, |
77 | }; | 100 | }; |
78 | 101 | ||
@@ -85,50 +108,62 @@ static struct clk clk_video = { | |||
85 | 108 | ||
86 | /* DMA Clocks */ | 109 | /* DMA Clocks */ |
87 | static struct clk clk_m2p0 = { | 110 | static struct clk clk_m2p0 = { |
111 | .parent = &clk_h, | ||
88 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 112 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
89 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, | 113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, |
90 | }; | 114 | }; |
91 | static struct clk clk_m2p1 = { | 115 | static struct clk clk_m2p1 = { |
116 | .parent = &clk_h, | ||
92 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 117 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
93 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, | 118 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, |
94 | }; | 119 | }; |
95 | static struct clk clk_m2p2 = { | 120 | static struct clk clk_m2p2 = { |
121 | .parent = &clk_h, | ||
96 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 122 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
97 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, | 123 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, |
98 | }; | 124 | }; |
99 | static struct clk clk_m2p3 = { | 125 | static struct clk clk_m2p3 = { |
126 | .parent = &clk_h, | ||
100 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 127 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
101 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, | 128 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, |
102 | }; | 129 | }; |
103 | static struct clk clk_m2p4 = { | 130 | static struct clk clk_m2p4 = { |
131 | .parent = &clk_h, | ||
104 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 132 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
105 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, | 133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, |
106 | }; | 134 | }; |
107 | static struct clk clk_m2p5 = { | 135 | static struct clk clk_m2p5 = { |
136 | .parent = &clk_h, | ||
108 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 137 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
109 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, | 138 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, |
110 | }; | 139 | }; |
111 | static struct clk clk_m2p6 = { | 140 | static struct clk clk_m2p6 = { |
141 | .parent = &clk_h, | ||
112 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 142 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, | 143 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, |
114 | }; | 144 | }; |
115 | static struct clk clk_m2p7 = { | 145 | static struct clk clk_m2p7 = { |
146 | .parent = &clk_h, | ||
116 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 147 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
117 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, | 148 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, |
118 | }; | 149 | }; |
119 | static struct clk clk_m2p8 = { | 150 | static struct clk clk_m2p8 = { |
151 | .parent = &clk_h, | ||
120 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 152 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
121 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, | 153 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, |
122 | }; | 154 | }; |
123 | static struct clk clk_m2p9 = { | 155 | static struct clk clk_m2p9 = { |
156 | .parent = &clk_h, | ||
124 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 157 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
125 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, | 158 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, |
126 | }; | 159 | }; |
127 | static struct clk clk_m2m0 = { | 160 | static struct clk clk_m2m0 = { |
161 | .parent = &clk_h, | ||
128 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 162 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
129 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, | 163 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, |
130 | }; | 164 | }; |
131 | static struct clk clk_m2m1 = { | 165 | static struct clk clk_m2m1 = { |
166 | .parent = &clk_h, | ||
132 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 167 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, | 168 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, |
134 | }; | 169 | }; |
@@ -137,6 +172,7 @@ static struct clk clk_m2m1 = { | |||
137 | { .dev_id = dev, .con_id = con, .clk = ck } | 172 | { .dev_id = dev, .con_id = con, .clk = ck } |
138 | 173 | ||
139 | static struct clk_lookup clocks[] = { | 174 | static struct clk_lookup clocks[] = { |
175 | INIT_CK(NULL, "xtali", &clk_xtali), | ||
140 | INIT_CK("apb:uart1", NULL, &clk_uart1), | 176 | INIT_CK("apb:uart1", NULL, &clk_uart1), |
141 | INIT_CK("apb:uart2", NULL, &clk_uart2), | 177 | INIT_CK("apb:uart2", NULL, &clk_uart2), |
142 | INIT_CK("apb:uart3", NULL, &clk_uart3), | 178 | INIT_CK("apb:uart3", NULL, &clk_uart3), |
@@ -163,48 +199,84 @@ static struct clk_lookup clocks[] = { | |||
163 | INIT_CK(NULL, "m2m1", &clk_m2m1), | 199 | INIT_CK(NULL, "m2m1", &clk_m2m1), |
164 | }; | 200 | }; |
165 | 201 | ||
202 | static DEFINE_SPINLOCK(clk_lock); | ||
203 | |||
204 | static void __clk_enable(struct clk *clk) | ||
205 | { | ||
206 | if (!clk->users++) { | ||
207 | if (clk->parent) | ||
208 | __clk_enable(clk->parent); | ||
209 | |||
210 | if (clk->enable_reg) { | ||
211 | u32 v; | ||
212 | |||
213 | v = __raw_readl(clk->enable_reg); | ||
214 | v |= clk->enable_mask; | ||
215 | if (clk->sw_locked) | ||
216 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
217 | else | ||
218 | __raw_writel(v, clk->enable_reg); | ||
219 | } | ||
220 | } | ||
221 | } | ||
166 | 222 | ||
167 | int clk_enable(struct clk *clk) | 223 | int clk_enable(struct clk *clk) |
168 | { | 224 | { |
169 | if (!clk->users++ && clk->enable_reg) { | 225 | unsigned long flags; |
170 | u32 value; | ||
171 | 226 | ||
172 | value = __raw_readl(clk->enable_reg); | 227 | if (!clk) |
173 | value |= clk->enable_mask; | 228 | return -EINVAL; |
174 | if (clk->sw_locked) | 229 | |
175 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | 230 | spin_lock_irqsave(&clk_lock, flags); |
176 | else | 231 | __clk_enable(clk); |
177 | __raw_writel(value, clk->enable_reg); | 232 | spin_unlock_irqrestore(&clk_lock, flags); |
178 | } | ||
179 | 233 | ||
180 | return 0; | 234 | return 0; |
181 | } | 235 | } |
182 | EXPORT_SYMBOL(clk_enable); | 236 | EXPORT_SYMBOL(clk_enable); |
183 | 237 | ||
184 | void clk_disable(struct clk *clk) | 238 | static void __clk_disable(struct clk *clk) |
185 | { | 239 | { |
186 | if (!--clk->users && clk->enable_reg) { | 240 | if (!--clk->users) { |
187 | u32 value; | 241 | if (clk->enable_reg) { |
242 | u32 v; | ||
243 | |||
244 | v = __raw_readl(clk->enable_reg); | ||
245 | v &= ~clk->enable_mask; | ||
246 | if (clk->sw_locked) | ||
247 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
248 | else | ||
249 | __raw_writel(v, clk->enable_reg); | ||
250 | } | ||
188 | 251 | ||
189 | value = __raw_readl(clk->enable_reg); | 252 | if (clk->parent) |
190 | value &= ~clk->enable_mask; | 253 | __clk_disable(clk->parent); |
191 | if (clk->sw_locked) | ||
192 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | ||
193 | else | ||
194 | __raw_writel(value, clk->enable_reg); | ||
195 | } | 254 | } |
196 | } | 255 | } |
256 | |||
257 | void clk_disable(struct clk *clk) | ||
258 | { | ||
259 | unsigned long flags; | ||
260 | |||
261 | if (!clk) | ||
262 | return; | ||
263 | |||
264 | spin_lock_irqsave(&clk_lock, flags); | ||
265 | __clk_disable(clk); | ||
266 | spin_unlock_irqrestore(&clk_lock, flags); | ||
267 | } | ||
197 | EXPORT_SYMBOL(clk_disable); | 268 | EXPORT_SYMBOL(clk_disable); |
198 | 269 | ||
199 | static unsigned long get_uart_rate(struct clk *clk) | 270 | static unsigned long get_uart_rate(struct clk *clk) |
200 | { | 271 | { |
272 | unsigned long rate = clk_get_rate(clk->parent); | ||
201 | u32 value; | 273 | u32 value; |
202 | 274 | ||
203 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); | 275 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); |
204 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) | 276 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) |
205 | return EP93XX_EXT_CLK_RATE; | 277 | return rate; |
206 | else | 278 | else |
207 | return EP93XX_EXT_CLK_RATE / 2; | 279 | return rate / 2; |
208 | } | 280 | } |
209 | 281 | ||
210 | unsigned long clk_get_rate(struct clk *clk) | 282 | unsigned long clk_get_rate(struct clk *clk) |
@@ -244,16 +316,16 @@ static int set_keytchclk_rate(struct clk *clk, unsigned long rate) | |||
244 | return 0; | 316 | return 0; |
245 | } | 317 | } |
246 | 318 | ||
247 | static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | 319 | static int calc_clk_div(struct clk *clk, unsigned long rate, |
248 | int *pdiv, int *div) | 320 | int *psel, int *esel, int *pdiv, int *div) |
249 | { | 321 | { |
250 | unsigned long max_rate, best_rate = 0, | 322 | struct clk *mclk; |
251 | actual_rate = 0, mclk_rate = 0, rate_err = -1; | 323 | unsigned long max_rate, actual_rate, mclk_rate, rate_err = -1; |
252 | int i, found = 0, __div = 0, __pdiv = 0; | 324 | int i, found = 0, __div = 0, __pdiv = 0; |
253 | 325 | ||
254 | /* Don't exceed the maximum rate */ | 326 | /* Don't exceed the maximum rate */ |
255 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), | 327 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), |
256 | (unsigned long)EP93XX_EXT_CLK_RATE / 4); | 328 | clk_xtali.rate / 4); |
257 | rate = min(rate, max_rate); | 329 | rate = min(rate, max_rate); |
258 | 330 | ||
259 | /* | 331 | /* |
@@ -267,11 +339,12 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
267 | */ | 339 | */ |
268 | for (i = 0; i < 3; i++) { | 340 | for (i = 0; i < 3; i++) { |
269 | if (i == 0) | 341 | if (i == 0) |
270 | mclk_rate = EP93XX_EXT_CLK_RATE * 2; | 342 | mclk = &clk_xtali; |
271 | else if (i == 1) | 343 | else if (i == 1) |
272 | mclk_rate = clk_pll1.rate * 2; | 344 | mclk = &clk_pll1; |
273 | else if (i == 2) | 345 | else |
274 | mclk_rate = clk_pll2.rate * 2; | 346 | mclk = &clk_pll2; |
347 | mclk_rate = mclk->rate * 2; | ||
275 | 348 | ||
276 | /* Try each predivider value */ | 349 | /* Try each predivider value */ |
277 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { | 350 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { |
@@ -286,7 +359,8 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
286 | *div = __div; | 359 | *div = __div; |
287 | *psel = (i == 2); | 360 | *psel = (i == 2); |
288 | *esel = (i != 0); | 361 | *esel = (i != 0); |
289 | best_rate = actual_rate; | 362 | clk->parent = mclk; |
363 | clk->rate = actual_rate; | ||
290 | rate_err = abs(actual_rate - rate); | 364 | rate_err = abs(actual_rate - rate); |
291 | found = 1; | 365 | found = 1; |
292 | } | 366 | } |
@@ -294,21 +368,19 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
294 | } | 368 | } |
295 | 369 | ||
296 | if (!found) | 370 | if (!found) |
297 | return 0; | 371 | return -EINVAL; |
298 | 372 | ||
299 | return best_rate; | 373 | return 0; |
300 | } | 374 | } |
301 | 375 | ||
302 | static int set_div_rate(struct clk *clk, unsigned long rate) | 376 | static int set_div_rate(struct clk *clk, unsigned long rate) |
303 | { | 377 | { |
304 | unsigned long actual_rate; | 378 | int err, psel = 0, esel = 0, pdiv = 0, div = 0; |
305 | int psel = 0, esel = 0, pdiv = 0, div = 0; | ||
306 | u32 val; | 379 | u32 val; |
307 | 380 | ||
308 | actual_rate = calc_clk_div(rate, &psel, &esel, &pdiv, &div); | 381 | err = calc_clk_div(clk, rate, &psel, &esel, &pdiv, &div); |
309 | if (actual_rate == 0) | 382 | if (err) |
310 | return -EINVAL; | 383 | return err; |
311 | clk->rate = actual_rate; | ||
312 | 384 | ||
313 | /* Clear the esel, psel, pdiv and div bits */ | 385 | /* Clear the esel, psel, pdiv and div bits */ |
314 | val = __raw_readl(clk->enable_reg); | 386 | val = __raw_readl(clk->enable_reg); |
@@ -344,7 +416,7 @@ static unsigned long calc_pll_rate(u32 config_word) | |||
344 | unsigned long long rate; | 416 | unsigned long long rate; |
345 | int i; | 417 | int i; |
346 | 418 | ||
347 | rate = EP93XX_EXT_CLK_RATE; | 419 | rate = clk_xtali.rate; |
348 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ | 420 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ |
349 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ | 421 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ |
350 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ | 422 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ |
@@ -377,7 +449,7 @@ static int __init ep93xx_clock_init(void) | |||
377 | 449 | ||
378 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); | 450 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); |
379 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ | 451 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ |
380 | clk_pll1.rate = EP93XX_EXT_CLK_RATE; | 452 | clk_pll1.rate = clk_xtali.rate; |
381 | } else { | 453 | } else { |
382 | clk_pll1.rate = calc_pll_rate(value); | 454 | clk_pll1.rate = calc_pll_rate(value); |
383 | } | 455 | } |
@@ -388,7 +460,7 @@ static int __init ep93xx_clock_init(void) | |||
388 | 460 | ||
389 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); | 461 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); |
390 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ | 462 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ |
391 | clk_pll2.rate = EP93XX_EXT_CLK_RATE; | 463 | clk_pll2.rate = clk_xtali.rate; |
392 | } else if (value & 0x00040000) { /* PLL2 enabled? */ | 464 | } else if (value & 0x00040000) { /* PLL2 enabled? */ |
393 | clk_pll2.rate = calc_pll_rate(value); | 465 | clk_pll2.rate = calc_pll_rate(value); |
394 | } else { | 466 | } else { |