summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Lin <jon.lin@rock-chips.com>2021-09-26 15:38:16 +0300
committerJianhong Chen <chenjh@rock-chips.com>2021-11-03 04:58:20 +0300
commit31120150cf3d50d51e881e274a6554b47b57ccda (patch)
treeb5d2197845d2b89149962fd2a62caffd18e59545
parent3ddd5a65dd8b097f60e661fb10b70bd04d94a2d2 (diff)
downloadu-boot-31120150cf3d50d51e881e274a6554b47b57ccda.tar.xz
rockchip: rkimg: support setting NVME as main storage
Change-Id: I9332a33b6412452c83170c7390126c4f4be8b9d3 Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
-rw-r--r--arch/arm/mach-rockchip/boot_rkimg.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/mach-rockchip/boot_rkimg.c b/arch/arm/mach-rockchip/boot_rkimg.c
index 7b789af3ac..89c554b879 100644
--- a/arch/arm/mach-rockchip/boot_rkimg.c
+++ b/arch/arm/mach-rockchip/boot_rkimg.c
@@ -19,6 +19,7 @@
#include <key.h>
#include <mmc.h>
#include <malloc.h>
+#include <nvme.h>
#include <stdlib.h>
#include <sysmem.h>
#include <asm/io.h>
@@ -67,6 +68,24 @@ static void boot_devtype_init(void)
}
#endif
+#ifdef CONFIG_NVME
+ struct udevice *udev;
+
+ ret = nvme_scan_namespace();
+ if (!ret) {
+ ret = blk_get_device(IF_TYPE_NVME, 0, &udev);
+ if (!ret) {
+ devtype = "nvme";
+ devnum = "0";
+ env_set("devtype", devtype);
+ env_set("devnum", devnum);
+ goto finish;
+ }
+ } else {
+ printf("Set nvme as boot storage fail ret=%d\n", ret);
+ }
+#endif
+
/* High priority: get bootdev from atags */
#ifdef CONFIG_ROCKCHIP_PRELOADER_ATAGS
ret = param_parse_bootdev(&devtype, &devnum);
@@ -153,6 +172,9 @@ static int get_bootdev_type(void)
} else if (!strcmp(devtype, "scsi")) {
type = IF_TYPE_SCSI;
boot_media = "scsi";
+ } else if (!strcmp(devtype, "nvme")) {
+ type = IF_TYPE_NVME;
+ boot_media = "nvme";
} else {
/* Add new to support */
}