rockchip: spl: implement spl_kernel_partition()
Get boot or recovery partition according to boot mode. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I5b5806985f166cd37382b1d4df32c9eaf7508c7a
This commit is contained in:
parent
cdf7e9d0ac
commit
4484e03e2d
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <boot_rkimg.h>
|
||||||
#include <debug_uart.h>
|
#include <debug_uart.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
|
|
@ -297,6 +298,43 @@ void spl_next_stage(struct spl_image_info *spl)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_FIT_LOAD_KERNEL
|
||||||
|
const char *spl_kernel_partition(struct spl_image_info *spl,
|
||||||
|
struct spl_load_info *info)
|
||||||
|
{
|
||||||
|
struct bootloader_message *bmsg = NULL;
|
||||||
|
u32 boot_mode;
|
||||||
|
int ret, cnt;
|
||||||
|
u32 sector = 0;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_LIBDISK_SUPPORT
|
||||||
|
disk_partition_t part_info;
|
||||||
|
|
||||||
|
ret = part_get_info_by_name(info->dev, PART_MISC, &part_info);
|
||||||
|
if (ret >= 0)
|
||||||
|
sector = part_info.start;
|
||||||
|
#else
|
||||||
|
sector = CONFIG_SPL_MISC_SECTOR;
|
||||||
|
#endif
|
||||||
|
if (sector) {
|
||||||
|
cnt = DIV_ROUND_UP(sizeof(*bmsg), info->bl_len);
|
||||||
|
bmsg = memalign(ARCH_DMA_MINALIGN, cnt * info->bl_len);
|
||||||
|
ret = info->read(info, sector + BCB_MESSAGE_BLK_OFFSET,
|
||||||
|
cnt, bmsg);
|
||||||
|
if (ret == cnt && !strcmp(bmsg->command, "boot-recovery")) {
|
||||||
|
free(bmsg);
|
||||||
|
return PART_RECOVERY;
|
||||||
|
} else {
|
||||||
|
free(bmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boot_mode = readl((void *)CONFIG_ROCKCHIP_BOOT_MODE_REG);
|
||||||
|
|
||||||
|
return (boot_mode == BOOT_RECOVERY) ? PART_RECOVERY : PART_BOOT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void spl_hang_reset(void)
|
void spl_hang_reset(void)
|
||||||
{
|
{
|
||||||
printf("# Reset the board to bootrom #\n");
|
printf("# Reset the board to bootrom #\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue