diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-04-04 12:26:23 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-04-05 12:40:42 +0200 |
commit | 9dd40f0d077d2bec435a8f361209b364f10268fa (patch) | |
tree | 7a28da8d64f97ebf6a05fd42b9b195b47b2a2084 | |
parent | 1e778c610dd454507239eccf69c5af51fc006251 (diff) | |
download | barebox-9dd40f0d077d.tar.gz barebox-9dd40f0d077d.tar.xz |
ARM: stm32mp: lxa-mc1: add state description
The MC-1 can boot from either SD or eMMC. Detect this at runtime and
select the state that's stored on the boot medium.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240404102623.1008974-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/boards/lxa-mc1/board.c | 13 | ||||
-rw-r--r-- | arch/arm/dts/stm32mp157c-lxa-mc1.dts | 14 |
2 files changed, 25 insertions, 2 deletions
diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c index b377d4323e..8be265b0fc 100644 --- a/arch/arm/boards/lxa-mc1/board.c +++ b/arch/arm/boards/lxa-mc1/board.c @@ -31,6 +31,7 @@ static int of_fixup_regulator_supply_disable(struct device_node *root, void *pat static int mc1_probe(struct device *dev) { + struct device_node *state_node, *state_backend; int flags; flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0; @@ -40,10 +41,18 @@ static int mc1_probe(struct device *dev) stm32mp_bbu_mmc_register_handler("emmc", "/dev/mmc1.ssbl", flags); - if (bootsource_get_instance() == 0) + if (bootsource_get_instance() == 0) { of_device_enable_path("/chosen/environment-sd"); - else + state_backend = of_find_node_by_alias(NULL, "mmc0"); + } else { of_device_enable_path("/chosen/environment-emmc"); + state_backend = of_find_node_by_alias(NULL, "mmc1"); + } + + state_node = of_find_node_by_alias(NULL, "state"); + if (state_node) + of_property_write_u32(state_node, "backend", + of_node_create_phandle(state_backend)); barebox_set_hostname("lxa-mc1"); diff --git a/arch/arm/dts/stm32mp157c-lxa-mc1.dts b/arch/arm/dts/stm32mp157c-lxa-mc1.dts index 1220a77c1b..29852ee9aa 100644 --- a/arch/arm/dts/stm32mp157c-lxa-mc1.dts +++ b/arch/arm/dts/stm32mp157c-lxa-mc1.dts @@ -7,6 +7,10 @@ #include "stm32mp151.dtsi" / { + aliases { + state = &state; + }; + chosen { environment-sd { compatible = "barebox,environment"; @@ -21,6 +25,16 @@ }; }; + state: state { + compatible = "barebox,state"; + magic = <0x778ec0f4>; + /* backend is fixed up by board code */ + backend-type = "raw"; + backend-storage-type = "direct"; + backend-stridesize = <0x40>; + + #include "bootstate.dtsi" + }; }; &panel { |