SPL démarre avec la fonction SPL_OF_CONTROL pour U-Boot version 2023.1

This commit is contained in:
2023-04-04 07:00:33 +00:00
parent d3cfc7d68c
commit f98111799e
10 changed files with 332 additions and 105 deletions
+137 -58
View File
@@ -9,49 +9,6 @@
#include <common.h>
#include <cpu_func.h>
#include <event.h>
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -5,6 +5,9 @@
*
* Aneesh V <aneesh@ti.com>
*/
+
+#define DEBUG
+
#include <common.h>
#include <dm.h>
#include <log.h>
@@ -155,6 +158,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
int err, mmc_dev;
mmc_dev = spl_mmc_get_device_index(boot_device);
+ printf("spl: mmc get device index : %d\n", mmc_dev);
if (mmc_dev < 0)
return mmc_dev;
@@ -423,10 +427,13 @@ int spl_mmc_load(struct spl_image_info *spl_image,
/* Perform peripheral init only once for an mmc device */
mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
+ printf("spl: mmc_dev: %d\n", mmc_dev);
if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
err = spl_mmc_find_device(&mmc, bootdev->boot_device);
- if (err)
+ if (err) {
+ printf("spl: mmc find device failed: %d\n", err);
return err;
+ }
err = mmc_init(mmc);
if (err) {
@@ -438,6 +445,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
}
}
+ debug("spl: on passe par ici\n");
boot_mode = spl_mmc_boot_mode(mmc, bootdev->boot_device);
err = -EINVAL;
switch (boot_mode) {
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -5,6 +5,8 @@
@@ -102,21 +59,6 @@
#define LOG_CATEGORY LOGC_DM
#include <common.h>
@@ -29,12 +31,14 @@ struct uclass *uclass_find(enum uclass_id key)
if (!gd->dm_root)
return NULL;
+ log_debug("uclass_find, key: %d\n", key);
/*
* TODO(sjg@chromium.org): Optimise this, perhaps moving the found
* node to the start of the list, or creating a linear array mapping
* id to node.
*/
list_for_each_entry(uc, gd->uclass_root, sibling_node) {
+ log_debug("uclass_find, id: %d - key: %d\n", uc->uc_drv->id, key);
if (uc->uc_drv->id == key)
return uc;
}
@@ -57,6 +61,7 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
struct uclass *uc;
int ret;
@@ -304,3 +246,140 @@
return 0;
}
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 22d2a0621e..f77b238237 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -6,6 +6,8 @@
* Aneesh V <aneesh@ti.com>
*/
+#define DEBUG
+
#include <common.h>
#include <bloblist.h>
#include <binman_sym.h>
@@ -750,11 +752,13 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
debug(">>" SPL_TPL_PROMPT "board_init_r()\n");
+ debug("boot_init_r\n");
spl_set_bd();
#if defined(CONFIG_SYS_SPL_MALLOC)
mem_malloc_init(SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE);
gd->flags |= GD_FLG_FULL_MALLOC_INIT;
+ debug("boot_init_r: SYS_SPL_MALLOC\n");
#endif
if (!(gd->flags & GD_FLG_SPL_INIT)) {
if (spl_init())
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -5,6 +5,9 @@
*
* Aneesh V <aneesh@ti.com>
*/
+
+#define DEBUG
+
#include <common.h>
#include <dm.h>
#include <log.h>
@@ -155,6 +158,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
int err, mmc_dev;
mmc_dev = spl_mmc_get_device_index(boot_device);
+ printf("spl: mmc get device index : %d\n", mmc_dev);
if (mmc_dev < 0)
return mmc_dev;
@@ -305,6 +309,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
#endif
#ifdef CONFIG_SPL_FS_FAT
+ debug("spl: spl_start_uboot ...\n");
if (!spl_start_uboot()) {
err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
partition);
@@ -312,6 +317,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
return err;
}
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
+ debug("spl: spl_load_image_fat (%s)...\n", filename);
err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
partition,
filename);
@@ -423,10 +429,13 @@ int spl_mmc_load(struct spl_image_info *spl_image,
/* Perform peripheral init only once for an mmc device */
mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
+ printf("spl: mmc_dev: %d\n", mmc_dev);
if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
err = spl_mmc_find_device(&mmc, bootdev->boot_device);
- if (err)
+ if (err) {
+ printf("spl: mmc find device failed: %d\n", err);
return err;
+ }
err = mmc_init(mmc);
if (err) {
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -8,6 +8,8 @@
* FAT Image Functions copied from spl_mmc.c
*/
+#define DEBUG
+
#include <common.h>
#include <env.h>
#include <log.h>
@@ -62,6 +64,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
int err;
struct legacy_img_hdr *header;
+ debug("spl_register_fat_device ...\n");
err = spl_register_fat_device(block_dev, partition);
if (err)
goto end;
@@ -74,6 +77,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
image_get_magic(header) == FDT_MAGIC) {
+ debug("Load FIT Full ...\n");
err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0);
if (err <= 0)
goto end;
@@ -95,6 +99,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
return spl_load_simple_fit(spl_image, &load, 0, header);
} else {
+ debug("spl_parse_image_header ...\n");
err = spl_parse_image_header(spl_image, bootdev, header);
if (err)
goto end;
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -7,6 +7,8 @@
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
*/
+#define DEBUG
+
#include <common.h>
#include <dm.h>
#include <debug_uart.h>
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -620,7 +620,8 @@ int fdtdec_prepare_fdt(void)
}
# endif
#endif
- return -1;
+ return 0;
+ //return -1;
}
return 0;
}