common: fastboot: support reboot-bootloader command
authorChanho Park <chanho61.park@samsung.com>
Wed, 5 Aug 2015 02:22:27 +0000 (11:22 +0900)
committerChanho Park <chanho61.park@samsung.com>
Wed, 5 Aug 2015 02:31:59 +0000 (11:31 +0900)
This patch supports reboot-bootloader command of fastboot. To enter
fastboot mode during reboot, we use INFORM4 register which is used for
FACTORY_RESET_MODE.

Change-Id: Ic3e28774ca128296deebd0ca184ed11f849301ad
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
common/cmd_fastboot.c

index 572a51b574ff82f694ca76b982430df61f15f217..186c0d8629e84de8b56d8af6e0f7da4924e47680 100644 (file)
@@ -95,6 +95,20 @@ DECLARE_GLOBAL_DATA_PTR;
 #define OmPin  readl(EXYNOS5_POWER_BASE + INFORM3_OFFSET)
 #endif
 
+#ifdef CONFIG_FASTBOOT_AUTO_REBOOT
+inline void do_reset_fastboot(void)
+{
+#ifdef CONFIG_CPU_EXYNOS3250
+       writel(CONFIG_FASTBOOT_AUTO_REBOOT_MODE,
+                       EXYNOS4_POWER_BASE + INFORM4_OFFSET);
+#elif defined(CONFIG_CPU_EXYNOS5422_EVT0)
+       writel(CONFIG_FASTBOOT_AUTO_REBOOT_MODE,
+                       EXYNOS5_POWER_BASE + INFORM4_OFFSET);
+#endif
+       do_reset(NULL, 0, 0, NULL);
+}
+#endif
+
 #if defined(CONFIG_FASTBOOT)
 
 /* Use do_reset for fastboot's 'reboot' command */
@@ -892,7 +906,14 @@ static int download_data(const unsigned char *buffer,
 static int process_cmd_reboot(const char *cmdbuf, char *response)
 {
        if (!strcmp(cmdbuf + 6, "-bootloader")) {
+#ifdef CONFIG_FASTBOOT_AUTO_REBOOT
+               sprintf(response, "OKAY");
+               fastboot_tx_status(response, strlen(response),
+                                  FASTBOOT_TX_SYNC);
+               do_reset_fastboot();
+#else
                gflag_reboot = 1;
+#endif
                return 0;
        } else
                memset(interface.transfer_buffer, 0x0,