diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-23 13:39:21 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-09 10:34:11 -0500 |
commit | f3bb3d7422b4161df31e2fd2e503897926d8ffe7 (patch) | |
tree | f1a1127404dd61fc8c52774a9b13079991085818 | |
parent | cb5e2399f9e504dc78525988c85882643e915da4 (diff) |
ARM: sa11x0: fix sleep entry
Sometimes, we get stuck while trying to enter sleep. This seems
to occur if we do not have udelay() in the instruction cache. Avoid
this by requesting a short delay prior to modifying the SDRAM timings.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-sa1100/sleep.S | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S index e8223315b442..30cc6721665b 100644 --- a/arch/arm/mach-sa1100/sleep.S +++ b/arch/arm/mach-sa1100/sleep.S | |||
@@ -26,27 +26,36 @@ | |||
26 | * | 26 | * |
27 | * Causes sa11x0 to enter sleep state | 27 | * Causes sa11x0 to enter sleep state |
28 | * | 28 | * |
29 | * Must be aligned to a cacheline. | ||
29 | */ | 30 | */ |
30 | 31 | .balign 32 | |
31 | ENTRY(sa1100_finish_suspend) | 32 | ENTRY(sa1100_finish_suspend) |
32 | @ disable clock switching | 33 | @ disable clock switching |
33 | mcr p15, 0, r1, c15, c2, 2 | 34 | mcr p15, 0, r1, c15, c2, 2 |
34 | 35 | ||
35 | @ Adjust memory timing before lowering CPU clock | 36 | ldr r6, =MDREFR |
36 | @ Clock speed adjustment without changing memory timing makes | 37 | ldr r4, [r6] |
37 | @ CPU hang in some cases | 38 | orr r4, r4, #MDREFR_K1DB2 |
38 | ldr r0, =MDREFR | 39 | ldr r5, =PPCR |
39 | ldr r1, [r0] | 40 | |
40 | orr r1, r1, #MDREFR_K1DB2 | 41 | @ Pre-load __udelay into the I-cache |
41 | str r1, [r0] | 42 | mov r0, #1 |
43 | bl __udelay | ||
44 | mov r0, r0 | ||
45 | |||
46 | @ The following must all exist in a single cache line to | ||
47 | @ avoid accessing memory until this sequence is complete, | ||
48 | @ otherwise we occasionally hang. | ||
49 | |||
50 | @ Adjust memory timing before lowering CPU clock | ||
51 | str r4, [r6] | ||
42 | 52 | ||
43 | @ delay 90us and set CPU PLL to lowest speed | 53 | @ delay 90us and set CPU PLL to lowest speed |
44 | @ fixes resume problem on high speed SA1110 | 54 | @ fixes resume problem on high speed SA1110 |
45 | mov r0, #90 | 55 | mov r0, #90 |
46 | bl __udelay | 56 | bl __udelay |
47 | ldr r0, =PPCR | ||
48 | mov r1, #0 | 57 | mov r1, #0 |
49 | str r1, [r0] | 58 | str r1, [r5] |
50 | mov r0, #90 | 59 | mov r0, #90 |
51 | bl __udelay | 60 | bl __udelay |
52 | 61 | ||
@@ -85,12 +94,10 @@ ENTRY(sa1100_finish_suspend) | |||
85 | bic r5, r5, #FMsk(MSC_RT) | 94 | bic r5, r5, #FMsk(MSC_RT) |
86 | bic r5, r5, #FMsk(MSC_RT)<<16 | 95 | bic r5, r5, #FMsk(MSC_RT)<<16 |
87 | 96 | ||
88 | ldr r6, =MDREFR | ||
89 | |||
90 | ldr r7, [r6] | 97 | ldr r7, [r6] |
91 | bic r7, r7, #0x0000FF00 | 98 | bic r7, r7, #0x0000FF00 |
92 | bic r7, r7, #0x000000F0 | 99 | bic r7, r7, #0x000000F0 |
93 | orr r8, r7, #MDREFR_SLFRSH | 100 | orr r8, r7, #MDREFR_SLFRSH |
94 | 101 | ||
95 | ldr r9, =MDCNFG | 102 | ldr r9, =MDCNFG |
96 | ldr r10, [r9] | 103 | ldr r10, [r9] |