blob: c78eaa072439715498cde0b55baab3549fae412a [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
Tom Rini76d483c2024-04-30 20:42:15 -06006#include <config.h>
David Woodhouse38a57682020-07-12 23:33:01 +01007#include <mmc.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06008#include <asm/global_data.h>
developered71a402018-11-15 10:07:53 +08009
10DECLARE_GLOBAL_DATA_PTR;
11
12int board_init(void)
13{
14 /* address of boot parameters */
Tom Rinibb4dd962022-11-16 13:10:37 -050015 gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
developered71a402018-11-15 10:07:53 +080016
17 return 0;
18}
Frank Wunderlicha981f682019-01-15 18:49:06 +010019
David Woodhouse38a57682020-07-12 23:33:01 +010020#ifdef CONFIG_MMC
Frank Wunderlicha981f682019-01-15 18:49:06 +010021int mmc_get_boot_dev(void)
22{
23 int g_mmc_devid = -1;
24 char *uflag = (char *)0x81DFFFF0;
David Woodhouse38a57682020-07-12 23:33:01 +010025
26 if (!find_mmc_device(1))
27 return 0;
28
Frank Wunderlicha981f682019-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 Woodhouse38a57682020-07-12 23:33:01 +010043#endif