diff options
author | Dmitrii Merkurev <dimorinny@google.com> | 2023-04-12 19:49:31 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-05-05 17:48:44 -0400 |
commit | c8acbbbf0847744ff2ad98e9d8d4e11d5e37eda2 (patch) | |
tree | e37737cfec46839b48ab3e86d49239f9bf24c451 /drivers/fastboot | |
parent | 443d319180a68156ca152d164f446e6789004c1d (diff) | |
download | u-boot-c8acbbbf0847744ff2ad98e9d8d4e11d5e37eda2.tar.gz u-boot-c8acbbbf0847744ff2ad98e9d8d4e11d5e37eda2.tar.bz2 u-boot-c8acbbbf0847744ff2ad98e9d8d4e11d5e37eda2.zip |
net: share fastboot boot handle logic between transports
Introduce reboot, boot and continue commands support to
TCP fastboot by moving existing UDP logic into the common module.
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/fastboot')
-rw-r--r-- | drivers/fastboot/fb_common.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c index dde3cda78f..621146bc6b 100644 --- a/drivers/fastboot/fb_common.c +++ b/drivers/fastboot/fb_common.c @@ -15,6 +15,7 @@ #include <command.h> #include <env.h> #include <fastboot.h> +#include <net.h> /** * fastboot_buf_addr - base address of the fastboot download buffer @@ -156,6 +157,37 @@ void fastboot_boot(void) } /** + * fastboot_handle_boot() - Shared implementation of system reaction to + * fastboot commands + * + * Making desceisions about device boot state (stay in fastboot, reboot + * to bootloader, reboot to OS, etc). + */ +void fastboot_handle_boot(int command, bool success) +{ + if (!success) + return; + + switch (command) { + case FASTBOOT_COMMAND_BOOT: + fastboot_boot(); + net_set_state(NETLOOP_SUCCESS); + break; + + case FASTBOOT_COMMAND_CONTINUE: + net_set_state(NETLOOP_SUCCESS); + break; + + case FASTBOOT_COMMAND_REBOOT: + case FASTBOOT_COMMAND_REBOOT_BOOTLOADER: + case FASTBOOT_COMMAND_REBOOT_FASTBOOTD: + case FASTBOOT_COMMAND_REBOOT_RECOVERY: + do_reset(NULL, 0, 0, NULL); + break; + } +} + +/** * fastboot_set_progress_callback() - set progress callback * * @progress: Pointer to progress callback |