rockchip: rk322x: enable fastboot to set boot mode tag
authorKever Yang <kever.yang@rock-chips.com>
Wed, 9 Aug 2017 11:28:03 +0000 (19:28 +0800)
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Mon, 18 Sep 2017 18:40:32 +0000 (20:40 +0200)
To support fastboot "fastboot reboot-bootloader" cmd.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
arch/arm/mach-rockchip/rk322x-board.c

index c0ac2e9b56fc499245899fbc99c2f2e920881caa..63875557ec93d362004709f63678c3832b388446 100644 (file)
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <ram.h>
+#include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/periph.h>
@@ -136,3 +137,17 @@ int board_usb_cleanup(int index, enum usb_init_type init)
        return 0;
 }
 #endif
+
+#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
+int fb_set_reboot_flag(void)
+{
+       struct rk322x_grf *grf;
+
+       printf("Setting reboot to fastboot flag ...\n");
+       grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+       /* Set boot mode to fastboot */
+       writel(BOOT_FASTBOOT, &grf->os_reg[0]);
+
+       return 0;
+}
+#endif