aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-omap/Makefile1
-rw-r--r--drivers/cpufreq/Makefile1
-rw-r--r--drivers/cpufreq/omap-cpufreq.c (renamed from arch/arm/plat-omap/cpu-omap.c)69
3 files changed, 44 insertions, 27 deletions
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 985262242f25..a53eca33627f 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_device.o
19 19
20obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 20obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
21 21
22obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
23obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 22obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
24obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o 23obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
25obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o 24obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index a48bc02cd765..ce75fcbcca4f 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_UX500_SOC_DB8500) += db8500-cpufreq.o
43obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o 43obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o
44obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o 44obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o
45obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o 45obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o
46obj-$(CONFIG_ARCH_OMAP2PLUS) += omap-cpufreq.o
46 47
47################################################################################## 48##################################################################################
48# PowerPC platform drivers 49# PowerPC platform drivers
diff --git a/arch/arm/plat-omap/cpu-omap.c b/drivers/cpufreq/omap-cpufreq.c
index da4f68dbba1d..a6b2be7ea5a9 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/cpu-omap.c
3 *
4 * CPU frequency scaling for OMAP 2 * CPU frequency scaling for OMAP
5 * 3 *
6 * Copyright (C) 2005 Nokia Corporation 4 * Copyright (C) 2005 Nokia Corporation
@@ -8,6 +6,9 @@
8 * 6 *
9 * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King 7 * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
10 * 8 *
9 * Copyright (C) 2007-2011 Texas Instruments, Inc.
10 * - OMAP3/4 support by Rajendra Nayak, Santosh Shilimkar
11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
@@ -21,25 +22,22 @@
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/clk.h> 23#include <linux/clk.h>
23#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/opp.h>
24 26
25#include <mach/hardware.h>
26#include <plat/clock.h>
27#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/smp_plat.h>
28 29
29#define VERY_HI_RATE 900000000 30#include <plat/clock.h>
31#include <plat/omap-pm.h>
32#include <plat/common.h>
30 33
31static struct cpufreq_frequency_table *freq_table; 34#include <mach/hardware.h>
32 35
33#ifdef CONFIG_ARCH_OMAP1 36#define VERY_HI_RATE 900000000
34#define MPU_CLK "mpu"
35#else
36#define MPU_CLK "virt_prcm_set"
37#endif
38 37
38static struct cpufreq_frequency_table *freq_table;
39static struct clk *mpu_clk; 39static struct clk *mpu_clk;
40 40
41/* TODO: Add support for SDRAM timing changes */
42
43static int omap_verify_speed(struct cpufreq_policy *policy) 41static int omap_verify_speed(struct cpufreq_policy *policy)
44{ 42{
45 if (freq_table) 43 if (freq_table)
@@ -73,8 +71,8 @@ static int omap_target(struct cpufreq_policy *policy,
73 unsigned int target_freq, 71 unsigned int target_freq,
74 unsigned int relation) 72 unsigned int relation)
75{ 73{
76 struct cpufreq_freqs freqs;
77 int ret = 0; 74 int ret = 0;
75 struct cpufreq_freqs freqs;
78 76
79 /* Ensure desired rate is within allowed range. Some govenors 77 /* Ensure desired rate is within allowed range. Some govenors
80 * (ondemand) will just pass target_freq=0 to get the minimum. */ 78 * (ondemand) will just pass target_freq=0 to get the minimum. */
@@ -91,11 +89,13 @@ static int omap_target(struct cpufreq_policy *policy,
91 return ret; 89 return ret;
92 90
93 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 91 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
92
94#ifdef CONFIG_CPU_FREQ_DEBUG 93#ifdef CONFIG_CPU_FREQ_DEBUG
95 printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n", 94 pr_info("cpufreq-omap: transition: %u --> %u\n", freqs.old, freqs.new);
96 freqs.old, freqs.new);
97#endif 95#endif
96
98 ret = clk_set_rate(mpu_clk, freqs.new * 1000); 97 ret = clk_set_rate(mpu_clk, freqs.new * 1000);
98
99 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 99 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
100 100
101 return ret; 101 return ret;
@@ -104,8 +104,15 @@ static int omap_target(struct cpufreq_policy *policy,
104static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) 104static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
105{ 105{
106 int result = 0; 106 int result = 0;
107 struct device *mpu_dev;
108
109 if (cpu_is_omap24xx())
110 mpu_clk = clk_get(NULL, "virt_prcm_set");
111 else if (cpu_is_omap34xx())
112 mpu_clk = clk_get(NULL, "dpll1_ck");
113 else if (cpu_is_omap44xx())
114 mpu_clk = clk_get(NULL, "dpll_mpu_ck");
107 115
108 mpu_clk = clk_get(NULL, MPU_CLK);
109 if (IS_ERR(mpu_clk)) 116 if (IS_ERR(mpu_clk))
110 return PTR_ERR(mpu_clk); 117 return PTR_ERR(mpu_clk);
111 118
@@ -114,7 +121,13 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
114 121
115 policy->cur = policy->min = policy->max = omap_getspeed(0); 122 policy->cur = policy->min = policy->max = omap_getspeed(0);
116 123
117 clk_init_cpufreq_table(&freq_table); 124 mpu_dev = omap2_get_mpuss_device();
125 if (!mpu_dev) {
126 pr_warning("%s: unable to get the mpu device\n", __func__);
127 return -EINVAL;
128 }
129 opp_init_cpufreq_table(mpu_dev, &freq_table);
130
118 if (freq_table) { 131 if (freq_table) {
119 result = cpufreq_frequency_table_cpuinfo(policy, freq_table); 132 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
120 if (!result) 133 if (!result)
@@ -126,6 +139,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
126 VERY_HI_RATE) / 1000; 139 VERY_HI_RATE) / 1000;
127 } 140 }
128 141
142 policy->min = policy->cpuinfo.min_freq;
143 policy->max = policy->cpuinfo.max_freq;
144 policy->cur = omap_getspeed(0);
145
129 /* FIXME: what's the actual transition time? */ 146 /* FIXME: what's the actual transition time? */
130 policy->cpuinfo.transition_latency = 300 * 1000; 147 policy->cpuinfo.transition_latency = 300 * 1000;
131 148
@@ -160,12 +177,12 @@ static int __init omap_cpufreq_init(void)
160 return cpufreq_register_driver(&omap_driver); 177 return cpufreq_register_driver(&omap_driver);
161} 178}
162 179
163arch_initcall(omap_cpufreq_init); 180static void __exit omap_cpufreq_exit(void)
164 181{
165/* 182 cpufreq_unregister_driver(&omap_driver);
166 * if ever we want to remove this, upon cleanup call: 183}
167 *
168 * cpufreq_unregister_driver()
169 * cpufreq_frequency_table_put_attr()
170 */
171 184
185MODULE_DESCRIPTION("cpufreq driver for OMAP SoCs");
186MODULE_LICENSE("GPL");
187module_init(omap_cpufreq_init);
188module_exit(omap_cpufreq_exit);