aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-03-10 06:13:18 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-11 20:06:01 -0400
commit2449d33a40553504867f407dd713e9bcf6f9fe24 (patch)
tree86b3ce294a01a4a1c12dddb24d0ae5cd81a9c0a5
parent96bbbe4a2a5b13c440a19dd7a5ff33de3303aac4 (diff)
cpufreq: SPEAr: Instantiate as platform_driver
As multiplatform build is being adopted by more and more ARM platforms, initcall function should be used very carefully. For example, when SPEAr cpufreq driver is enabled on a kernel booted on a non-SPEAr board, we will get following boot time error: spear_cpufreq: Invalid cpufreq_tbl To eliminate this undesired the effect, the patch changes SPEAr driver to have it instantiated as a platform_driver. Then it will only run on platforms that create the platform_device "spear-cpufreq". This patch also creates platform node for SPEAr13xx boards. Reported-by: Josh Cartwright <joshc@codeaurora.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--arch/arm/mach-spear/spear1310.c1
-rw-r--r--arch/arm/mach-spear/spear1340.c1
-rw-r--r--drivers/cpufreq/spear-cpufreq.c13
3 files changed, 13 insertions, 2 deletions
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 7ad003001ab7..824b12a56a42 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -28,6 +28,7 @@
28static void __init spear1310_dt_init(void) 28static void __init spear1310_dt_init(void)
29{ 29{
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
31} 32}
32 33
33static const char * const spear1310_dt_board_compat[] = { 34static const char * const spear1310_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 3fb683424729..7b6bff7154e1 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void)
143{ 143{
144 of_platform_populate(NULL, of_default_bus_match_table, 144 of_platform_populate(NULL, of_default_bus_match_table,
145 spear1340_auxdata_lookup, NULL); 145 spear1340_auxdata_lookup, NULL);
146 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
146} 147}
147 148
148static const char * const spear1340_dt_board_compat[] = { 149static const char * const spear1340_dt_board_compat[] = {
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 410b54a9346c..4cfdcff8a310 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/platform_device.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
@@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = {
166 .attr = cpufreq_generic_attr, 167 .attr = cpufreq_generic_attr,
167}; 168};
168 169
169static int spear_cpufreq_driver_init(void) 170static int spear_cpufreq_probe(struct platform_device *pdev)
170{ 171{
171 struct device_node *np; 172 struct device_node *np;
172 const struct property *prop; 173 const struct property *prop;
@@ -234,7 +235,15 @@ out_put_node:
234 of_node_put(np); 235 of_node_put(np);
235 return ret; 236 return ret;
236} 237}
237late_initcall(spear_cpufreq_driver_init); 238
239static struct platform_driver spear_cpufreq_platdrv = {
240 .driver = {
241 .name = "spear-cpufreq",
242 .owner = THIS_MODULE,
243 },
244 .probe = spear_cpufreq_probe,
245};
246module_platform_driver(spear_cpufreq_platdrv);
238 247
239MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>"); 248MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>");
240MODULE_DESCRIPTION("SPEAr CPUFreq driver"); 249MODULE_DESCRIPTION("SPEAr CPUFreq driver");