spl_sdp.c 778 B

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