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 <schuffelen@google.com> Signed-off-by: Cody Schuffelen <schuffelen@google.com> Signed-off-by: Dmitrii Merkurev <dimorinny@google.com> Cc: Eugeniu Rosca <erosca@de.adit-jv.com> Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com> Cc: Sean Anderson <sean.anderson@seco.com> Cc: Cody Schuffelen <schuffelen@google.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3 Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
committed by
Tom Rini
parent
a654369b49
commit
dfeb4f0d79
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user