aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clock3xxx.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-02-23 00:09:36 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 19:45:15 -0500
commit4d30e82c26b7212021b9a5ab57760d9b8a3075fe (patch)
treeb824e735401ccf62eb762db68d06c4bd3231fab5 /arch/arm/mach-omap2/clock3xxx.c
parentad9561609c41f704fd82facd37127e957bcaea94 (diff)
OMAP2/3 clock: combine OMAP2 & 3 boot-time MPU rate change code
The OMAP2 and OMAP3 boot-time MPU rate change code is almost identical. Merge them into mach-omap2/clock.c, and add kerneldoc documentation. Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock3xxx.c')
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c59
1 files changed, 9 insertions, 50 deletions
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index d142457cd041..a447c4d2c28a 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -18,12 +18,9 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/delay.h>
22#include <linux/clk.h> 21#include <linux/clk.h>
23#include <linux/io.h> 22#include <linux/io.h>
24#include <linux/err.h>
25 23
26#include <plat/cpu.h>
27#include <plat/clock.h> 24#include <plat/clock.h>
28 25
29#include "clock.h" 26#include "clock.h"
@@ -83,63 +80,25 @@ void __init omap3_clk_lock_dpll5(void)
83 80
84/* Common clock code */ 81/* Common clock code */
85 82
86/* REVISIT: Move this init stuff out into clock.c */
87
88/* 83/*
89 * Switch the MPU rate if specified on cmdline. 84 * Switch the MPU rate if specified on cmdline. We cannot do this
90 * We cannot do this early until cmdline is parsed. 85 * early until cmdline is parsed. XXX This should be removed from the
86 * clock code and handled by the OPP layer code in the near future.
91 */ 87 */
92static int __init omap3xxx_clk_arch_init(void) 88static int __init omap3xxx_clk_arch_init(void)
93{ 89{
94 struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck; 90 int ret;
95 unsigned long osc_sys_rate;
96 bool err = 0;
97 91
98 if (!cpu_is_omap34xx()) 92 if (!cpu_is_omap34xx())
99 return 0; 93 return 0;
100 94
101 if (!mpurate) 95 ret = omap2_clk_switch_mpurate_at_boot("dpll1_ck");
102 return -EINVAL; 96 if (!ret)
103 97 omap2_clk_print_new_rates("osc_sys_ck", "arm_fck", "core_ck");
104 /* XXX test these for success */
105 dpll1_ck = clk_get(NULL, "dpll1_ck");
106 if (WARN(IS_ERR(dpll1_ck), "Failed to get dpll1_ck.\n"))
107 err = 1;
108
109 arm_fck = clk_get(NULL, "arm_fck");
110 if (WARN(IS_ERR(arm_fck), "Failed to get arm_fck.\n"))
111 err = 1;
112
113 core_ck = clk_get(NULL, "core_ck");
114 if (WARN(IS_ERR(core_ck), "Failed to get core_ck.\n"))
115 err = 1;
116
117 osc_sys_ck = clk_get(NULL, "osc_sys_ck");
118 if (WARN(IS_ERR(osc_sys_ck), "Failed to get osc_sys_ck.\n"))
119 err = 1;
120
121 if (err)
122 return -ENOENT;
123 98
124 /* REVISIT: not yet ready for 343x */ 99 return ret;
125 if (clk_set_rate(dpll1_ck, mpurate))
126 printk(KERN_ERR "*** Unable to set MPU rate\n");
127
128 recalculate_root_clocks();
129
130 osc_sys_rate = clk_get_rate(osc_sys_ck);
131
132 pr_info("Switched to new clocking rate (Crystal/Core/MPU): "
133 "%ld.%01ld/%ld/%ld MHz\n",
134 (osc_sys_rate / 1000000),
135 ((osc_sys_rate / 100000) % 10),
136 (clk_get_rate(core_ck) / 1000000),
137 (clk_get_rate(arm_fck) / 1000000));
138
139 calibrate_delay();
140
141 return 0;
142} 100}
101
143arch_initcall(omap3xxx_clk_arch_init); 102arch_initcall(omap3xxx_clk_arch_init);
144 103
145 104