diff options
author | Kevin Hilman <khilman@mvista.com> | 2009-01-27 21:13:38 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-08 12:50:28 -0500 |
commit | aeec299011da8c3f07a47fe5d988f0eafda53906 (patch) | |
tree | 8661476adf90325972e5feab723f1272ab04fc6b /arch/arm/mach-omap2/clock24xx.c | |
parent | ae8578c0194695bd37435249dfed720769a6bbf3 (diff) |
[ARM] OMAP2: Implement CPUfreq frequency table based on PRCM table
This patch adds a CPUfreq frequency-table implementation for OMAP2 by
walking the PRCM rate-table for available entries and adding them to a
CPUfreq table.
CPUfreq can then be used to manage switching between all the available
entries in the PRCM rate table. Either use the CPUfreq sysfs
interface directly, (see Section 3 of Documentation/cpu-freq/user-guide.txt)
or use the cpufrequtils package:
http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Updated to try to use cpufreq_table if it exists.
linux-omap source commit is 77ce544fa48deb7a2003f454624e3ca10d37ab87.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap2/clock24xx.c')
-rw-r--r-- | arch/arm/mach-omap2/clock24xx.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index 421728a7f903..b9902666e4b7 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -574,6 +574,45 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
574 | return 0; | 574 | return 0; |
575 | } | 575 | } |
576 | 576 | ||
577 | #ifdef CONFIG_CPU_FREQ | ||
578 | /* | ||
579 | * Walk PRCM rate table and fillout cpufreq freq_table | ||
580 | */ | ||
581 | static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)]; | ||
582 | |||
583 | void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | ||
584 | { | ||
585 | struct prcm_config *prcm; | ||
586 | int i = 0; | ||
587 | |||
588 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
589 | if (!(prcm->flags & cpu_mask)) | ||
590 | continue; | ||
591 | if (prcm->xtal_speed != sys_ck.rate) | ||
592 | continue; | ||
593 | |||
594 | /* don't put bypass rates in table */ | ||
595 | if (prcm->dpll_speed == prcm->xtal_speed) | ||
596 | continue; | ||
597 | |||
598 | freq_table[i].index = i; | ||
599 | freq_table[i].frequency = prcm->mpu_speed / 1000; | ||
600 | i++; | ||
601 | } | ||
602 | |||
603 | if (i == 0) { | ||
604 | printk(KERN_WARNING "%s: failed to initialize frequency " | ||
605 | "table\n", __func__); | ||
606 | return; | ||
607 | } | ||
608 | |||
609 | freq_table[i].index = i; | ||
610 | freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
611 | |||
612 | *table = &freq_table[0]; | ||
613 | } | ||
614 | #endif | ||
615 | |||
577 | static struct clk_functions omap2_clk_functions = { | 616 | static struct clk_functions omap2_clk_functions = { |
578 | .clk_enable = omap2_clk_enable, | 617 | .clk_enable = omap2_clk_enable, |
579 | .clk_disable = omap2_clk_disable, | 618 | .clk_disable = omap2_clk_disable, |
@@ -581,6 +620,9 @@ static struct clk_functions omap2_clk_functions = { | |||
581 | .clk_set_rate = omap2_clk_set_rate, | 620 | .clk_set_rate = omap2_clk_set_rate, |
582 | .clk_set_parent = omap2_clk_set_parent, | 621 | .clk_set_parent = omap2_clk_set_parent, |
583 | .clk_disable_unused = omap2_clk_disable_unused, | 622 | .clk_disable_unused = omap2_clk_disable_unused, |
623 | #ifdef CONFIG_CPU_FREQ | ||
624 | .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, | ||
625 | #endif | ||
584 | }; | 626 | }; |
585 | 627 | ||
586 | static u32 omap2_get_apll_clkin(void) | 628 | static u32 omap2_get_apll_clkin(void) |