/* * Copyright (c) Hunan Goke,Chengdu Goke,Shandong Goke. 2021. All rights reserved. */ #include #include #include 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; }