X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fboard_f.c;h=e3591cbaebdbf48aa9fd65ddafdd26c1a167b530;hb=ac9cd4805c8b11f529b508921c2275b889265313;hp=835b7247c58d634bf7655ca87d96e85acd788ae4;hpb=c06088b3601118485ae333efb27363383626858d;p=oweals%2Fu-boot.git diff --git a/common/board_f.c b/common/board_f.c index 835b7247c5..e3591cbaeb 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -14,17 +14,18 @@ #include #include #include -#include +#include +#include #include #include #include #include +#include #include #include #include #include #include -#include #ifdef CONFIG_SPL #include #endif @@ -262,16 +263,6 @@ __weak int init_func_vid(void) } #endif -#if defined(CONFIG_HARD_SPI) -static int init_func_spi(void) -{ - puts("SPI: "); - spi_init(); - puts("ready\n"); - return 0; -} -#endif - static int setup_mon_len(void) { #if defined(__ARM__) || defined(__MICROBLAZE__) @@ -392,7 +383,7 @@ static int reserve_round_4k(void) #ifdef CONFIG_ARM __weak int reserve_mmu(void) { -#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) +#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) /* reserve TLB table */ gd->arch.tlb_size = PGTABLE_SIZE; gd->relocaddr -= gd->arch.tlb_size; @@ -436,13 +427,6 @@ static int reserve_video(void) gd->relocaddr = lcd_setmem(gd->relocaddr); gd->fb_base = gd->relocaddr; # endif /* CONFIG_FB_ADDR */ -#elif defined(CONFIG_VIDEO) && \ - (!defined(CONFIG_PPC)) && \ - !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ - !defined(CONFIG_M68K) - /* reserve memory for video display (always full pages) */ - gd->relocaddr = video_setmem(gd->relocaddr); - gd->fb_base = gd->relocaddr; #endif return 0; @@ -453,8 +437,8 @@ static int reserve_trace(void) #ifdef CONFIG_TRACE gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE; gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE); - debug("Reserving %dk for trace data at: %08lx\n", - CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr); + debug("Reserving %luk for trace data at: %08lx\n", + (unsigned long)CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr); #endif return 0; @@ -483,12 +467,38 @@ static int reserve_uboot(void) return 0; } +#ifdef CONFIG_SYS_NONCACHED_MEMORY +static int reserve_noncached(void) +{ + /* + * The value of gd->start_addr_sp must match the value of malloc_start + * calculated in boatrd_f.c:initr_malloc(), which is passed to + * board_r.c:mem_malloc_init() and then used by + * cache.c:noncached_init() + * + * These calculations must match the code in cache.c:noncached_init() + */ + gd->start_addr_sp = ALIGN(gd->start_addr_sp, MMU_SECTION_SIZE) - + MMU_SECTION_SIZE; + gd->start_addr_sp -= ALIGN(CONFIG_SYS_NONCACHED_MEMORY, + MMU_SECTION_SIZE); + debug("Reserving %dM for noncached_alloc() at: %08lx\n", + CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp); + + return 0; +} +#endif + /* reserve memory for malloc() area */ static int reserve_malloc(void) { gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN; debug("Reserving %dk for malloc() at: %08lx\n", TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); +#ifdef CONFIG_SYS_NONCACHED_MEMORY + reserve_noncached(); +#endif + return 0; } @@ -578,6 +588,7 @@ static int reserve_stacks(void) static int reserve_bloblist(void) { #ifdef CONFIG_BLOBLIST + gd->start_addr_sp &= ~0xf; gd->start_addr_sp -= CONFIG_BLOBLIST_SIZE; gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE); #endif @@ -685,6 +696,7 @@ static int reloc_bootstage(void) gd->bootstage, gd->new_bootstage, size); memcpy(gd->new_bootstage, gd->bootstage, size); gd->bootstage = gd->new_bootstage; + bootstage_relocate(); } #endif @@ -725,7 +737,7 @@ static int setup_reloc(void) * just after the default vector table location, so at 0x400 */ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400); -#else +#elif !defined(CONFIG_SANDBOX) gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; #endif #endif @@ -850,7 +862,7 @@ static const init_fnc_t init_sequence_f[] = { #ifdef CONFIG_OF_CONTROL fdtdec_setup, #endif -#ifdef CONFIG_TRACE +#ifdef CONFIG_TRACE_EARLY trace_early_init, #endif initf_malloc, @@ -912,9 +924,6 @@ static const init_fnc_t init_sequence_f[] = { #endif #if defined(CONFIG_VID) && !defined(CONFIG_SPL) init_func_vid, -#endif -#if defined(CONFIG_HARD_SPI) - init_func_spi, #endif announce_dram_init, dram_init, /* configure available RAM banks */