aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/clk-pllv3.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-11-21 08:42:31 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2012-11-22 09:32:33 -0500
commit7a04092c733fd72ded1294719046cfdb31feced3 (patch)
tree2505ec2958480a8a06b5d11c07eb191bbf6ed8e0 /arch/arm/mach-imx/clk-pllv3.c
parent13861701a83765cc442ffe9bac0126ec75a3342e (diff)
ARM i.MX6: Fix ethernet PLL clocks
In current code the ethernet PLL is not handled correctly. The PLL runs at 500MHz and has different outputs. Only the enet reference clock is implemented. This patch changes the PLL so that it outputs 500MHz and adds the additional outputs as dividers. This now matches the datasheet which says: > This PLL synthesizes a low jitter clock from 24 MHz reference clock. > The PLL outputs a 500 MHz clock. The reference clocks generated by this PLL are: > • Ref_PCIe = 125 MHz > • Ref_SATA = 100 MHz > • Ref_ethernet, which is configurable based on the PLL_ENET[1:0] register field. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx/clk-pllv3.c')
-rw-r--r--arch/arm/mach-imx/clk-pllv3.c63
1 files changed, 1 insertions, 62 deletions
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c
index 36aac947bce1..59e74339ab08 100644
--- a/arch/arm/mach-imx/clk-pllv3.c
+++ b/arch/arm/mach-imx/clk-pllv3.c
@@ -287,66 +287,7 @@ static const struct clk_ops clk_pllv3_av_ops = {
287static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw, 287static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
288 unsigned long parent_rate) 288 unsigned long parent_rate)
289{ 289{
290 struct clk_pllv3 *pll = to_clk_pllv3(hw); 290 return 500000000;
291 u32 div = readl_relaxed(pll->base) & pll->div_mask;
292
293 switch (div) {
294 case 0:
295 return 25000000;
296 case 1:
297 return 50000000;
298 case 2:
299 return 100000000;
300 case 3:
301 return 125000000;
302 }
303
304 return 0;
305}
306
307static long clk_pllv3_enet_round_rate(struct clk_hw *hw, unsigned long rate,
308 unsigned long *prate)
309{
310 if (rate >= 125000000)
311 rate = 125000000;
312 else if (rate >= 100000000)
313 rate = 100000000;
314 else if (rate >= 50000000)
315 rate = 50000000;
316 else
317 rate = 25000000;
318 return rate;
319}
320
321static int clk_pllv3_enet_set_rate(struct clk_hw *hw, unsigned long rate,
322 unsigned long parent_rate)
323{
324 struct clk_pllv3 *pll = to_clk_pllv3(hw);
325 u32 val, div;
326
327 switch (rate) {
328 case 25000000:
329 div = 0;
330 break;
331 case 50000000:
332 div = 1;
333 break;
334 case 100000000:
335 div = 2;
336 break;
337 case 125000000:
338 div = 3;
339 break;
340 default:
341 return -EINVAL;
342 }
343
344 val = readl_relaxed(pll->base);
345 val &= ~pll->div_mask;
346 val |= div;
347 writel_relaxed(val, pll->base);
348
349 return 0;
350} 291}
351 292
352static const struct clk_ops clk_pllv3_enet_ops = { 293static const struct clk_ops clk_pllv3_enet_ops = {
@@ -355,8 +296,6 @@ static const struct clk_ops clk_pllv3_enet_ops = {
355 .enable = clk_pllv3_enable, 296 .enable = clk_pllv3_enable,
356 .disable = clk_pllv3_disable, 297 .disable = clk_pllv3_disable,
357 .recalc_rate = clk_pllv3_enet_recalc_rate, 298 .recalc_rate = clk_pllv3_enet_recalc_rate,
358 .round_rate = clk_pllv3_enet_round_rate,
359 .set_rate = clk_pllv3_enet_set_rate,
360}; 299};
361 300
362static const struct clk_ops clk_pllv3_mlb_ops = { 301static const struct clk_ops clk_pllv3_mlb_ops = {