summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c10
-rw-r--r--common/spl/Kconfig8
-rw-r--r--common/spl/spl_sdp.c5
3 files changed, 17 insertions, 6 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 5c650f046cf..52234535112 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -183,11 +183,11 @@ static int print_cpuinfo(void)
char desc[512];
int ret;
- ret = uclass_first_device_err(UCLASS_CPU, &dev);
- if (ret) {
- debug("%s: Could not get CPU device (err = %d)\n",
- __func__, ret);
- return ret;
+ dev = cpu_get_current_dev();
+ if (!dev) {
+ debug("%s: Could not get CPU device\n",
+ __func__);
+ return -ENODEV;
}
ret = cpu_get_desc(dev, desc, sizeof(desc));
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 9feadb5e43e..6f37f756501 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1172,6 +1172,14 @@ config SPL_USB_SDP_SUPPORT
Enable Serial Download Protocol (SDP) device support in SPL. This
allows to download images into memory and execute (jump to) them
using the same protocol as implemented by the i.MX family's boot ROM.
+
+config SPL_SDP_USB_DEV
+ int "SDP USB controller index"
+ default 0
+ depends on SPL_USB_SDP_SUPPORT
+ help
+ Some boards have USB controller other than 0. Define this option
+ so it can be used in compiled environment.
endif
config SPL_WATCHDOG_SUPPORT
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index 806bf1327ef..644dfa8cc3e 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -14,7 +14,9 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
int ret;
- const int controller_index = 0;
+ const int controller_index = CONFIG_SPL_SDP_USB_DEV;
+
+ usb_gadget_initialize(controller_index);
g_dnl_clear_detach();
ret = g_dnl_register("usb_dnl_sdp");
@@ -37,6 +39,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
ret = spl_sdp_handle(controller_index, spl_image);
debug("SDP ended\n");
+ usb_gadget_release(controller_index);
return ret;
}
SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);