1 /* 2 * (C) Copyright 2019 ASPEED Technology Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 #include <common.h> 7 #include <debug_uart.h> 8 #include <spl.h> 9 10 #include <asm/io.h> 11 #include <asm/spl.h> 12 13 DECLARE_GLOBAL_DATA_PTR; 14 15 #define AST_BOOTMODE_SPI 0 16 #define AST_BOOTMODE_EMMC 1 17 18 u32 ast_bootmode(void); 19 20 void board_init_f(ulong dummy) 21 { 22 #ifndef CONFIG_SPL_TINY 23 spl_early_init(); 24 timer_init(); 25 preloader_console_init(); 26 dram_init(); 27 #endif 28 } 29 30 u32 spl_boot_device(void) 31 { 32 switch(ast_bootmode()) { 33 #ifdef CONFIG_SPL_MMC_SUPPORT 34 case AST_BOOTMODE_EMMC: 35 return BOOT_DEVICE_MMC1; 36 #endif 37 case AST_BOOTMODE_SPI: 38 return BOOT_DEVICE_RAM; 39 default: 40 break; 41 } 42 return BOOT_DEVICE_NONE; 43 } 44 45 struct image_header *spl_get_load_buffer(ssize_t offset, size_t size) 46 { 47 return (struct image_header *)(CONFIG_SYS_TEXT_BASE); 48 } 49 50 #ifdef CONFIG_SPL_MMC_SUPPORT 51 u32 spl_boot_mode(const u32 boot_device) 52 { 53 return MMCSD_MODE_RAW; 54 } 55 #endif 56 57 #ifdef CONFIG_SPL_OS_BOOT 58 int spl_start_uboot(void) 59 { 60 /* boot linux */ 61 return 0; 62 } 63 #endif 64 65 #ifdef CONFIG_SPL_LOAD_FIT 66 int board_fit_config_name_match(const char *name) 67 { 68 /* Just empty function now - can't decide what to choose */ 69 debug("%s: %s\n", __func__, name); 70 71 return 0; 72 } 73 #endif 74