summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Sanshan <b51434@freescale.com>2015-07-07 14:05:47 +0800
committerZhang Sanshan <b51434@freescale.com>2015-07-07 16:32:10 +0800
commit7c250c44fb697e281afe4924d4356525cfdab6d3 (patch)
treee3105368eece2c16fcdf51625d58ddfc4b6afa6d
parent34ead9cfc888eb242749143a20727c220cad64d8 (diff)
downloadu-boot-imx-7c250c44fb697e281afe4924d4356525cfdab6d3.zip
u-boot-imx-7c250c44fb697e281afe4924d4356525cfdab6d3.tar.gz
u-boot-imx-7c250c44fb697e281afe4924d4356525cfdab6d3.tar.bz2
MA-6860-2 refine fastboot in uboot
enable fastboot command: "fastboot reboot-bootloader" After type this command, the board will reboot to bootloader mode. Set ANDROID_FASTBOOT_BOOT flag in SNVS_LPGPR before reboot. Signed-off-by: Zhang Sanshan <b51434@freescale.com>
-rw-r--r--arch/arm/cpu/armv7/mx6/soc.c9
-rw-r--r--arch/arm/cpu/armv7/mx7/soc.c9
-rw-r--r--common/cmd_fastboot.c17
-rw-r--r--include/fastboot.h3
4 files changed, 37 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 812594b..9a539d9 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -1061,6 +1061,15 @@ int fastboot_check_and_clean_flag(void)
return flag_set;
}
+
+void fastboot_enable_flag(void)
+{
+ u32 reg;
+ reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR);
+ reg |= ANDROID_FASTBOOT_BOOT;
+ writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR);
+}
+
#endif /*CONFIG_FASTBOOT*/
#ifdef CONFIG_IMX_UDC
diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index 586a6f2..285c1f7 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -442,6 +442,15 @@ int fastboot_check_and_clean_flag(void)
return flag_set;
}
+
+void fastboot_enable_flag(void)
+{
+ u32 reg;
+ reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR);
+ reg |= ANDROID_FASTBOOT_BOOT;
+ writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR);
+}
+
#endif /*CONFIG_FASTBOOT*/
#ifdef CONFIG_IMX_UDC
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index b741ecd..4f5c3c7 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -988,6 +988,15 @@ static void rx_process_flash(const char *cmdbuf, char *response)
}
}
+static void rx_process_reboot_bootloader(const char *cmdbuf, char *response)
+{
+ sprintf(response, "OKAY");
+ fastboot_tx_status(response, strlen(response));
+ udelay(1000000);
+ fastboot_enable_flag();
+ do_reset(NULL, 0, 0, NULL);
+}
+
static void rx_process_boot(const char *cmdbuf, char *response)
{
if ((download_bytes) &&
@@ -1300,6 +1309,13 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
/* Generic failed response */
sprintf(response, "FAIL");
+ /*reboot to bootloader mode*/
+ if (memcmp(cmdbuf, "reboot-bootloader", 17) == 0) {
+ rx_process_reboot_bootloader(cmdbuf, response);
+ return 0;
+ }
+
+
/* reboot
Reboot the board. */
if (memcmp(cmdbuf, "reboot", 6) == 0) {
@@ -1308,7 +1324,6 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
leave it to make the compiler happy */
return 0;
}
-
/* getvar
Get common fastboot variables
Board has a chance to handle other variables */
diff --git a/include/fastboot.h b/include/fastboot.h
index ad7bb29..59250e1 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -329,6 +329,9 @@ void fastboot_flash_dump_ptn(void);
/* Check the board special boot mode reboot to fastboot mode. */
int fastboot_check_and_clean_flag(void);
+/* Set the flag which reboot to fastboot mode*/
+void fastboot_enable_flag(void);
+
/*fastboot command handling function*/
int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);