summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/cpu.c')
-rw-r--r--arch/arm/cpu/cpu.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index bf604fd60d..0e70a23260 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -89,6 +89,22 @@ void mmu_disable(void)
}
#endif
+static void disable_interrupts(void)
+{
+#if __LINUX_ARM_ARCH__ <= 7
+ uint32_t r;
+
+ /*
+ * barebox normally does not use interrupts, but some functionalities
+ * (eg. OMAP4_USBBOOT) require them enabled. So be sure interrupts are
+ * disabled before exiting.
+ */
+ __asm__ __volatile__("mrs %0, cpsr" : "=r"(r));
+ r |= PSR_I_BIT;
+ __asm__ __volatile__("msr cpsr, %0" : : "r"(r));
+#endif
+}
+
/**
* Disable MMU and D-cache, flush caches
* @return 0 (always)
@@ -98,23 +114,13 @@ void mmu_disable(void)
*/
static void arch_shutdown(void)
{
- uint32_t r;
#ifdef CONFIG_MMU
mmu_disable();
#endif
icache_invalidate();
-#if __LINUX_ARM_ARCH__ <= 7
- /*
- * barebox normally does not use interrupts, but some functionalities
- * (eg. OMAP4_USBBOOT) require them enabled. So be sure interrupts are
- * disabled before exiting.
- */
- __asm__ __volatile__("mrs %0, cpsr" : "=r"(r));
- r |= PSR_I_BIT;
- __asm__ __volatile__("msr cpsr, %0" : : "r"(r));
-#endif
+ disable_interrupts();
}
archshutdown_exitcall(arch_shutdown);