diff options
| author | Tom Rini <trini@konsulko.com> | 2026-06-30 09:27:19 -0600 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2026-06-30 09:27:19 -0600 |
| commit | 0acd34228cc71ae76070ae50e6e633ab0201ffe3 (patch) | |
| tree | 7fecbc325d51749f78efbb1664f33ccda813b909 | |
| parent | 0d8e33717d7e5b2a4034cc88f18bf233f77801e7 (diff) | |
| parent | 865f62483b86b7936c2136d91bbce252b6406330 (diff) | |
| download | u-boot-0acd34228cc71ae76070ae50e6e633ab0201ffe3.tar.gz u-boot-0acd34228cc71ae76070ae50e6e633ab0201ffe3.zip | |
Merge tag 'u-boot-dfu-next-20260629' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next
u-boot-dfu-next-20260629:
CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/30562
Fastboot:
- Add support for CMD_FASTBOOT_ABORT_KEYED
- Enable CMD_FASTBOOT_ABORT_KEYED for qualcomm phones
USB Gadget:
- f_mass_storage: Disable eps during disconnect
- f_sdp: Fix spl load failure error handling
| -rw-r--r-- | board/qualcomm/qcom-phone.config | 1 | ||||
| -rw-r--r-- | board/qualcomm/qcom-phone.env | 2 | ||||
| -rw-r--r-- | cmd/Kconfig | 7 | ||||
| -rw-r--r-- | cmd/fastboot.c | 9 | ||||
| -rw-r--r-- | doc/android/fastboot.rst | 4 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_mass_storage.c | 11 | ||||
| -rw-r--r-- | drivers/usb/gadget/f_sdp.c | 16 |
7 files changed, 45 insertions, 5 deletions
diff --git a/board/qualcomm/qcom-phone.config b/board/qualcomm/qcom-phone.config index d24094eefdd..1387aa1dfa2 100644 --- a/board/qualcomm/qcom-phone.config +++ b/board/qualcomm/qcom-phone.config @@ -13,6 +13,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x1A000000 CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_USB_FUNCTION_ACM=y CONFIG_CMD_UMS_ABORT_KEYED=y +CONFIG_CMD_FASTBOOT_ABORT_KEYED=y # Record all console output and let it be dumped via fastboot CONFIG_CONSOLE_RECORD=y diff --git a/board/qualcomm/qcom-phone.env b/board/qualcomm/qcom-phone.env index 42f58c3bac6..5eaa2ceada8 100644 --- a/board/qualcomm/qcom-phone.env +++ b/board/qualcomm/qcom-phone.env @@ -32,7 +32,7 @@ menucmd=setenv bootcmd run menucmd; bootmenu -1 bootmenu_0=Boot=bootefi bootmgr; pause bootmenu_1=Enable serial console gadget=run serial_gadget bootmenu_2=Enable USB mass storage=echo "Press any key to exit UMS mode"; ums 0 scsi 0 -bootmenu_3=Enable fastboot mode=run fastboot +bootmenu_3=Enable fastboot mode=echo "Press any key to exit fastboot mode"; run fastboot # Disabling bootretry means we'll just drop the shell bootmenu_4=Drop to shell=setenv bootretry -1 bootmenu_5=Reset device=reset diff --git a/cmd/Kconfig b/cmd/Kconfig index d0fb7397067..ca1039f6a03 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1208,6 +1208,13 @@ config CMD_FASTBOOT See doc/android/fastboot.rst for more information. +config CMD_FASTBOOT_ABORT_KEYED + bool "fastboot abort with any key" + depends on CMD_FASTBOOT && USB_FUNCTION_FASTBOOT + help + Allow interruption of USB fastboot mode by any key presses, + rather than just Ctrl-c. + config CMD_FLASH bool "flinfo, erase, protect" default y diff --git a/cmd/fastboot.c b/cmd/fastboot.c index e71f873527b..f3929f88dfa 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -103,8 +103,15 @@ static int do_fastboot_usb(int argc, char *const argv[], while (1) { if (g_dnl_detach()) break; - if (ctrlc()) + if (IS_ENABLED(CONFIG_CMD_FASTBOOT_ABORT_KEYED)) { + if (tstc()) { + getchar(); + puts("\rOperation aborted.\n"); + break; + } + } else if (ctrlc()) { break; + } schedule(); dm_usb_gadget_handle_interrupts(udc); } diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst index 818b8815ebd..96c544ae11b 100644 --- a/doc/android/fastboot.rst +++ b/doc/android/fastboot.rst @@ -217,6 +217,10 @@ It's possible to interrupt the fastboot command using Ctrl-c:: => fastboot usb 0 Operation aborted. +``CONFIG_CMD_FASTBOOT_ABORT_KEYED`` can be enabled so that *any* keypress +will interrupt the fastboot command, rather than just Ctrl-c. This can be +quite useful on mobile devices which lack a means to input Ctrl-c. + You can also specify a kernel image to boot. You have to either specify the an image in Android format *or* pass a binary kernel and let the fastboot client wrap the Android suite around it. On OMAP for instance you diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 71dc58da3f0..87ed25e8bb3 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -2275,6 +2275,17 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) static void fsg_disable(struct usb_function *f) { struct fsg_dev *fsg = fsg_from_func(f); + + /* Disable the endpoints */ + if (fsg->bulk_in_enabled) { + usb_ep_disable(fsg->bulk_in); + fsg->bulk_in_enabled = 0; + } + if (fsg->bulk_out_enabled) { + usb_ep_disable(fsg->bulk_out); + fsg->bulk_out_enabled = 0; + } + fsg->common->new_fsg = NULL; raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); } diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index f72e27028b7..cd2c282247a 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -75,6 +75,7 @@ struct hid_report { #define SDP_HID_PACKET_SIZE_EP1 1024 #define SDP_EXIT 1 +#define SDP_FAIL 2 struct sdp_command { u16 cmd; @@ -840,11 +841,14 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image, #ifdef CONFIG_SPL_LOAD_FIT if (image_get_magic(header) == FDT_MAGIC) { struct spl_load_info load; + int ret; debug("Found FIT\n"); spl_load_init(&load, sdp_load_read, header, 1); - spl_load_simple_fit(spl_image, &load, 0, - header); + ret = spl_load_simple_fit(spl_image, &load, 0, + header); + if (ret) + return SDP_FAIL; return SDP_EXIT; } @@ -852,9 +856,13 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image, if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) && valid_container_hdr((void *)header)) { struct spl_load_info load; + int ret; spl_load_init(&load, sdp_load_read, header, 1); - spl_load_imx_container(spl_image, &load, 0); + ret = spl_load_imx_container(spl_image, &load, 0); + if (ret) + return SDP_FAIL; + return SDP_EXIT; } @@ -924,6 +932,8 @@ int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, if (flag == SDP_EXIT) return 0; + else if (flag == SDP_FAIL) + return -EIO; schedule(); dm_usb_gadget_handle_interrupts(udc); |
