summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
AgeCommit message (Collapse)Author
2026-03-16Merge tag 'u-boot-dfu-20260316' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dfu into next u-boot-dfu-20260316 DFU: * Make DFU_WRITE_ALT symbol available outside of DFU * Fix PCI subclass_code warning in spl_dfu Usb Gadget: * Mark udc_disconnect() as static
2026-03-10arch: arm: rockchip: Add initial support for RK3506Jonas Karlman
Rockchip RK3506 is a ARM-based SoC with tri-core Cortex-A7. Add initial arch support for the RK3506 SoC. Signed-off-by: Jonas Karlman <[email protected]> Acked-by: Mattijs Korpershoek <[email protected]> # drivers/usb/gadget Reviewed-by: Kever Yang <[email protected]>
2026-03-03usb: gadget: Mark udc_disconnect as staticTom Rini
With the last external callers of udc_disconnect long removed, mark this function as static now and remove it from headers. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2026-01-30usb: gadget: dwc2: Move dr_mode check from of_to_plat() to bind()Jonas Karlman
Rockchip RK3288 and RK3506 contain two DWC2 USB controllers, typically one controller use dr_mode=otg and the other one use dr_mode=host. With USB_GADGET_DWC2_OTG, DM_USB_GADGET and USB_DWC2 enabled this result in the dwc2-udc-otg driver binding to both controllers, however only one will probe due to use of dr_mode=host on the other one. After the commit 6668b8e7cc68 ("dm: core: Support multiple drivers with same compatibles") it is possible to bind one controller to the dwc2-udc-otg driver and the other one to the dwc2_usb driver. Move the dr_mode check from of_to_plat() to bind() to allow dm core to bind the dwc2 host driver to dr_mode=host controllers. Before this: => dm tree ... usb_gadget 0 [ ] dwc2-udc-otg | |-- usb@ff740000 usb_gadget 1 [ ] dwc2-udc-otg | |-- usb@ff780000 => usb start starting USB... No USB controllers found After this: dwc2-udc-otg usb@ff780000: Invalid dr_mode 1 => dm tree ... usb_gadget 0 [ ] dwc2-udc-otg | |-- usb@ff740000 usb 0 [ ] dwc2_usb | |-- usb@ff780000 => usb start starting USB... USB DWC2 Bus usb@ff780000: 1 USB Device(s) found Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2026-01-16Merge branch 'qcom-main' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-snapdragon We have been getting a lot more patches from Qualcomm engineers, largely focusing on IoT, router, and automotive platforms (those with QCS, IPQ, and SA prefixes specifically). Quite a variety of changes here: - Watchdog overflow fix - Hardcoded fastboot buffer addresses for a few board (hoppefully temporary until fastboot is updated to read $fastboot_addr_r) - Enable memory protection (MMU_MGPROT) for ARCH_SNAPDRAGON - pinctrl support for the QCS615 soc - various USB/phy fixes including phy config for msm8996/qcs615 - mmc and i2c clock configuration fixes - significant fixes for rpmh and regulator drivers - added config fragment for pixel devices - sa8775p clock fixes - support for "flattened" dwc3 DT that recently landed upstream for sc7280 (qcs6490) and a few other platforms
2026-01-14usb: gadget: Kconfig: Correct Qualcomm config name usedBalaji Selvanathan
Correct ARCH_QCOM to ARCH_SNAPDRAGON as ARCH_QCOM is outdated/unused config. Using ARCH_QCOM was causing USB fastboot mode to fail. Signed-off-by: Balaji Selvanathan <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Acked-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2026-01-09usb: ci_udc: cosmetics: EP and requests debug infoPetr Beneš
Make a note in an unexpected situation, e.g. queuing a request on a disabled endpoint, enabling an enabled endpoint... Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Petr Beneš <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2026-01-09usb: ci_udc: Check ci_ep->desc before usePetr Beneš
There are two places where ci_ep->desc could be accessed despite it is not valid at that moment. Either the endpoint has not been enabled yet or it has been disabled meanwhile (The ethernet gadged behaves this way at least.). That results in dereferencing a null pointer. Moreover, the patch gets rid of possible outstanding requests if the endpoint's state changes to disabled. Signed-off-by: Petr Beneš <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-11-12usb: gadget: Tighten CI_UDC dependenciesTom Rini
This driver cannot build when DM_USB_GADGET is enabled as both options control building of files that use the same global namespace and functionality. In this case make CI_UDC depend on DM_USB_GADGET being disabled as non-DM support is the legacy choice. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-11-12usb: gadget: Tighten the dependency for DWC2 OTG supportTom Rini
The DWC2 OTG driver depends on an ARM-specific header file to compile, so make it depend on ARM. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-11-12usb: gadget: spl: Add missing dependency for SPL_USB_GADGETTom Rini
It makes no sense to ask about nor enable SPL_USB_GADGET without SPL_FRAMEWORK being enabled. Attempting to do so leads to Kconfig noting dependency issues. Add the missing dependency. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-11-04usb: f_sdp: Update SDP driver to support PQC containerYe Li
Since PQC container has changed version to 0x2 in container header, update the header's check. Signed-off-by: Ye Li <[email protected]> Signed-off-by: Alice Guo <[email protected]> Acked-by: Peng Fan <[email protected]> Reviewed-by: Jacky Bai <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-10-30usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOMGeorge Chan
Currently vendor/product id are both 0, and that might not as we want. Set to some arbitrary known value that we can make it work more smoothly. Reviewed-by: Mattijs Korpershoek <[email protected]> Acked-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: George Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
2025-09-30usb: dwc2: Add missing null checkAndrew Goodbody
Add in the missing null check for dev->driver that is present at other points in the function before it is dereferenced. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-09-30usb: gadget: atmel: Add missing null checkAndrew Goodbody
Add in the missing null check for udc->driver that is present at other points in the function before it is dereferenced. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-09-26usb: gadget: max3420_udc: Remove unused driverTom Rini
This driver was never enabled by any platforms after being added to the tree over 5 years ago. Remove it. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Marek Vasut <[email protected]>
2025-09-26usb: gadget: bcm_udc_otg: Remove unused driverTom Rini
This driver is unused since the removal of the bcm28155_ap board in commit 0f6807e77b07 ("arm: Remove bcm28155_ap board"). Remove it. Fixes: 0f6807e77b07 ("arm: Remove bcm28155_ap board") Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Marek Vasut <[email protected]>
2025-09-26usb: gadget: Tighten requirements on USB_GADGET_ATMEL_USBATom Rini
This driver requires some mach-at91 specific header files in order to build. Express that requirement in Kconfig as well. Reviewed-by: Marek Vasut <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2025-08-30rockchip: Add default USB_GADGET_PRODUCT_NUM for RK3576Jonas Karlman
Use 0x350e as the default USB Product ID for Rockchip RK3576, same PID being used by the BootROM when the device is in MASKROM mode. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Kever Yang <[email protected]>
2025-08-30usb: gadget: rockchip: Fix spacing around the Kconfig optionTom Rini
This Kconfig option used spaces and not tabs for indentation. Switch to tabs. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Quentin Schulz <[email protected]> Reviewed-by: Kever Yang <[email protected]>
2025-08-30usb: gadget: rockchip: Add missing dependencyTom Rini
The rockchip usb gadget driver cannot build without platform specific headers being available. Express that requirement in Kconfig as well. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Quentin Schulz <[email protected]> Reviewed-by: Kever Yang <[email protected]>
2025-06-18Merge patch series "list.h/treewide: get rid of no-op prefetch()"Tom Rini
Rasmus Villemoes <[email protected]> says: While looking through list.h, I saw that the regular list_* helpers (and one of the hlist_* ones) still contain the prefetch() that was removed in linux 14 years ago. It doesn't do anything, but makes the macros harder to read, so get rid of it, and the fallback, no-op definition that they relied on. That requires removing a few uses outside list.h as well. checkpatch warns about some whitespace issues in list.h, but as I've copied whole kerneldoc+#define blocks directly from the linux kernel, I think it's better to just accept that so that we don't introduce needless diffs. The "macro argument reuse" arguments should also be ignored, as e.g. the "member" arguments are obviously always just bare identifiers, and the "pos" arguments must be assigned to multiple times. Link: https://lore.kernel.org/r/[email protected]
2025-06-18treewide: drop no-op prefetch() callsRasmus Villemoes
These all end up using the no-op prefetch() defined in linux/list.h, because the only possible real implementation is in arch/mips/include/asm/processor.h, which is behing CONFIG_CPU_HAS_PREFETCH which is nowhere defined. In order to be able to drop that fallback definition from list.h, first remove all uses. Signed-off-by: Rasmus Villemoes <[email protected]>
2025-06-16usb: gadget: atmel: reliably generate disconnect by disabling controllerZixun LI
Contrary to the datasheet, setting both DETACH and PULLD_DIS bits to 1 does not always drive the DP and DM lines to high-impedance. This prevents the host from reliably detecting a USB disconnect and subsequent reconnect. The symptom is that the first gadget command (e.g., dhcp) succeeds, while subsequent commands (e.g., nfs) fail. Disabling and re-enabling the controller entirely, instead of toggling the PULLD_DIS bit, reliably generates a disconnect event. The Linux driver works correctly because gadget_disconnect/gadget_connect are always followed by gadget_udc_start/gadget_udc_stop. In U-Boot pullup() is used solely. This behavior has been observed on the SAM9X60-Curiosity and AT91SAM9G25-EK boards and has been reported to Microchip. Signed-off-by: Zixun LI <[email protected]> Link: https://lore.kernel.org/r/[email protected] [mkorpershoek: reworded commit title + comment to usba_udc_pullup()] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-13spl: Rename jump_to_image_no_args()Simon Glass
This function is currently a misnomer at times as we have cases where it passes arguments to the image. In preparation for making that be a more common case rename this function to jump_to_image(...). In order to do this, rename jump_to_image in board_init_r(...) to jumper so that we do not have a conflict. Signed-off-by: Simon Glass <[email protected]> [trini: Reword the commit message, adding missing cases of jump_to_image_no_args()] Signed-off-by: Tom Rini <[email protected]>
2025-06-02usb: dwc2: Refactor register operations with clrsetbits macrosJunhui Liu
Refactor DWC2 USB gadget driver to replace manual read-modify-write operations with `clrsetbits_le32`, `setbits_le32`, and `clrbits_le32` macros, which simplify the code and improve readability. Signed-off-by: Junhui Liu <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/20250126-dwc2-clrsetbits-refactor-v1-1-68c27e1b6f84@pigmoral.tech Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Replace uint<x>_t types with u<x>Kongyang Liu
Updates all instances of uint8_t, uint16_t, and uint32_t to u8, u16, and u32 respectively, ensuring consistent use of kernel-preferred types and resolving checkpatch.pl warnings. Signed-off-by: Kongyang Liu <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Tested-by: Peter Robinson <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Unify flush and reset logic with v4.20a supportKongyang Liu
This patch merges flush and reset logic for both host and gadget code into a common set of functions, reducing duplication. It also adds support for the updated reset logic to compatible with core version since v4.20a. This patch mainly refers to the patch in the kernel. link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c Signed-off-by: Kongyang Liu <[email protected]> Tested-by: Peter Robinson <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Extract macro definitions to common headerKongyang Liu
Some macros are shared between host and gadget code, causing duplicated definitions. Move DWC2 macro definitions from host and gadget code into a common header to reduce duplication. Signed-off-by: Kongyang Liu <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Tested-by: Peter Robinson <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Align macros with Linux kernel definitionsKongyang Liu
Update the DWC2 macros to match those used in the Linux kernel, making it easier to synchronize updates with kernel. Also removed some unused macros to cleanup the code. Signed-off-by: Kongyang Liu <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Tested-by: Peter Robinson <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Clean up with bitfield macrosKongyang Liu
Use FIELD_PREP, FIELD_GET, BIT, and GENMASK macros to standardize bit manipulation across the DWC2 code, improving readability and maintainability without altering functionality. Signed-off-by: Kongyang Liu <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Tested-by: Peter Robinson <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-06-02usb: dwc2: Extract register definitions to common header fileKongyang Liu
The same registers are accessed in both the otg and gatet drivers of dwc2, and these registers are repeatedly defined in these two parts. Extract register definitions into a common header file to reduce redundancy and make the code more maintainable. Signed-off-by: Kongyang Liu <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Tested-by: Peter Robinson <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Junhui Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-24Merge tag 'u-boot-dfu-20250424' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dfu u-boot-dfu-20250425 Usb gadget: - Fix ACM gadget release - Allow ACM gadget restart after releasing it - Add 'enabled' flag to usb_ep structure DFU: - Fix alt buffer clearing for DeveloperBox board
2025-04-23arch: arm: rockchip: Add initial support for RK3528Jonas Karlman
Rockchip RK3528 is a ARM-based SoC with quad-core Cortex-A53. Add initial arch support for the RK3528 SoC. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Kever Yang <[email protected]>
2025-04-23usb: gadget: f_acm: Allow restarting ACM console after stopping itStephan Gerhold
When using IOMUX, the "usbacm" console can be added/removed dynamically from the stdout/stderr/stdin environment variables to allow temporarily starting other USB gadgets (e.g. Fastboot). However, right now acm_stdio_stop() does not completely undo acm_stdio_start(): The USB gadget is unregistered, but as long as dev->priv stays set acm_stdio_start() will never register the USB gadget again. Clear dev->priv after we detach to make sure a start operation after a stop operation registers the gadget again. Fixes: fc2b399ac03b ("usb: gadget: Add CDC ACM function") Signed-off-by: Stephan Gerhold <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-23usb: gadget: f_acm: Claim requested USB endpointsStephan Gerhold
U-Boot has an older version of the Linux gadget API, where USB endpoints returned by usb_ep_autoconfig() are not automatically claimed. As written in the documentation comment: "To prevent the endpoint from being returned by a later autoconfig call, claim it by assigning ep->driver_data to some non-null value." Right now f_acm doesn't do that, which means that e.g. ep_in and ep_notify may end up being assigned the same endpoint. Surprisingly, the ACM console is still somehow working, but this is not the expected behavior. It will break with a later commit that disallows calling usb_ep_enable() multiple times. Fix this by assigning some data to ep->driver_data, similar to the other gadget drivers. Fixes: fc2b399ac03b ("usb: gadget: Add CDC ACM function") Signed-off-by: Stephan Gerhold <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-11Merge patch series "Switch to using $(PHASE_) in Makefiles"Tom Rini
Tom Rini <[email protected]> says: This series switches to always using $(PHASE_) in Makefiles when building rather than $(PHASE_) or $(XPL_). It also starts on documenting this part of the build, but as a follow-up we need to rename doc/develop/spl.rst and expand on explaining things a bit. Link: https://lore.kernel.org/r/[email protected]
2025-04-11Kbuild: Always use $(PHASE_)Tom Rini
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our Makefiles as part of the macros to determine when to do something in our Makefiles based on what phase of the build we are in. For consistency, bring this down to a single macro and use "$(PHASE_)" only. Signed-off-by: Tom Rini <[email protected]>
2025-04-10usb: gadget: atmel: Add SAM9X60 supportZixun LI
Compared to SAM9X5 the only difference is the DPRAM memory from the USB High Speed Device Port (UDPHS) hardware block was increased, so we can reuse the same endpoint data. Also add compatible "microchip,sam9x60-udc". Signed-off-by: Zixun LI <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-10usb: gadget: f_mass_storage: Fix memory leak of fsg buffersMattijs Korpershoek
In fsg_common_init, we allocate some buffers via memalign(). However, these buffers are never freed. Because of that, we cannot call => ums command multiple times on boards with low memory (CONFIG_SYS_MALLOC_LEN=0x81000): => ums 0 mmc 2 UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000 |crq->brequest:0x0 CTRL+C - Operation aborted => ums 0 mmc 2 UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000 failed to start <NULL>: -12 g_dnl_register: failed!, error: -12 g_dnl_register failed Make sure the fsg buffers are freed when the gadget is unbound by calling fsg_common_release() in fsg_unbind(). Reported-by: Zixun LI <[email protected]> Signed-off-by: Mattijs Korpershoek <[email protected]> Tested-by: Zixun LI <[email protected]> # on SAM9X60 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-10usb: gadget: f_mass_storage: Fix NULL dereference in fsg_add()Mattijs Korpershoek
fsg_common_init() can fail when memory is low. In that case, it returns PTR_ERR(). fsg_add() does not check for failure, and thus dereferences an invalid fsg_common later, which crashes. Verify if we receive an error from fsg_common_init() and handle it gracefully. Reported-by: Zixun LI <[email protected]> Signed-off-by: Mattijs Korpershoek <[email protected]> Tested-by: Zixun LI <[email protected]> # on SAM9X60 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-10usb: gadget: f_mass_storage: Drop invalid kfree() in fsg_common_release()Mattijs Korpershoek
Boards with low memory (CONFIG_SYS_MALLOC_LEN=0x81000), can be crashed using the => ums command twice in row: => ums 0 mmc 2 UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000 |crq->brequest:0x0 CTRL+C - Operation aborted => ums 0 mmc 2 UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000 "Synchronous Abort" handler, esr 0x96000004, far 0xfffffffff2ea20f0 elr: 000000000102ea78 lr : 000000000105e028 (reloc) elr: 00000000f2f33a78 lr : 00000000f2f63028 x0 : 0000000100000000 x1 : 0000000100000000 x2 : 0000000000000000 x3 : fffffffff2ea20e0 x4 : 00000000f2fc9720 x5 : 00000000f2ea20e0 x6 : 00000000f2fc9730 x7 : 00000000f2ee4780 x8 : 000000000000003f x9 : 0000000000000004 x10: 0000000000000058 x11: 00000000000058c4 x12: 0000000000000000 x13: 00000000f2e60800 x14: 00000000f4ec0040 x15: 0000000000000000 x16: 00000000f2f62f2c x17: 0000000000c0c0c0 x18: 00000000f2e73e00 x19: 00000000f2ea2010 x20: 00000000fffffff4 x21: 00000000f2e9b500 x22: 00000000f2ea20f0 x23: 00000000f2ea2050 x24: 00000000f2f61eec x25: 00000000f2fcf000 x26: 00000000f2e9fcd0 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000f2e60290 Code: d00004a6 911cc0c6 cb000063 8b000021 (f9400860) Resetting CPU ... This happens when fsg_common_init() fails to allocate memory and calls fsg_common_release(). fsg_common_release() then calls kfree() which frees common->luns. However, common->luns was never allocated via kmalloc/calloc(), resulting in a crash. Drop the invalid kfree. The memory from common->luns will be reclaimed when we kfree(common) later in fgs_common_release(). Reported-by: Zixun LI <[email protected]> Signed-off-by: Mattijs Korpershoek <[email protected]> Tested-by: Zixun LI <[email protected]> # on SAM9X60 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-10usb: gadget: f_mass_storage: Remove kref structure useMattijs Korpershoek
The kref structure is locally to f_mass_storage and is not used anywhere beside in fsg_common_release(). Remove it and use struct fsg_common* instead. No functional change. Signed-off-by: Mattijs Korpershoek <[email protected]> Tested-by: Zixun LI <[email protected]> # on SAM9X60 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-04-08Merge patch series "Annotate switch/case fallthrough cases"Tom Rini
Andre Przywara <[email protected]> says: C's implicit fallthrough behaviour in switch/case statements can lead to subtle bugs. Quite some while ago many compilers introduced warnings in those cases, requiring intentional fallthrough's to be annotated. So far we were not enabling that compiler option, so many ambiguities and some bugs in the code went unnoticed. This series adds the required annotations in code paths that the first stage of the U-Boot CI covers. There is a large number of cases left in the libbz2 code. The usage of switch/case is borderline insane there, labels are hidden in macros, and there are no breaks, but just goto's. Upstream still uses very similar code, without any annotations. I still am not 100% sure those are meant to fall through or not, and plan to do further investigations, but didn't want to hold the rest of the patches back. You can see for yourself by applying patch 18/18 and building for sandbox64, for instance. Because of this we cannot quite enable the warning in the Makefile yet, but those fixes are worth regardless, and be it to increase readability. Please note that those patches do not fix anything, really, they just add those fallthrough annotations, so the series is not really critical. Link: https://lore.kernel.org/r/[email protected]
2025-04-08gadget: f_thor: annotate switch/case fallthroughAndre Przywara
Even though we seem to catch POWEROFF and EFSCLEAR commands in the THOR protocol request handling, we ultimately do not seem to handle them (apart from sending a response), so those commands still print an error message. Annotate the switch/case fallthrough in this case, to make this clear to the compiler. Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-03-10usb: gadget: Remove final remnants of CONFIG_USB_DEVICETom Rini
The lone user of the legacy USB device framework have been removed for some time. Remove the final parts of the code that were missed. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-02-11usb: gadget: f_mass_storage: Add schedule() in sleep_thread()Patrice Chotard
In case "ums" command is used on platforms which don't implement g_dnl_board_usb_cable_connected() and USB cable is not connected, we stay inside sleep_thread() forever and watchdog is triggered. Add schedule() call to avoid this issue. Signed-off-by: Patrice Chotard <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2025-02-06usb: gadget: g_dnl: Fix NULLPTR dereference when serial# is unsetMichael Ferolito
The current behaviour of this function will dereference a null pointer if the serial# environment variable is unset. This was discovered on a board where U-Boot did not have access to the first 256MB of ram, resulting in a board crash. In the event that U-Boot has full access to memory, it will still read from address 0, which is probably not optimal. This simple check is enough to fix it Signed-off-by: Michael Ferolito <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Heiko Schocher <[email protected]> Cc: Kyungmin Park <[email protected]> Reviewed-by: Heiko Schocher <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2024-12-11usb: renesas: Fix R-Car spellingMarek Vasut
The correct spelling is R-Car, including the dash, update the usage. Kconfig strings and comment changes only, no functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-11-26usb: ci_udc: don't use "advance" feature when setting addressIon Agorria
In the older USB controllers like for example in ChipIdea controller used by the Tegra 2 the "USBADRA: Device Address Advance" bitflag does not exist, so the new device address set during SET_ADDRESS can't be deferred by hardware, which causes the host to not recognize the device and give an error. Instead store it until ep completes to apply the change into the hw register as Linux kernel does. This should fix regression on old and and be compatible with newer controllers. Inspired by: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ef15e5490edc7edf808d3477ab32e0e320792f65 Signed-off-by: Ion Agorria <[email protected]> Signed-off-by: Svyatoslav Ryhel <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>