aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-11-15 11:08:51 -0500
committerArnd Bergmann <arnd@arndb.de>2012-11-15 11:08:51 -0500
commitcb64babf9ebe06984d87c08d241d05e2f6a7eb5b (patch)
tree61cd54de0b0dc5c42a99ee733e9984700b0732b7 /arch/arm/mach-omap2/clkt2xxx_dpllcore.c
parent809a3226ad7cf0807f79ddc31ed2094dbb9911fd (diff)
parentcc4b1e24b93dd529b1d49258bee044d319b5b129 (diff)
Merge tag 'omap-for-v3.8/cleanup-prcm-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/cleanup
From Tony Lindgren <tony@atomide.com>: More PRCM cleanups via Paul Walmsley <paul@pwsan.com>: Second set of OMAP PRCM cleanups for 3.8. These patches remove the use of omap_prcm_get_reset_sources() from the OMAP watchdog driver, and remove mach-omap2/prcm.c and plat-omap/include/plat/prcm.h. Basic test logs for this branch on top of Tony's cleanup-prcm branch at commit 7fc54fd3084457c7f11b9e2e1e3fcd19a3badc33 are here: http://www.pwsan.com/omap/testlogs/prcm_cleanup_b_3.8/20121108151646/ However, cleanup-prcm at 7fc54fd3 does not include some fixes that are needed for a successful test. With several reverts, fixes, and workarounds applied, the following test logs were obtained: http://www.pwsan.com/omap/testlogs/TEST_prcm_cleanup_b_3.8/20121108151930/ which indicate that the series tests cleanly. This second pull request updates one of the patches which broke with rmk's allnoconfigs, and also updates the tag description to indicate that 7fc54fd3 is building cleanly here. * tag 'omap-for-v3.8/cleanup-prcm-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (27 commits) ARM: OMAP2: Fix compillation error in cm_common ARM: OMAP2+: PRCM: remove obsolete prcm.[ch] ARM: OMAP2+: hwmod: call to _omap4_disable_module() should use the SoC-specific call ARM: OMAP2+: PRCM: consolidate PRCM-related timeout macros ARM: OMAP2+: PRCM: split and relocate the PRM/CM globals setup ARM: OMAP2+: PRCM: remove omap2_cm_wait_idlest() ARM: OMAP2+: CM/clock: convert _omap2_module_wait_ready() to use SoC-independent CM functions ARM: OMAP2xxx: APLL/CM: convert to use omap2_cm_wait_module_ready() ARM: OMAP2+: board files: use SoC-specific system restart functions ARM: OMAP2+: PRCM: create SoC-specific chip restart functions ARM: OMAP2xxx: clock: move virt_prcm_set code into clkt2xxx_virt_prcm_set.c ARM: OMAP2xxx: clock: remove global 'dclk' variable ARM: OMAP2/3: PRM: add SoC reset functions (using the CORE DPLL method) ARM: OMAP2+: common: remove mach-omap2/common.c globals and map_common_io code ARM: OMAP2+: PRCM: remove omap_prcm_get_reset_sources() watchdog: OMAP: use standard GETBOOTSTATUS interface; use platform_data fn ptr ARM: OMAP2+: WDT: move init; add read_reset_sources pdata function pointer ARM: OMAP1: CGRM: fix omap1_get_reset_sources() return type ARM: OMAP2+: PRM: create PRM reset source API for the watchdog timer driver ARM: OMAP1: create read_reset_sources() function (for initial use by watchdog) ... Conflicts: arch/arm/mach-omap2/cm33xx.c arch/arm/mach-omap2/io.c arch/arm/mach-omap2/prm_common.c Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-omap2/clkt2xxx_dpllcore.c')
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 0d2f14c2dcce..825e44cdf1cf 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -28,16 +28,22 @@
28#include "clock.h" 28#include "clock.h"
29#include "clock2xxx.h" 29#include "clock2xxx.h"
30#include "opp2xxx.h" 30#include "opp2xxx.h"
31#include "cm2xxx_3xxx.h" 31#include "cm2xxx.h"
32#include "cm-regbits-24xx.h" 32#include "cm-regbits-24xx.h"
33#include "sdrc.h" 33#include "sdrc.h"
34#include "sram.h" 34#include "sram.h"
35 35
36/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 36/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
37 37
38/*
39 * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
40 * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
41 * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
42 */
43static struct clk *dpll_core_ck;
44
38/** 45/**
39 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 46 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
40 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
41 * 47 *
42 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate 48 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
43 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz 49 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
@@ -45,12 +51,14 @@
45 * struct clk *dpll_ck, which is a composite clock of dpll_ck and 51 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
46 * core_ck. 52 * core_ck.
47 */ 53 */
48unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) 54unsigned long omap2xxx_clk_get_core_rate(void)
49{ 55{
50 long long core_clk; 56 long long core_clk;
51 u32 v; 57 u32 v;
52 58
53 core_clk = omap2_get_dpll_rate(clk); 59 WARN_ON(!dpll_core_ck);
60
61 core_clk = omap2_get_dpll_rate(dpll_core_ck);
54 62
55 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 63 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
56 v &= OMAP24XX_CORE_CLK_SRC_MASK; 64 v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -98,7 +106,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
98 106
99unsigned long omap2_dpllcore_recalc(struct clk *clk) 107unsigned long omap2_dpllcore_recalc(struct clk *clk)
100{ 108{
101 return omap2xxx_clk_get_core_rate(clk); 109 return omap2xxx_clk_get_core_rate();
102} 110}
103 111
104int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 112int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
@@ -108,7 +116,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
108 struct prcm_config tmpset; 116 struct prcm_config tmpset;
109 const struct dpll_data *dd; 117 const struct dpll_data *dd;
110 118
111 cur_rate = omap2xxx_clk_get_core_rate(dclk); 119 cur_rate = omap2xxx_clk_get_core_rate();
112 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 120 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
113 mult &= OMAP24XX_CORE_CLK_SRC_MASK; 121 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
114 122
@@ -169,3 +177,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
169 return 0; 177 return 0;
170} 178}
171 179
180/**
181 * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
182 * @clk: struct clk *dpll_ck
183 *
184 * Store a local copy of @clk in dpll_core_ck so other code can query
185 * the core rate without having to clk_get(), which can sleep. Must
186 * only be called once. No return value. XXX If the clock
187 * registration process is ever changed such that dpll_ck is no longer
188 * statically defined, this code may need to change to increment some
189 * kind of use count on dpll_ck.
190 */
191void omap2xxx_clkt_dpllcore_init(struct clk *clk)
192{
193 WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
194 dpll_core_ck = clk;
195}