blob: 0c4603a3db3b881c37f56f908654fe64d840f985 [file] [log] [blame]
Stefan Agnerd0d9d212017-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
14DECLARE_GLOBAL_DATA_PTR;
15
16static int spl_sdp_load_image(struct spl_image_info *spl_image,
17 struct spl_boot_device *bootdev)
18{
19 int ret;
20 const int controller_index = 0;
21
22 g_dnl_clear_detach();
23 g_dnl_register("usb_dnl_sdp");
24
25 ret = sdp_init(controller_index);
26 if (ret) {
Andre Heiderb841e972018-02-15 07:08:55 +010027 pr_err("SDP init failed: %d\n", ret);
Stefan Agnerd0d9d212017-08-16 11:00:54 -070028 return -ENODEV;
29 }
30
31 /* This command typically does not return but jumps to an image */
32 sdp_handle(controller_index);
Andre Heiderb841e972018-02-15 07:08:55 +010033 pr_err("SDP ended\n");
Stefan Agnerd0d9d212017-08-16 11:00:54 -070034
35 return -EINVAL;
36}
37SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);