Skip to content

Commit 5a1e2e1

Browse files
Leonid IziumtsevRuchika Kharwar
authored andcommitted
fastboot: add the 'reboot-bootloader' command
Implements the ability to reboot device into bootloader fastboot mode. Only for OMAP4 devices for now. Change-Id: Ie798f63e2c31dc5b27c714a284d6634737793192 Signed-off-by: Leonid Iziumtsev <[email protected]>
1 parent 0a929aa commit 5a1e2e1

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

arch/omap4/board/board_blaze.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include <mux.h>
3838
#include <hw.h>
3939

40+
#include <string.h>
41+
4042
static struct partition partitions[] = {
4143
{ "-", 128 },
4244
{ "xloader", 128 },
@@ -392,6 +394,14 @@ static void blaze_ddr_init(struct proc_specific_functions *proc_ops)
392394

393395
static int blaze_check_fastboot(void)
394396
{
397+
if (readl(PRM_RSTST) & PRM_RSTST_RESET_WARM_BIT)
398+
if (!strcmp((const char *)PUBLIC_SAR_RAM_1_FREE,
399+
"bootloader")) {
400+
printf("\nreboot command [%s]\n",
401+
(const char *)PUBLIC_SAR_RAM_1_FREE);
402+
return 1;
403+
}
404+
395405
return 0;
396406
}
397407

arch/omap4/board/board_blaze_tablet.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include <mux.h>
3838
#include <hw.h>
3939

40+
#include <string.h>
41+
4042
static struct partition partitions[] = {
4143
{ "-", 128 },
4244
{ "xloader", 128 },
@@ -390,6 +392,14 @@ static void blaze_tablet_ddr_init(struct proc_specific_functions *proc_ops)
390392

391393
static int blaze_tablet_check_fastboot(void)
392394
{
395+
if (readl(PRM_RSTST) & PRM_RSTST_RESET_WARM_BIT)
396+
if (!strcmp((const char *)PUBLIC_SAR_RAM_1_FREE,
397+
"bootloader")) {
398+
printf("\nreboot command [%s]\n",
399+
(const char *)PUBLIC_SAR_RAM_1_FREE);
400+
return 1;
401+
}
402+
393403
return 0;
394404
}
395405

arch/omap4/board/board_panda.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#include <mux.h>
4242
#include <hw.h>
4343

44+
#include <string.h>
45+
4446
static struct partition partitions[] = {
4547
{ "-", 128 },
4648
{ "xloader", 128 },
@@ -390,6 +392,14 @@ static void panda_ddr_init(struct proc_specific_functions *proc_ops)
390392

391393
static int panda_check_fastboot(void)
392394
{
395+
if (readl(PRM_RSTST) & PRM_RSTST_RESET_WARM_BIT)
396+
if (!strcmp((const char *)PUBLIC_SAR_RAM_1_FREE,
397+
"bootloader")) {
398+
printf("\nreboot command [%s]\n",
399+
(const char *)PUBLIC_SAR_RAM_1_FREE);
400+
return 1;
401+
}
402+
393403
return 0;
394404
}
395405

fastboot.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <bootimg.h>
3131
#include <io.h>
3232
#include <types.h>
33+
#include <hw.h>
3334

3435
#include <alloc.h>
3536
#include <omap_rom.h>
@@ -976,6 +977,22 @@ static int fastboot_erase(char *cmd, char *response, struct usb *usb)
976977
}
977978

978979
#if defined(CONFIG_IS_OMAP4)
980+
static int fastboot_reboot_bl(char *cmd, char *response, struct usb *usb)
981+
{
982+
strcpy(response, "OKAY");
983+
fastboot_tx_status(response, strlen(response), usb);
984+
985+
/* clear all reset events */
986+
writel(PRM_RSTST_CLR, PRM_RSTST);
987+
988+
strcpy((char *)PUBLIC_SAR_RAM_1_FREE, "bootloader");
989+
990+
/* trigger warm reset */
991+
writel(PRM_RSTCTRL_RESET_WARM_BIT, PRM_RSTCTRL);
992+
993+
return 0;
994+
}
995+
979996
static int fastboot_reboot(char *cmd, char *response, struct usb *usb)
980997
{
981998
strcpy(response, "OKAY");
@@ -1085,6 +1102,8 @@ void do_fastboot(struct bootloader_ops *boot_ops)
10851102
} else if (memcmp(cmd, "boot", 4) == 0) {
10861103
ret = fastboot_boot(boot_ops, cmd + 4, response);
10871104
#if defined(CONFIG_IS_OMAP4)
1105+
} else if (memcmp(cmd, "reboot-bootloader", 17) == 0) {
1106+
ret = fastboot_reboot_bl(cmd + 17, response, usb);
10881107
} else if (memcmp(cmd, "reboot", 6) == 0) {
10891108
ret = fastboot_reboot(cmd + 6, response, usb);
10901109
#endif

include/omap4/hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
#define PRM_RSTCTRL_RESET_WARM_BIT (1<<0)
225225
#define PRM_RSTCTRL_RESET_COLD_BIT (1<<1)
226226
#define PRM_RSTST (PRM_DEVICE_BASE + 0x4)
227+
#define PRM_RSTST_CLR 0xfff
227228
#define PRM_RSTST_RESET_COLD_BIT (1<<0)
228229
#define PRM_RSTST_RESET_WARM_BIT (1<<1)
229230

0 commit comments

Comments
 (0)