1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2020 PHYTEC Messtechnik GmbH
4  * Author: Teresa Remmet <t.remmet@phytec.de>
5  */
6 
7 #include <common.h>
8 #include <asm/arch/sys_proto.h>
9 #include <asm/global_data.h>
10 #include <asm/io.h>
11 #include <asm/mach-imx/boot_mode.h>
12 #include <env.h>
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
board_init(void)16 int board_init(void)
17 {
18 	return 0;
19 }
20 
board_mmc_get_env_dev(int devno)21 int board_mmc_get_env_dev(int devno)
22 {
23 	return devno;
24 }
25 
board_late_init(void)26 int board_late_init(void)
27 {
28 	switch (get_boot_device()) {
29 	case SD2_BOOT:
30 		env_set_ulong("mmcdev", 1);
31 		break;
32 	case MMC3_BOOT:
33 		env_set_ulong("mmcdev", 2);
34 		break;
35 	default:
36 		break;
37 	}
38 
39 	return 0;
40 }
41