aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-01-08 18:08:49 -0500
committerOlof Johansson <olof@lixom.net>2013-01-08 18:08:59 -0500
commit96e61b8e34ea4982ce57319c19ab73e9e5d74165 (patch)
tree5a92e274069225396051e3b12d6b82d6cdd8175b
parentd1c3ed669a2d452cacfb48c2d171a1f364dae2ed (diff)
parentec6691239373395d64fb73f50444f09a6f29d5ef (diff)
Merge tag 'ux500-cpufreq-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/drivers
From Linus Walleij: These are cpufreq updates for the ux500 - Updates to the ux500 cpufreq driver - Support for delay timers in the MTU clksrc - Consequential updates to the cpufreq driver * tag 'ux500-cpufreq-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson: cpufreq: db8500: set CPUFREQ_CONST_LOOPS clocksource: nomadik-mtu: support timer-based delay cpufreq: dbx500: Update file header cpufreq: dbx500: Minor code cleanup cpufreq: dbx500: Move clk_get to probe mfd: db8500: Update cpufreq device name cpufreq: Give driver used for dbx500 family a more generic name Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--drivers/clocksource/nomadik-mtu.c11
-rw-r--r--drivers/cpufreq/Makefile2
-rw-r--r--drivers/cpufreq/dbx500-cpufreq.c (renamed from drivers/cpufreq/db8500-cpufreq.c)101
-rw-r--r--drivers/mfd/db8500-prcmu.c4
4 files changed, 65 insertions, 53 deletions
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index 8914c3c1c88b..5f3c8dbf360f 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -15,6 +15,7 @@
15#include <linux/clocksource.h> 15#include <linux/clocksource.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/jiffies.h> 17#include <linux/jiffies.h>
18#include <linux/delay.h>
18#include <linux/err.h> 19#include <linux/err.h>
19#include <linux/platform_data/clocksource-nomadik-mtu.h> 20#include <linux/platform_data/clocksource-nomadik-mtu.h>
20#include <asm/mach/time.h> 21#include <asm/mach/time.h>
@@ -64,6 +65,7 @@ static void __iomem *mtu_base;
64static bool clkevt_periodic; 65static bool clkevt_periodic;
65static u32 clk_prescale; 66static u32 clk_prescale;
66static u32 nmdk_cycle; /* write-once */ 67static u32 nmdk_cycle; /* write-once */
68static struct delay_timer mtu_delay_timer;
67 69
68#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK 70#ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK
69/* 71/*
@@ -80,6 +82,11 @@ static u32 notrace nomadik_read_sched_clock(void)
80} 82}
81#endif 83#endif
82 84
85static unsigned long nmdk_timer_read_current_timer(void)
86{
87 return ~readl_relaxed(mtu_base + MTU_VAL(0));
88}
89
83/* Clockevent device: use one-shot mode */ 90/* Clockevent device: use one-shot mode */
84static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev) 91static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
85{ 92{
@@ -227,4 +234,8 @@ void __init nmdk_timer_init(void __iomem *base, int irq)
227 setup_irq(irq, &nmdk_timer_irq); 234 setup_irq(irq, &nmdk_timer_irq);
228 nmdk_clkevt.cpumask = cpumask_of(0); 235 nmdk_clkevt.cpumask = cpumask_of(0);
229 clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); 236 clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
237
238 mtu_delay_timer.read_current_timer = &nmdk_timer_read_current_timer;
239 mtu_delay_timer.freq = rate;
240 register_current_timer_delay(&mtu_delay_timer);
230} 241}
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 1f254ec087c1..6700251f7e90 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -41,7 +41,7 @@ obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o
41 41
42################################################################################## 42##################################################################################
43# ARM SoC drivers 43# ARM SoC drivers
44obj-$(CONFIG_UX500_SOC_DB8500) += db8500-cpufreq.o 44obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o
45obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o 45obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o
46obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o 46obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o
47obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o 47obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
index 4f154bc0ebe4..9a623753dee2 100644
--- a/drivers/cpufreq/db8500-cpufreq.c
+++ b/drivers/cpufreq/dbx500-cpufreq.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * Copyright (C) STMicroelectronics 2009 2 * Copyright (C) STMicroelectronics 2009
3 * Copyright (C) ST-Ericsson SA 2010 3 * Copyright (C) ST-Ericsson SA 2010-2012
4 * 4 *
5 * License Terms: GNU General Public License v2 5 * License Terms: GNU General Public License v2
6 * Author: Sundar Iyer <sundar.iyer@stericsson.com> 6 * Author: Sundar Iyer <sundar.iyer@stericsson.com>
7 * Author: Martin Persson <martin.persson@stericsson.com> 7 * Author: Martin Persson <martin.persson@stericsson.com>
8 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> 8 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
9 *
10 */ 9 */
10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/cpufreq.h> 13#include <linux/cpufreq.h>
@@ -20,22 +20,23 @@
20static struct cpufreq_frequency_table *freq_table; 20static struct cpufreq_frequency_table *freq_table;
21static struct clk *armss_clk; 21static struct clk *armss_clk;
22 22
23static struct freq_attr *db8500_cpufreq_attr[] = { 23static struct freq_attr *dbx500_cpufreq_attr[] = {
24 &cpufreq_freq_attr_scaling_available_freqs, 24 &cpufreq_freq_attr_scaling_available_freqs,
25 NULL, 25 NULL,
26}; 26};
27 27
28static int db8500_cpufreq_verify_speed(struct cpufreq_policy *policy) 28static int dbx500_cpufreq_verify_speed(struct cpufreq_policy *policy)
29{ 29{
30 return cpufreq_frequency_table_verify(policy, freq_table); 30 return cpufreq_frequency_table_verify(policy, freq_table);
31} 31}
32 32
33static int db8500_cpufreq_target(struct cpufreq_policy *policy, 33static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
34 unsigned int target_freq, 34 unsigned int target_freq,
35 unsigned int relation) 35 unsigned int relation)
36{ 36{
37 struct cpufreq_freqs freqs; 37 struct cpufreq_freqs freqs;
38 unsigned int idx; 38 unsigned int idx;
39 int ret;
39 40
40 /* scale the target frequency to one of the extremes supported */ 41 /* scale the target frequency to one of the extremes supported */
41 if (target_freq < policy->cpuinfo.min_freq) 42 if (target_freq < policy->cpuinfo.min_freq)
@@ -44,10 +45,9 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy,
44 target_freq = policy->cpuinfo.max_freq; 45 target_freq = policy->cpuinfo.max_freq;
45 46
46 /* Lookup the next frequency */ 47 /* Lookup the next frequency */
47 if (cpufreq_frequency_table_target 48 if (cpufreq_frequency_table_target(policy, freq_table, target_freq,
48 (policy, freq_table, target_freq, relation, &idx)) { 49 relation, &idx))
49 return -EINVAL; 50 return -EINVAL;
50 }
51 51
52 freqs.old = policy->cur; 52 freqs.old = policy->cur;
53 freqs.new = freq_table[idx].frequency; 53 freqs.new = freq_table[idx].frequency;
@@ -60,9 +60,12 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy,
60 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 60 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
61 61
62 /* update armss clk frequency */ 62 /* update armss clk frequency */
63 if (clk_set_rate(armss_clk, freq_table[idx].frequency * 1000)) { 63 ret = clk_set_rate(armss_clk, freqs.new * 1000);
64 pr_err("db8500-cpufreq: Failed to update armss clk\n"); 64
65 return -EINVAL; 65 if (ret) {
66 pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n",
67 freqs.new * 1000, ret);
68 return ret;
66 } 69 }
67 70
68 /* post change notification */ 71 /* post change notification */
@@ -72,7 +75,7 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy,
72 return 0; 75 return 0;
73} 76}
74 77
75static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) 78static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu)
76{ 79{
77 int i = 0; 80 int i = 0;
78 unsigned long freq = clk_get_rate(armss_clk) / 1000; 81 unsigned long freq = clk_get_rate(armss_clk) / 1000;
@@ -84,40 +87,26 @@ static unsigned int db8500_cpufreq_getspeed(unsigned int cpu)
84 } 87 }
85 88
86 /* We could not find a corresponding frequency. */ 89 /* We could not find a corresponding frequency. */
87 pr_err("db8500-cpufreq: Failed to find cpufreq speed\n"); 90 pr_err("dbx500-cpufreq: Failed to find cpufreq speed\n");
88 return 0; 91 return 0;
89} 92}
90 93
91static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) 94static int __cpuinit dbx500_cpufreq_init(struct cpufreq_policy *policy)
92{ 95{
93 int i = 0;
94 int res; 96 int res;
95 97
96 armss_