diff options
author | Gaku Inami <gaku.inami.xw@bp.renesas.com> | 2014-06-03 08:02:45 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-06-16 06:50:54 -0400 |
commit | 06e32c91dbce3c24ccbe84e3af2a35199662bca0 (patch) | |
tree | 839fea4adc5298aafaab8ddac50bcc6b9d356cff /arch/arm | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
ARM: shmobile: add cpufreq-cpu0 driver for common SH-Mobile
I add a new file(cpufreq.c) for the following reasons.
- Registration of platform_device must be unified in SH-Mobile.
- We can't create a node of cpufreq drivers into device tree.
(Because cpufreq driver is virtual device.)
Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-shmobile/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/cpufreq.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 7 |
3 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 38d5fe825e93..1b966da2c81c 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -48,6 +48,7 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o | |||
48 | # PM objects | 48 | # PM objects |
49 | obj-$(CONFIG_SUSPEND) += suspend.o | 49 | obj-$(CONFIG_SUSPEND) += suspend.o |
50 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 50 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
51 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o | ||
51 | obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o | 52 | obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o |
52 | obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o | 53 | obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o |
53 | obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o | 54 | obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o |
diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c new file mode 100644 index 000000000000..e2c868fc41cf --- /dev/null +++ b/arch/arm/mach-shmobile/cpufreq.c | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * CPUFreq support code for SH-Mobile ARM | ||
3 | * | ||
4 | * Copyright (C) 2014 Gaku Inami | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/of.h> | ||
12 | #include <linux/of_device.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | |||
15 | int __init shmobile_cpufreq_init(void) | ||
16 | { | ||
17 | struct device_node *np; | ||
18 | |||
19 | np = of_cpu_device_node_get(0); | ||
20 | if (np == NULL) { | ||
21 | pr_err("failed to find cpu0 node\n"); | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | if (of_get_property(np, "operating-points", NULL)) | ||
26 | platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); | ||
27 | |||
28 | of_node_put(np); | ||
29 | |||
30 | return 0; | ||
31 | } | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index f7a360edcc35..921a18ef4dfe 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -45,12 +45,19 @@ int shmobile_cpuidle_init(void); | |||
45 | static inline int shmobile_cpuidle_init(void) { return 0; } | 45 | static inline int shmobile_cpuidle_init(void) { return 0; } |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifdef CONFIG_CPU_FREQ | ||
49 | int shmobile_cpufreq_init(void); | ||
50 | #else | ||
51 | static inline int shmobile_cpufreq_init(void) { return 0; } | ||
52 | #endif | ||
53 | |||
48 | extern void __iomem *shmobile_scu_base; | 54 | extern void __iomem *shmobile_scu_base; |
49 | 55 | ||
50 | static inline void __init shmobile_init_late(void) | 56 | static inline void __init shmobile_init_late(void) |
51 | { | 57 | { |
52 | shmobile_suspend_init(); | 58 | shmobile_suspend_init(); |
53 | shmobile_cpuidle_init(); | 59 | shmobile_cpuidle_init(); |
60 | shmobile_cpufreq_init(); | ||
54 | } | 61 | } |
55 | 62 | ||
56 | #endif /* __ARCH_MACH_COMMON_H */ | 63 | #endif /* __ARCH_MACH_COMMON_H */ |