* [PATCH 2/3]: Support cpu frequency scaling and power management for iMX6SL
@ 2013-12-17 1:40 John Tobias
2013-12-17 14:14 ` Shawn Guo
0 siblings, 1 reply; 2+ messages in thread
From: John Tobias @ 2013-12-17 1:40 UTC (permalink / raw)
To: linux-arm-kernel
iMX6SL re-using iMX6Q driver in order to enable the cpu frequency
scaling and power management
From: John Tobias <john.tobias.ph@gmail.com>
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 2f952e3..e66eccf 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -9,7 +9,10 @@
#include <linux/irqchip.h>
#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/pm_opp.h>
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
#include <linux/regmap.h>
@@ -17,6 +20,7 @@
#include <asm/mach/map.h>
#include "common.h"
+#include "cpuidle.h"
static void __init imx6sl_fec_init(void)
{
@@ -34,6 +38,47 @@ static void __init imx6sl_fec_init(void)
}
}
+
+static void __init imx6sl_opp_init(void)
+{
+ struct device_node *np;
+ struct device *cpu_dev = get_cpu_device(0);
+
+ if (!cpu_dev) {
+ pr_warn("failed to get cpu0 device\n");
+ return;
+ }
+ np = of_node_get(cpu_dev->of_node);
+ if (!np) {
+ pr_warn("failed to find cpu0 node\n");
+ return;
+ }
+
+ if (of_init_opp_table(cpu_dev)) {
+ pr_warn("failed to init OPP table\n");
+ goto put_node;
+ }
+
+put_node:
+ of_node_put(np);
+}
+
+static struct platform_device imx6q_cpufreq_pdev = {
+ .name = "imx6q-cpufreq",
+};
+
+
+static void __init imx6sl_init_late(void)
+{
+ /* re-use imx6q */
+ imx6q_cpuidle_init();
+
+ if (IS_ENABLED(CONFIG_ARM_IMX6SQ_CPUFREQ)) {
+ imx6sl_opp_init();
+ platform_device_register(&imx6q_cpufreq_pdev);
+ }
+}
+
static void __init imx6sl_init_machine(void)
{
struct device *parent;
@@ -70,6 +115,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite
(Device Tree)")
.map_io = debug_ll_io_init,
.init_irq = imx6sl_init_irq,
.init_machine = imx6sl_init_machine,
+ .init_late = imx6sl_init_late,
.dt_compat = imx6sl_dt_compat,
.restart = mxc_restart,
MACHINE_END
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/3]: Support cpu frequency scaling and power management for iMX6SL
2013-12-17 1:40 [PATCH 2/3]: Support cpu frequency scaling and power management for iMX6SL John Tobias
@ 2013-12-17 14:14 ` Shawn Guo
0 siblings, 0 replies; 2+ messages in thread
From: Shawn Guo @ 2013-12-17 14:14 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Dec 16, 2013 at 05:40:18PM -0800, John Tobias wrote:
> iMX6SL re-using iMX6Q driver in order to enable the cpu frequency
> scaling and power management
>
> From: John Tobias <john.tobias.ph@gmail.com>
>
>
> diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
> index 2f952e3..e66eccf 100644
> --- a/arch/arm/mach-imx/mach-imx6sl.c
> +++ b/arch/arm/mach-imx/mach-imx6sl.c
> @@ -9,7 +9,10 @@
>
> #include <linux/irqchip.h>
> #include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> #include <linux/of_platform.h>
> +#include <linux/pm_opp.h>
> #include <linux/mfd/syscon.h>
> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
> #include <linux/regmap.h>
> @@ -17,6 +20,7 @@
> #include <asm/mach/map.h>
>
> #include "common.h"
> +#include "cpuidle.h"
>
> static void __init imx6sl_fec_init(void)
> {
> @@ -34,6 +38,47 @@ static void __init imx6sl_fec_init(void)
> }
> }
>
> +
One blank line is enough.
> +static void __init imx6sl_opp_init(void)
> +{
> + struct device_node *np;
> + struct device *cpu_dev = get_cpu_device(0);
> +
> + if (!cpu_dev) {
> + pr_warn("failed to get cpu0 device\n");
> + return;
> + }
> + np = of_node_get(cpu_dev->of_node);
> + if (!np) {
> + pr_warn("failed to find cpu0 node\n");
> + return;
> + }
> +
> + if (of_init_opp_table(cpu_dev)) {
> + pr_warn("failed to init OPP table\n");
> + goto put_node;
> + }
> +
> +put_node:
> + of_node_put(np);
> +}
We have this for imx6q, because we need to check 1.2GHz case. But
I hope we can improve imx6q-cpufreq driver to invoke of_init_opp_table()
from there, if platform does not supply an opp table, so that we can
save these code in platform for most of cases.
> +
> +static struct platform_device imx6q_cpufreq_pdev = {
> + .name = "imx6q-cpufreq",
> +};
> +
> +
> +static void __init imx6sl_init_late(void)
> +{
> + /* re-use imx6q */
> + imx6q_cpuidle_init();
It's not about cpufreq. The change does not belong to this patch.
> +
> + if (IS_ENABLED(CONFIG_ARM_IMX6SQ_CPUFREQ)) {
IMX6SQ?
Shawn
> + imx6sl_opp_init();
> + platform_device_register(&imx6q_cpufreq_pdev);
> + }
> +}
> +
> static void __init imx6sl_init_machine(void)
> {
> struct device *parent;
> @@ -70,6 +115,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite
> (Device Tree)")
> .map_io = debug_ll_io_init,
> .init_irq = imx6sl_init_irq,
> .init_machine = imx6sl_init_machine,
> + .init_late = imx6sl_init_late,
> .dt_compat = imx6sl_dt_compat,
> .restart = mxc_restart,
> MACHINE_END
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-17 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-17 1:40 [PATCH 2/3]: Support cpu frequency scaling and power management for iMX6SL John Tobias
2013-12-17 14:14 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).