spl_sdp.c 753 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2016 Toradex
  4. * Author: Stefan Agner <stefan.agner@toradex.com>
  5. */
  6. #include <common.h>
  7. #include <spl.h>
  8. #include <usb.h>
  9. #include <g_dnl.h>
  10. #include <sdp.h>
  11. static int spl_sdp_load_image(struct spl_image_info *spl_image,
  12. struct spl_boot_device *bootdev)
  13. {
  14. int ret;
  15. const int controller_index = 0;
  16. g_dnl_clear_detach();
  17. g_dnl_register("usb_dnl_sdp");
  18. ret = sdp_init(controller_index);
  19. if (ret) {
  20. pr_err("SDP init failed: %d\n", ret);
  21. return -ENODEV;
  22. }
  23. /* This command typically does not return but jumps to an image */
  24. sdp_handle(controller_index);
  25. pr_err("SDP ended\n");
  26. return -EINVAL;
  27. }
  28. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);