fastboot: Rename fb_set_reboot_flag to fastboot_set_reboot_flag

Rename fb_set_reboot_flag to fastboot_set_reboot_flag so it matches
all other fastboot code in the global name space. Fix the guards around
them so that they're dependent on FASTBOOT, not just USB_FUNCTION_FASTBOOT.

Move the weak implementation of fastboot_set_reboot_flag to fb_common.c
so we can call it from non-USB fastboot code.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
lime2-spi
Alex Kiernan 7 years ago committed by Marek Vasut
parent 52fdf10708
commit 8a65bd6372
  1. 4
      arch/arm/mach-omap2/boot-common.c
  2. 4
      arch/arm/mach-rockchip/rk3128-board.c
  3. 4
      arch/arm/mach-rockchip/rk322x-board.c
  4. 2
      board/amazon/kc1/kc1.c
  5. 2
      board/lg/sniper/sniper.c
  6. 15
      drivers/fastboot/fb_common.c
  7. 7
      drivers/usb/gadget/f_fastboot.c
  8. 2
      include/fastboot.h

@ -237,8 +237,8 @@ void arch_preboot_os(void)
}
#endif
#if defined(CONFIG_USB_FUNCTION_FASTBOOT) && !defined(CONFIG_ENV_IS_NOWHERE)
int fb_set_reboot_flag(void)
#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
int fastboot_set_reboot_flag(void)
{
printf("Setting reboot to fastboot flag ...\n");
env_set("dofastboot", "1");

@ -111,8 +111,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
}
#endif
#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
int fb_set_reboot_flag(void)
#if CONFIG_IS_ENABLED(FASTBOOT)
int fastboot_set_reboot_flag(void)
{
struct rk3128_grf *grf;

@ -139,8 +139,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
}
#endif
#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
int fb_set_reboot_flag(void)
#if CONFIG_IS_ENABLED(FASTBOOT)
int fastboot_set_reboot_flag(void)
{
struct rk322x_grf *grf;

@ -161,7 +161,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
omap_die_id_get_board_serial(serialnr);
}
int fb_set_reboot_flag(void)
int fastboot_set_reboot_flag(void)
{
return omap_reboot_mode_store("b");
}

@ -173,7 +173,7 @@ void reset_misc(void)
omap_reboot_mode_store(reboot_mode);
}
int fb_set_reboot_flag(void)
int fastboot_set_reboot_flag(void)
{
return omap_reboot_mode_store("b");
}

@ -59,3 +59,18 @@ void fastboot_okay(const char *reason, char *response)
else
fastboot_response("OKAY", response, NULL);
}
/**
* fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
*
* Set flag which indicates that we should reboot into the bootloader
* following the reboot that fastboot executes after this function.
*
* This function should be overridden in your board file with one
* which sets whatever flag your board specific Android bootloader flow
* requires in order to re-enter the bootloader.
*/
int __weak fastboot_set_reboot_flag(void)
{
return -ENOSYS;
}

@ -357,16 +357,11 @@ static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
do_reset(NULL, 0, 0, NULL);
}
int __weak fb_set_reboot_flag(void)
{
return -ENOSYS;
}
static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
if (!strcmp_l1("reboot-bootloader", cmd)) {
if (fb_set_reboot_flag()) {
if (fastboot_set_reboot_flag()) {
fastboot_tx_write_str("FAILCannot set reboot flag");
return;
}

@ -41,5 +41,5 @@ void fastboot_fail(const char *reason, char *response);
* @response: Pointer to fastboot response buffer
*/
void fastboot_okay(const char *reason, char *response);
int fastboot_set_reboot_flag(void);
#endif /* _FASTBOOT_H_ */

Loading…
Cancel
Save