1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023
4 * Ventana Micro Systems Inc.
5 *
6 */
7
8#include <common.h>
9#include <spl.h>
10#include <nvme.h>
11
12static int spl_nvme_load_image(struct spl_image_info *spl_image,
13			       struct spl_boot_device *bootdev)
14{
15	int ret;
16
17	ret = nvme_scan_namespace();
18	if (ret < 0)
19		return ret;
20
21	ret = spl_blk_load_image(spl_image, bootdev, UCLASS_NVME,
22				 CONFIG_SPL_NVME_BOOT_DEVICE,
23				 CONFIG_SYS_NVME_BOOT_PARTITION);
24	return ret;
25}
26
27SPL_LOAD_IMAGE_METHOD("NVME", 0, BOOT_DEVICE_NVME, spl_nvme_load_image);
28