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> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 8 | #include <asm/global_data.h> |
developer | ed71a40 | 2018-11-15 10:07:53 +0800 | [diff] [blame] | 9 | |
| 10 | DECLARE_GLOBAL_DATA_PTR; |
| 11 | |
| 12 | int 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 Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 19 | |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 20 | #ifdef CONFIG_MMC |
Frank Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 21 | int mmc_get_boot_dev(void) |
| 22 | { |
| 23 | int g_mmc_devid = -1; |
| 24 | char *uflag = (char *)0x81DFFFF0; |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 25 | |
| 26 | if (!find_mmc_device(1)) |
| 27 | return 0; |
| 28 | |
Frank Wunderlich | a981f68 | 2019-01-15 18:49:06 +0100 | [diff] [blame] | 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 | |
| 39 | int mmc_get_env_dev(void) |
| 40 | { |
| 41 | return mmc_get_boot_dev(); |
| 42 | } |
David Woodhouse | 38a5768 | 2020-07-12 23:33:01 +0100 | [diff] [blame] | 43 | #endif |