e32114a8802232b852c7c19f282f11ece2111776
[openwrt/openwrt.git] / package / boot / uboot-mediatek / patches / 008-board-mediatek-fix-mmc_get_boot_dev-for-platforms-wi.patch
1 From b0d1b85fb25a28a9532eaa9dda064b40a0e25f25 Mon Sep 17 00:00:00 2001
2 From: David Woodhouse <dwmw2@infradead.org>
3 Date: Sun, 12 Jul 2020 23:19:09 +0100
4 Subject: [PATCH 1/3] board: mediatek: fix mmc_get_boot_dev() for platforms
5 without external SD
6
7 On the UniElec U7623 board there is no external SD slot and the preloader
8 doesn't fill in the magic field at 0x81dffff0 to indicate that it was
9 booted from eMMC.
10
11 Signed-off-by: David Woodhouse <dwmw2@infradead.org>
12 ---
13 board/mediatek/mt7623/mt7623_rfb.c | 7 +++++++
14 1 file changed, 7 insertions(+)
15
16 diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c
17 index 4ec2764976..984e75ccaf 100644
18 --- a/board/mediatek/mt7623/mt7623_rfb.c
19 +++ b/board/mediatek/mt7623/mt7623_rfb.c
20 @@ -4,6 +4,7 @@
21 */
22
23 #include <common.h>
24 +#include <mmc.h>
25
26 DECLARE_GLOBAL_DATA_PTR;
27
28 @@ -15,10 +16,15 @@ int board_init(void)
29 return 0;
30 }
31
32 +#ifdef CONFIG_MMC
33 int mmc_get_boot_dev(void)
34 {
35 int g_mmc_devid = -1;
36 char *uflag = (char *)0x81DFFFF0;
37 +
38 + if (!find_mmc_device(1))
39 + return 0;
40 +
41 if (strncmp(uflag,"eMMC",4)==0) {
42 g_mmc_devid = 0;
43 printf("Boot From Emmc(id:%d)\n\n", g_mmc_devid);
44 @@ -33,3 +39,4 @@ int mmc_get_env_dev(void)
45 {
46 return mmc_get_boot_dev();
47 }
48 +#endif
49 --
50 2.26.2
51