[PATCH v2 2/2] f_sdp: Retry sourcing default FIT script

Sven Schwermer sven at svenschwermer.de
Sat Jan 1 19:45:40 CET 2022


"script at 1" is not a valid node name if the "reg" property is missing.
The yocto build system embeds the boot script as an image that's pointed
to by the "bootscr" property within the default configuration. That is
what we use here as the fallback when sourcing the "script at 1" fails.
This implementation should be backward-compatible with existing ITS
files.

Signed-off-by: Sven Schwermer <sven at svenschwermer.de>
---

Changes in v2:
- Fixed patman issues

 drivers/usb/gadget/f_sdp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index e48aa2f90d..d97c017d90 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -865,8 +865,13 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image)
 			spl_parse_image_header(&spl_image, header);
 			jump_to_image_no_args(&spl_image);
 #else
-			/* In U-Boot, allow jumps to scripts */
-			image_source_script(sdp_func->jmp_address, "script at 1");
+			/*
+			 * In U-Boot, allow jumps to scripts. Run/retry with default
+			 * configuration if FIT is disabled or script at 1 is not found.
+			 */
+			if (!IS_ENABLED(CONFIG_FIT) ||
+			    image_source_script(sdp_func->jmp_address, "script at 1"))
+				image_source_script(sdp_func->jmp_address, NULL);
 #endif
 		}
 
-- 
2.34.1



More information about the U-Boot mailing list