common: boot_rkimg: get boot_mode from register without misc partition
If the misc partition is nonexistent, it's still to be hope that get the boot mode from GRF register. Change-Id: I94e6a64b9433a0c95071e3ee380841b8fddf768d Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
parent
1631bee789
commit
6ebb5f3d0d
|
|
@ -308,7 +308,7 @@ int rockchip_get_boot_mode(void)
|
||||||
{
|
{
|
||||||
struct blk_desc *dev_desc;
|
struct blk_desc *dev_desc;
|
||||||
disk_partition_t part_info;
|
disk_partition_t part_info;
|
||||||
struct bootloader_message *bmsg;
|
struct bootloader_message *bmsg = NULL;
|
||||||
int size = DIV_ROUND_UP(sizeof(struct bootloader_message), RK_BLK_SIZE)
|
int size = DIV_ROUND_UP(sizeof(struct bootloader_message), RK_BLK_SIZE)
|
||||||
* RK_BLK_SIZE;
|
* RK_BLK_SIZE;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -336,7 +336,7 @@ int rockchip_get_boot_mode(void)
|
||||||
&part_info);
|
&part_info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("get part %s fail %d\n", PART_MISC, ret);
|
printf("get part %s fail %d\n", PART_MISC, ret);
|
||||||
return -EIO;
|
goto fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
bmsg = memalign(ARCH_DMA_MINALIGN, size);
|
bmsg = memalign(ARCH_DMA_MINALIGN, size);
|
||||||
|
|
@ -348,8 +348,9 @@ int rockchip_get_boot_mode(void)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fallback:
|
||||||
/* Mode from misc partition */
|
/* Mode from misc partition */
|
||||||
if (!strcmp(bmsg->command, "boot-recovery")) {
|
if (bmsg && !strcmp(bmsg->command, "boot-recovery")) {
|
||||||
boot_mode = BOOT_MODE_RECOVERY;
|
boot_mode = BOOT_MODE_RECOVERY;
|
||||||
} else {
|
} else {
|
||||||
/* Mode from boot mode register */
|
/* Mode from boot mode register */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue