[PATCH 04/17] cmd: fastboot: Use plain udevice for UDC controller interaction

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue Aug 22 18:22:25 CEST 2023


On sam., août 19, 2023 at 16:23, Marek Vasut <marex at denx.de> wrote:

> Convert to plain udevice interaction with UDC controller
> device, avoid the use of UDC uclass dev_array .
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Angus Ainslie <angus at akkea.ca>
> Cc: Dmitrii Merkurev <dimorinny at google.com>
> Cc: Eddie Cai <eddie.cai.linux at gmail.com>
> Cc: Kever Yang <kever.yang at rock-chips.com>
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Miquel Raynal <miquel.raynal at bootlin.com>
> Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> Cc: Nishanth Menon <nm at ti.com>
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> Cc: Philipp Tomsich <philipp.tomsich at vrull.eu>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Stefan Roese <sr at denx.de>
> Cc: kernel at puri.sm
> ---
>  cmd/fastboot.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Tested that I could reflash the bootloader (raw) partition with:

$ fastboot flash bootloader u-boot_kvim3_noab.bin

Works fine!

Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek at baylibre.com> # on khadas vim3

Based on: 2023.10-rc3

>
> diff --git a/cmd/fastboot.c b/cmd/fastboot.c
> index 3d5ff951eb6..17fb0a0aa7b 100644
> --- a/cmd/fastboot.c
> +++ b/cmd/fastboot.c
> @@ -61,6 +61,7 @@ static int do_fastboot_usb(int argc, char *const argv[],
>  {
>  	int controller_index;
>  	char *usb_controller;
> +	struct udevice *udc;
>  	char *endp;
>  	int ret;
>  
> @@ -79,7 +80,7 @@ static int do_fastboot_usb(int argc, char *const argv[],
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	ret = usb_gadget_initialize(controller_index);
> +	ret = udc_device_get_by_index(controller_index, &udc);
>  	if (ret) {
>  		pr_err("USB init failed: %d\n", ret);
>  		return CMD_RET_FAILURE;
> @@ -103,13 +104,13 @@ static int do_fastboot_usb(int argc, char *const argv[],
>  		if (ctrlc())
>  			break;
>  		schedule();
> -		usb_gadget_handle_interrupts(controller_index);
> +		dm_usb_gadget_handle_interrupts(udc);
>  	}
>  
>  	ret = CMD_RET_SUCCESS;
>  
>  exit:
> -	usb_gadget_release(controller_index);
> +	udc_device_put(udc);
>  	g_dnl_unregister();
>  	g_dnl_clear_detach();
>  
> -- 
> 2.40.1


More information about the U-Boot mailing list