1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
8 #include <linux/linkage.h>
10 #define M4IF_MCR0_OFFSET (0x008C)
11 #define M4IF_MCR0_FDVFS (0x1 << 11)
12 #define M4IF_MCR0_FDVACK (0x1 << 27)
17 * ==================== low level suspend ====================
20 * r0: pm_info structure address;
22 * suspend ocram space layout:
23 * ======================== high address ======================
31 * PM_INFO structure(imx53_suspend_info)
32 * ======================== low address =======================
35 /* Offsets of members of struct imx53_suspend_info */
36 #define SUSPEND_INFO_MX53_M4IF_V_OFFSET 0x0
37 #define SUSPEND_INFO_MX53_IOMUXC_V_OFFSET 0x4
38 #define SUSPEND_INFO_MX53_IO_COUNT_OFFSET 0x8
39 #define SUSPEND_INFO_MX53_IO_STATE_OFFSET 0xc
42 stmfd sp!, {r4,r5,r6,r7}
45 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
49 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
50 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
53 ldr r5, [r2], #12 /* IOMUXC register offset */
54 ldr r6, [r3, r5] /* current value */
55 str r6, [r2], #4 /* save area */
60 /* Set FDVFS bit of M4IF_MCR0 to request DDR to enter self-refresh */
61 ldr r1, [r0, #SUSPEND_INFO_MX53_M4IF_V_OFFSET]
62 ldr r2,[r1, #M4IF_MCR0_OFFSET]
63 orr r2, r2, #M4IF_MCR0_FDVFS
64 str r2,[r1, #M4IF_MCR0_OFFSET]
66 /* Poll FDVACK bit of M4IF_MCR to wait for DDR to enter self-refresh */
68 ldr r2,[r1, #M4IF_MCR0_OFFSET]
69 ands r2, r2, #M4IF_MCR0_FDVACK
73 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
77 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
78 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
81 ldr r5, [r2], #4 /* IOMUXC register offset */
82 ldr r6, [r2], #4 /* clear */
85 ldr r6, [r2], #8 /* set */
92 /* Zzz, enter stop mode */
99 /* Restore pad config */
100 ldr r1, [r0, #SUSPEND_INFO_MX53_IO_COUNT_OFFSET]
104 add r2, r0, #SUSPEND_INFO_MX53_IO_STATE_OFFSET
105 ldr r3, [r0, #SUSPEND_INFO_MX53_IOMUXC_V_OFFSET]
108 ldr r5, [r2], #12 /* IOMUXC register offset */
109 ldr r6, [r2], #4 /* saved value */
115 /* Clear FDVFS bit of M4IF_MCR0 to request DDR to exit self-refresh */
116 ldr r1, [r0, #SUSPEND_INFO_MX53_M4IF_V_OFFSET]
117 ldr r2,[r1, #M4IF_MCR0_OFFSET]
118 bic r2, r2, #M4IF_MCR0_FDVFS
119 str r2,[r1, #M4IF_MCR0_OFFSET]
121 /* Poll FDVACK bit of M4IF_MCR to wait for DDR to exit self-refresh */
123 ldr r2,[r1, #M4IF_MCR0_OFFSET]
124 ands r2, r2, #M4IF_MCR0_FDVACK
127 /* Restore registers */
128 ldmfd sp!, {r4,r5,r6,r7}
131 ENDPROC(imx53_suspend)
133 ENTRY(imx53_suspend_sz)
134 .word . - imx53_suspend