gk7205v200-uboot/arch/arm/cpu/armv7/gk7202v300/boot_mode.c

35 lines
697 B
C
Raw Normal View History

2025-08-07 17:13:54 +08:00
/*
* Copyright (c) Hunan Goke,Chengdu Goke,Shandong Goke. 2021. All rights reserved.
*/
#include <common.h>
#include <asm/io.h>
#include <asm/arch/platform.h>
int get_boot_media(void)
{
unsigned int reg_val, boot_mode, spi_device_mode;
int boot_media;
reg_val = readl(SYS_CTRL_REG_BASE + REG_SYSSTAT);
boot_mode = get_sys_boot_mode(reg_val);
switch (boot_mode) {
case BOOT_FROM_SPI:
spi_device_mode = get_spi_device_type(reg_val);
if (spi_device_mode)
boot_media = BOOT_MEDIA_NAND;
else
boot_media = BOOT_MEDIA_SPIFLASH;
break;
case BOOT_FROM_EMMC:
boot_media = BOOT_MEDIA_EMMC;
break;
default:
boot_media = BOOT_MEDIA_UNKNOWN;
break;
}
return boot_media;
}