summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2026-03-04treewide: Remove Timesys from ADI ADSP maintenancePhilip Molloy
After years of developing the ADI ADSP platform, Timesys was purchased by another company and is no longer contracted to maintain the platform. Signed-off-by: Philip Molloy <philip.molloy@analog.com> Reviewed-by: Greg Malysa <malysagreg@gmail.com>
2026-02-16usb: cdns3: use VBUS Valid to determine role for dr_mode OTGSiddharth Vadapalli
The cdns3_bind() function is responsible for identifying the appropriate driver to bind to the USB Controller's device-tree node. If the device-tree node has the 'dr_mode' property set to 'otg', the existing approach fails to bind a driver, leading to loss of functionality. To address this, use the VBUS Valid field of the OTG Status register to determine the role as follows: - If VBUS Valid field is set, it indicates that a USB Host is supplying power and the Controller should assume the Peripheral role. - If VBUS Valid field is clear, it indicates the absence of a USB Host and the Controller should assume the Host role. Additionally, when 'dr_mode' happens to be 'otg' and the STRAP settings are not specified, use VBUS Valid to determine the role in cdns3_drd_init() and assign it to cdns->dr_mode. Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
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 <jonas@kwiboo.se> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org> Link: https://lore.kernel.org/r/20260129195207.2260264-1-jonas@kwiboo.se Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-30usb: dwc3: core: improve reset sequenceChris Morgan
According to Synopsys Databook, we shouldn't be relying on GCTL.CORESOFTRESET bit as that's only for debugging purposes. Instead, let's use DCTL.CSFTRST if we're OTG or PERIPHERAL mode. Host side block will be reset by XHCI driver if necessary. Note that this reduces amount of time spent on dwc3_probe() by a long margin. We're still gonna wait for reset to finish for a long time (default to 1ms max), but tests show that the reset polling loop executed at most 19 times (modprobe dwc3 && modprobe -r dwc3 executed 1000 times in a row). Note that this patch was submitted to Linux in 2016 [1], however I can confirm it is needed to support gadget mode in U-Boot on my device. While I am referencing this patch from Linux I am in fact taking the full existing dwc3_core_soft_reset() function from Linux as it exists in v6.19-rc5, so it may differ slightly from the information in the 2016 patch. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/drivers/usb/dwc3?id=f59dcab176293b646e1358144c93c58c3cda2813 Suggested-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://lore.kernel.org/r/20260115230135.183158-5-macroalpha82@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-30usb: dwc3: gadget: Don't send unintended link state changeChris Morgan
DCTL.ULSTCHNGREQ is a write-only field. When doing a read-modify-write to DCTL, the driver must make sure that there's no unintended link state change request from whatever is read from DCTL.ULSTCHNGREQ. Set link state change to no-action when the driver writes to DCTL. Note that this patch was submitted upstream in Linux in 2020 [1], and I've confirmed I need it in U-Boot to enable gadget mode. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/drivers/usb/dwc3?id=5b738211fb59e114727381d07c647a77c0010996 Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://lore.kernel.org/r/20260115230135.183158-4-macroalpha82@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-30usb: dwc3: Increase DWC3 controller halt timeoutChris Morgan
Since EP0 transactions need to be completed before the controller halt sequence is finished, this may take some time depending on the host and the enabled functions. Increase the controller halt timeout, so that we give the controller sufficient time to handle EP0 transfers. This patch was originally submitted to Linux in 2022, but is required to use USB gadget mode on my device in U-Boot. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=461ee467507cb98a348fa91ff8460908bb0ea423 Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://lore.kernel.org/r/20260115230135.183158-3-macroalpha82@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-30usb: dwc3: core: Add ip and version_type support from LinuxChris Morgan
Add support for the ip and version_type fields from the Linux version of the dwc3 driver. Included in this is support for a few additional macros in the header from Linux as well. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://lore.kernel.org/r/20260115230135.183158-2-macroalpha82@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-25usb: xhci: fix DMA address corruption in abort_tdANANDHAKRISHNAN S
When aborting a Transfer Descriptor (TD), the xHCI driver updates the device dequeue pointer by converting the virtual enqueue TRB pointer into a DMA address. Previously, the code OR-ed the ring's Dequeue Cycle State (DCS) bit into the virtual TRB pointer before passing it to xhci_trb_virt_to_dma(). This produced an unaligned virtual address (e.g. ending in 0x...1). Inside xhci_trb_virt_to_dma(), the offset calculation: segment_offset = trb - seg->trbs; operated on this unaligned pointer, resulting in an incorrect TRB index. In wraparound cases, this caused the bounds check to fail and the function to return 0. As a result, a SET_DEQ_PTR command was issued with a DMA address of 0x0, leading to controller hangs and transfer timeouts, most commonly when aborting TDs near the end of a ring segment (e.g. index 63). Fix this by translating the aligned virtual TRB pointer to a DMA address first, and only then applying the DCS bit to the resulting physical address. Reviewed-by: Marek Vasut <marek.vasut@mailbox.org> Signed-off-by: ANANDHAKRISHNAN S <anandhakrishnan.s@dicortech.com>
2026-01-21arm: Remove remainder of ARCH_ORION5XTom Rini
With commit 5663b137e682 ("arm: Remove edminiv2 board") the last ARCH_ORION5X platform was removed. Remove the rest of the architecture code which is now unused. Reviewed-by: Tony Dinh <mibodhi@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2026-01-17Merge branch 'master' of git://source.denx.de/u-boot-usbTom Rini
- Add the "apple,t8103-dwc3" compatible to the xhci-dwc3 glue
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-16usb: dwc3-generic: support Qualcomm flattened DTCasey Connolly
Qualcomm devicetrees are moving away from having a glue node with dwc3 as a subnode and now may just have a single flattened node. Rockchip already have a glue_get_ctrl_dev op which returns the node for the glue device itself, commonise this and reuse it for the new Qualcomm node. Lastly adjust the qscratch base address since it now requires an offset from the dwc3 base. Link: https://patch.msgid.link/20260116-casey-usb-role-switch-v2-1-83a1a6501a11@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2026-01-16Merge tag 'u-boot-dfu-20260116' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dfu u-boot-dfu-20260116 CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/29018 Android: * Fix missing dependency for BOOTMETH_ANDROID * Add bootconfig support * Add 'get ramdisk' command to abootimg DFU: * Improve error handling in dfu_fill_entity() USB Gadget: * ci_udc: Ensure ci_ep->desc is valid before using it * ci_udc: Add additional debug prints
2026-01-16usb: xhci-dwc3: Add "apple,t8103-dwc3" compatibleJanne Grunau
The Linux support for dwc3 on Apple silicon SoCs switched to using a apple specific glue driver [1] that uses it own compatible string. The glue driver handles platform specific requirements on the interaction between dwc3 and the USB2/USB3 PHY and reset-controller for USB role switches and plug events. To keep USB working as before when the nodes still carried "snps,dwc3" as compatible add "apple,t8103-dwc3" to the of match table. Eventually it is probably advisable to add a dwc3-apple glue driver and write code for the currently empty Apple Type-C PHY driver in phy-apple-atc.c. Link: https://lore.kernel.org/asahi/20251015-b4-aplpe-dwc3-v2-0-cbd65a2d511a@kernel.org/ [1] Reviewed-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org> Signed-off-by: Janne Grunau <j@jannau.net>
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 <balaji.selvanathan@oss.qualcomm.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Acked-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Link: https://patch.msgid.link/20251224044747.3898137-1-balaji.selvanathan@oss.qualcomm.com Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2026-01-14usb: dwc3: qcom: Add delays in UTMI clock selection for QscratchBalaji Selvanathan
Added delays before and after setting the PIPE_UTMI_CLK_SEL and PIPE3_PHYSTATUS_SW bits in the Qscratch GENERAL_CFG register during UTMI clock selection for DWC3 on Qualcomm platforms. These delays help ensure proper timing and stability of the UTMI clock switching sequence, potentially avoiding race conditions or unstable PHY behavior during initialization. Tested on platforms using Qscratch-based DWC3 PHY configuration. This change is taken from this Linux kernel implementation: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?id=a4333c3a6ba9ca9cff50a3c1d1bf193dc5489e1c Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://patch.msgid.link/20250627045244.2225303-1-balaji.selvanathan@oss.qualcomm.com Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2026-01-09Merge patch series "Enable / require DEVRES for devm_.alloc usage outside xPL"Tom Rini
Tom Rini <trini@konsulko.com> says: As seen by a number of patches fixing memory leaks, U-Boot has a problem with developer expectations around devm_kmalloc and friends. Namely, whereas in Linux these memory allocations will be freed automatically in most cases, in U-Boot this is only true if DEVRES is enabled. Now, intentionally, in xPL phases, we do not (and do not offer as an option) enabling DEVRES. However in full U-Boot this is left either to the user, or some drivers have select'd DEVRES on their own. This inconsistency is a problem. This series goes and deals with two small issues that were shown by having all drivers that use devm_.alloc to allocate memory also select DEVRES and then we make DEVRES no longer be a prompted option and instead select'd as needed. We do not make this unconditional as it would result in growing the resulting binary on the many platforms which have no users of the devm_.alloc family of functions. Link: https://lore.kernel.org/r/20251227223833.3019311-1-trini@konsulko.com
2026-01-09dm: core: Default to using DEVRES outside of xPLTom Rini
The devm alloc functions that we have may follow the Linux kernel model where allocations are (almost always) automatically free()'d. However, quite often we don't enable, in full U-Boot, the tracking and free()'ing functionality. This in turn leads to memory leaks because the driver author expects that since the functions have the same name as in the Linux Kernel they have the same behavior. In turn we then get functionally correct commits such as commit 00e1fed93c8c ("firmware: ti_sci: Fix memory leaks in devm_ti_sci_get_of_resource") that manually add these calls. Rather than manually tracking allocations and implementing free()s, rework things so that we follow expectations by enabling the DEVRES functionality (outside of xPL phases). This turns DEVRES from a prompted symbol to a symbol that must be select'd, and we now remove our non-managed alloc/free functions from outside of xPL builds. Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Tom Rini <trini@konsulko.com>
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 <mkorpershoek@kernel.org> Signed-off-by: Petr Beneš <petr.benes@ysoft.com> Link: https://lore.kernel.org/r/20251218142737.3169753-2-petr.benes@ysoft.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
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š <petr.benes@ysoft.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Link: https://lore.kernel.org/r/20251218142737.3169753-1-petr.benes@ysoft.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2026-01-08usb: dwc3-generic: add support for exynos7870Kaustabh Chakraborty
Exynos7870's DWC3 glue layer is quite simple, consisting of a few clocks, which is handled by this driver. Add the compatible string in here. Reviewed-by: Marek Vasut <marek.vasut@mailbox.org> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
2026-01-08usb: dwc3-generic: allow fallback of dr_mode property to "otg"Kaustabh Chakraborty
Documentation [1] states that the default value of the dr_mode property is "otg". It also isn't marked a mandatory node, so it may or may not be set. So, accordingly if dr_mode is not mentioned in the devicetree node, OTG mode must be assumed. In this driver however, this case is not handled. If dr_mode is not mentioned, USB_DR_MODE_UNKNOWN is set. The logic implemented raises an error, instead of falling back to USB_DR_MODE_OTG. Correct this to conform to the specification. Link: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/tree/Bindings/usb/usb-drd.yaml?h=v6.18-dts [1] Reviewed-by: Marek Vasut <marek.vasut@mailbox.org> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
2026-01-08usb: xhci: avoid noisy 'Starting the controller' message.Heinrich Schuchardt
We should avoid overwhelming users with non-essential messages. The message 'Starting the controller' is not written for EHCI. We should not write it for XHCI either. Adjust the Python test accordingly. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-11-27usb/xhci: avoid noisy 'Register NbrPorts' messageHeinrich Schuchardt
We should avoid overwhelming users with non-essential messages. 'Register NbrPorts' is a debug message for EHCI. Do the same for XHCI. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-11-27usb: USB_EHCI_PCI depends on PCIHeinrich Schuchardt
CONFIG_USB_EHCI_PCI cannot work without CONFIG_PCI. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
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 <trini@konsulko.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-11-12usb: host: xhci: Make U_BOOT_DRIVER entries uniqueTom Rini
All instances of the U_BOOT_DRIVER must use a unique name or they will lead to link time failures due to name space conflicts when both are present. Most of the XHCI drivers follow pattern of xhci_xxx in their name, but a few used "usb_xhci". Change these to follow the pattern of the rest of the XHCI glue drivers. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
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 <trini@konsulko.com> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-11-12usb: musb: drop musb legacy driversPeter Robinson
The last of the users of the legacy musb drivers have been migrated so now remove the old musb stack, all users should now be using the new musb stack if they need this functionality. Signed-off-by: Peter Robinson <pbrobinson@gmail.com> [trini: Remove a Makefile reference that was missed in v1] Signed-off-by: Tom Rini <trini@konsulko.com>
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 <trini@konsulko.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-11-04Merge tag 'u-boot-imx-master-20251104' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/28144 - Extend USB support for the i.MX9 family. - Update memory controller for imx6ulz_smm_m2. - Add remoteproc support for several i.MX boards. - Add support for iMX95 15x15 EVK.
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 <ye.li@nxp.com> Signed-off-by: Alice Guo <alice.guo@nxp.com> Acked-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-11-04usb: ehci-mx6: Extend support to i.MX91, i.MX93, i.MX94, and i.MX95Alice Guo
Since the EHCI USB driver is shared across i.MX91, i.MX93, i.MX94, and i.MX95, the condition check is updated to use IMX9. Signed-off-by: Alice Guo <alice.guo@nxp.com> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-11-04usb: musb-new: fix typosYegor Yefremov
Typos found via codespell utility. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-11-04usb: musb-new: fix ti-musb dependenciesYegor Yefremov
If OF_CONTROL is on, ti-musb.c registers a "ti-musb-wrapper" driver that requires UCLASS_MISC. Hence, select MISC if both OF_CONTROL and USB_MUSB_TI are selected. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2025-10-30Merge tag 'qcom-for-2026.01-rc2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-snapdragon A variety of Qualcomm features/fixes for this cycle, notably with a few new platforms gaining support: * Initial support for SDM670 (similar to SDM845), SM6350, and SM7150 platforms is added * USB and UART issues on MSM8916 are addressed (improving stability/ reliability) * Firmware loading is implemented for the GENI serial engine, this is used on some platforms to load firmware for i2c/spi/uart to work Some additional patches like binman support for building MBN files still need some additional work. CI: https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/8ef6ac07b35e39a57501554680bbf452e818d3e3/pipelines?ref=qcom-main
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 <mkorpershoek@kernel.org> Acked-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: George Chan <gchan9527@gmail.com> Link: https://patch.msgid.link/20251021-sc7180-minor-v1-2-9fe33c73365e@gmail.com Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: ehci-msm: Register ULPI PHY through NOP wrapperStephan Gerhold
The UCLASS_USB device is removed and rebound each time you run "usb stop" followed by "usb start", or when you switch between USB device and USB host mode. Unfortunately, this causes issues with the current ehci-msm driver: In ehci_usb_remove() we call generic_shutdown_phy(), but at that point the ULPI PHY we registered in ehci_usb_of_bind() was already removed again by the DM core. Fix this by adding a UCLASS_NOP driver that keeps the PHY driver bound permanently, and then just re-probe the actual USB part. Reported-by: Jianfeng Zhu <JianfengA.Zhu@sony.com> Closes: https://lore.kernel.org/u-boot/OSQPR04MB774067EBEEADD714EFE18C2A90882@OSQPR04MB7740.apcprd04.prod.outlook.com/ Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-6-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: ehci-msm: Drop redundant EHCI register writesStephan Gerhold
ehci_unregister() already clears the CMD_RUN bit with more careful checks. It also ensures that we only do this in case we were actually in USB host (rather than USB device) mode. It's not clear what the extra register writes in the Qualcomm-specific ehci-msm driver are supposed to do, so just drop them. Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-5-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: ehci-msm: Use clk bulk helpersStephan Gerhold
The enable order for the clocks does not matter much, we just need to enable all the USB clocks. Use the clk bulk helpers to simplify the code. Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-4-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: ehci-msm: Disable clocks after all register accessesStephan Gerhold
We need the USB clocks to do accesses like wait_for_bit_le32(&ehci->usbcmd, CMD_RESET, ...) so we should disable them only after all of them are done. At the moment this works only because the clock driver doesn't actually disabling these clocks in U-Boot. Fixes: 9b3a9f896e66 ("ehci: msm: bring up iface + core clocks") Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-3-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: echi-msm: Drop ulpi definitionsStephan Gerhold
These are unused. Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-2-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-30usb: host: ehci-msm: Fix pointer checkStephan Gerhold
dev_read_addr_ptr() returns a null pointer on error, not FDT_ADDR_T_NONE. Fixes: 2be1130a9305 ("usb: ehci-msm: Use dev interface to get device address") Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Acked-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Sam Day <me@samcday.com> Link: https://patch.msgid.link/20250407-ehci-msm-fixes-v1-1-f8b30eb05d07@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-10-28usb: musb-new: Cannot test unsigned member to be negativeAndrew Goodbody
You cannot test an unsigned member of a struct for being negative, the test will always fail. Instead assign the return value of fdtdec_get_int, which returns an int, to a temporary variable declared as an int, so that it can be tested for being negative before being assigned to the unsigned struct member. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2025-10-28usb: musb-new: Limit check array index before useAndrew Goodbody
epnum is used as an index into an array. The limit check for this index should be performed before using it to access an element in the array to prevent possible bounds overrun. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-10-28usb: musb-new: Null check before dereferenceAndrew Goodbody
A null check for the variable 'data' was introduced before dereferencing it for set_phy_power but other uses were not so protected. Add the null check for other dereferences of 'data'. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2025-10-28usb: xhci: exynos: variable node should be signedAndrew Goodbody
The variable node is assigned to the return value of a function that returns an int. It is tested for being negative and then passed as an argument to a function that takes an int. So 'node' should not be declared as unsigned. Correct it. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2025-10-28usb: ulpi: Incorrect operator usedAndrew Goodbody
Combining two bits into a mask to be used so that the same write code can be used to set or reset bits in a register clearly needs to use the binary 'or' operator, not the binary 'and'. Fix it. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2025-10-28usb: ohci-hcd: Null check lurb_priv before dereferenceAndrew Goodbody
When a variable needs a null check before it is dreferenced ensure that this is done even in the case of assignment on declaration. This was not happening for lurb_priv so correct it. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2025-10-28usb: fsl-dt-fixup: Return an error code on errorAndrew Goodbody
fsl_fdt_fixup_usb_erratum uses strcmp to detect an error but then returns 'err' without it being set to an error. Calling code may not detect that an error occurred leading to a silent failure. Instead just return -EINVAL. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>