ARM: imx: add suspend in ocram support for i.mx6q
Subsystems (3)
PATCH v8 1/3 ARM: imx: add suspend in ocram support for i.mx6q
When system enter suspend, we can set the DDR IO to high-Z state to save DDR IOs' power consumption, this operation can save many power(from ~26mA at 1.5V to ~15mA at 1.5V, measured on i.MX6Q SabreSD board, R25) of DDR IOs. To achieve that, we need to copy the suspend code to ocram and run the low level hardware related code(set DDR IOs to high-Z state) in ocram.
If there is no ocram space available, then system will still do suspend in external DDR, hence no DDR IOs will be set to high-Z.
The OCRAM usage layout is as below,
ocram suspend region(4K currently):
======================== high address ======================
.
.
.
^
^
^
imx6_suspend code
PM_INFO structure(imx6_cpu_pm_info)======================== low address =======================
---
Changes since V7:
Add __initconst to imx6q_mmdc_io_offset[].
arch/arm/mach-imx/Makefile | 3 +- arch/arm/mach-imx/common.h | 8 +- arch/arm/mach-imx/hardware.h | 4 +- arch/arm/mach-imx/mach-imx6q.c | 2 +- arch/arm/mach-imx/mach-imx6sl.c | 3 +- arch/arm/mach-imx/pm-imx6q.c | 281 +++++++++++++++++++++++++++++++++++- arch/arm/mach-imx/suspend-imx6.S | 289 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 579 insertions(+), 11 deletions(-) create mode 100644 arch/arm/mach-imx/suspend-imx6.S
arch/arm/mach-imx/Makefile +2 -1
@@ -102,7 +102,8 @@ obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o ifeq ($(CONFIG_PM),y) -obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o +AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a +obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o suspend-imx6.o # i.MX6SL reuses i.MX6Q code obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o headsmp.o endif
arch/arm/mach-imx/common.h +7 -1
@@ -1,5 +1,5 @@/* -* Copyright 2004-2013 Freescale Semiconductor, Inc. All Rights Reserved. +* Copyright 2004-2014 Freescale Semiconductor, Inc. All Rights Reserved. */ /*
@@ -145,11 +145,17 @@ void imx_cpu_die(unsigned int cpu);int imx_cpu_kill (unsigned int cpu);#ifdef CONFIG_PM +void imx6_suspend (void __iomem *ocram_vbase);void imx6q_pm_init (void ); +void imx6dl_pm_init (void ); +void imx6sl_pm_init (void );void imx6q_pm_set_ccm_base (void __iomem *base);void imx5_pm_init (void );#else +static inline void imx6_suspend (void __iomem *ocram_vbase) {}static inline void imx6q_pm_init (void ) {} +static inline void imx6dl_pm_init (void ) {} +static inline void imx6sl_pm_init (void ) {}static inline void imx6q_pm_set_ccm_base (void __iomem *base) {}static inline void imx5_pm_init (void ) {}#endif
arch/arm/mach-imx/hardware.h +3 -1
@@ -1,5 +1,5 @@/* -* Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. +* Copyright 2004-2007, 2014 Freescale Semiconductor, Inc. All Rights Reserved. * Copyright 2008 Juergen Beisert, kernel at pengutronix.de * * This program is free software; you can redistribute it and/or
@@ -20,7 +20,9 @@#ifndef __ASM_ARCH_MXC_HARDWARE_H__#define __ASM_ARCH_MXC_HARDWARE_H__ +#ifndef __ASSEMBLY__#include <asm/io.h> +#endif #include <asm/sizes.h> #define addr_in_module (addr, mod) \
arch/arm/mach-imx/mach-imx6q.c +1 -1
@@ -212,7 +212,7 @@ static void __init imx6q_init_machine(void)of_platform_populate (NULL , of_default_bus_match_table,NULL , parent);imx_anatop_init (); -imx6q_pm_init (); +cpu_is_imx6q () ?imx6q_pm_init () :imx6dl_pm_init ();imx6q_1588_init (); }
arch/arm/mach-imx/mach-imx6sl.c +1 -2
@@ -55,8 +55,7 @@ static void __init imx6sl_init_machine(void)imx6sl_fec_init ();imx_anatop_init (); -/* Reuse imx6q pm code */ -imx6q_pm_init (); +imx6sl_pm_init (); }static void __init imx6sl_init_irq (void )
arch/arm/mach-imx/pm-imx6q.c +276 -5
333 lines not on this page · raw message
arch/arm/mach-imx/suspend-imx6.S new file +289 -0
289 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v8 2/3 ARM: imx: add suspend in ocram support for i.mx6dl
i.MX6DL's suspend in ocram function is derived from i.MX6Q, it can lower the DDR IO power from ~26mA at 1.5V to ~15mA at 1.5V, measured on i.MX6DL SabreSD board, R25.
---
Changes since V7:
Add __initconst to imx6dl_mmdc_io_offset[].
arch/arm/mach-imx/pm-imx6q.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
arch/arm/mach-imx/pm-imx6q.c +23 -1
@@ -109,6 +109,18 @@ static const u32 imx6q_mmdc_io_offset[] __initconst = { 0x74c, /* GPR_ADDS */ }; +static const u32 imx6dl_mmdc_io_offset[]__initconst = { +0x470 ,0x474 ,0x478 ,0x47c ,/* DQM0 ~ DQM3 */ +0x480 ,0x484 ,0x488 ,0x48c ,/* DQM4 ~ DQM7 */ +0x464 ,0x490 ,0x4ac ,0x4b0 ,/* CAS, RAS, SDCLK_0, SDCLK_1 */ +0x4bc ,0x4c0 ,0x4c4 ,0x4c8 ,/* DRAM_SDQS0 ~ DRAM_SDQS3 */ +0x4cc ,0x4d0 ,0x4d4 ,0x4d8 ,/* DRAM_SDQS4 ~ DRAM_SDQS7 */ +0x764 ,0x770 ,0x778 ,0x77c ,/* GPR_B0DS ~ GPR_B3DS */ +0x780 ,0x784 ,0x78c ,0x748 ,/* GPR_B4DS ~ GPR_B7DS */ +0x4b4 ,0x4b8 ,0x750 ,0x760 ,/* SODT0, SODT1, MODE_CTL, MODE */ +0x74c ,/* GPR_ADDS */ +}; +static const struct imx6_pm_socdata imx6q_pm_data__initconst = { .cpu_type =MXC_CPU_IMX6Q , .mmdc_compat ="fsl,imx6q-mmdc" ,
@@ -119,6 +131,16 @@ static const struct imx6_pm_socdata imx6q_pm_data __initconst = { .mmdc_io_offset = imx6q_mmdc_io_offset, }; +static const struct imx6_pm_socdata imx6dl_pm_data__initconst = { + .cpu_type =MXC_CPU_IMX6DL , + .mmdc_compat ="fsl,imx6q-mmdc" , + .src_compat ="fsl,imx6q-src" , + .iomuxc_compat ="fsl,imx6dl-iomuxc" , + .gpc_compat ="fsl,imx6q-gpc" , + .mmdc_io_num =ARRAY_SIZE (imx6dl_mmdc_io_offset), + .mmdc_io_offset = imx6dl_mmdc_io_offset, +}; +/* * This structure is for passing necessary data for low level ocram * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
@@ -505,7 +527,7 @@ void __init imx6q_pm_init(void)void __init imx6dl_pm_init (void ) { -imx6_pm_common_init (NULL ); +imx6_pm_common_init (&imx6dl_pm_data); }void __init imx6sl_pm_init (void )
Signature · 1 line
1.7.9.5
PATCH v8 3/3 ARM: imx: add suspend in ocram support for i.mx6sl
In reply to Anson Huangi.MX6SL's suspend in ocram function is derived from i.MX6Q, it can lower the DDR IO power from ~10mA at 1.2V to ~1mA at 1.2V, measured on i.MX6SL EVK board, SH5.
---
Changes since V7:
1. Add __initconst to imx6sl_mmdc_io_offset[];
2. Add last 3 MMDC IOs lpm settings back, they are missed by mistake in V7.
arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/pm-imx6q.c | 20 +++++++++++++++++- arch/arm/mach-imx/suspend-imx6.S | 43 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 4 deletions(-)
arch/arm/mach-imx/Makefile +1 -1
@@ -105,7 +105,7 @@ ifeq ($(CONFIG_PM),y) AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o suspend-imx6.o # i.MX6SL reuses i.MX6Q code -obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o headsmp.o +obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o headsmp.o suspend-imx6.o endif # i.MX5 based machines
arch/arm/mach-imx/pm-imx6q.c +19 -1
@@ -121,6 +121,14 @@ static const u32 imx6dl_mmdc_io_offset[] __initconst = { 0x74c, /* GPR_ADDS */ }; +static const u32 imx6sl_mmdc_io_offset[]__initconst = { +0x30c ,0x310 ,0x314 ,0x318 ,/* DQM0 ~ DQM3 */ +0x5c4 ,0x5cc ,0x5d4 ,0x5d8 ,/* GPR_B0DS ~ GPR_B3DS */ +0x300 ,0x31c ,0x338 ,0x5ac ,/* CAS, RAS, SDCLK_0, GPR_ADDS */ +0x33c ,0x340 ,0x5b0 ,0x5c0 ,/* SODT0, SODT1, MODE_CTL, MODE */ +0x330 ,0x334 ,0x320 ,/* SDCKE0, SDCKE1, RESET */ +}; +static const struct imx6_pm_socdata imx6q_pm_data__initconst = { .cpu_type =MXC_CPU_IMX6Q , .mmdc_compat ="fsl,imx6q-mmdc" ,
@@ -141,6 +149,16 @@ static const struct imx6_pm_socdata imx6dl_pm_data __initconst = { .mmdc_io_offset = imx6dl_mmdc_io_offset, }; +static const struct imx6_pm_socdata imx6sl_pm_data__initconst = { + .cpu_type =MXC_CPU_IMX6SL , + .mmdc_compat ="fsl,imx6sl-mmdc" , + .src_compat ="fsl,imx6sl-src" , + .iomuxc_compat ="fsl,imx6sl-iomuxc" , + .gpc_compat ="fsl,imx6sl-gpc" , + .mmdc_io_num =ARRAY_SIZE (imx6sl_mmdc_io_offset), + .mmdc_io_offset = imx6sl_mmdc_io_offset, +}; +/* * This structure is for passing necessary data for low level ocram * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
@@ -532,5 +550,5 @@ void __init imx6dl_pm_init(void)void __init imx6sl_pm_init (void ) { -imx6_pm_common_init (NULL ); +imx6_pm_common_init (&imx6sl_pm_data); }
arch/arm/mach-imx/suspend-imx6.S +41 -2
79 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v8 1/3 ARM: imx: add suspend in ocram support for i.mx6q
In reply to Anson HuangQuoted 24 lines · Anson Huang
When system enter suspend, we can set the DDR IO to high-Z state to save DDR IOs' power consumption, this operation can save many
power(from ~26mA at 1.5V to ~15mA at 1.5V, measured on i.MX6Q SabreSD board, R25)of DDR IOs. To achieve that, we need to copy the suspend code to ocram and run the low level hardware related code(set DDR IOs to high-Z state) in ocram.If there is no ocram space available, then system will still do suspend in external DDR, hence no DDR IOs will be set to high-Z.
The OCRAM usage layout is as below,
ocram suspend region(4K currently):
======================== high address ======================. . . ^ ^ ^ imx6_suspend code PM_INFO structure(imx6_cpu_pm_info)
Quoted 4 lines
======================== low address =======================
Reviewed-by Sascha Hauer <[email protected]>Signed-off-by Anson Huang <[email protected]>
Thanks for the work. Applied all 3, thanks.