Skip to contentSkip to conversation

ARM: imx: add suspend in ocram support for i.mx6q

PATCH Superseded Anson Huang 3 participants 6 messages Jan 16, 2014

Subsystems (3)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 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 V5:
1. Remove unnecessary info in comments of ocram suspend region description;
2. Optimize asm loop code and make all those reused code as macro define.

 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     |  279 +++++++++++++++++++++++++++++++++++-
 arch/arm/mach-imx/suspend-imx6.S |  292 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 580 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm/mach-imx/suspend-imx6.S
arch/arm/mach-imx/Makefile +2 -1
index befcaf5..3d96a45 100644
@@ -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
index 4f4a95c..a363e71 100644
@@ -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
index a3b0b04..abf43bb 100644
@@ -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
index e51e3da..e629593 100644
@@ -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
index 0f4fd4c..aa873d8 100644
@@ -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 +274 -5

331 lines not on this page · raw message

arch/arm/mach-imx/suspend-imx6.S new file +292 -0

292 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v6 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 V5:
None.

 arch/arm/mach-imx/pm-imx6q.c |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
arch/arm/mach-imx/pm-imx6q.c +21 -1
index bd06d5c..8c2d912 100644
@@ -117,6 +117,26 @@ static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
 	},
 };
 
+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 = 33,
+	.mmdc_io_offset = {
+		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 */
+	},
+};
+
 /*
  * This structure is for passing necessary data for low level ocram
  * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
@@ -503,7 +523,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
#2 lore raw

PATCH v6 3/3 ARM: imx: add suspend in ocram support for i.mx6sl

In reply to Anson Huang

i.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 V5:
1. Improve asm code and make reused code as macro define.

 arch/arm/mach-imx/Makefile       |    2 +-
 arch/arm/mach-imx/pm-imx6q.c     |   18 +++++++++++-
 arch/arm/mach-imx/suspend-imx6.S |   57 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)
arch/arm/mach-imx/Makefile +1 -1
index 3d96a45..f2df89f 100644
@@ -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 +17 -1
index 8c2d912..03e7be4 100644
@@ -137,6 +137,22 @@ static const struct imx6_pm_socdata imx6dl_pm_data __initconst = {
 	},
 };
 
+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 = 19,
+	.mmdc_io_offset = {
+		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 */
+	},
+};
+
 /*
  * This structure is for passing necessary data for low level ocram
  * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
@@ -528,5 +544,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 +57 -0

93 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v6 3/3 ARM: imx: add suspend in ocram support for i.mx6sl

Quoted 5 lines · Anson Huang
(quoted diff) +1 -0
@@ -119,6 +120,31 @@
 
 	.endm
 
+	.macro reset_mmdc_read_fifo

Review line 133

Quoted 10 lines
(quoted diff) +10 -0
+
+	/* reset read FIFO, RST_RD_FIFO */
+	ldr	r7, =MX6Q_MMDC_MPDGCTRL0
+	ldr	r6, [r11, r7]
+	orr     r6, r6, #(1 << 31)
+	str	r6, [r11, r7]
+1:
+	ldr	r6, [r11, r7]
+	and	r6, r6, #(1 << 31)
+	cmp	r6, #0

Use 'ands' to save the 'cmp'.

Review line 143

Quoted 10 lines
(quoted diff) +10 -0
+	bne	1b
+
+	/* reset FIFO a second time */
+	ldr	r6, [r11, r7]
+	orr     r6, r6, #(1 << 31)
+	str	r6, [r11, r7]
+2:
+	ldr	r6, [r11, r7]
+	and	r6, r6, #(1 << 31)
+	cmp	r6, #0

Ditto

Quoted 7 lines
(quoted diff) +4 -0
+	bne	2b
+
+	.endm
+
 ENTRY(imx6_suspend)
 	ldr	r1, [r0, #PM_INFO_PBASE_OFFSET]
 	ldr	r2, [r0, #PM_INFO_RESUME_ADDR_OFFSET]

<snip>

Quoted 5 lines
(quoted diff) +1 -0
@@ -286,6 +335,14 @@ resume:
 	restore_mmdc_io
 
 	ldr	r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET]
+

Review resume: · line 348

Quoted 10 lines
(quoted diff) +7 -0
+	ldr	r3, [r0, #PM_INFO_CPU_TYPE_OFFSET]
+	cmp 	r3, #MXC_CPU_IMX6SL
+	bne	dsm_restore_mmdc_io_done
+
+	reset_mmdc_read_fifo
+dsm_restore_mmdc_io_done:
+
 	enable_mmdc_access
 
 	mov	pc, lr

Instead of creating 3 macros, restore_mmdc_io, reset_mmdc_read_fifo and enable_mmdc_access, I was actually suggesting to do all the mmdc resume work in one macro. We will need to tell the macro whether we're running at virtual or physical space. For you reference, the following changes are what I made on top of yours.

Shawn

---8<-------

arch/arm/mach-imx/suspend-imx6.S +38 -58
index 570fede..1ba8fc8 100644
@@ -18,8 +18,8 @@
  *
  * Better to follow below rules to use ARM registers:
  * r0: pm_info structure address;
- * r1 ~ r5: for saving pm_info members;
- * r6 ~ r10: free registers;
+ * r1 ~ r4: for saving pm_info members;
+ * r5 ~ r10: free registers;
  * r11: io base address.
  *
  * suspend ocram space layout:
@@ -87,9 +87,13 @@
 
 	.endm
 
-	.macro	restore_mmdc_io
+	.macro	resume_mmdc
+
+	/* restore MMDC IO */
+	cmp	r5, #0
+	ldreq	r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
+	ldrne	r11, [r0, #PM_INFO_MX6Q_IOMUXC_P_OFFSET]
 
-	/* r11 must be the MMDC IO address before calling it */
 	ldr	r6, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
 	ldr	r7, =PM_INFO_MMDC_IO_VAL_OFFSET
 	add	r7, r7, r0
@@ -100,48 +104,45 @@
 	subs	r6, r6, #0x1
 	bne	1b
 
-	.endm
-
-	.macro	enable_mmdc_access
+	cmp	r5, #0
+	ldreq	r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
+	ldrne	r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET]
 
-	/* let DDR out of self-refresh */
-	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
-	bic	r7, r7, #(1 << 21)
-	str	r7, [r11, #MX6Q_MMDC_MAPSR]
-
-1:
-	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
-	ands	r7, r7, #(1 << 25)
-	bne	1b
-	/* enable DDR auto power saving */
-	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
-	bic	r7, r7, #0x1
-	str	r7, [r11, #MX6Q_MMDC_MAPSR]
-
-	.endm
-
-	.macro reset_mmdc_read_fifo
+	cmp 	r3, #MXC_CPU_IMX6SL
+	bne	4f
 
 	/* reset read FIFO, RST_RD_FIFO */
 	ldr	r7, =MX6Q_MMDC_MPDGCTRL0
 	ldr	r6, [r11, r7]
 	orr     r6, r6, #(1 << 31)
 	str	r6, [r11, r7]
-1:
+2:
 	ldr	r6, [r11, r7]
-	and	r6, r6, #(1 << 31)
-	cmp	r6, #0
-	bne	1b
+	ands	r6, r6, #(1 << 31)
+	bne	2b
 
 	/* reset FIFO a second time */
 	ldr	r6, [r11, r7]
 	orr     r6, r6, #(1 << 31)
 	str	r6, [r11, r7]
-2:
+3:
 	ldr	r6, [r11, r7]
-	and	r6, r6, #(1 << 31)
-	cmp	r6, #0
-	bne	2b
+	ands	r6, r6, #(1 << 31)
+	bne	3b
+
+4:
+	/* let DDR out of self-refresh */
+	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
+	bic	r7, r7, #(1 << 21)
+	str	r7, [r11, #MX6Q_MMDC_MAPSR]
+5:
+	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
+	ands	r7, r7, #(1 << 25)
+	bne	5b
+	/* enable DDR auto power saving */
+	ldr	r7, [r11, #MX6Q_MMDC_MAPSR]
+	bic	r7, r7, #0x1
+	str	r7, [r11, #MX6Q_MMDC_MAPSR]
 
 	.endm
 
@@ -281,8 +282,7 @@ set_mmdc_io_lpm_done:
 	 */
 	ldr     r6, =2000
 rbc_loop:
-	sub     r6, r6, #0x1
-	cmp     r6, #0x0
+	subs	r6, r6, #0x1
 	bne     rbc_loop
 
 	/* Zzz, enter stop mode */
@@ -297,18 +297,8 @@ rbc_loop:
 	 * wakeup source, system should auto
 	 * resume, we need to restore MMDC IO first
 	 */
-	ldr	r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
-	restore_mmdc_io
-
-	ldr	r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
-
-	cmp 	r3, #MXC_CPU_IMX6SL
-	bne	restore_mmdc_io_done
-
-	reset_mmdc_read_fifo
-restore_mmdc_io_done:
-
-	enable_mmdc_access
+	mov	r5, #0
+	resume_mmdc
 
 	/* return to suspend finish */
 	mov	pc, lr
@@ -331,19 +321,9 @@ resume:
 	str	r7, [r11, #MX6Q_SRC_GPR1]
 	str	r7, [r11, #MX6Q_SRC_GPR2]
 
-	ldr	r11, [r0, #PM_INFO_MX6Q_IOMUXC_P_OFFSET]
-	restore_mmdc_io
-
-	ldr	r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET]
-
 	ldr	r3, [r0, #PM_INFO_CPU_TYPE_OFFSET]
-	cmp 	r3, #MXC_CPU_IMX6SL
-	bne	dsm_restore_mmdc_io_done
-
-	reset_mmdc_read_fifo
-dsm_restore_mmdc_io_done:
-
-	enable_mmdc_access
+	mov	r5, #1
+	resume_mmdc
 
 	mov	pc, lr
 ENDPROC(imx6_suspend)
maintainer
#4 lore raw

PATCH v6 1/3 ARM: imx: add suspend in ocram support for i.mx6q

In reply to Anson Huang

arch/arm/mach-imx/pm-imx6q.c line 98

Quoted 9 lines · Anson Huang
arch/arm/mach-imx/pm-imx6q.c +9 -0
+struct imx6_pm_socdata {
+	u32 cpu_type;
+	const char *mmdc_compat;
+	const char *src_compat;
+	const char *iomuxc_compat;
+	const char *gpc_compat;
+	const u32 mmdc_io_num;
+	const u32 mmdc_io_offset[MX6_MAX_MMDC_IO_NUM];
+};

This is error prone. Use const u32 *mmdc_io_offset here, and...

Quoted 10 lines
arch/arm/mach-imx/pm-imx6q.c +10 -0
+
+static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
+	.cpu_type = MXC_CPU_IMX6Q,
+	.mmdc_compat = "fsl,imx6q-mmdc",
+	.src_compat = "fsl,imx6q-src",
+	.iomuxc_compat = "fsl,imx6q-iomuxc",
+	.gpc_compat = "fsl,imx6q-gpc",
+	.mmdc_io_num = 33,
+	.mmdc_io_offset = {
+		0x5ac, 0x5b4, 0x528, 0x520, /* DQM0 ~ DQM3 */

arch/arm/mach-imx/pm-imx6q.c line 118

Quoted 10 lines
arch/arm/mach-imx/pm-imx6q.c +10 -0
+		0x514, 0x510, 0x5bc, 0x5c4, /* DQM4 ~ DQM7 */
+		0x56c, 0x578, 0x588, 0x594, /* CAS, RAS, SDCLK_0, SDCLK_1 */
+		0x5a8, 0x5b0, 0x524, 0x51c, /* SDQS0 ~ SDQS3 */
+		0x518, 0x50c, 0x5b8, 0x5c0, /* SDQS4 ~ SDQS7 */
+		0x784, 0x788, 0x794, 0x79c, /* GPR_B0DS ~ GPR_B3DS */
+		0x7a0, 0x7a4, 0x7a8, 0x748, /* GPR_B4DS ~ GPR_B7DS */
+		0x59c, 0x5a0, 0x750, 0x774, /* SODT0, SODT1, MODE_CTL, MODE */
+		0x74c,			    /* GPR_ADDS */
+	},
+};
static u32 imx6q_mmdc_io_offset[] = {
	0x5ac, 0x5b4, 0x528, 0x520, /* DQM0 ~ DQM3 */
	0x514, 0x510, 0x5bc, 0x5c4, /* DQM4 ~ DQM7 */
	0x56c, 0x578, 0x588, 0x594, /* CAS, RAS, SDCLK_0, SDCLK_1 */
	0x5a8, 0x5b0, 0x524, 0x51c, /* SDQS0 ~ SDQS3 */
	0x518, 0x50c, 0x5b8, 0x5c0, /* SDQS4 ~ SDQS7 */
	0x784, 0x788, 0x794, 0x79c, /* GPR_B0DS ~ GPR_B3DS */
	0x7a0, 0x7a4, 0x7a8, 0x748, /* GPR_B4DS ~ GPR_B7DS */
	0x59c, 0x5a0, 0x750, 0x774, /* SODT0, SODT1, MODE_CTL, MODE */
	0x74c,                      /* GPR_ADDS */
};

static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
.mmdc_io_num = ARRAY_SIZE(imx6q_mmdc_io_offset), .mmdc_io_offset = imx6q_mmdc_io_offset,
};

instead.

arch/arm/mach-imx/pm-imx6q.c line 125

Quoted 7 lines
arch/arm/mach-imx/pm-imx6q.c +7 -0
+
+/*
+ * This structure is for passing necessary data for low level ocram
+ * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
+ * definition is changed, the offset definition in
+ * arch/arm/mach-imx/suspend-imx6.S must be also changed accordingly,
+ * otherwise, the suspend to ocram fucntion will be broken!

s/fucntion/function/

Other than that:

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw

PATCH v6 1/3 ARM: imx: add suspend in ocram support for i.mx6q

In reply to Anson Huang
Quoted 6 lines · Anson Huang

+/*
+ * ==================== low level suspend ====================
+ *
+ * Better to follow below rules to use ARM registers:
+ * r0: pm_info structure address;
+ * r1 ~ r5: for saving pm_info members;

The register r5 is free to use now.

Quoted 15 lines

+ * r6 ~ r10: free registers;
+ * r11: io base address.
+ *
+ * suspend ocram space layout:
+ * ======================== high address ======================

+ *                              .
+ *                              .
+ *                              .
+ *                              ^
+ *                              ^
+ *                              ^

+ * imx6_suspend code
+ * PM_INFO structure(imx6_cpu_pm_info)
+ * ======================== low address =======================
+ */

<snip>

Quoted 4 lines
arch/arm/mach-imx/suspend-imx6.S new file +4 -0
+	/*
+	 * now delay for a short while (3usec)
+	 * ARM is at 1GHz at this point
+	 * so a short loop should be enough.

arch/arm/mach-imx/suspend-imx6.S line 243

Quoted 10 lines
arch/arm/mach-imx/suspend-imx6.S new file +10 -0
+	 * this delay is required to ensure that
+	 * the RBC counter can start counting in
+	 * case an interrupt is already pending
+	 * or in case an interrupt arrives just
+	 * as ARM is about to assert DSM_request.
+	 */
+	ldr     r6, =2000
+rbc_loop:
+	sub     r6, r6, #0x1
+	cmp     r6, #0x0

Use 'subs' instead to save the 'cmp'.

Shawn

Quoted 1 line
arch/arm/mach-imx/suspend-imx6.S new file +1 -0
+	bne     rbc_loop