]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm: Move CP15 init out of cpu_init_crit()
authorSimon Glass <sjg@chromium.org>
Sat, 5 Nov 2011 03:56:51 +0000 (03:56 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 9 Dec 2011 16:30:09 +0000 (17:30 +0100)
Some SOCs have do not start up with their 'main' CPU. The first U-Boot
code may then be executed with a CPU which does not have a CP15, or not a
useful one.

Here we split the initialization of CP15 into a separate call, which can
be performed later if required.

Once the main CPU is running, you should call cpu_init_cp15() to perform
this init as early as possible.

Existing ARMv7 boards which define CONFIG_SKIP_LOWLEVEL_INIT should not
need to change, this CP15 init is still skipped in that case. The only
impact for these boards is that the cpu_init_cp15() will be available
even if it is never used on these boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/cpu/armv7/start.S
arch/arm/include/asm/u-boot-arm.h

index d23dc9d719b926cc7f2e3b978fbc728d1df8a2e8..b05be6cc943bc31228fb0401a70fd159f8669aab 100644 (file)
@@ -162,6 +162,7 @@ reset:
 
        /* the mask ROM code should have PLL and others stable */
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
+       bl      cpu_init_cp15
        bl      cpu_init_crit
 #endif
 
@@ -299,17 +300,16 @@ jump_2_ram:
 _board_init_r_ofs:
        .word board_init_r - _start
 
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 /*************************************************************************
  *
- * CPU_init_critical registers
+ * cpu_init_cp15
  *
- * setup important registers
- * setup memory timing
+ * Setup CP15 registers (cache, MMU, TLBs). The I-cache is turned on unless
+ * CONFIG_SYS_ICACHE_OFF is defined.
  *
  *************************************************************************/
-cpu_init_crit:
+.globl cpu_init_cp15
+cpu_init_cp15:
        /*
         * Invalidate L1 I/D
         */
@@ -334,7 +334,19 @@ cpu_init_crit:
        orr     r0, r0, #0x00001000     @ set bit 12 (I) I-cache
 #endif
        mcr     p15, 0, r0, c1, c0, 0
+       mov     pc, lr                  @ back to my caller
 
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+/*************************************************************************
+ *
+ * CPU_init_critical registers
+ *
+ * setup important registers
+ * setup memory timing
+ *
+ *************************************************************************/
+cpu_init_crit:
        /*
         * Jump to board specific initialization...
         * The Mask ROM will have already initialized
index d3308f7a811dc5570a4421fae6bbbcc42df40122..4ca75f9f93d4b13b6a3c1437448ca459e51019b5 100644 (file)
@@ -46,6 +46,9 @@ extern ulong IRQ_STACK_START_IN;      /* 8 bytes in IRQ stack */
 int    cpu_init(void);
 int    cleanup_before_linux(void);
 
+/* Set up ARMv7 MMU, caches and TLBs */
+void   cpu_init_cp15(void);
+
 /* cpu/.../arch/cpu.c */
 int    arch_cpu_init(void);
 int    arch_misc_init(void);