2 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
13 #include <linux/linkage.h>
15 #define M4IF_MCR0_OFFSET (0x008C)
16 #define M4IF_MCR0_FDVFS (0x1 << 11)
17 #define M4IF_MCR0_FDVACK (0x1 << 27)
22 * ==================== low level suspend ====================
25 * r0: pm_info structure address;
27 * suspend ocram space layout:
28 * ======================== high address ======================
36 * PM_INFO structure(imx53_suspend_info)
37 * ======================== low address =======================
40 /* Offsets of members of struct imx53_suspend_info */
41 #define SUSPEND_INFO_MX53_M4IF_V_OFFSET 0x0
42 #define SUSPEND_INFO_MX53_IOMUXC_V_OFFSET 0x4
43 #define SUSPEND_INFO_MX53_IO_COUNT_OFFSET 0x8
44 #define SUSPEND_INFO_MX53_IO_STATE_OFFSET 0xc
47 stmfd sp!, {r4,r5,r6,r7}
50 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
54 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
55 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
58 ldr r5, [r2], #12 /* IOMUXC register offset */
59 ldr r6, [r3, r5] /* current value */
60 str r6, [r2], #4 /* save area */
65 /* Set FDVFS bit of M4IF_MCR0 to request DDR to enter self-refresh */
66 ldr r1, [r0, #SUSPEND_INFO_MX53_M4IF_V_OFFSET]
67 ldr r2,[r1, #M4IF_MCR0_OFFSET]
68 orr r2, r2, #M4IF_MCR0_FDVFS
69 str r2,[r1, #M4IF_MCR0_OFFSET]
71 /* Poll FDVACK bit of M4IF_MCR to wait for DDR to enter self-refresh */
73 ldr r2,[r1, #M4IF_MCR0_OFFSET]
74 ands r2, r2, #M4IF_MCR0_FDVACK
78 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
82 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
83 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
86 ldr r5, [r2], #4 /* IOMUXC register offset */
87 ldr r6, [r2], #4 /* clear */
90 ldr r6, [r2], #8 /* set */
97 /* Zzz, enter stop mode */
104 /* Restore pad config */
105 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
109 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
110 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
113 ldr r5, [r2], #12 /* IOMUXC register offset */
114 ldr r6, [r2], #4 /* saved value */
120 /* Clear FDVFS bit of M4IF_MCR0 to request DDR to exit self-refresh */
121 ldr r1, [r0, #SUSPEND_INFO_MX53_M4IF_V_OFFSET]
122 ldr r2,[r1, #M4IF_MCR0_OFFSET]
123 bic r2, r2, #M4IF_MCR0_FDVFS
124 str r2,[r1, #M4IF_MCR0_OFFSET]
126 /* Poll FDVACK bit of M4IF_MCR to wait for DDR to exit self-refresh */
128 ldr r2,[r1, #M4IF_MCR0_OFFSET]
129 ands r2, r2, #M4IF_MCR0_FDVACK
132 /* Restore registers */
133 ldmfd sp!, {r4,r5,r6,r7}
136 ENDPROC(imx53_suspend)
138 ENTRY(imx53_suspend_sz)
139 .word . - imx53_suspend