diff options
author | Olof Johansson <olof@lixom.net> | 2012-10-09 17:05:38 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-10-09 18:00:57 -0400 |
commit | 1e574e3a7dbef1c0365494687d7a0b6dca7eac93 (patch) | |
tree | c01ad64304ac7538542173b60b45f11828d915d5 | |
parent | ccd7e49c241d8db86d7935a3976d11f2e2301d1f (diff) | |
parent | 37fedb4c423ab78639e65a7c15d2f23cb412aa7e (diff) |
Merge tag 'omap-for-v3.7-rc1/fixes-cpufreq-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
From Tony Lindgren:
These were agreed to be merged via arm soc tree as Rafael
is on vacation.
From Kevin Hilman <khilman@deeprootsystems.com>:
This series a couple bug fixes and a couple fixes that make this
driver support recently added OMAP-based SoCs.
The 'get_cpu_device' patch is needed due to a change in the OMAP
OMAP PM core code which enforces use of get_cpu_device() instead of
a deprecated OMAP-specific API.
The usage of plat/*.h headers breaks single zImage, so platforms are
cleaning up and/or removing plat/*.h so the driver needs to be fixed
accordingly.
This series is based on the merge of Rafael's pm-for-3.7-rc1 tag into
Linus' master branch: commit 16642a2e7be23bbda013fc32d8f6c68982eab603.
* tag 'omap-for-v3.7-rc1/fixes-cpufreq-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP2+: PM: MPU DVFS: use generic CPU device for MPU-SS
cpufreq: OMAP: use get_cpu_device() instead of omap_device API
cpufreq: OMAP: fix clock usage to be SoC independent, remove plat/ includes
cpufreq: OMAP: remove unused <plat/omap-pm.h>
cpufreq: OMAP: ensure valid clock rate before scaling
-rw-r--r-- | arch/arm/mach-omap2/opp.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-omap2/twl-common.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/omap-cpufreq.c | 36 |
4 files changed, 40 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c index 45ad7f74f356..58e16aef40bb 100644 --- a/arch/arm/mach-omap2/opp.c +++ b/arch/arm/mach-omap2/opp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/opp.h> | 20 | #include <linux/opp.h> |
21 | #include <linux/cpu.h> | ||
21 | 22 | ||
22 | #include <plat/omap_device.h> | 23 | #include <plat/omap_device.h> |
23 | 24 | ||
@@ -62,13 +63,23 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, | |||
62 | __func__, i); | 63 | __func__, i); |
63 | return -EINVAL; | 64 | return -EINVAL; |
64 | } | 65 | } |
65 | oh = omap_hwmod_lookup(opp_def->hwmod_name); | 66 | |
66 | if (!oh || !oh->od) { | 67 | if (!strncmp(opp_def->hwmod_name, "mpu", 3)) { |
67 | pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n", | 68 | /* |
68 | __func__, opp_def->hwmod_name, i); | 69 | * All current OMAPs share voltage rail and |
69 | continue; | 70 | * clock source, so CPU0 is used to represent |
71 | * the MPU-SS. | ||
72 | */ | ||
73 | dev = get_cpu_device(0); | ||
74 | } else { | ||
75 | oh = omap_hwmod_lookup(opp_def->hwmod_name); | ||
76 | if (!oh || !oh->od) { | ||
77 | pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n", | ||
78 | __func__, opp_def->hwmod_name, i); | ||
79 | continue; | ||
80 | } | ||
81 | dev = &oh->od->pdev->dev; | ||
70 | } | 82 | } |
71 | dev = &oh->od->pdev->dev; | ||
72 | 83 | ||
73 | r = opp_add(dev, opp_def->freq, opp_def->u_volt); | 84 | r = opp_add(dev, opp_def->freq, opp_def->u_volt); |
74 | if (r) { | 85 | if (r) { |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 1e40afe7ed3c..ea61c32957bd 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/opp.h> | 16 | #include <linux/opp.h> |
17 | #include <linux/export.h> | 17 | #include <linux/export.h> |
18 | #include <linux/suspend.h> | 18 | #include <linux/suspend.h> |
19 | #include <linux/cpu.h> | ||
19 | 20 | ||
20 | #include <asm/system_misc.h> | 21 | #include <asm/system_misc.h> |
21 | 22 | ||
@@ -169,7 +170,15 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |||
169 | goto exit; | 170 | goto exit; |
170 | } | 171 | } |
171 | 172 | ||
172 | dev = omap_device_get_by_hwmod_name(oh_name); | 173 | if (!strncmp(oh_name, "mpu", 3)) |
174 | /* | ||
175 | * All current OMAPs share voltage rail and clock | ||
176 | * source, so CPU0 is used to represent the MPU-SS. | ||
177 | */ | ||
178 | dev = get_cpu_device(0); | ||
179 | else | ||
180 | dev = omap_device_get_by_hwmod_name(oh_name); | ||
181 | |||
173 | if (IS_ERR(dev)) { | 182 | if (IS_ERR(dev)) { |
174 | pr_err("%s: Unable to get dev pointer for hwmod %s\n", | 183 | pr_err("%s: Unable to get dev pointer for hwmod %s\n", |
175 | __func__, oh_name); | 184 | __func__, oh_name); |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 45f77413c21d..3f5eaccf6d8f 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
@@ -158,7 +158,7 @@ static struct regulator_init_data omap3_vpll2_idata = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct regulator_consumer_supply omap3_vdd1_supply[] = { | 160 | static struct regulator_consumer_supply omap3_vdd1_supply[] = { |
161 | REGULATOR_SUPPLY("vcc", "mpu.0"), | 161 | REGULATOR_SUPPLY("vcc", "cpu0"), |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static struct regulator_consumer_supply omap3_vdd2_supply[] = { | 164 | static struct regulator_consumer_supply omap3_vdd2_supply[] = { |
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 65f8e9a54975..1f3417a8322d 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c | |||
@@ -30,20 +30,12 @@ | |||
30 | #include <asm/smp_plat.h> | 30 | #include <asm/smp_plat.h> |
31 | #include <asm/cpu.h> | 31 | #include <asm/cpu.h> |
32 | 32 | ||
33 | #include <plat/clock.h> | ||
34 | #include <plat/omap-pm.h> | ||
35 | #include <plat/common.h> | ||
36 | #include <plat/omap_device.h> | ||
37 | |||
38 | #include <mach/hardware.h> | ||
39 | |||
40 | /* OPP tolerance in percentage */ | 33 | /* OPP tolerance in percentage */ |
41 | #define OPP_TOLERANCE 4 | 34 | #define OPP_TOLERANCE 4 |
42 | 35 | ||
43 | static struct cpufreq_frequency_table *freq_table; | 36 | static struct cpufreq_frequency_table *freq_table; |
44 | static atomic_t freq_table_users = ATOMIC_INIT(0); | 37 | static atomic_t freq_table_users = ATOMIC_INIT(0); |
45 | static struct clk *mpu_clk; | 38 | static struct clk *mpu_clk; |
46 | static char *mpu_clk_name; | ||
47 | static struct device *mpu_dev; | 39 | static struct device *mpu_dev; |
48 | static struct regulator *mpu_reg; | 40 | static struct regulator *mpu_reg; |
49 | 41 | ||
@@ -108,6 +100,14 @@ static int omap_target(struct cpufreq_policy *policy, | |||
108 | } | 100 | } |
109 | 101 | ||
110 | freq = freqs.new * 1000; | 102 | freq = freqs.new * 1000; |
103 | ret = clk_round_rate(mpu_clk, freq); | ||
104 | if (IS_ERR_VALUE(ret)) { | ||
105 | dev_warn(mpu_dev, | ||
106 | "CPUfreq: Cannot find matching frequency for %lu\n", | ||
107 | freq); | ||
108 | return ret; | ||
109 | } | ||
110 | freq = ret; | ||
111 | 111 | ||
112 | if (mpu_reg) { | 112 | if (mpu_reg) { |
113 | opp = opp_find_freq_ceil(mpu_dev, &freq); | 113 | opp = opp_find_freq_ceil(mpu_dev, &freq); |
@@ -172,7 +172,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) | |||
172 | { | 172 | { |
173 | int result = 0; | 173 | int result = 0; |
174 | 174 | ||
175 | mpu_clk = clk_get(NULL, mpu_clk_name); | 175 | mpu_clk = clk_get(NULL, "cpufreq_ck"); |
176 | if (IS_ERR(mpu_clk)) | 176 | if (IS_ERR(mpu_clk)) |
177 | return PTR_ERR(mpu_clk); | 177 | return PTR_ERR(mpu_clk); |
178 | 178 | ||
@@ -253,22 +253,10 @@ static struct cpufreq_driver omap_driver = { | |||
253 | 253 | ||
254 | static int __init omap_cpufreq_init(void) | 254 | static int __init omap_cpufreq_init(void) |
255 | { | 255 | { |
256 | if (cpu_is_omap24xx()) | 256 | mpu_dev = get_cpu_device(0); |
257 | mpu_clk_name = "virt_prcm_set"; | 257 | if (!mpu_dev) { |
258 | else if (cpu_is_omap34xx()) | ||
259 | mpu_clk_name = "dpll1_ck"; | ||
260 | else if (cpu_is_omap44xx()) | ||
261 | mpu_clk_name = "dpll_mpu_ck"; | ||
262 | |||
263 | if (!mpu_clk_name) { | ||
264 | pr_err("%s: unsupported Silicon?\n", __func__); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | |||
268 | mpu_dev = omap_device_get_by_hwmod_name("mpu"); | ||
269 | if (IS_ERR(mpu_dev)) { | ||
270 | pr_warning("%s: unable to get the mpu device\n", __func__); | 258 | pr_warning("%s: unable to get the mpu device\n", __func__); |
271 | return PTR_ERR(mpu_dev); | 259 | return -EINVAL; |
272 | } | 260 | } |
273 | 261 | ||
274 | mpu_reg = regulator_get(mpu_dev, "vcc"); | 262 | mpu_reg = regulator_get(mpu_dev, "vcc"); |