Message ID | 538DB965.7030806@bp.renesas.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 06e32c91dbce3c24ccbe84e3af2a35199662bca0 |
Headers | show |
On Tue, Jun 03, 2014 at 09:02:45PM +0900, Gaku Inami wrote: > 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> Thanks, I have queued this up with Magnus's ack. > --- > > Changes since version 1: > - changed the method of checking the device tree. > > arch/arm/mach-shmobile/Makefile | 1 + > arch/arm/mach-shmobile/cpufreq.c | 31 ++++++++++++++++++++++++++ > arch/arm/mach-shmobile/include/mach/common.h | 7 ++++++ > 3 files changed, 39 insertions(+) > create mode 100644 arch/arm/mach-shmobile/cpufreq.c > > diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile > index 29034aa..ccb0563 100644 > --- a/arch/arm/mach-shmobile/Makefile > +++ b/arch/arm/mach-shmobile/Makefile > @@ -48,6 +48,7 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o > # PM objects > obj-$(CONFIG_SUSPEND) += suspend.o > obj-$(CONFIG_CPU_IDLE) += cpuidle.o > +obj-$(CONFIG_CPU_FREQ) += cpufreq.o > obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o > obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o > 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 0000000..e2c868f > --- /dev/null > +++ b/arch/arm/mach-shmobile/cpufreq.c > @@ -0,0 +1,31 @@ > +/* > + * CPUFreq support code for SH-Mobile ARM > + * > + * Copyright (C) 2014 Gaku Inami > + * > + * This file is subject to the terms and conditions of the GNU General Public > + * License. See the file "COPYING" in the main directory of this archive > + * for more details. > + */ > + > +#include <linux/of.h> > +#include <linux/of_device.h> > +#include <linux/platform_device.h> > + > +int __init shmobile_cpufreq_init(void) > +{ > + struct device_node *np; > + > + np = of_cpu_device_node_get(0); > + if (np == NULL) { > + pr_err("failed to find cpu0 node\n"); > + return 0; > + } > + > + if (of_get_property(np, "operating-points", NULL)) > + platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); > + > + of_node_put(np); > + > + return 0; > +} > diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h > index 8f0cd57..ab5a9b2 100644 > --- a/arch/arm/mach-shmobile/include/mach/common.h > +++ b/arch/arm/mach-shmobile/include/mach/common.h > @@ -47,12 +47,19 @@ int shmobile_cpuidle_init(void); > static inline int shmobile_cpuidle_init(void) { return 0; } > #endif > > +#ifdef CONFIG_CPU_FREQ > +int shmobile_cpufreq_init(void); > +#else > +static inline int shmobile_cpufreq_init(void) { return 0; } > +#endif > + > extern void __iomem *shmobile_scu_base; > > static inline void __init shmobile_init_late(void) > { > shmobile_suspend_init(); > shmobile_cpuidle_init(); > + shmobile_cpufreq_init(); > } > > #endif /* __ARCH_MACH_COMMON_H */ > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 29034aa..ccb0563 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o # PM objects obj-$(CONFIG_SUSPEND) += suspend.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o 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 0000000..e2c868f --- /dev/null +++ b/arch/arm/mach-shmobile/cpufreq.c @@ -0,0 +1,31 @@ +/* + * CPUFreq support code for SH-Mobile ARM + * + * Copyright (C) 2014 Gaku Inami + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +int __init shmobile_cpufreq_init(void) +{ + struct device_node *np; + + np = of_cpu_device_node_get(0); + if (np == NULL) { + pr_err("failed to find cpu0 node\n"); + return 0; + } + + if (of_get_property(np, "operating-points", NULL)) + platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); + + of_node_put(np); + + return 0; +} diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 8f0cd57..ab5a9b2 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h @@ -47,12 +47,19 @@ int shmobile_cpuidle_init(void); static inline int shmobile_cpuidle_init(void) { return 0; } #endif +#ifdef CONFIG_CPU_FREQ +int shmobile_cpufreq_init(void); +#else +static inline int shmobile_cpufreq_init(void) { return 0; } +#endif + extern void __iomem *shmobile_scu_base; static inline void __init shmobile_init_late(void) { shmobile_suspend_init(); shmobile_cpuidle_init(); + shmobile_cpufreq_init(); } #endif /* __ARCH_MACH_COMMON_H */
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> --- Changes since version 1: - changed the method of checking the device tree. arch/arm/mach-shmobile/Makefile | 1 + arch/arm/mach-shmobile/cpufreq.c | 31 ++++++++++++++++++++++++++ arch/arm/mach-shmobile/include/mach/common.h | 7 ++++++ 3 files changed, 39 insertions(+) create mode 100644 arch/arm/mach-shmobile/cpufreq.c