ARM: imx: add cpuidle support for i.mx6ul
Subsystems (3)
PATCH v3 1/1 ARM: imx: add cpuidle support for i.mx6ul
This patch adds cpuidle support for i.MX6UL,
it shares cpuidle driver with i.MX6SX, total
3 levels of cpuidle are supported as below:
1. ARM WFI;
2. SOC in WAIT mode;
3. SOC in WAIT mode + ARM power off.
---
I am NOT sure if using cpu_is_xxx() here to distinguish i.MX6UL from i.MX6SX is good enough, as I saw many other patches are trying to avoid using such cpu_is_xxx() API.
Obviously we have many other ways to identify if the ARM core is a Cortex-A9 or Cortex-A7, they have different L2 cache implemented, so cache operation is different.
Please advise if you have better idea about this point, thanks!
arch/arm/mach-imx/cpuidle-imx6sx.c | 8 +++++++- arch/arm/mach-imx/mach-imx6ul.c | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/mach-imx/cpuidle-imx6sx.c +7 -1
@@ -1,5 +1,5 @@/* -* Copyright (C) 2014 Freescale Semiconductor, Inc. +* Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -9,14 +9,20 @@#include <linux/cpuidle.h> #include <linux/cpu_pm.h> #include <linux/module.h> +#include <asm/cacheflush.h> #include <asm/cpuidle.h> #include <asm/suspend.h> #include "common.h" #include "cpuidle.h" +#include "hardware.h" static int imx6sx_idle_finish (unsigned long val) { +/* flush internal L2 cache if necessary */ +if (cpu_is_imx6ul ()) +flush_cache_all (); +cpu_do_idle ();return 0 ;
arch/arm/mach-imx/mach-imx6ul.c +9 -0
@@ -11,6 +11,7 @@#include <asm/mach/map.h> #include "common.h" +#include "cpuidle.h" static void __init imx6ul_init_machine (void ) {
@@ -29,6 +30,13 @@ static void __init imx6ul_init_irq(void)imx_init_revision_from_anatop ();imx_src_init ();irqchip_init (); +imx6_pm_ccm_init ("fsl,imx6ul-ccm" ); +} + +static void __init imx6ul_init_late (void ) +{ +/* share cpuidle driver with i.MX6SX */ +imx6sx_cpuidle_init (); }static const char *imx6ul_dt_compat[]__initconst = {
@@ -40,4 +48,5 @@ DT_MACHINE_START(IMX6UL, "Freescale i.MX6 Ultralite (Device Tree)") .init_irq = imx6ul_init_irq, .init_machine = imx6ul_init_machine, .dt_compat = imx6ul_dt_compat, + .init_late = imx6ul_init_late,MACHINE_END
Signature · 1 line
1.9.1
PATCH v3 1/1 ARM: imx: add cpuidle support for i.mx6ul
Quoted 8 lines · Anson Huang
This patch adds cpuidle support for i.MX6UL,
it shares cpuidle driver with i.MX6SX, total
3 levels of cpuidle are supported as below:1. ARM WFI;
2. SOC in WAIT mode;
3. SOC in WAIT mode + ARM power off.
Quoted 5 lines
Signed-off-by Anson Huang <[email protected]>---
I am NOT sure if usingcpu_is_xxx()here to distinguish i.MX6UL from i.MX6SX is good enough, as I saw many other patches are trying to avoid using suchcpu_is_xxx()API.
Right, the use of cpu_is_xxx() should be avoid where possible.
Quoted 6 lines
Obviously we have many other ways to identify if the ARM core is a Cortex-A9 or Cortex-A7, they have different L2 cache implemented, so cache operation is different.
Please advise if you have better idea about this point, thanks!
We can have a variable to be initialized per different SoC type, which in turn can be figured out from device tree with of_machine_is_compatible().
Shawn
Quoted 2 lines
arch/arm/mach-imx/cpuidle-imx6sx.c | 8 +++++++-
We will need the following additional line inarch/arm/mach-imx/Makefile, right?
obj-$(CONFIG_SOC_IMX6UL) += cpuidle-imx6sx.o
Shawn
Quoted 70 lines
arch/arm/mach-imx/mach-imx6ul.c | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)arch/arm/mach-imx/cpuidle-imx6sx.c +7
-1@@ -1,5 +1,5 @@/* -* Copyright (C) 2014 Freescale Semiconductor, Inc. +* Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,14 +9,20 @@#include <linux/cpuidle.h> #include <linux/cpu_pm.h> #include <linux/module.h> +#include <asm/cacheflush.h> #include <asm/cpuidle.h> #include <asm/suspend.h> #include "common.h" #include "cpuidle.h" +#include "hardware.h" static int imx6sx_idle_finish (unsigned long val) { +/* flush internal L2 cache if necessary */ +if (cpu_is_imx6ul ()) +flush_cache_all (); +cpu_do_idle ();return 0 ;arch/arm/mach-imx/mach-imx6ul.c +9
-0@@ -11,6 +11,7 @@#include <asm/mach/map.h> #include "common.h" +#include "cpuidle.h" static void __init imx6ul_init_machine (void ) {@@ -29,6 +30,13 @@ static void __init imx6ul_init_irq(void)imx_init_revision_from_anatop ();imx_src_init ();irqchip_init (); +imx6_pm_ccm_init ("fsl,imx6ul-ccm" ); +} + +static void __init imx6ul_init_late (void ) +{ +/* share cpuidle driver with i.MX6SX */ +imx6sx_cpuidle_init (); }static const char *imx6ul_dt_compat[]__initconst = {@@ -40,4 +48,5 @@ DT_MACHINE_START(IMX6UL, "Freescale i.MX6 Ultralite (Device Tree)") .init_irq = imx6ul_init_irq, .init_machine = imx6ul_init_machine, .dt_compat = imx6ul_dt_compat, + .init_late = imx6ul_init_late,MACHINE_END Signature · 1 line
1.9.1