aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-03-18 05:56:39 -0400
committerTony Lindgren <tony@atomide.com>2008-04-14 13:29:38 -0400
commita16e97037b518533569a778f0e997704e5c43796 (patch)
tree0ab385008123a46d2a396d8aa1bf690a2f506fea
parent2150ef46f8b5b2a5e3e5c53c1b04c513276ad4f7 (diff)
ARM: OMAP2: Clean up 24xx clock code
Clean up 24xx clock code to sync it with linux-omap tree. Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/clock.c15
-rw-r--r--arch/arm/mach-omap2/clock.h13
-rw-r--r--arch/arm/mach-omap2/clock24xx.c46
-rw-r--r--arch/arm/mach-omap2/clock24xx.h37
4 files changed, 49 insertions, 62 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index b76c9fc1b8e9..a5b9564ea78e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1,20 +1,13 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock.c 2 * linux/arch/arm/mach-omap2/clock.c
3 * 3 *
4 * Copyright (C) 2005 Texas Instruments Inc. 4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Richard Woodruff <r-woodruff2@ti.com> 5 * Copyright (C) 2004-2008 Nokia Corporation
6 * Created for OMAP2.
7 *
8 * Cleaned up and modified to use omap shared clock framework by
9 * Tony Lindgren <tony@atomide.com>
10 * 6 *
11 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Contacts:
12 * Copyright (C) 2007 Nokia Corporation 8 * Richard Woodruff <r-woodruff2@ti.com>
13 * Paul Walmsley 9 * Paul Walmsley
14 * 10 *
15 * Based on omap1 clock.c, Copyright (C) 2004 - 2005 Nokia corporation
16 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
17 *
18 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index d9cc99c466da..d5980a9e09a4 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -1,16 +1,11 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock.h 2 * linux/arch/arm/mach-omap2/clock.h
3 * 3 *
4 * Copyright (C) 2005 Texas Instruments Inc. 4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Richard Woodruff <r-woodruff2@ti.com> 5 * Copyright (C) 2004-2008 Nokia Corporation
6 * Created for OMAP2.
7 *
8 * Copyright (C) 2004 Nokia corporation
9 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
10 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
11 * 6 *
12 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Contacts:
13 * Copyright (C) 2007 Nokia Corporation 8 * Richard Woodruff <r-woodruff2@ti.com>
14 * Paul Walmsley 9 * Paul Walmsley
15 * 10 *
16 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 615b511c68c9..ece32d8acba4 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -1,15 +1,15 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock.c 2 * linux/arch/arm/mach-omap2/clock.c
3 * 3 *
4 * Copyright (C) 2005 Texas Instruments Inc. 4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Richard Woodruff <r-woodruff2@ti.com> 5 * Copyright (C) 2004-2008 Nokia Corporation
6 * Created for OMAP2.
7 * 6 *
8 * Cleaned up and modified to use omap shared clock framework by 7 * Contacts:
9 * Tony Lindgren <tony@atomide.com> 8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 * 10 *
11 * Based on omap1 clock.c, Copyright (C) 2004 - 2005 Nokia corporation 11 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 12 * Gordon McNutt and RidgeRun, Inc.
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
@@ -60,6 +60,21 @@ static struct clk *sclk;
60 * Omap24xx specific clock functions 60 * Omap24xx specific clock functions
61 *-------------------------------------------------------------------------*/ 61 *-------------------------------------------------------------------------*/
62 62
63/* This actually returns the rate of core_ck, not dpll_ck. */
64static u32 omap2_get_dpll_rate_24xx(struct clk *tclk)
65{
66 long long dpll_clk;
67 u8 amult;
68
69 dpll_clk = omap2_get_dpll_rate(tclk);
70
71 amult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
72 amult &= OMAP24XX_CORE_CLK_SRC_MASK;
73 dpll_clk *= amult;
74
75 return dpll_clk;
76}
77
63static int omap2_enable_osc_ck(struct clk *clk) 78static int omap2_enable_osc_ck(struct clk *clk)
64{ 79{
65 u32 pcc; 80 u32 pcc;
@@ -94,21 +109,6 @@ static void omap2_sys_clk_recalc(struct clk * clk)
94} 109}
95#endif /* OLD_CK */ 110#endif /* OLD_CK */
96 111
97/* This actually returns the rate of core_ck, not dpll_ck. */
98static u32 omap2_get_dpll_rate_24xx(struct clk *tclk)
99{
100 long long dpll_clk;
101 u8 amult;
102
103 dpll_clk = omap2_get_dpll_rate(tclk);
104
105 amult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
106 amult &= OMAP24XX_CORE_CLK_SRC_MASK;
107 dpll_clk *= amult;
108
109 return dpll_clk;
110}
111
112/* Enable an APLL if off */ 112/* Enable an APLL if off */
113static int omap2_clk_fixed_enable(struct clk *clk) 113static int omap2_clk_fixed_enable(struct clk *clk)
114{ 114{
@@ -333,7 +333,7 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
333 333
334 if (!found_speed) { 334 if (!found_speed) {
335 printk(KERN_INFO "Could not set MPU rate to %luMHz\n", 335 printk(KERN_INFO "Could not set MPU rate to %luMHz\n",
336 rate / 1000000); 336 rate / 1000000);
337 return -EINVAL; 337 return -EINVAL;
338 } 338 }
339 339
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index ccf6a6ca5ce4..88081ed13f96 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -1,13 +1,12 @@
1/* 1/*
2 * linux/arch/arm/mach-omap24xx/clock.h 2 * linux/arch/arm/mach-omap2/clock24xx.h
3 * 3 *
4 * Copyright (C) 2005 Texas Instruments Inc. 4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Richard Woodruff <r-woodruff2@ti.com> 5 * Copyright (C) 2004-2008 Nokia Corporation
6 * Created for OMAP2.
7 * 6 *
8 * Copyright (C) 2004 Nokia corporation 7 * Contacts:
9 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 8 * Richard Woodruff <r-woodruff2@ti.com>
10 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc 9 * Paul Walmsley
11 * 10 *
12 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of the GNU General Public License version 2 as
@@ -25,18 +24,18 @@
25#include "cm-regbits-24xx.h" 24#include "cm-regbits-24xx.h"
26#include "sdrc.h" 25#include "sdrc.h"
27 26
28static void omap2_table_mpu_recalc(struct clk * clk); 27static void omap2_table_mpu_recalc(struct clk *clk);
29static int omap2_select_table_rate(struct clk * clk, unsigned long rate); 28static int omap2_select_table_rate(struct clk *clk, unsigned long rate);
30static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate); 29static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
31static void omap2_sys_clk_recalc(struct clk * clk); 30static void omap2_sys_clk_recalc(struct clk *clk);
32static void omap2_osc_clk_recalc(struct clk * clk); 31static void omap2_osc_clk_recalc(struct clk *clk);
33static void omap2_sys_clk_recalc(struct clk * clk); 32static void omap2_sys_clk_recalc(struct clk *clk);
34static void omap2_dpll_recalc(struct clk * clk); 33static void omap2_dpll_recalc(struct clk *clk);
35static int omap2_clk_fixed_enable(struct clk * clk); 34static int omap2_clk_fixed_enable(struct clk *clk);
36static void omap2_clk_fixed_disable(struct clk * clk); 35static void omap2_clk_fixed_disable(struct clk *clk);
37static int omap2_enable_osc_ck(struct clk * clk); 36static int omap2_enable_osc_ck(struct clk *clk);
38static void omap2_disable_osc_ck(struct clk * clk); 37static void omap2_disable_osc_ck(struct clk *clk);
39static int omap2_reprogram_dpll(struct clk * clk, unsigned long rate); 38static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate);
40 39
41/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 40/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
42 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP 41 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP