blob: 69390edcbaebe3542e14542cbe90ba527649c11b [file] [log] [blame]
Stefan Agnera3774c12017-08-16 11:00:54 -07001/*
2 * (C) Copyright 2016 Toradex
3 * Author: Stefan Agner <stefan.agner@toradex.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <spl.h>
10#include <usb.h>
11#include <g_dnl.h>
12#include <sdp.h>
13
Stefan Agnera3774c12017-08-16 11:00:54 -070014static int spl_sdp_load_image(struct spl_image_info *spl_image,
15 struct spl_boot_device *bootdev)
16{
17 int ret;
18 const int controller_index = 0;
19
20 g_dnl_clear_detach();
21 g_dnl_register("usb_dnl_sdp");
22
23 ret = sdp_init(controller_index);
24 if (ret) {
Andre Heider24ccd0c2018-02-15 07:08:55 +010025 pr_err("SDP init failed: %d\n", ret);
Stefan Agnera3774c12017-08-16 11:00:54 -070026 return -ENODEV;
27 }
28
29 /* This command typically does not return but jumps to an image */
30 sdp_handle(controller_index);
Andre Heider24ccd0c2018-02-15 07:08:55 +010031 pr_err("SDP ended\n");
Stefan Agnera3774c12017-08-16 11:00:54 -070032
33 return -EINVAL;
34}
35SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);