mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: rockchip: select bbu default target using bootsource
@ 2025-09-16  8:04 Michael Tretter
  2025-09-18 14:20 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tretter @ 2025-09-16  8:04 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter

The ROCK 5 boards may be booted from SD card and eMMC. The BootROM
prefers the eMMC unless disabled explicitly.

As a user, I'd expect barebox_update to update the SD card if I booted a
board from SD card.

Use the bootsource to set the default target for the bbu default
handler. If booted from SD card, by default update barebox on the SD
card.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/boards/radxa-rock5/board.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/radxa-rock5/board.c b/arch/arm/boards/radxa-rock5/board.c
index eab0c010400036f281beaa1c199cec8b8b841de2..1f145bb61f5f663e7a99e40b759e0a94768b4a8e 100644
--- a/arch/arm/boards/radxa-rock5/board.c
+++ b/arch/arm/boards/radxa-rock5/board.c
@@ -15,16 +15,21 @@ static int rock5_probe(struct device *dev)
 	enum bootsource bootsource = bootsource_get();
 	int instance = bootsource_get_instance();
 	const struct rock5_model *model;
+	int bbu_flags_emmc = 0;
+	int bbu_flags_sd = 0;
 
 	model = device_get_match_data(dev);
 
-	if (bootsource == BOOTSOURCE_MMC && instance == 1)
+	if (bootsource == BOOTSOURCE_MMC && instance == 1) {
 		of_device_enable_path("/chosen/environment-sd");
-	else
+		bbu_flags_sd |= BBU_HANDLER_FLAG_DEFAULT;
+	} else {
 		of_device_enable_path("/chosen/environment-emmc");
+		bbu_flags_emmc |= BBU_HANDLER_FLAG_DEFAULT;
+	}
 
-	rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc0");
-	rockchip_bbu_mmc_register("sd", 0, "/dev/mmc1");
+	rockchip_bbu_mmc_register("emmc", bbu_flags_emmc, "/dev/mmc0");
+	rockchip_bbu_mmc_register("sd", bbu_flags_sd, "/dev/mmc1");
 
 	return 0;
 }

---
base-commit: f3be3a8e9ae884bdfb116238e9049b1eb2759810
change-id: 20250916-rock5-bbu-default-target-454f31b85518

Best regards,
-- 
Michael Tretter <m.tretter@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-18 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-16  8:04 [PATCH] ARM: rockchip: select bbu default target using bootsource Michael Tretter
2025-09-18 14:20 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox