diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2019-02-14 10:55:01 -0500 |
---|---|---|
committer | Ludovic Desroches <ludovic.desroches@microchip.com> | 2019-03-28 06:05:53 -0400 |
commit | bc0779bd8f1317faddf65385f7af1f1fe229f23b (patch) | |
tree | 04fa7e22d554f524e4f0c5f397ae55e28776f4f1 | |
parent | eaedc0d379da6d1157a4f274d186001d11615b2b (diff) |
ARM: at91: pm: disable RC oscillator in ULP0
Disable RC oscillator in ULP0 as datasheet specifies.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
-rw-r--r-- | arch/arm/mach-at91/pm_suspend.S | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index 8b18cad1dcf5..5c33023f9129 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S | |||
@@ -178,11 +178,46 @@ ENDPROC(at91_backup_mode) | |||
178 | orr tmp1, tmp1, #AT91_PMC_KEY | 178 | orr tmp1, tmp1, #AT91_PMC_KEY |
179 | str tmp1, [pmc, #AT91_CKGR_MOR] | 179 | str tmp1, [pmc, #AT91_CKGR_MOR] |
180 | 180 | ||
181 | /* Save RC oscillator state */ | ||
182 | ldr tmp1, [pmc, #AT91_PMC_SR] | ||
183 | str tmp1, .saved_osc_status | ||
184 | tst tmp1, #AT91_PMC_MOSCRCS | ||
185 | bne 1f | ||
186 | |||
187 | /* Turn off RC oscillator */ | ||
188 | ldr tmp1, [pmc, #AT91_CKGR_MOR] | ||
189 | bic tmp1, tmp1, #AT91_PMC_MOSCRCEN | ||
190 | bic tmp1, tmp1, #AT91_PMC_KEY_MASK | ||
191 | orr tmp1, tmp1, #AT91_PMC_KEY | ||
192 | str tmp1, [pmc, #AT91_CKGR_MOR] | ||
193 | |||
194 | /* Wait main RC disabled done */ | ||
195 | 2: ldr tmp1, [pmc, #AT91_PMC_SR] | ||
196 | tst tmp1, #AT91_PMC_MOSCRCS | ||
197 | bne 2b | ||
198 | |||
181 | /* Wait for interrupt */ | 199 | /* Wait for interrupt */ |
182 | at91_cpu_idle | 200 | 1: at91_cpu_idle |
183 | 201 | ||
184 | /* Turn on the crystal oscillator */ | 202 | /* Restore RC oscillator state */ |
203 | ldr tmp1, .saved_osc_status | ||
204 | tst tmp1, #AT91_PMC_MOSCRCS | ||
205 | beq 4f | ||
206 | |||
207 | /* Turn on RC oscillator */ | ||
185 | ldr tmp1, [pmc, #AT91_CKGR_MOR] | 208 | ldr tmp1, [pmc, #AT91_CKGR_MOR] |
209 | orr tmp1, tmp1, #AT91_PMC_MOSCRCEN | ||
210 | bic tmp1, tmp1, #AT91_PMC_KEY_MASK | ||
211 | orr tmp1, tmp1, #AT91_PMC_KEY | ||
212 | str tmp1, [pmc, #AT91_CKGR_MOR] | ||
213 | |||
214 | /* Wait main RC stabilization */ | ||
215 | 3: ldr tmp1, [pmc, #AT91_PMC_SR] | ||
216 | tst tmp1, #AT91_PMC_MOSCRCS | ||
217 | beq 3b | ||
218 | |||
219 | /* Turn on the crystal oscillator */ | ||
220 | 4: ldr tmp1, [pmc, #AT91_CKGR_MOR] | ||
186 | orr tmp1, tmp1, #AT91_PMC_MOSCEN | 221 | orr tmp1, tmp1, #AT91_PMC_MOSCEN |
187 | orr tmp1, tmp1, #AT91_PMC_KEY | 222 | orr tmp1, tmp1, #AT91_PMC_KEY |
188 | str tmp1, [pmc, #AT91_CKGR_MOR] | 223 | str tmp1, [pmc, #AT91_CKGR_MOR] |