From 23fa18eaa71266feff7ba8d83022d9e1cc83c65a Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 10 May 2024 07:42:03 +0000
Subject: [PATCH] disable pwm7

---
 u-boot/common/spl/spl_fit.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/u-boot/common/spl/spl_fit.c b/u-boot/common/spl/spl_fit.c
index b19e0c6..29f9436 100644
--- a/u-boot/common/spl/spl_fit.c
+++ b/u-boot/common/spl/spl_fit.c
@@ -12,6 +12,7 @@
 #include <image.h>
 #include <malloc.h>
 #include <mtd_blk.h>
+#include <mp_boot.h>
 #include <spl.h>
 #include <spl_ab.h>
 #include <linux/libfdt.h>
@@ -481,6 +482,8 @@
 #else
 	sector = CONFIG_SPL_KERNEL_BOOT_SECTOR;
 #endif
+	printf("Trying kernel at 0x%x sector from '%s' part\n", sector, part_name);
+
 	if (info->read(info, sector, 1, &fit_header) != 1) {
 		debug("%s: Failed to read header\n", __func__);
 		return -EIO;
@@ -793,6 +796,10 @@
 	int ret = -EINVAL;
 	int i;
 
+#ifdef CONFIG_MP_BOOT
+	mpb_init_1(*info);
+#endif
+
 	printf("Trying fit image at 0x%lx sector\n", sector_offs);
 	for (i = 0; i < CONFIG_SPL_FIT_IMAGE_MULTIPLE; i++) {
 		if (i > 0) {
@@ -820,15 +827,18 @@
 		}
 	}
 #ifdef CONFIG_SPL_AB
+	/* If boot fail in spl, spl must decrease 1 and do_reset. */
+	if (ret)
+		return spl_ab_decrease_reset(info->dev);
 	/*
-	 * If boot fail in spl, spl must decrease 1. If boot
-	 * successfully, it is no need to do that and U-boot will
-	 * always to decrease 1. If in thunderboot process,
-	 * always need to decrease 1.
+	 * If boot successfully, it is no need to do decrease
+	 * and U-boot will always decrease 1.
+	 * If in thunderboot process, always need to decrease 1.
 	 */
-	if (IS_ENABLED(CONFIG_SPL_KERNEL_BOOT) || ret)
+	if (spl_image->next_stage == SPL_NEXT_STAGE_KERNEL)
 		spl_ab_decrease_tries(info->dev);
 #endif
+
 	return ret;
 }
 

--
Gitblit v1.6.2