usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
[project/bcm63xx/u-boot.git] / common / spl / spl_sdp.c
index 807256e908c2cc43eefcced065f7cb25b822f1b6..51b245b886262e253f516acb50cabed64437e112 100644 (file)
@@ -25,10 +25,14 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
                return -ENODEV;
        }
 
-       /* This command typically does not return but jumps to an image */
-       sdp_handle(controller_index);
-       pr_err("SDP ended\n");
+       /*
+        * This command either loads a legacy image, jumps and never returns,
+        * or it loads a FIT image and returns it to be handled by the SPL
+        * code.
+        */
+       ret = spl_sdp_handle(controller_index, spl_image);
+       debug("SDP ended\n");
 
-       return -EINVAL;
+       return ret;
 }
 SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);