aboutsummaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorMarek Vasut2023-09-01 11:49:58 +0200
committerMarek Vasut2023-09-15 23:38:02 +0200
commit6b84acc978d39d2e46ddceab292ae67174c66b40 (patch)
tree7b221599865a617bd3e9a72fd05471d7887e2895 /common/spl
parent99924db71f61ffb155cd4d0ce640376019126de8 (diff)
sdp: Use plain udevice for UDC controller interaction
Convert to plain udevice interaction with UDC controller device, avoid the use of UDC uclass dev_array . Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/spl_sdp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index aae886d2e57..5a5ccd0676c 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -14,10 +14,13 @@
static int spl_sdp_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
- int ret;
const int controller_index = CONFIG_SPL_SDP_USB_DEV;
+ struct udevice *udc;
+ int ret;
- usb_gadget_initialize(controller_index);
+ ret = udc_device_get_by_index(controller_index, &udc);
+ if (ret)
+ return ret;
board_usb_init(controller_index, USB_INIT_DEVICE);
@@ -28,7 +31,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
goto err_detach;
}
- ret = sdp_init(controller_index);
+ ret = sdp_init(udc);
if (ret) {
pr_err("SDP init failed: %d\n", ret);
goto err_unregister;
@@ -39,13 +42,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
* or it loads a FIT image and returns it to be handled by the SPL
* code.
*/
- ret = spl_sdp_handle(controller_index, spl_image, bootdev);
+ ret = spl_sdp_handle(udc, spl_image, bootdev);
debug("SDP ended\n");
err_unregister:
g_dnl_unregister();
err_detach:
- usb_gadget_release(controller_index);
+ udc_device_put(udc);
return ret;
}
SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);