]> git.sur5r.net Git - u-boot/blobdiff - common/board_f.c
board_f: Add a mach_cpu_init callback
[u-boot] / common / board_f.c
index 05f60269eb0ea9e62c9b31c1955a8191875a7b53..9ef998f9ed239337f542f9f875e826e4050a270e 100644 (file)
@@ -54,6 +54,8 @@
 #include <asm/sections.h>
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
 #include <asm/init_helpers.h>
+#endif
+#if defined(CONFIG_X86) || defined(CONFIG_ARC) || defined(CONFIG_XTENSA)
 #include <asm/relocate.h>
 #endif
 #ifdef CONFIG_SANDBOX
@@ -120,8 +122,8 @@ static int init_func_watchdog_init(void)
        defined(CONFIG_DESIGNWARE_WATCHDOG) || \
        defined(CONFIG_IMX_WATCHDOG))
        hw_watchdog_init();
-# endif
        puts("       Watchdog enabled\n");
+# endif
        WATCHDOG_RESET();
 
        return 0;
@@ -271,7 +273,8 @@ static int setup_mon_len(void)
        gd->mon_len = (ulong)&__bss_end - (ulong)_start;
 #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
        gd->mon_len = (ulong)&_end - (ulong)_init;
-#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
+#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) || \
+       defined(CONFIG_XTENSA)
        gd->mon_len = CONFIG_SYS_MONITOR_LEN;
 #elif defined(CONFIG_NDS32)
        gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
@@ -287,6 +290,11 @@ __weak int arch_cpu_init(void)
        return 0;
 }
 
+__weak int mach_cpu_init(void)
+{
+       return 0;
+}
+
 #ifdef CONFIG_SANDBOX
 static int setup_ram_buf(void)
 {
@@ -340,7 +348,7 @@ static int setup_dest_addr(void)
         * Record secure memory location. Need recalcuate if memory splits
         * into banks, or the ram base is not zero.
         */
-       gd->secure_ram = gd->ram_size;
+       gd->arch.secure_ram = gd->ram_size;
 #endif
        /*
         * Subtract specified amount of memory to hide so that it won't
@@ -433,6 +441,15 @@ static int reserve_mmu(void)
        gd->arch.tlb_addr = gd->relocaddr;
        debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
              gd->arch.tlb_addr + gd->arch.tlb_size);
+
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+       /*
+        * Record allocated tlb_addr in case gd->tlb_addr to be overwritten
+        * with location within secure ram.
+        */
+       gd->arch.tlb_allocated = gd->arch.tlb_addr;
+#endif
+
        return 0;
 }
 #endif
@@ -848,6 +865,7 @@ static init_fnc_t init_sequence_f[] = {
        x86_fsp_init,
 #endif
        arch_cpu_init,          /* basic arch cpu dependent setup */
+       mach_cpu_init,          /* SoC/machine dependent CPU setup */
        initf_dm,
        arch_cpu_init_dm,
        mark_bootstage,         /* need timer, go after init dm */
@@ -962,7 +980,7 @@ static init_fnc_t init_sequence_f[] = {
         *  - board info struct
         */
        setup_dest_addr,
-#if defined(CONFIG_BLACKFIN)
+#if defined(CONFIG_BLACKFIN) || defined(CONFIG_XTENSA)
        /* Blackfin u-boot monitor should be on top of the ram */
        reserve_uboot,
 #endif
@@ -994,7 +1012,7 @@ static init_fnc_t init_sequence_f[] = {
 # endif
 #endif /* CONFIG_DM_VIDEO */
        reserve_trace,
-#if !defined(CONFIG_BLACKFIN)
+#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_XTENSA)
        reserve_uboot,
 #endif
 #ifndef CONFIG_SPL_BUILD
@@ -1027,6 +1045,9 @@ static init_fnc_t init_sequence_f[] = {
        clear_bss,
        do_elf_reloc_fixups,
 #endif
+#if defined(CONFIG_XTENSA)
+       clear_bss,
+#endif
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
        jump_to_copy,
 #endif