]> Git Repo - J-u-boot.git/blobdiff - cmd/usb_gadget_sdp.c
Merge tag 'efi-2025-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
[J-u-boot.git] / cmd / usb_gadget_sdp.c
index 2ead06be9f5acf351f2e24e450ecff683167f6d0..39259a3b09253cb643f26f4f2f98c79745fbff62 100644 (file)
@@ -6,21 +6,25 @@
  * Author: Stefan Agner <[email protected]>
  */
 
-#include <common.h>
+#include <command.h>
 #include <g_dnl.h>
 #include <sdp.h>
 #include <usb.h>
+#include <linux/printk.h>
 
-static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
+       int controller_index;
+       struct udevice *udc;
        int ret;
 
        if (argc < 2)
                return CMD_RET_USAGE;
 
-       char *usb_controller = argv[1];
-       int controller_index = simple_strtoul(usb_controller, NULL, 0);
-       usb_gadget_initialize(controller_index);
+       controller_index = simple_strtoul(argv[1], NULL, 0);
+       ret = udc_device_get_by_index(controller_index, &udc);
+       if (ret)
+               return ret;
 
        g_dnl_clear_detach();
        ret = g_dnl_register("usb_dnl_sdp");
@@ -29,20 +33,20 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                goto exit_register;
        }
 
-       ret = sdp_init(controller_index);
+       ret = sdp_init(udc);
        if (ret) {
                pr_err("SDP init failed: %d\n", ret);
                goto exit;
        }
 
        /* This command typically does not return but jumps to an image */
-       sdp_handle(controller_index);
+       sdp_handle(udc);
        pr_err("SDP ended\n");
 
 exit:
        g_dnl_unregister();
 exit_register:
-       usb_gadget_release(controller_index);
+       udc_device_put(udc);
 
        return CMD_RET_FAILURE;
 }
This page took 0.029391 seconds and 4 git commands to generate.