1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2016 Toradex
4 * Author: Stefan Agner <stefan.agner@toradex.com>
14 static int spl_sdp_load_image(struct spl_image_info *spl_image,
15 struct spl_boot_device *bootdev)
18 const int controller_index = CONFIG_SPL_SDP_USB_DEV;
20 usb_gadget_initialize(controller_index);
23 ret = g_dnl_register("usb_dnl_sdp");
25 pr_err("SDP dnl register failed: %d\n", ret);
29 ret = sdp_init(controller_index);
31 pr_err("SDP init failed: %d\n", ret);
36 * This command either loads a legacy image, jumps and never returns,
37 * or it loads a FIT image and returns it to be handled by the SPL
40 ret = spl_sdp_handle(controller_index, spl_image);
43 usb_gadget_release(controller_index);
46 SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);