16507f133STom Rini /* 26507f133STom Rini * (C) Copyright 2010-2012 36507f133STom Rini * Texas Instruments, <www.ti.com> 46507f133STom Rini * 56507f133STom Rini * Aneesh V <aneesh@ti.com> 66507f133STom Rini * Tom Rini <trini@ti.com> 76507f133STom Rini * 81a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 96507f133STom Rini */ 106507f133STom Rini #include <common.h> 116507f133STom Rini #include <config.h> 126507f133STom Rini #include <spl.h> 136507f133STom Rini #include <image.h> 146507f133STom Rini #include <linux/compiler.h> 156507f133STom Rini 16b5d92ba1STom Rini #ifndef CONFIG_SPL_DM 176507f133STom Rini /* Pointer to as well as the global data structure for SPL */ 186507f133STom Rini DECLARE_GLOBAL_DATA_PTR; 19480ca13eSSimon Glass 20480ca13eSSimon Glass /* 21480ca13eSSimon Glass * WARNING: This is going away very soon. Don't use it and don't submit 22480ca13eSSimon Glass * pafches that rely on it. The global_data area is set up in crt0.S. 23480ca13eSSimon Glass */ 246507f133STom Rini gd_t gdata __attribute__ ((section(".data"))); 25fc8fdc76SSimon Glass #endif 266507f133STom Rini 276507f133STom Rini /* 28b8cb51d0SJeremy Hunt * In the context of SPL, board_init_f() prepares the hardware for execution 29b8cb51d0SJeremy Hunt * from system RAM (DRAM, DDR...). As system RAM may not be available yet, 30b8cb51d0SJeremy Hunt * board_init_f() must use the current GD to store any data which must be 31b8cb51d0SJeremy Hunt * passed on to later stages. These data include the relocation destination, 32b8cb51d0SJeremy Hunt * the future stack, and the future GD location. BSS is cleared after this 33b8cb51d0SJeremy Hunt * function (and therefore must be accessible). 34b8cb51d0SJeremy Hunt * 35b8cb51d0SJeremy Hunt * We provide this version by default but mark it as __weak to allow for 36b8cb51d0SJeremy Hunt * platforms to do this in their own way if needed. Please see the top 37b8cb51d0SJeremy Hunt * level U-Boot README "Board Initialization Flow" section for info on what 38b8cb51d0SJeremy Hunt * to put in this function. 396507f133STom Rini */ 406507f133STom Rini void __weak board_init_f(ulong dummy) 416507f133STom Rini { 426507f133STom Rini } 436507f133STom Rini 446507f133STom Rini /* 456507f133STom Rini * This function jumps to an image with argument. Normally an FDT or ATAGS 466507f133STom Rini * image. 476507f133STom Rini * arg: Pointer to paramter image in RAM 486507f133STom Rini */ 496507f133STom Rini #ifdef CONFIG_SPL_OS_BOOT 50*ca12e65cSSimon Glass void __noreturn jump_to_image_linux(struct spl_image_info *spl_image, void *arg) 516507f133STom Rini { 52ec101fdbSTom Rini unsigned long machid = 0xffffffff; 53ec101fdbSTom Rini #ifdef CONFIG_MACH_TYPE 54ec101fdbSTom Rini machid = CONFIG_MACH_TYPE; 55ec101fdbSTom Rini #endif 56ec101fdbSTom Rini 576507f133STom Rini debug("Entering kernel arg pointer: 0x%p\n", arg); 586507f133STom Rini typedef void (*image_entry_arg_t)(int, int, void *) 596507f133STom Rini __attribute__ ((noreturn)); 606507f133STom Rini image_entry_arg_t image_entry = 61*ca12e65cSSimon Glass (image_entry_arg_t)(uintptr_t) spl_image->entry_point; 626507f133STom Rini cleanup_before_linux(); 63ec101fdbSTom Rini image_entry(0, machid, arg); 646507f133STom Rini } 656507f133STom Rini #endif 66