diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2023-04-19 08:59:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-04-19 08:59:13 +0200 |
commit | d5a06d4800305af6740cde3894d8f4b65b26b392 (patch) | |
tree | 2e70629b56a411184faf62496410f87f48b47642 /arch/arm/boards/radxa-cm3/board.c | |
parent | 8dd99807baf0b15b74e68e4e66d93bb0fe597621 (diff) | |
parent | 7bf493b1a646e1ee2e88cc7d41b462a6714eafee (diff) | |
download | barebox-d5a06d4800305af6740cde3894d8f4b65b26b392.tar.gz |
Merge branch 'for-next/rockchip'
Diffstat (limited to 'arch/arm/boards/radxa-cm3/board.c')
-rw-r--r-- | arch/arm/boards/radxa-cm3/board.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/arm/boards/radxa-cm3/board.c b/arch/arm/boards/radxa-cm3/board.c new file mode 100644 index 0000000000..14b6784179 --- /dev/null +++ b/arch/arm/boards/radxa-cm3/board.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <bootsource.h> +#include <common.h> +#include <deep-probe.h> +#include <init.h> +#include <mach/rockchip/bbu.h> + +struct cm3_model { + const char *name; + const char *shortname; +}; + +static int cm3_probe(struct device *dev) +{ + enum bootsource bootsource = bootsource_get(); + int instance = bootsource_get_instance(); + const struct cm3_model *model; + + model = device_get_match_data(dev); + + barebox_set_model(model->name); + barebox_set_hostname(model->shortname); + + if (bootsource == BOOTSOURCE_MMC && instance == 1) + of_device_enable_path("/chosen/environment-sd"); + else + of_device_enable_path("/chosen/environment-emmc"); + + rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, + "/dev/mmc0"); + rk3568_bbu_mmc_register("sd", 0, "/dev/mmc1"); + + return 0; +} + +static const struct cm3_model cm3_io = { + .name = "Radxa CM3 on IO Board", + .shortname = "cm3-io", +}; + +static const struct of_device_id cm3_of_match[] = { + { + .compatible = "radxa,cm3-io", + .data = &cm3_io, + }, + { /* sentinel */ }, +}; + +static struct driver cm3_io_board_driver = { + .name = "board-cm3-io", + .probe = cm3_probe, + .of_compatible = cm3_of_match, +}; +coredevice_platform_driver(cm3_io_board_driver); + +BAREBOX_DEEP_PROBE_ENABLE(cm3_of_match); |