Blame view

common/spl/spl_sdp.c 942 Bytes
83d290c56   Tom Rini   SPDX: Convert all...
1
  // SPDX-License-Identifier: GPL-2.0+
a3774c1c3   Stefan Agner   spl: add serial d...
2
3
4
  /*
   * (C) Copyright 2016 Toradex
   * Author: Stefan Agner <stefan.agner@toradex.com>
a3774c1c3   Stefan Agner   spl: add serial d...
5
6
7
8
9
10
11
   */
  
  #include <common.h>
  #include <spl.h>
  #include <usb.h>
  #include <g_dnl.h>
  #include <sdp.h>
a3774c1c3   Stefan Agner   spl: add serial d...
12
13
14
15
16
17
18
  static int spl_sdp_load_image(struct spl_image_info *spl_image,
  			      struct spl_boot_device *bootdev)
  {
  	int ret;
  	const int controller_index = 0;
  
  	g_dnl_clear_detach();
25ee92464   Sjoerd Simons   usb: gadget: erro...
19
20
21
22
23
24
  	ret = g_dnl_register("usb_dnl_sdp");
  	if (ret) {
  		pr_err("SDP dnl register failed: %d
  ", ret);
  		return ret;
  	}
a3774c1c3   Stefan Agner   spl: add serial d...
25
26
27
  
  	ret = sdp_init(controller_index);
  	if (ret) {
24ccd0c8f   Andre Heider   usb: gadget: sdp:...
28
29
  		pr_err("SDP init failed: %d
  ", ret);
a3774c1c3   Stefan Agner   spl: add serial d...
30
31
  		return -ENODEV;
  	}
2c72ead73   Frieder Schrempf   usb: gadget: f_sd...
32
33
34
35
36
37
38
39
  	/*
  	 * This command either loads a legacy image, jumps and never returns,
  	 * or it loads a FIT image and returns it to be handled by the SPL
  	 * code.
  	 */
  	ret = spl_sdp_handle(controller_index, spl_image);
  	debug("SDP ended
  ");
a3774c1c3   Stefan Agner   spl: add serial d...
40

2c72ead73   Frieder Schrempf   usb: gadget: f_sd...
41
  	return ret;
a3774c1c3   Stefan Agner   spl: add serial d...
42
43
  }
  SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);