hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
u-boot/common/spl/spl_fit.c
....@@ -12,6 +12,7 @@
1212 #include <image.h>
1313 #include <malloc.h>
1414 #include <mtd_blk.h>
15
+#include <mp_boot.h>
1516 #include <spl.h>
1617 #include <spl_ab.h>
1718 #include <linux/libfdt.h>
....@@ -481,6 +482,8 @@
481482 #else
482483 sector = CONFIG_SPL_KERNEL_BOOT_SECTOR;
483484 #endif
485
+ printf("Trying kernel at 0x%x sector from '%s' part\n", sector, part_name);
486
+
484487 if (info->read(info, sector, 1, &fit_header) != 1) {
485488 debug("%s: Failed to read header\n", __func__);
486489 return -EIO;
....@@ -793,6 +796,10 @@
793796 int ret = -EINVAL;
794797 int i;
795798
799
+#ifdef CONFIG_MP_BOOT
800
+ mpb_init_1(*info);
801
+#endif
802
+
796803 printf("Trying fit image at 0x%lx sector\n", sector_offs);
797804 for (i = 0; i < CONFIG_SPL_FIT_IMAGE_MULTIPLE; i++) {
798805 if (i > 0) {
....@@ -820,15 +827,18 @@
820827 }
821828 }
822829 #ifdef CONFIG_SPL_AB
830
+ /* If boot fail in spl, spl must decrease 1 and do_reset. */
831
+ if (ret)
832
+ return spl_ab_decrease_reset(info->dev);
823833 /*
824
- * If boot fail in spl, spl must decrease 1. If boot
825
- * successfully, it is no need to do that and U-boot will
826
- * always to decrease 1. If in thunderboot process,
827
- * always need to decrease 1.
834
+ * If boot successfully, it is no need to do decrease
835
+ * and U-boot will always decrease 1.
836
+ * If in thunderboot process, always need to decrease 1.
828837 */
829
- if (IS_ENABLED(CONFIG_SPL_KERNEL_BOOT) || ret)
838
+ if (spl_image->next_stage == SPL_NEXT_STAGE_KERNEL)
830839 spl_ab_decrease_tries(info->dev);
831840 #endif
841
+
832842 return ret;
833843 }
834844