summaryrefslogtreecommitdiff
path: root/drivers/fastboot
diff options
context:
space:
mode:
authorDmitrii Merkurev <[email protected]>2023-11-10 05:59:55 +0000
committerTom Rini <[email protected]>2023-11-16 18:59:58 -0500
commitdfeb4f0d79351dc0256b45c7a9f26c752c4e0e09 (patch)
tree64b1b7600b2c053188b7aa7f9eea75547c78491a /drivers/fastboot
parenta654369b4923781059032b7c7ba68f4c5195d93f (diff)
cmd: bcb: extend BCB C API to allow read/write the fields
Currently BCB C API only allows to modify 'command' BCB field. Extend it so that we can also read and modify all the available BCB fields (command, status, recovery, stage). Co-developed-by: Cody Schuffelen <[email protected]> Signed-off-by: Cody Schuffelen <[email protected]> Signed-off-by: Dmitrii Merkurev <[email protected]> Cc: Eugeniu Rosca <[email protected]> Cc: Ying-Chun Liu (PaulLiu) <[email protected]> Cc: Simon Glass <[email protected]> Cc: Mattijs Korpershoek <[email protected]> Cc: Sean Anderson <[email protected]> Cc: Cody Schuffelen <[email protected]> Tested-by: Mattijs Korpershoek <[email protected]> # on vim3 Reviewed-by: Mattijs Korpershoek <[email protected]>
Diffstat (limited to 'drivers/fastboot')
-rw-r--r--drivers/fastboot/fb_common.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index 2a6608b28c2..3576b067729 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -91,6 +91,7 @@ void fastboot_okay(const char *reason, char *response)
*/
int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
{
+ int ret;
static const char * const boot_cmds[] = {
[FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader",
[FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot",
@@ -105,7 +106,18 @@ int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
if (reason >= FASTBOOT_REBOOT_REASONS_COUNT)
return -EINVAL;
- return bcb_write_reboot_reason("mmc", mmc_dev, "misc", boot_cmds[reason]);
+ ret = bcb_find_partition_and_load("mmc", mmc_dev, "misc");
+ if (ret)
+ goto out;
+
+ ret = bcb_set(BCB_FIELD_COMMAND, boot_cmds[reason]);
+ if (ret)
+ goto out;
+
+ ret = bcb_store();
+out:
+ bcb_reset();
+ return ret;
}
/**