1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (C) 2018 MediaTek Inc. 4 */ 5 6 #include <common.h> 7 #include <mmc.h> 8 #include <asm/global_data.h> 9 10 DECLARE_GLOBAL_DATA_PTR; 11 board_init(void)12int board_init(void) 13 { 14 /* address of boot parameters */ 15 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; 16 17 return 0; 18 } 19 20 #ifdef CONFIG_MMC mmc_get_boot_dev(void)21int mmc_get_boot_dev(void) 22 { 23 int g_mmc_devid = -1; 24 char *uflag = (char *)0x81DFFFF0; 25 26 if (!find_mmc_device(1)) 27 return 0; 28 29 if (strncmp(uflag,"eMMC",4)==0) { 30 g_mmc_devid = 0; 31 printf("Boot From Emmc(id:%d)\n\n", g_mmc_devid); 32 } else { 33 g_mmc_devid = 1; 34 printf("Boot From SD(id:%d)\n\n", g_mmc_devid); 35 } 36 return g_mmc_devid; 37 } 38 mmc_get_env_dev(void)39int mmc_get_env_dev(void) 40 { 41 return mmc_get_boot_dev(); 42 } 43 #endif 44