From 8acfd7ddce409cab5ac3b994faa0ae2c0d38ccf3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 21 Jul 2023 14:09:43 +0200 Subject: spl: blk: use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME We should target to unify the code for different block devices in SPL to reduce code size. MMC, USB, SATA, and Semihosting use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME to indicate the filename to load. NVMe uses CONFIG_SPL_PAYLOAD in spl_blk_load_image(). CONFIG_SPL_PAYLOAD is meant to define which binary to integrate into u-boot-with-spl.bin. See commit 7550dbe38b3f ("spl: Add option SPL_PAYLOAD"). Change spl_blk_load_image() to use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME. Fixes: 8ce6a2e17577 ("spl: blk: Support loading images from fs") Signed-off-by: Heinrich Schuchardt Reviewed-by: Mayuresh Chitale --- common/spl/spl_blk_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c index d97adc4d39a..d4161fa850a 100644 --- a/common/spl/spl_blk_fs.c +++ b/common/spl/spl_blk_fs.c @@ -43,7 +43,7 @@ int spl_blk_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, enum uclass_id uclass_id, int devnum, int partnum) { - const char *filename = CONFIG_SPL_PAYLOAD; + const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME; struct disk_partition part_info = {}; struct legacy_img_hdr *header; struct blk_desc *blk_desc; -- cgit v1.2.3 From d62e7b8059847a06bc0f2222643425bff775320b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 22 Jul 2023 12:45:44 +0200 Subject: spl: blk: partition numbers are hexadecimal Loading u-boot.itb from device 0x00, partition 0x0f fails with: Trying to boot from NVME Device 0: Vendor: 0x4x Rev: 8.0.50 Prod: nvme-1 Type: Hard Disk Capacity: 3814.6 MB = 3.7 GB (7812500 x 512) ** Invalid partition 21 ** Couldn't find partition nvme 0:15 Like the command line interface fs_det_blk_dev() expects that the device number and the partition number are hexadecimal. Fixes: 8ce6a2e17577 ("spl: blk: Support loading images from fs") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Mayuresh Chitale --- common/spl/spl_blk_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c index d4161fa850a..16ecece7023 100644 --- a/common/spl/spl_blk_fs.c +++ b/common/spl/spl_blk_fs.c @@ -66,7 +66,7 @@ int spl_blk_load_image(struct spl_image_info *spl_image, } dev.ifname = blk_get_uclass_name(uclass_id); - snprintf(dev.dev_part_str, sizeof(dev.dev_part_str) - 1, "%d:%d", + snprintf(dev.dev_part_str, sizeof(dev.dev_part_str) - 1, "%x:%x", devnum, partnum); ret = fs_set_blk_dev(dev.ifname, dev.dev_part_str, FS_TYPE_ANY); if (ret) { -- cgit v1.2.3 From 7d4c8cfe2547596d07c51b2f38cde8d4c75f17fc Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 24 Jul 2023 22:18:41 +0200 Subject: spl: initialize PCI before booting MMC, SATA, and USB may be using PCI based controllers. Initialize the PCI sub-system before trying to boot. Remove the initialization for NVMe that is now redundant. Signed-off-by: Heinrich Schuchardt Reviewed-by: Tom Rini Reviewed-by: Mayuresh Chitale --- common/spl/spl.c | 7 +++++++ common/spl/spl_nvme.c | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/spl/spl.c b/common/spl/spl.c index f09bb977814..0062f3f45d9 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -800,6 +800,13 @@ void board_init_r(gd_t *dummy1, ulong dummy2) IS_ENABLED(CONFIG_SPL_ATF)) dram_init_banksize(); + if (CONFIG_IS_ENABLED(PCI)) { + ret = pci_init(); + if (ret) + puts(SPL_TPL_PROMPT "Cannot initialize PCI\n"); + /* Don't fail. We still can try other boot methods. */ + } + bootcount_inc(); /* Dump driver model states to aid analysis */ diff --git a/common/spl/spl_nvme.c b/common/spl/spl_nvme.c index 2af63f1dc8c..c8774d67ecf 100644 --- a/common/spl/spl_nvme.c +++ b/common/spl/spl_nvme.c @@ -7,7 +7,6 @@ #include #include -#include #include static int spl_nvme_load_image(struct spl_image_info *spl_image, @@ -15,10 +14,6 @@ static int spl_nvme_load_image(struct spl_image_info *spl_image, { int ret; - ret = pci_init(); - if (ret < 0) - return ret; - ret = nvme_scan_namespace(); if (ret < 0) return ret; -- cgit v1.2.3