summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/stm32mp15x-ev1/board.c
blob: b8e26cd37b3dcea98f475fee93d6e50a77232c91 (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
// SPDX-License-Identifier: GPL-2.0+

#include <bootsource.h>
#include <common.h>
#include <init.h>
#include <mach/bbu.h>

static int ed1_probe(struct device_d *dev)
{
	int flags;

	flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
	stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);

	flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
	stm32mp_bbu_mmc_register_handler("emmc", "/dev/mmc1.ssbl", flags);

	if (bootsource_get_instance() == 0)
		of_device_enable_path("/chosen/environment-sd");
	else
		of_device_enable_path("/chosen/environment-emmc");

	barebox_set_model("STM32MP157C-ED1");

	return 0;
}

/* ED1 is the SoM on top of the EV1 */
static const struct of_device_id ed1_of_match[] = {
	{ .compatible = "st,stm32mp157c-ed1" },
	{ /* sentinel */ },
};

static struct driver_d ed1_board_driver = {
	.name = "board-stm32mp15x-ed1",
	.probe = ed1_probe,
	.of_compatible = ed1_of_match,
};
postcore_platform_driver(ed1_board_driver);