summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/phytec-som-imx8mq/board.c
blob: 4fd098c5f6575f83f7d7873e2e4853f58127e73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2018 Christian Hemp
 */

#include <asm/memory.h>
#include <bootsource.h>
#include <environment.h>
#include <common.h>
#include <init.h>
#include <linux/sizes.h>
#include <mach/bbu.h>

#include <envfs.h>

static int physom_imx8mq_devices_init(void)
{
	int flag_emmc = 0;
	int flag_sd = 0;

	if (!of_machine_is_compatible("phytec,imx8mq-pcl066"))
		return 0;

	barebox_set_hostname("phycore-imx8mq");

	switch (bootsource_get_instance()) {
	case 0:
		flag_emmc = BBU_HANDLER_FLAG_DEFAULT;
		of_device_enable_path("/chosen/environment-emmc");
		break;
	case 1:
	default:
		flag_sd = BBU_HANDLER_FLAG_DEFAULT;
		of_device_enable_path("/chosen/environment-sd");
		break;
	}

	imx8mq_bbu_internal_mmc_register_handler("eMMC",
						 "/dev/mmc0.barebox", flag_emmc);
	imx8mq_bbu_internal_mmc_register_handler("SD",
						 "/dev/mmc1.barebox", flag_sd);


	return 0;
}
device_initcall(physom_imx8mq_devices_init);