2541 Commits

Author SHA1 Message Date
Heinrich Schuchardt
7dbcc316a6 usb/xhci: avoid noisy 'Register NbrPorts' message
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-27 19:41:03 +01:00
Heinrich Schuchardt
2736ed925e usb: USB_EHCI_PCI depends on PCI
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-27 19:14:09 +01:00
Tom Rini
70c3b4c318 usb: gadget: Tighten CI_UDC dependencies
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-12 22:13:03 +01:00
Tom Rini
4ea93faceb usb: host: xhci: Make U_BOOT_DRIVER entries unique
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-12 22:13:03 +01:00
Tom Rini
91b9659273 usb: gadget: Tighten the dependency for DWC2 OTG support
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-12 22:13:03 +01:00
Peter Robinson
fa9864f1c4 usb: musb: drop musb legacy drivers
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-12 22:13:03 +01:00
Tom Rini
3b0945fb7b usb: gadget: spl: Add missing dependency for SPL_USB_GADGET
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-12 22:13:03 +01:00
Tom Rini
1c250e444a Merge tag 'u-boot-imx-master-20251104' of 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-04 13:06:26 -06:00
Ye Li
30c482fe6e usb: f_sdp: Update SDP driver to support PQC container
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-04 12:39:46 -03:00
Alice Guo
9a5f0724ea usb: ehci-mx6: Extend support to i.MX91, i.MX93, i.MX94, and i.MX95
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-04 12:39:45 -03:00
Yegor Yefremov
f0f23e0618 usb: musb-new: fix typos
Typos found via codespell utility.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-11-04 12:42:10 +01:00
Yegor Yefremov
c9838ec545 usb: musb-new: fix ti-musb dependencies
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-11-04 12:42:09 +01:00
Tom Rini
08bf42e1fa Merge tag 'qcom-for-2026.01-rc2' of 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: 8ef6ac07b3/pipelines
2025-10-30 11:06:44 -06:00
George Chan
934647d49c usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM
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-30 11:06:29 -06:00
Stephan Gerhold
ed733d40ec usb: host: ehci-msm: Register ULPI PHY through NOP wrapper
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-30 11:04:51 -06:00
Stephan Gerhold
f5ff016b44 usb: host: ehci-msm: Drop redundant EHCI register writes
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-30 11:04:51 -06:00
Stephan Gerhold
c45a043d8a usb: host: ehci-msm: Use clk bulk helpers
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-30 11:04:51 -06:00
Stephan Gerhold
2faabff358 usb: host: ehci-msm: Disable clocks after all register accesses
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-30 11:04:51 -06:00
Stephan Gerhold
e4e47da7e8 usb: host: echi-msm: Drop ulpi definitions
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-30 11:04:51 -06:00
Stephan Gerhold
fef8c84b57 usb: host: ehci-msm: Fix pointer check
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-30 11:04:51 -06:00
Andrew Goodbody
41fd18219f usb: musb-new: Cannot test unsigned member to be negative
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-28 16:35:05 +01:00
Andrew Goodbody
d5de67c57e usb: musb-new: Limit check array index before use
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-28 16:35:05 +01:00
Andrew Goodbody
6ea91bf805 usb: musb-new: Null check before dereference
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-28 16:35:05 +01:00
Andrew Goodbody
adcec085e0 usb: xhci: exynos: variable node should be signed
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-28 16:33:15 +01:00
Andrew Goodbody
dd01b0541b usb: ulpi: Incorrect operator used
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-28 16:33:15 +01:00
Andrew Goodbody
08f4c52c97 usb: ohci-hcd: Null check lurb_priv before dereference
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-28 16:33:15 +01:00
Andrew Goodbody
76d3b66531 usb: fsl-dt-fixup: Return an error code on error
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>
2025-10-28 16:33:15 +01:00
Andrew Goodbody
e41e6feb3d usb: ehci: exynos: variable node should be signed
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>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-10-28 16:33:15 +01:00
Tom Rini
0eaa4b3373 Merge branch 'next'
Merge the outstanding changes from the 'next' branch to master.
2025-10-06 13:20:24 -06:00
Tom Rini
dc6c80056e global: Add expected space between '#include' and directive
These files had '#include<file.h>' rather than '#include <file.h>' which
while functional is not the correct style.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-10-04 13:31:01 -06:00
Andrew Goodbody
8cd4a5e94b usb: dwc3: Remove redundant test
In dwc3_ep0_complete_data there is a test for 'r' being null and the
code will return at that point if so. After that point 'r' is guaranteed
to not be null and testing for that is redundant. Remove the test for
'r' being non-null.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Link: https://lore.kernel.org/r/20250929-dwc3_ep0-v1-1-1d5c58933bde@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-09-30 11:55:23 +02:00
Andrew Goodbody
5ac61383b2 usb: dwc2: Add missing null check
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 <andrew.goodbody@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Link: https://lore.kernel.org/r/20250929-usb_dwc2-v1-1-863133dcbcde@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-09-30 11:53:10 +02:00
Andrew Goodbody
f586675872 usb: gadget: atmel: Add missing null check
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 <andrew.goodbody@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Link: https://lore.kernel.org/r/20250929-atmel_usba_udc-v1-1-e1426271e12a@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-09-30 11:51:17 +02:00
Tom Rini
3285584429 usb: host: Tighten USB musb-new host glue driver dependencies
A few of the USB musb-new host glue drivers cannot build without access
to some platform specific header files. Express those requirements in
Kconfig as well.

Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2025-09-26 00:06:00 +02:00
Tom Rini
be8c07b606 usb: host: Tighten USB host driver dependencies
A few of the USB host drivers cannot build without access to some
platform specific header files. Express those requirements in Kconfig as
well.

Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2025-09-26 00:06:00 +02:00
Tom Rini
56edb1cc76 usb: gadget: max3420_udc: Remove unused driver
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 <trini@konsulko.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-09-26 00:06:00 +02:00
Tom Rini
219751e8c7 usb: gadget: bcm_udc_otg: Remove unused driver
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 <trini@konsulko.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-09-26 00:06:00 +02:00
Tom Rini
70553ec85f usb: gadget: Tighten requirements on USB_GADGET_ATMEL_USBA
This driver requires some mach-at91 specific header files in order to build.
Express that requirement in Kconfig as well.

Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2025-09-26 00:06:00 +02:00
Tom Rini
f83a9e5df4 usb: dwc3: Tighten driver glue dependencies
A few of the platform specific DWC3 host glue drivers cannot build
without access to some platform specific header files. Express those
requirements in Kconfig as well.

Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2025-09-26 00:06:00 +02:00
Tom Rini
c9800dc906 Merge patch series "Fix dma_addr_t for R5 SPL"
Anshul Dalal <anshuld@ti.com> says:

On various TI's K3 platforms boot failure was observed on SPI NOR since the
commit 5609f200d062 ("arm: Kconfig: enable LTO for ARCH_K3"). This issue was
root caused to stack corruption by the 'udma_transfer' function. Where the local
variable 'paddr' of type 'dma_addr_t' was being written to as a 64-bit value
which overwrote the stack frame of the caller (dma_memcpy) as only 32-bits had
been reserved for paddr on the stack, specifically the r4 register in the frame
of dma_memcpy was being overwritten with a 0.

drivers/dma/ti/k3-udma.c:2192:

	int udma_transfer(...)
	{
		...
		dma_addr_t paddr = 0;

		...
		/* paddr was written to as 64-bit value here */
		udma_poll_completion(uc, &paddr);
	}

drivers/dma/dma-uclass.c:234:

	int dma_memcpy(...)
	{
		dma_addr_t destination;
		dma_addr_t source;
		int ret;

		...

		/* This call resolves to udma_transfer */
		ret = ops->transfer(...);

		...

		dma_unmap_single(destination, ...);
		dma_unmap_single(...);
		return ret;
	}

Enabling LTO changed how gcc mapped local variables of dma_memcpy to CPU
registers, where earlier the bug was hidden since the overwritten register
'r4' was allotted to 'ret' but was allotted to 'destination' once LTO was
enabled. And since the overwritten value was 0, the bug remained undetected
as it just meant ret was 0, but having 'destination' set to 0 caused
dma_unmap_single to fail silently leading to boot failures.

The fix entails enabling DMA_ADDR_T_64BIT which changes dma_addr_t from u32 to
u64 for the R5 SPL thus reserving enough space for 'paddr' to prevent the
overflow.

Link: https://lore.kernel.org/r/20250903115207.572304-1-anshuld@ti.com
2025-09-11 10:03:12 -06:00
Anshul Dalal
e9e55fefb1 dma: ti: k3-udma: fix dma_addr_t typecasts
dma_addr_t is used to store any valid DMA address which might not
necessarily be the same size as host architecture's word size. Though
various typecasts in k3's dma and usb driver expect dma_addr_t to be the
same size as the word size.

This leads the compiler to throw a "cast from pointer to integer of
different size" warning when the condition is not met, for example when
enabling CONFIG_DMA_ADDR_T_64BIT for the R5 core.

Therefore this patch fixes the typecasts by using 'uintptr_t' as an
intermediary type which is guaranteed to be the same size as void* on
the host architecture. Thus, eliminating the compiler warning.

Signed-off-by: Anshul Dalal <anshuld@ti.com>
2025-09-11 10:03:02 -06:00
Tom Rini
328747974a Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung
- Fix issues reported by smatch
- exynos4210-origen cleanups
- e850-96 improvements
2025-09-05 08:15:16 -06:00
Sam Protsenko
3b36c242eb usb: host: dwc3-of-simple: Add exynos850 compatible
Enable support for Exynos850 SoC in DWC3 host glue layer driver.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2025-09-01 16:37:12 +09:00
Jonas Karlman
0f310a0895 usb: dwc3-generic: Use combined glue and ctrl node for RK3528
Like Rockchip RK3328, RK3568 and RK3588, the RK3528 also have a single
node to represent the glue and ctrl for USB 3.0.

Use rk_ops as driver data to select correct ctrl node for RK3528 DWC3.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-08-30 23:26:08 +08:00
Jonas Karlman
2d87afba58 usb: dwc3-generic: Use combined glue and ctrl node for RK3576
Like Rockchip RK3328, RK3568 and RK3588, the RK3576 also have a single
node to represent the glue and ctrl for USB 3.0.

Use rk_ops as driver data to select correct ctrl node for RK3576 DWC3.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-08-30 23:01:29 +08:00
Jonas Karlman
dd2c7df419 rockchip: Add default USB_GADGET_PRODUCT_NUM for RK3576
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 <jonas@kwiboo.se>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-08-30 23:01:28 +08:00
Tom Rini
9bd3fc8cd9 usb: gadget: rockchip: Fix spacing around the Kconfig option
This Kconfig option used spaces and not tabs for indentation. Switch to
tabs.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-08-30 22:41:16 +08:00
Tom Rini
571244f574 usb: gadget: rockchip: Add missing dependency
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 <trini@konsulko.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-08-30 22:41:16 +08:00
Andrew Goodbody
ae2cd1b52d usb: cdns3: Do not access memory after free
The call to cdns3_gadget_ep_free_request will free priv_req so do the
call to list_del_init which accesses the memory pointed to by priv_req
before the free.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
2025-08-29 13:12:41 +02:00
Patrick Delaunay
332714b905 usb: dwc2: fix reset logic in dwc2_core_reset
Use GUSBCFG_FORCEHOSTMODE to detected the HOST forced mode as it is done
in the Linux driver drivers/usb/dwc2/core.c:dwc2_core_reset().

The host polling must be executed only if the current mode is host,
either due to the force HOST mode (which persists after core reset)
or the connector id pin.

The GUSBCFG_FORCEDEVMODE bits is used to force the device mode (for
example used on STM32MP1x platform) and when it is activated the DWC2 reset
failed with the trace:
"dwc2_core_reset: Waiting for GINTSTS_CURMODE_HOST timeout"

Fixes: c5d685b8993c ("usb: dwc2: Unify flush and reset logic with v4.20a support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Junhui Liu <junhui.liu@pigmoral.tech>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
2025-08-23 18:20:01 +02:00