blob: 755e879085c23d89fcaa353fca9ef7ed8f7ca084 [file] [log] [blame]
Weijie Gao361e13f2018-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 Woodhousee3cc5112020-07-12 23:33:01 +01007#include <mmc.h>
Simon Glass401d1c42020-10-30 21:38:53 -06008#include <asm/global_data.h>
Weijie Gao361e13f2018-11-15 10:07:53 +08009
10DECLARE_GLOBAL_DATA_PTR;
11
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}
Frank Wunderlichf3af98e2019-01-15 18:49:06 +010019
David Woodhousee3cc5112020-07-12 23:33:01 +010020#ifdef CONFIG_MMC
Frank Wunderlichf3af98e2019-01-15 18:49:06 +010021int mmc_get_boot_dev(void)
22{
23 int g_mmc_devid = -1;
24 char *uflag = (char *)0x81DFFFF0;
David Woodhousee3cc5112020-07-12 23:33:01 +010025
26 if (!find_mmc_device(1))
27 return 0;
28
Frank Wunderlichf3af98e2019-01-15 18:49:06 +010029 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
39int mmc_get_env_dev(void)
40{
41 return mmc_get_boot_dev();
42}
David Woodhousee3cc5112020-07-12 23:33:01 +010043#endif