diff options
author | Vikram Pandita <vikram.pandita@ti.com> | 2011-03-31 15:37:58 -0700 |
---|---|---|
committer | Vikram Pandita <vikram.pandita@ti.com> | 2011-03-31 15:37:58 -0700 |
commit | 85542bf4e7dd5af51ba6153bdaa4bfbdf3158fc4 (patch) | |
tree | c8df89481f653083e20eeec3603f5968294c65e4 | |
parent | 09d770e2f31c69bd47cea43267a06c796882ec93 (diff) | |
download | u-boot-pandroid-85542bf4e7dd5af51ba6153bdaa4bfbdf3158fc4.tar.gz |
fastboot: add oem commands
%fastboot oem recovery
* will take the system into recovery mode
%fastboot oem unlock
* Not implemented yet. Used to unlock phone
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
-rw-r--r-- | common/cmd_fastboot.c | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index 2665c58b..9e5b3163 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -866,16 +866,51 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size) } + /* %fastboot oem <cmd> */ if (memcmp(cmdbuf, "oem ", 4) == 0) { - int r = fastboot_oem(cmdbuf + 4); - if (r < 0) { - strcpy(response,"FAIL"); - } else { - strcpy(response,"OKAY"); - } + ret = 0; + cmdbuf += 4; + + /* fastboot oem format */ + if(memcmp(cmdbuf, "format", 6) == 0){ + ret = fastboot_oem(cmdbuf); + if (ret < 0) { + strcpy(response,"FAIL"); + } else { + strcpy(response,"OKAY"); + } + goto done; + } + + /* fastboot oem recovery */ + if(memcmp(cmdbuf, "recovery", 8) == 0){ + sprintf(response,"OKAY"); + fastboot_tx_status(response, strlen(response)); + + /* Clear all reset reasons */ + __raw_writel(0xfff, PRM_RSTST); + strcpy(PUBLIC_SAR_RAM_1_FREE, "recovery"); + /* now warm reset the silicon */ + __raw_writel(PRM_RSTCTRL_RESET_WARM_BIT, + PRM_RSTCTRL); + /* Never returns */ + while(1); + } + + /* fastboot oem unlock */ + if(memcmp(cmdbuf, "unlock", 6) == 0){ + sprintf(response,"FAIL"); + printf("\nfastboot: oem unlock "\ + "not implemented yet!!\n"); + goto done; + } + + /* fastboot oem [xxx] */ + printf("\nfastboot: do not understand oem %s\n", cmdbuf); + strcpy(response,"FAIL"); goto done; - } + } /* end: %fastboot oem <cmd> */ /* erase Erase a register flash partition |