MLK-20559-5 f_sdp: Add a callback to clean up USB driver
authorYe Li <ye.li@nxp.com>
Thu, 3 Jan 2019 08:46:09 +0000 (00:46 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 10:38:53 +0000 (03:38 -0700)
Because SDP directly jumps to next level boot image, we'd better
clean up the USB driver before it. Implement a weak callback function,
that spl sdp can use it to clean up USB driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 1f6b3efc62cb277fd4316d8ed5115f47b09369a0)

common/spl/spl_sdp.c
drivers/usb/gadget/f_sdp.c

index b15f1a5..f5f6735 100644 (file)
 #include <g_dnl.h>
 #include <sdp.h>
 
+void board_sdp_cleanup(void)
+{
+       board_usb_cleanup(CONFIG_SPL_SDP_USB_DEV, USB_INIT_DEVICE);
+}
+
 static int spl_sdp_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
index af76a7b..ebf40dc 100644 (file)
@@ -247,6 +247,10 @@ static struct usb_gadget_strings *sdp_generic_strings[] = {
        NULL,
 };
 
+void __weak board_sdp_cleanup(void)
+{
+}
+
 static inline void *sdp_ptr(u32 val)
 {
        return (void *)(uintptr_t)val;
@@ -748,6 +752,8 @@ static void sdp_handle_in_ep(void)
                                        (struct image_header *)(ulong)(sdp_func->jmp_address));
                        }
 
+                       board_sdp_cleanup();
+
                        jump_to_image_no_args(&spl_image);
 #else
                        /* In U-Boot, allow jumps to scripts */