blob: 984e75ccaf26bc583b9124d41d5411db1394a5a0 [file] [log] [blame]
developered71a402018-11-15 10:07:53 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 MediaTek Inc.
4 */
5
6#include <common.h>
David Woodhouse38a57682020-07-12 23:33:01 +01007#include <mmc.h>
developered71a402018-11-15 10:07:53 +08008
9DECLARE_GLOBAL_DATA_PTR;
10
11int board_init(void)
12{
13 /* address of boot parameters */
14 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
15
16 return 0;
17}
Frank Wunderlicha981f682019-01-15 18:49:06 +010018
David Woodhouse38a57682020-07-12 23:33:01 +010019#ifdef CONFIG_MMC
Frank Wunderlicha981f682019-01-15 18:49:06 +010020int mmc_get_boot_dev(void)
21{
22 int g_mmc_devid = -1;
23 char *uflag = (char *)0x81DFFFF0;
David Woodhouse38a57682020-07-12 23:33:01 +010024
25 if (!find_mmc_device(1))
26 return 0;
27
Frank Wunderlicha981f682019-01-15 18:49:06 +010028 if (strncmp(uflag,"eMMC",4)==0) {
29 g_mmc_devid = 0;
30 printf("Boot From Emmc(id:%d)\n\n", g_mmc_devid);
31 } else {
32 g_mmc_devid = 1;
33 printf("Boot From SD(id:%d)\n\n", g_mmc_devid);
34 }
35 return g_mmc_devid;
36}
37
38int mmc_get_env_dev(void)
39{
40 return mmc_get_boot_dev();
41}
David Woodhouse38a57682020-07-12 23:33:01 +010042#endif