aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:04 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:04 -0500
commit69ecefca514c318d0ce993c48ffa3bad009c7b9b (patch)
treeb23bcdbf2eda2fc212a5fd081abda89cbe13927f
parent4b1f76ed4f8012929494261eb6923b3c98554a9a (diff)
OMAP2/3/4 clock: combine all omap2_clk_functions
The struct clk_functions for OMAP2, 3, and 4 are all essentially the same, so combine them. This removes one multi-OMAP kernel impediment and saves memory on multi-OMAP builds. The stubs for omap2_clk_{init,exit}_cpufreq() code will removed once the OPP layer code that's currently in Kevin's PM branch is merged. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-omap2/clock.c17
-rw-r--r--arch/arm/mach-omap2/clock.h7
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c23
-rw-r--r--arch/arm/mach-omap2/clock34xx.c9
-rw-r--r--arch/arm/mach-omap2/clock44xx.c9
5 files changed, 32 insertions, 33 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 0d54fde5b455..999b91e023b1 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -351,3 +351,20 @@ void omap2_clk_disable_unused(struct clk *clk)
351 pwrdm_clkdm_state_switch(clk->clkdm); 351 pwrdm_clkdm_state_switch(clk->clkdm);
352} 352}
353#endif 353#endif
354
355/* Common data */
356
357struct clk_functions omap2_clk_functions = {
358 .clk_enable = omap2_clk_enable,
359 .clk_disable = omap2_clk_disable,
360 .clk_round_rate = omap2_clk_round_rate,
361 .clk_set_rate = omap2_clk_set_rate,
362 .clk_set_parent = omap2_clk_set_parent,
363 .clk_disable_unused = omap2_clk_disable_unused,
364#ifdef CONFIG_CPU_FREQ
365 /* These will be removed when the OPP code is integrated */
366 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
367 .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
368#endif
369};
370
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 0d21702a3cdd..dcd58cde13b6 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -105,5 +105,12 @@ extern const struct clksel_rate gpt_32k_rates[];
105extern const struct clksel_rate gpt_sys_rates[]; 105extern const struct clksel_rate gpt_sys_rates[];
106extern const struct clksel_rate gfx_l3_rates[]; 106extern const struct clksel_rate gfx_l3_rates[];
107 107
108#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_CPU_FREQ)
109extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
110extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
111#else
112#define omap2_clk_init_cpufreq_table 0
113#define omap2_clk_exit_cpufreq_table 0
114#endif
108 115
109#endif 116#endif
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index 5420356eb407..bef557488fec 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -453,13 +453,16 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
453 */ 453 */
454static struct cpufreq_frequency_table *freq_table; 454static struct cpufreq_frequency_table *freq_table;
455 455
456void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) 456void omap2xxx_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
457{ 457{
458 const struct prcm_config *prcm; 458 const struct prcm_config *prcm;
459 long sys_ck_rate; 459 long sys_ck_rate;
460 int i = 0; 460 int i = 0;
461 int tbl_sz = 0; 461 int tbl_sz = 0;
462 462
463 if (!cpu_is_omap2xxx())
464 return;
465
463 sys_ck_rate = clk_get_rate(sclk); 466 sys_ck_rate = clk_get_rate(sclk);
464 467
465 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 468 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
@@ -516,26 +519,16 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
516 *table = &freq_table[0]; 519 *table = &freq_table[0];
517} 520}
518 521
519void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) 522void omap2xxx_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
520{ 523{
524 if (!cpu_is_omap2xxx())
525 return;
526
521 kfree(freq_table); 527 kfree(freq_table);
522} 528}
523 529
524#endif 530#endif
525 531
526struct clk_functions omap2_clk_functions = {
527 .clk_enable = omap2_clk_enable,
528 .clk_disable = omap2_clk_disable,
529 .clk_round_rate = omap2_clk_round_rate,
530 .clk_set_rate = omap2_clk_set_rate,
531 .clk_set_parent = omap2_clk_set_parent,
532 .clk_disable_unused = omap2_clk_disable_unused,
533#ifdef CONFIG_CPU_FREQ
534 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
535 .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
536#endif
537};
538
539static u32 omap2_get_apll_clkin(void) 532static u32 omap2_get_apll_clkin(void)
540{ 533{
541 u32 aplls, srate = 0; 534 u32 aplls, srate = 0;
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index d4217b93e10b..4c4bb3cb79e8 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -258,15 +258,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
258 */ 258 */
259#if defined(CONFIG_ARCH_OMAP3) 259#if defined(CONFIG_ARCH_OMAP3)
260 260
261struct clk_functions omap2_clk_functions = {
262 .clk_enable = omap2_clk_enable,
263 .clk_disable = omap2_clk_disable,
264 .clk_round_rate = omap2_clk_round_rate,
265 .clk_set_rate = omap2_clk_set_rate,
266 .clk_set_parent = omap2_clk_set_parent,
267 .clk_disable_unused = omap2_clk_disable_unused,
268};
269
270/* 261/*
271 * Set clocks for bypass mode for reboot to work. 262 * Set clocks for bypass mode for reboot to work.
272 */ 263 */
diff --git a/arch/arm/mach-omap2/clock44xx.c b/arch/arm/mach-omap2/clock44xx.c
index e370868a79a8..08dd6427df70 100644
--- a/arch/arm/mach-omap2/clock44xx.c
+++ b/arch/arm/mach-omap2/clock44xx.c
@@ -13,15 +13,6 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include "clock.h" 14#include "clock.h"
15 15
16struct clk_functions omap2_clk_functions = {
17 .clk_enable = omap2_clk_enable,
18 .clk_disable = omap2_clk_disable,
19 .clk_round_rate = omap2_clk_round_rate,
20 .clk_set_rate = omap2_clk_set_rate,
21 .clk_set_parent = omap2_clk_set_parent,
22 .clk_disable_unused = omap2_clk_disable_unused,
23};
24
25const struct clkops clkops_noncore_dpll_ops = { 16const struct clkops clkops_noncore_dpll_ops = {
26 .enable = &omap3_noncore_dpll_enable, 17 .enable = &omap3_noncore_dpll_enable,
27 .disable = &omap3_noncore_dpll_disable, 18 .disable = &omap3_noncore_dpll_disable,