ARM: OMAP: implement CPUfreq frequency table based on PRCM table
[Tony, the cpu-omap code now passes in a table pointer which gets set
to the one filled out in the clock code. Is this what you meant? ]
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
--- arch/arm/mach-omap2/clock24xx.c | 34 ++++++++++++++++++++++++++ arch/arm/plat-omap/cpu-omap.c | 52 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 84 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock24xx.c +34 -0
@@ -26,6 +26,7 @@#include <linux/clk.h> #include <linux/io.h> +#include <linux/cpufreq.h> #include <asm/arch/clock.h> #include <asm/arch/sram.h>
@@ -461,6 +462,39 @@ static int __init omap2_clk_arch_init(vo }arch_initcall (omap2_clk_arch_init); +#ifdef CONFIG_CPU_FREQ +/* +* Walk PRCM rate table and fillout cpufreq freq_table +*/ +static struct cpufreq_frequency_table freq_table[ARRAY_SIZE (rate_table)]; + +void omap2_cpufreq_init_table (struct cpufreq_frequency_table **table) +{ +struct prcm_config *prcm; +int i =0 ; + +for (prcm = rate_table; prcm->mpu_speed; prcm++) { +if (!(prcm->flags & cpu_mask)) +continue ; +if (prcm->xtal_speed != sys_ck.rate) +continue ; + +/* don't put bypass rates in table */ +if (prcm->dpll_speed == prcm->xtal_speed) +continue ; + + freq_table[i].index = i; + freq_table[i].frequency = prcm->mpu_speed /1000 ; + i++; + } + + freq_table[i].index = i; + freq_table[i].frequency =CPUFREQ_TABLE_END ; + + *table = &freq_table[0 ]; +} +#endif +int __init omap2_clk_init (void ) {struct prcm_config *prcm;
arch/arm/plat-omap/cpu-omap.c +50 -2
111 lines not on this page · raw message
--
Tony Lindgren
maintainerHi,
Quoted 2 lines · Kevin Hilman
[Tony, the cpu-omap code now passes in a table pointer which gets set
to the one filled out in the clock code. Is this what you meant? ]
Yeh, looks good. Just one more thing below.
Quoted 9 lines
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
<snip>
Quoted 6 lines
Index:
dev/arch/arm/plat-omap/cpu-omap.c
===================================================================arch/arm/plat-omap/cpu-omap.c +0
-0@@ -30,6 +30,11 @@#ifdef CONFIG_ARCH_OMAP1
arch/arm/plat-omap/cpu-omap.c line 40
Quoted 10 lines
arch/arm/plat-omap/cpu-omap.c +5
-0#define MPU_CLK "mpu"#else + +#define USE_FREQ_TABLE +void omap2_cpufreq_init_table (struct cpufreq_frequency_table **table); +static struct cpufreq_frequency_table *freq_table; +#define MPU_CLK "virt_prcm_set"#endif
How about calling omap2_cpufreq_init_table clk_init_cpufreq_table instead? Then export it and define it in clock.h for omap? It should be possible to have cpufreq as a module.
Regards,
Tony