developer | ed71a40 | 2018-11-15 10:07:53 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2018 MediaTek Inc. |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 7 | #include <mmc.h> |
developer | ed71a40 | 2018-11-15 10:07:53 +0800 | [diff] [blame] | 8 | |
| 9 | DECLARE_GLOBAL_DATA_PTR; |
| 10 | |
| 11 | int 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 Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 18 | |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 19 | #ifdef CONFIG_MMC |
Frank Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 20 | int mmc_get_boot_dev(void) |
| 21 | { |
| 22 | int g_mmc_devid = -1; |
| 23 | char *uflag = (char *)0x81DFFFF0; |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 24 | |
| 25 | if (!find_mmc_device(1)) |
| 26 | return 0; |
| 27 | |
Frank Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 28 | 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 | |
| 38 | int mmc_get_env_dev(void) |
| 39 | { |
| 40 | return mmc_get_boot_dev(); |
| 41 | } |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 42 | #endif |