rockchip: add get_bootdev_type api

Change-Id: Iebba25e824881a107615674f0700a39e03823949
Signed-off-by: Francis Fan <francis.fan@rock-chips.com>
This commit is contained in:
francis.fan 2017-10-20 10:24:22 +08:00 committed by Kever Yang
parent ed5ce51773
commit 5d86b08ce2
2 changed files with 38 additions and 0 deletions

View File

@ -77,3 +77,28 @@ int blkdev_write(void *buffer, u32 blk, u32 cnt)
return mmcblk_write(mmc, buffer, blk, cnt); return mmcblk_write(mmc, buffer, blk, cnt);
} }
/* Gets the storage type of the current device */
int get_bootdev_type(void)
{
int type = 0;
#ifdef CONFIG_EMMC_BOOT
type = BOOT_FROM_EMMC;
#endif /* CONFIG_EMMC_BOOT */
#ifdef CONFIG_QSPI_BOOT
type = BOOT_FROM_SPI_NAND;
#endif /* CONFIG_QSPI_BOOT */
#ifdef CONFIG_NAND_BOOT
typpe = BOOT_FROM_FLASH;
#endif /* CONFIG_NAND_BOOT */
#ifdef CONFIG_NOR_BOOT
type = BOOT_FROM_SPI_NOR;
#endif /* CONFIG_NOR_BOOT */
/* For current use(Only EMMC support!) */
if (!type)
type = BOOT_FROM_EMMC;
return type;
}

View File

@ -1,7 +1,20 @@
#ifndef __RK_BLK_H_ #ifndef __RK_BLK_H_
#define __RK_BLK_H_ #define __RK_BLK_H_
/*
* boot device type define
* 1:flash 2:emmc 4:sdcard0 8:sdcard1
*/
#define BOOT_FROM_FLASH (1 << 0)
#define BOOT_FROM_EMMC (1 << 1)
#define BOOT_FROM_SD0 (1 << 2)
#define BOOT_FROM_SD1 (1 << 3)
#define BOOT_FROM_SPI_NOR (1 << 4)
#define BOOT_FROM_RAM (1 << 5)
#define BOOT_FROM_SPI_NAND (1 << 6)
int blkdev_read(void *buffer, u32 blk, u32 cnt); int blkdev_read(void *buffer, u32 blk, u32 cnt);
int blkdev_write(void *buffer, u32 blk, u32 cnt); int blkdev_write(void *buffer, u32 blk, u32 cnt);
int get_bootdev_type(void);
#endif #endif