1 /* 2 * (C) Copyright 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 #include <dm.h> 10 #include <mmc.h> 11 #include <xyzModem.h> 12 #include <asm/io.h> 13 #include <asm/arch/aspeed_verify.h> 14 15 DECLARE_GLOBAL_DATA_PTR; 16 17 #define AST_BOOTMODE_SPI 0 18 #define AST_BOOTMODE_EMMC 1 19 #define AST_BOOTMODE_UART 2 20 21 u32 aspeed_bootmode(void); 22 void aspeed_mmc_init(void); 23 24 void board_init_f(ulong dummy) 25 { 26 #ifndef CONFIG_SPL_TINY 27 spl_early_init(); 28 timer_init(); 29 preloader_console_init(); 30 dram_init(); 31 aspeed_mmc_init(); 32 #endif 33 } 34 35 u32 spl_boot_device(void) 36 { 37 switch (aspeed_bootmode()) { 38 case AST_BOOTMODE_EMMC: 39 return (IS_ENABLED(CONFIG_ASPEED_SECURE_BOOT))? 40 ASPEED_SECBOOT_DEVICE_MMC : ASPEED_BOOT_DEVICE_MMC; 41 case AST_BOOTMODE_SPI: 42 return (IS_ENABLED(CONFIG_ASPEED_SECURE_BOOT))? 43 ASPEED_SECBOOT_DEVICE_RAM : ASPEED_BOOT_DEVICE_RAM; 44 case AST_BOOTMODE_UART: 45 return (IS_ENABLED(CONFIG_ASPEED_SECURE_BOOT))? 46 ASPEED_SECBOOT_DEVICE_UART : ASPEED_BOOT_DEVICE_UART; 47 default: 48 break; 49 } 50 51 return BOOT_DEVICE_NONE; 52 } 53 54 #ifdef CONFIG_SPL_OS_BOOT 55 int spl_start_uboot(void) 56 { 57 /* boot linux */ 58 return 0; 59 } 60 #endif 61 62 int board_fit_config_name_match(const char *name) 63 { 64 /* we always use the default configuration */ 65 debug("%s: %s\n", __func__, name); 66 return 0; 67 } 68 69 struct image_header *spl_get_load_buffer(ssize_t offset, size_t size) 70 { 71 return (struct image_header *)(CONFIG_SYS_LOAD_ADDR); 72 } 73