diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 18:12:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 18:12:18 -0500 |
commit | 5ce7aba976ebdfbf467e3cbcd3a7536ebdec4b11 (patch) | |
tree | a31ceb4a167035aad73fd116ee8512fca905fd7b /drivers/cpufreq | |
parent | 7ae1c76ee5b58fe5bd55a07f99a3359333270b86 (diff) | |
parent | b6a03d0492dedb5c10b8a5708ee92e04b0590c07 (diff) |
Merge tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver specific changes from Arnd Bergmann:
- Updates to the ux500 cpufreq code
- Moving the u300 DMA controller driver to drivers/dma
- Moving versatile express drivers out of arch/arm for sharing with arch/arm64
- Device tree bindings for the OMAP General Purpose Memory Controller
* tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (27 commits)
ARM: OMAP2+: gpmc: Add device tree documentation for elm handle
ARM: OMAP2+: gpmc: add DT bindings for OneNAND
ARM: OMAP2+: gpmc-onenand: drop __init annotation
mtd: omap-onenand: pass device_node in platform data
ARM: OMAP2+: Prevent potential crash if GPMC probe fails
ARM: OMAP2+: gpmc: Remove unneeded of_node_put()
arm: Move sp810.h to include/linux/amba/
ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
ARM: OMAP: gpmc: enable hwecc for AM33xx SoCs
ARM: OMAP: gpmc-nand: drop __init annotation
mtd: omap-nand: pass device_node in platform data
ARM: OMAP: gpmc: don't create devices from initcall on DT
dma: coh901318: cut down on platform data abstraction
dma: coh901318: merge header files
dma: coh901318: push definitions into driver
dma: coh901318: push header down into the DMA subsystem
dma: coh901318: skip hard-coded addresses
dma: coh901318: remove hardcoded target addresses
dma: coh901318: push platform data into driver
dma: coh901318: create a proper platform data file
...
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/Makefile | 2 | ||||
-rw-r--r-- | drivers/cpufreq/dbx500-cpufreq.c (renamed from drivers/cpufreq/db8500-cpufreq.c) | 101 |
2 files changed, 52 insertions, 51 deletions
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 5399c45ac311..863fd1865d45 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -44,7 +44,7 @@ obj-$(CONFIG_X86_INTEL_PSTATE) += intel_pstate.o | |||
44 | 44 | ||
45 | ################################################################################## | 45 | ################################################################################## |
46 | # ARM SoC drivers | 46 | # ARM SoC drivers |
47 | obj-$(CONFIG_UX500_SOC_DB8500) += db8500-cpufreq.o | 47 | obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o |
48 | obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o | 48 | obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o |
49 | obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o | 49 | obj-$(CONFIG_ARM_S3C64XX_CPUFREQ) += s3c64xx-cpufreq.o |
50 | obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o | 50 | obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o |
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c index 48a1988149d8..72f0c3efa76e 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> |
@@ -19,22 +19,23 @@ | |||
19 | static struct cpufreq_frequency_table *freq_table; | 19 | static struct cpufreq_frequency_table *freq_table; |
20 | static struct clk *armss_clk; | 20 | static struct clk *armss_clk; |
21 | 21 | ||
22 | static struct freq_attr *db8500_cpufreq_attr[] = { | 22 | static struct freq_attr *dbx500_cpufreq_attr[] = { |
23 | &cpufreq_freq_attr_scaling_available_freqs, | 23 | &cpufreq_freq_attr_scaling_available_freqs, |
24 | NULL, | 24 | NULL, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static int db8500_cpufreq_verify_speed(struct cpufreq_policy *policy) | 27 | static int dbx500_cpufreq_verify_speed(struct cpufreq_policy *policy) |
28 | { | 28 | { |
29 | return cpufreq_frequency_table_verify(policy, freq_table); | 29 | return cpufreq_frequency_table_verify(policy, freq_table); |
30 | } | 30 | } |
31 | 31 | ||
32 | static int db8500_cpufreq_target(struct cpufreq_policy *policy, | 32 | static int dbx500_cpufreq_target(struct cpufreq_policy *policy, |
33 | unsigned int target_freq, | 33 | unsigned int target_freq, |
34 | unsigned int relation) | 34 | unsigned int relation) |
35 | { | 35 | { |
36 | struct cpufreq_freqs freqs; | 36 | struct cpufreq_freqs freqs; |
37 | unsigned int idx; | 37 | unsigned int idx; |
38 | int ret; | ||
38 | 39 | ||
39 | /* scale the target frequency to one of the extremes supported */ | 40 | /* scale the target frequency to one of the extremes supported */ |
40 | if (target_freq < policy->cpuinfo.min_freq) | 41 | if (target_freq < policy->cpuinfo.min_freq) |
@@ -43,10 +44,9 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
43 | target_freq = policy->cpuinfo.max_freq; | 44 | target_freq = policy->cpuinfo.max_freq; |
44 | 45 | ||
45 | /* Lookup the next frequency */ | 46 | /* Lookup the next frequency */ |
46 | if (cpufreq_frequency_table_target | 47 | if (cpufreq_frequency_table_target(policy, freq_table, target_freq, |
47 | (policy, freq_table, target_freq, relation, &idx)) { | 48 | relation, &idx)) |
48 | return -EINVAL; | 49 | return -EINVAL; |
49 | } | ||
50 | 50 | ||
51 | freqs.old = policy->cur; | 51 | freqs.old = policy->cur; |
52 | freqs.new = freq_table[idx].frequency; | 52 | freqs.new = freq_table[idx].frequency; |
@@ -59,9 +59,12 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
59 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 59 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
60 | 60 | ||
61 | /* update armss clk frequency */ | 61 | /* update armss clk frequency */ |
62 | if (clk_set_rate(armss_clk, freq_table[idx].frequency * 1000)) { | 62 | ret = clk_set_rate(armss_clk, freqs.new * 1000); |
63 | pr_err("db8500-cpufreq: Failed to update armss clk\n"); | 63 | |
64 | return -EINVAL; | 64 | if (ret) { |
65 | pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n", | ||
66 | freqs.new * 1000, ret); | ||
67 | return ret; | ||
65 | } | 68 | } |
66 | 69 | ||
67 | /* post change notification */ | 70 | /* post change notification */ |
@@ -71,7 +74,7 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
71 | return 0; | 74 | return 0; |
72 | } | 75 | } |
73 | 76 | ||
74 | static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) | 77 | static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu) |
75 | { | 78 | { |
76 | int i = 0; | 79 | int i = 0; |
77 | unsigned long freq = clk_get_rate(armss_clk) / 1000; | 80 | unsigned long freq = clk_get_rate(armss_clk) / 1000; |
@@ -83,40 +86,26 @@ static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) | |||
83 | } | 86 | } |
84 | 87 | ||
85 | /* We could not find a corresponding frequency. */ | 88 | /* We could not find a corresponding frequency. */ |
86 | pr_err("db8500-cpufreq: Failed to find cpufreq speed\n"); | 89 | pr_err("dbx500-cpufreq: Failed to find cpufreq speed\n"); |
87 | return 0; | 90 | return 0; |
88 | } | 91 | } |
89 | 92 | ||
90 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | 93 | static int __cpuinit dbx500_cpufreq_init(struct cpufreq_policy *policy) |
91 | { | 94 | { |
92 | int i = 0; | ||
93 | int res; | 95 | int res; |
94 | 96 | ||
95 | armss_clk = clk_get(NULL, "armss"); | ||
96 | if (IS_ERR(armss_clk)) { | ||
97 | pr_err("db8500-cpufreq : Failed to get armss clk\n"); | ||
98 | return PTR_ERR(armss_clk); | ||
99 | } | ||
100 | |||
101 | pr_info("db8500-cpufreq : Available frequencies:\n"); | ||
102 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) { | ||
103 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); | ||
104 | i++; | ||
105 | } | ||
106 | |||
107 | /* get policy fields based on the table */ | 97 | /* get policy fields based on the table */ |
108 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); | 98 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); |
109 | if (!res) | 99 | if (!res) |
110 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | 100 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); |
111 | else { | 101 | else { |
112 | pr_err("db8500-cpufreq : Failed to read policy table\n"); | 102 | pr_err("dbx500-cpufreq: Failed to read policy table\n"); |
113 | clk_put(armss_clk); | ||
114 | return res; | 103 | return res; |
115 | } | 104 | } |
116 | 105 | ||
117 | policy->min = policy->cpuinfo.min_freq; | 106 | policy->min = policy->cpuinfo.min_freq; |
118 | policy->max = policy->cpuinfo.max_freq; | 107 | policy->max = policy->cpuinfo.max_freq; |
119 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); | 108 | policy->cur = dbx500_cpufreq_getspeed(policy->cpu); |
120 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 109 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
121 | 110 | ||
122 | /* | 111 | /* |
@@ -132,42 +121,54 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | |||
132 | return 0; | 121 | return 0; |
133 | } | 122 | } |
134 | 123 | ||
135 | static struct cpufreq_driver db8500_cpufreq_driver = { | 124 | static struct cpufreq_driver dbx500_cpufreq_driver = { |
136 | .flags = CPUFREQ_STICKY, | 125 | .flags = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS, |
137 | .verify = db8500_cpufreq_verify_speed, | 126 | .verify = dbx500_cpufreq_verify_speed, |
138 | .target = db8500_cpufreq_target, | 127 | .target = dbx500_cpufreq_target, |
139 | .get = db8500_cpufreq_getspeed, | 128 | .get = dbx500_cpufreq_getspeed, |
140 | .init = db8500_cpufreq_init, | 129 | .init = dbx500_cpufreq_init, |
141 | .name = "DB8500", | 130 | .name = "DBX500", |
142 | .attr = db8500_cpufreq_attr, | 131 | .attr = dbx500_cpufreq_attr, |
143 | }; | 132 | }; |
144 | 133 | ||
145 | static int db8500_cpufreq_probe(struct platform_device *pdev) | 134 | static int dbx500_cpufreq_probe(struct platform_device *pdev) |
146 | { | 135 | { |
147 | freq_table = dev_get_platdata(&pdev->dev); | 136 | int i = 0; |
148 | 137 | ||
138 | freq_table = dev_get_platdata(&pdev->dev); | ||
149 | if (!freq_table) { | 139 | if (!freq_table) { |
150 | pr_err("db8500-cpufreq: Failed to fetch cpufreq table\n"); | 140 | pr_err("dbx500-cpufreq: Failed to fetch cpufreq table\n"); |
151 | return -ENODEV; | 141 | return -ENODEV; |
152 | } | 142 | } |
153 | 143 | ||
154 | return cpufreq_register_driver(&db8500_cpufreq_driver); | 144 | armss_clk = clk_get(&pdev->dev, "armss"); |
145 | if (IS_ERR(armss_clk)) { | ||
146 | pr_err("dbx500-cpufreq: Failed to get armss clk\n"); | ||
147 | return PTR_ERR(armss_clk); | ||
148 | } | ||
149 | |||
150 | pr_info("dbx500-cpufreq: Available frequencies:\n"); | ||
151 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) { | ||
152 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); | ||
153 | i++; | ||
154 | } | ||
155 | |||
156 | return cpufreq_register_driver(&dbx500_cpufreq_driver); | ||
155 | } | 157 | } |
156 | 158 | ||
157 | static struct platform_driver db8500_cpufreq_plat_driver = { | 159 | static struct platform_driver dbx500_cpufreq_plat_driver = { |
158 | .driver = { | 160 | .driver = { |
159 | .name = "cpufreq-u8500", | 161 | .name = "cpufreq-ux500", |
160 | .owner = THIS_MODULE, | 162 | .owner = THIS_MODULE, |
161 | }, | 163 | }, |
162 | .probe = db8500_cpufreq_probe, | 164 | .probe = dbx500_cpufreq_probe, |
163 | }; | 165 | }; |
164 | 166 | ||
165 | static int __init db8500_cpufreq_register(void) | 167 | static int __init dbx500_cpufreq_register(void) |
166 | { | 168 | { |
167 | pr_info("cpufreq for DB8500 started\n"); | 169 | return platform_driver_register(&dbx500_cpufreq_plat_driver); |
168 | return platform_driver_register(&db8500_cpufreq_plat_driver); | ||
169 | } | 170 | } |
170 | device_initcall(db8500_cpufreq_register); | 171 | device_initcall(dbx500_cpufreq_register); |
171 | 172 | ||
172 | MODULE_LICENSE("GPL v2"); | 173 | MODULE_LICENSE("GPL v2"); |
173 | MODULE_DESCRIPTION("cpufreq driver for DB8500"); | 174 | MODULE_DESCRIPTION("cpufreq driver for DBX500"); |