aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* usb: dwc3-generic: Add STih407 supportPatrice Chotard2025-02-113-0/+143
| | | | | | | | | | | | Add STi glue logic to manage the DWC3 HC on STiH407 SoC family. It configures the internal glue logic and syscfg registers. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20250130163547.512990-6-patrice.chotard@foss.st.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* usb: dwc3-generic: Reorder includePatrice Chotard2025-02-111-16/+4
| | | | | | | | | | | | | | Reorder include following rules available here : https://docs.u-boot.org/en/latest/develop/codingstyle.html#include-files Remove useless include files. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Link: https://lore.kernel.org/r/20250130163547.512990-5-patrice.chotard@foss.st.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* usb: dwc3: Remove dwc3 glue driver support for STiPatrice Chotard2025-02-113-263/+0
| | | | | | | | | | | STi will migrate to dwc3-generic driver, dwc3-sti-glue driver can be removed. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20250130163547.512990-4-patrice.chotard@foss.st.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* usb: gadget: f_mass_storage: Add schedule() in sleep_thread()Patrice Chotard2025-02-111-0/+1
| | | | | | | | | | | | | | 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 <patrice.chotard@foss.st.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20241202074644.5380-1-patrice.chotard@foss.st.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* usb: gadget: g_dnl: Fix NULLPTR dereference when serial# is unsetMichael Ferolito2025-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | 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 <michaelsunn101@gmail.com> Cc: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20250128030945.1219589-1-michaelsunn101@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* blk: Make block subsystems select BLKTom Rini2025-01-201-0/+1
| | | | | | | | | | | | The BLK symbol has a few meanings, one of which is that it controls the driver model portion of a "block device". Rather than having this hidden symbol be "default y if ..." it should be select'd by the various block subsystems. Symbols such as PVBLOCK which already select'd BLK are unchanged". Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Tom Rini <trini@konsulko.com>
* usb: ehci-mx6: Add i.MX95 supportMarek Vasut2025-01-131-5/+5
| | | | | | | | i.MX95 uses the same USB IP as i.MX8MM. It can then reuse the ehci-mx6 driver. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Fabio Estevam <festevam@gmail.com>
* usb: ehci-mx6: Use regulator_set_enable_if_allowedMarek Vasut2025-01-091-3/+3
| | | | | | | | | | | | | | | With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators. Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled. Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed") Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* usb: ehci-mx5: Use regulator_set_enable_if_allowedMarek Vasut2025-01-091-3/+3
| | | | | | | | | | | | | | | With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators. Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled. Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed") Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* Merge tag 'v2025.01-rc5' into nextWIP/25Dec2024-nextTom Rini2024-12-254-6/+6
|\ | | | | | | Prepare v2025.01-rc5
| * usb: renesas: Fix R-Car spellingMarek Vasut2024-12-114-6/+6
| | | | | | | | | | | | | | 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 <marek.vasut+renesas@mailbox.org>
* | Merge patch series "AM62A DWC3: Add support for USB DFU boot in OTG mode"Tom Rini2024-12-131-4/+5
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Siddharth Vadapalli <s-vadapalli@ti.com> says: Hello, This series adds support for USB DFU boot on TI's AM62A SoC which has two instances of DWC3 USB Controllers namely USB0 and USB1. The USB0 instance of the USB Controller supports USB DFU boot: ROM => tiboot3.bin => tispl.bin => u-boot.img USB DFU Boot requires the USB Controller to be configured for Gadget mode of operation. Since the USB0 instance of the DWC3 USB Controller supports both Host and Gadget modes of operation via the Type-C interface on the AM62A7-SK board, the device-tree specifies the "dr_mode" as "OTG". However, there is currently no support for dynamically switching the "mode" from Host to Gadget and vice-versa with the help of a state-machine. The OTG mode is treated as a separate mode in itself rather than being treated as an intermediate stage before assuming the Host/Gadget mode. Due to this, USB DFU boot via the Type-C interface doesn't work as the USB Controller hasn't been appropriately configured for Device/Gadget mode of operation. One option is to change the device-tree to specify "dr_mode" as "peripheral" and force the controller to assume the Device role. This will imply that the U-Boot device-tree for AM62A diverges from its Linux counterpart. Therefore, with the intent of keeping the device-tree uniform across Linux and U-Boot, and at the same time, in order to enable USB DFU boot in "OTG" mode with the DWC3 Controller, the first patch in this series sets the "mode" on the basis of the caller function, rather than using the "dr_mode" property in the device-tree. There are only two callers of "dwc3_generic_probe()", each of which clearly specify the expected mode of configuration. This will enable both Host and Device mode of operation based on the command executed by the user, thereby truly supporting "OTG" functionality when the USB Controller supports it. The second patch in this series adds USB DFU environment for AM62A, enabling USB DFU Boot and USB DFU flash on AM62A. In addition to the patches in this series, the following device-tree changes will be required to test USB DFU on AM62A (bootph-all property to be added to ensure that USB Controller is present at all stages for DFU Boot): https://gist.github.com/Siddharth-Vadapalli-at-TI/53ba02cb0ff4a09c47e920d08247065f The above device-tree changes will be made to the Linux device-tree, which shall ensure that the same shall be a part of U-Boot device-tree eventually. The USB DFU config fragments for AM62x have been used for enabling USB DFU boot on AM62a as follows: R5 => am62ax_evm_r5_defconfig + am62x_r5_usbdfu.config A53 => am62ax_evm_a53_defconfig + am62x_a53_usbdfu.config Logs validating USB DFU boot with this series: https://gist.github.com/Siddharth-Vadapalli-at-TI/daa71da1b0e478a51afea42605fb2d2c Link: https://lore.kernel.org/r/20241126120322.1760862-1-s-vadapalli@ti.com
| * usb: dwc3-generic: set "mode" based on caller of dwc3_generic_probe()Siddharth Vadapalli2024-12-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are only two callers of "dwc3_generic_probe()", namely: 1. dwc3_generic_peripheral_probe() 2. dwc3_generic_host_probe() Currently, the "mode" is set based on the device-tree node of the platform device. Also, the DWC3 core doesn't support updating the "mode" dynamically at runtime if it is set to "OTG", i.e. "OTG" is treated as a separate mode in itself, rather than being treated as a mode which should eventually lead to "host"/"peripheral". Given that the callers of "dwc3_generic_probe()" clarify the expected "mode" of the USB Controller, use that "mode" instead of the one specified in the device-tree. This shall allow the USB Controller to function both as a "Host" and as a "Peripheral" when the "mode" is "otg" in the device-tree, based on the caller of "dwc3_generic_probe()". Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Roger Quadros <rogerq@kernel.org>
* | Merge tag 'u-boot-dfu-20241126' of ↵Tom Rini2024-11-262-1/+24
|\ \ | |/ |/| | | | | | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-dfu CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/23572 - Fastboot: - handle unknown partition type as "raw" - USB gadget: - Fix ci_udc gadget driver for Tegra 2 devices by not using USBADRA
| * usb: ci_udc: don't use "advance" feature when setting addressIon Agorria2024-11-262-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20241126072956.64778-2-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* | eth: asix88179: packet drop when receiving large fragmented packetsKhoa Hoang2024-11-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ASIX 88179A drops packets when receiving fragmented packets larger than the MTU size due to an insufficient URB buffer size. This change synchronizes the URB buffer size with the configuration used in the Linux kernel, resolving the packet drop issue. To reproduce the issue, set the following configuration: CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 Then, run the `tftp` command. It will fail with a timeout error: U-Boot> tftp zero.bin Using ax88179_eth device TFTP from server 10.0.0.196; our IP address is 10.0.0.18 Filename 'zero.bin' Load address: 0x10000000 Loading: T T T T T T T T T T T Retry count exceeded; starting again Signed-off-by: Khoa Hoang <admin@khoahoang.com> Reviewed-by: Marek Vasut <marex@denx.de>
* | eth: asix88179: Fix ASIX AX88179A PHY hangKhoa Hoang2024-11-251-2/+31
|/ | | | | | | | | | | | | | | | | | | | | The ASIX AX88179A locks up when the ADVERTISE_NPAGE bit is set in the MII_ADVERTISE register, suggesting that this feature may be broken or unsupported on this chip. In the Linux kernel, this bit is not set, and enabling it also causes the PHY to lock up and stay in a link-down state. Additionally, the AX88179 and AX88179A variants do not appear to support the ADVERTISE_LPACK bit, as setting it consistently reads back as 0. This patch removes the ADVERTISE_NPAGE and ADVERTISE_LPACK bits from the MII_ADVERTISE register configuration. It also resets the PHY before modifying the MII_ADVERTISE register, then restarts auto-negotiation, following the same flow used in the U-Boot asix.c driver. Signed-off-by: Khoa Hoang <admin@khoahoang.com> Reviewed-by: Marek Vasut <marex@denx.de>
* Merge patch series "Implement ACPI on aarch64"WIP/27Oct2024Tom Rini2024-10-273-0/+84
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patrick Rudolph <patrick.rudolph@9elements.com> says: Based on the existing work done by Simon Glass this series adds support for booting aarch64 devices using ACPI only. As first target QEMU SBSA support is added, which relies on ACPI only to boot an OS. As secondary target the Raspberry Pi4 was used, which is broadly available and allows easy testing of the proposed solution. The series is split into ACPI cleanups and code movements, adding Arm specific ACPI tables and finally SoC and mainboard related changes to boot a Linux on the QEMU SBSA and RPi4. Currently only the mandatory ACPI tables are supported, allowing to boot into Linux without errors. The QEMU SBSA support is feature complete and provides the same functionality as the EDK2 implementation. The changes were tested on real hardware as well on QEMU v9.0: qemu-system-aarch64 -machine sbsa-ref -nographic -cpu cortex-a57 \ -pflash secure-world.rom \ -pflash unsecure-world.rom qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \ -smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \ -dtb bcm2711-rpi-4-b.dtb -nographic Tested against FWTS V24.03.00. Known issues: - The QEMU rpi4 support is currently limited as it doesn't emulate PCI, USB or ethernet devices! - The SMP bringup doesn't work on RPi4, but works in QEMU (Possibly cache related). - PCI on RPI4 isn't working on real hardware since the pcie_brcmstb Linux kernel module doesn't support ACPI yet. Link: https://lore.kernel.org/r/20241023132116.970117-1-patrick.rudolph@9elements.com
| * drivers: usb: Add generic XHCIPatrick Rudolph2024-10-273-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the generic XHCI driver that contains no SoC specific code. It can be used on platforms that simply work out of the box, like on emulated platforms. TEST: Booted on QEMU sbsa machine using the generic xhci driver. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Marek Vasut <marex@denx.de>
* | Merge tag 'u-boot-dfu-20241017' of ↵Tom Rini2024-10-175-7/+32
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-dfu u-boot-dfu-20241017 CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/22742 Usb Gadget: - Fix cdns3 endpoint configuration by setting maxpacket - Fix dwc3 cache handling when using DMA Fastboot: - Make AVB_VERIFY depends on FASTBOOT
| * | usb: dwc3: invalidate dcache on buffer used in interrupt handlingNeil Armstrong2024-10-153-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Qualcomm systems, the setup buffer and even buffers are in a bad state at interrupt handling, so invalidate the dcache lines for the setup_buf and event buffer to make sure we read correct data written by the hardware. This fixes the following error: dwc3-generic-peripheral usb@a600000: UNKNOWN IRQ type -1 dwc3-generic-peripheral usb@a600000: UNKNOWN IRQ type 4673109 and invalid situation in dwc3_gadget_giveback() because setup_buf content is read at 0s and leads to fatal crash fixed by [1]. [1] https://lore.kernel.org/all/20240528-topic-sm8x50-dwc3-gadget-crash-fix-v1-1-58434ab4b3d3@linaro.org/ Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20241011-u-boot-dwc3-gadget-dcache-fixup-v4-3-5f3498d8035b@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
| * | usb: dwc3: fix dcache flush range calculationNeil Armstrong2024-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current flush operation will omit doing a flush/invalidate on the first and last bytes if the base address and size are not aligned with CACHELINE_SIZE. This causes operation failures Qualcomm platforms. Take in account the alignment and size of the buffer and also flush the previous and last cacheline. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20241011-u-boot-dwc3-gadget-dcache-fixup-v4-2-5f3498d8035b@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
| * | usb: dwc3: allocate setup_buf with dma_alloc_coherent()Neil Armstrong2024-10-153-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since setup_buf is also consumed by hardware DMA, aligns it's allocation like other hardware buffers by introduce setup_buf_addr populated by dma_alloc_coherent(), and use it to pass the physical address of the buffer to the hardware. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20241011-u-boot-dwc3-gadget-dcache-fixup-v4-1-5f3498d8035b@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
| * | usb: gadget: cdns3: Fix cdns3_ep_config() by setting ep.maxpacketSiddharth Vadapalli2024-10-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function cdns3_ep_config() calculates the maximum packet size based on the Endpoint Type and the Gadget Speed and stores it in the variable "max_packet_size". This value is then programmed in the USB Controller for the corresponding Endpoint. This may result in a mismatch between the maximum packet size programmed in the USB controller and the maximum packet size seen by the UDC Core via "maxpacket" member of "struct usb_ep". Additionally, since TD_SIZE is calculated in cdns3_ep_run_transfer() on the basis of the maximum packet size stored in the "maxpacket" member of "struct usb_ep", it may lead to an incorrect value of TD_SIZE when compared with what the USB controller actually expects (max_packet_size). Fix this. Fixes: 7e91f6ccdc84 ("usb: Add Cadence USB3 host and gadget driver") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20241007121927.1680039-1-s-vadapalli@ti.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* | | usb: tcpm: fusb302: add driverSebastian Reichel2024-10-174-0/+1509
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the TCPM framework exists we can introduce fusb302 driver using it. This chip is a very common USB-C controller chip with PD support, which can be found in the Radxa Rock 5B among many other boards. Apart from Power Delivery, it also handles detection of the cable orientation. That can be used to control a mux for connecting the right USB3 lane pair to the USB3 controller. The driver is originally from the Linux kernel, but has been adapted to the requirements of U-Boot and its TCPM framework. Co-developed-by: Wang Jie <dave.wang@rock-chips.com> Signed-off-by: Wang Jie <dave.wang@rock-chips.com> Tested-by: Soeren Moch <smoch@web.de> Tested-by: Anand Moon <linux.amoon@gmail.com> Reviewed-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | | usb: tcpm: add core frameworkSebastian Reichel2024-10-176-0/+2623
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds TCPM framework in preparation for fusb302 support, which can handle USB power delivery messages. This is needed to solve issues with devices, that are running from a USB-C port supporting USB-PD, but not having a battery. Such a device currently boots to the kernel without interacting with the power-supply at all. If there are no USB-PD message replies within 5 seconds, the power-supply assumes the peripheral is not capable of USB-PD. It usually takes more than 5 seconds for the system to reach the kernel and probe the I2C based fusb302 chip driver. Thus the system always runs into this state. The power-supply's solution to fix this error state is a hard reset, which involves removing the power from VBUS. Boards without a battery (or huge capacitors) will reset at this point resulting in a boot loop. This imports the TCPM framework from the kernel. The porting has originally been done by Rockchip using hardware timers and the Linux kernel's TCPM code from some years ago. I had a look at upgrading to the latest TCPM kernel code, but that beast became a lot more complex due to adding more USB-C features. I believe these features are not needed in U-Boot and with multiple kthreads and hrtimers being involved it is non-trivial to port them. Instead I worked on stripping down features from the Rockchip port to an even more basic level. Also the TCPM code has been reworked to avoid complete use of any timers (Rockchip used SoC specific hardware timers + IRQ to implement delayed work mechanism). Instead the delayed state changes are handled directly from the poll loop. Note, that (in contrast to the original Rockchip port) the state machine has the same hard reset quirk, that the kernel has - i.e. it avoids disabling the CC pin resistors for devices that are not self-powered. Without that quirk, the Radxa Rock 5B will not just end up doing a machine reset when a hard reset is triggered, but will not even recover, because the CPU will loose power and the FUSB302 will keep this state because of leak voltage arriving through the RX serial pin (assuming a serial adapter is connected). This also includes a 'tcpm' command, which can be used to get information about the current state and the negotiated voltage and current. Co-developed-by: Wang Jie <dave.wang@rock-chips.com> Signed-off-by: Wang Jie <dave.wang@rock-chips.com> Tested-by: Soeren Moch <smoch@web.de> Tested-by: Anand Moon <linux.amoon@gmail.com> Reviewed-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | | net: introduce alternative implementation as net/lwip/Jerome Forissier2024-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net/lwip/ directory and the NET_LWIP symbol. Network support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP. SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols that are part of NET (such as arp_init(), arp_timeout_check(), arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be added later. Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP because of dependencies on net_loop(), tftp_timeout_ms, tftp_timeout_count_max and other NET things. Let's add a dependency on !NET_LWIP for now. SANDBOX can select NET_LWIP but doing so will currently disable the eth dm tests as well as the wget tests which have strong dependencies on the NET code. Other adjustments to Kconfig files are made to fix "unmet direct dependencies detected" for USB_FUNCTION_SDP and CMD_FASTBOOT when the default networking stack is set to NET_LWIP ("default NET_LWIP" instead of "default NET" in Kconfig). The networking stack is now a choice between NO_NET, NET and NET_LWIP. Therefore '# CONFIG_NET is not set' should be 'CONFIG_NO_NET=y'. Adjust the defconfigs accordingly. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* | | usb: xhci: pet watchdog during transfersGodfrey Mwangi2024-10-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some platforms with low USB throughput, tranfers of huge files take a long time and watchdog timer can expire resulting in hardware reset. Avoid this by petting the watchdog as long as we have pending transfers. Signed-off-by: Godfrey Mwangi <godmwan@microsoft.com> Reviewed-by: Marek Vasut <marex@denx.de>
* | | Merge branch 'staging' of https://source.denx.de/u-boot/custodians/u-boot-tegraTom Rini2024-10-131-22/+114
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assorted Tegra enhancements. Merged with the recent XPL_BUILD changes, resolve some whitespace issues and fix the name of the new apalis-tk1 env file by Tom. Signed-off-by: Tom Rini <trini@konsulko.com>
| * | | usb: host: tegra: get usb phy configuration from phy nodeSvyatoslav Ryhel2024-10-131-22/+114
| |/ / | | | | | | | | | | | | | | | | | | Obtain USB phy configuration from phy node if such exists and is enabled. If no, set default values. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
* | | Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD"WIP/11Oct2024Tom Rini2024-10-119-25/+25
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simon Glass <sjg@chromium.org> says: When the SPL build-phase was first created it was designed to solve a particular problem (the need to init SDRAM so that U-Boot proper could be loaded). It has since expanded to become an important part of U-Boot, with three phases now present: TPL, VPL and SPL Due to this history, the term 'SPL' is used to mean both a particular phase (the one before U-Boot proper) and all the non-proper phases. This has become confusing. For a similar reason CONFIG_SPL_BUILD is set to 'y' for all 'SPL' phases, not just SPL. So code which can only be compiled for actual SPL, for example, must use something like this: #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) In Makefiles we have similar issues. SPL_ has been used as a variable which expands to either SPL_ or nothing, to chose between options like CONFIG_BLK and CONFIG_SPL_BLK. When TPL appeared, a new SPL_TPL variable was created which expanded to 'SPL_', 'TPL_' or nothing. Later it was updated to support 'VPL_' as well. This series starts a change in terminology and usage to resolve the above issues: - The word 'xPL' is used instead of 'SPL' to mean a non-proper build - A new CONFIG_XPL_BUILD define indicates that the current build is an 'xPL' build - The existing CONFIG_SPL_BUILD is changed to mean SPL; it is not now defined for TPL and VPL phases - The existing SPL_ Makefile variable is renamed to SPL_ - The existing SPL_TPL Makefile variable is renamed to PHASE_ It should be noted that xpl_phase() can generally be used instead of the above CONFIGs without a code-space or run-time penalty. This series does not attempt to convert all of U-Boot to use this new terminology but it makes a start. In particular, renaming spl.h and common/spl seems like a bridge too far at this point. The series is fully bisectable. It has also been checked to ensure there are no code-size changes on any commit.
| * | | global: Rename SPL_TPL_ to PHASE_Simon Glass2024-10-112-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use PHASE_ as the symbol to select a particular XPL build. This means that SPL_TPL_ is no-longer set. Update the comment in bootstage to refer to this symbol, instead of SPL_ Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | global: Rename SPL_ to XPL_Simon Glass2024-10-115-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use XPL_ as the symbol to indicate an SPL build. This means that SPL_ is no-longer set. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | | drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILDSimon Glass2024-10-114-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Use the new symbol to refer to any 'SPL' build, including TPL and VPL Signed-off-by: Simon Glass <sjg@chromium.org>
* | | | usb: dwc3-generic: fix CONFIG_DM_REGULATOR-off caseJan Kiszka2024-10-111-3/+3
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | When DM_REGULATOR is disabled, all calls will return -ENOSYS. Account for that so that targets like the IOT2050 will work again. Fixes: de451d5d5b6f ("usb: dwc3-generic: support external vbus regulator") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
* | | usb: gadget: usbhs: Add Renesas USBHS device driverVitaliy Vasylskyy2024-10-0113-0/+4735
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | Add UDC driver for Renesas USBHS controller found in R-Car Gen3 SoCs. This is mostly ported from the Linux kernel, with additional porting glue. The code has been synchronized with 1b4861e32e46 ("Linux 6.9.3") and cleaned up and ported to DM since the original implementation by Vitaliy. Signed-off-by: Vitaliy Vasylskyy <vitaliy.vasylskyy@globallogic.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240908230654.286062-1-marek.vasut+renesas@mailbox.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* | Merge tag 'v2024.10-rc6' into nextTom Rini2024-09-302-0/+14
|\ \ | | | | | | | | | Prepare v2024.10-rc6
| * \ Merge tag 'u-boot-dfu-20240930' of ↵WIP/30Sep2024Tom Rini2024-09-301-0/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-dfu u-boot-dfu-20240930 - Fix Kconfig dependencies for DFU_OVER_USB
| | * | dfu: fix Kconfig dependenciesJerome Forissier2024-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix link errors caused by missing Kconfig dependencies: 1. DFU_OVER_USB compiles common/dfu.c which calls g_dnl_clear_detach() which is implemented in drivers/usb/gadget/g_dnl.c which needs USB_GADGET_DOWNLOAD. Test case: $ printf "CONFIG_USB_GADGET_DOWNLOAD=n\nCONFIG_USB_FUNCTION_FASTBOOT=n" \ >>configs/am62px_evm_a53_defconfig $ make am62px_evm_a53_defconfig $ make CROSS_COMPILE=aarch64-linux-gnu- [...] common/dfu.c:34:(.text.run_usb_dnl_gadget+0x68): undefined reference to `g_dnl_clear_detach [...] 2. With the above fixed, the same build causes: common/spl/spl_dfu.c:29:(.text.spl_dfu_cmd+0xb0): undefined reference to `run_usb_dnl_gadget' This is because SPL_DFU compiles common/spl/spl_dfu.c which calls run_usb_dnl_gadget() which is implemented in common/dfu.c which needs DFU_OVER_USB. Therefore add these dependencies to Kconfig. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Link: https://lore.kernel.org/r/20240910102751.3182982-1-jerome.forissier@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
| * | | usb: gadget: cdns3: Fix missing cache operations for non-zero EndpointsSiddharth Vadapalli2024-09-301-0/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transfer initiation and completion for the non-zero Endpoints are handled by cdns3_ep_run_transfer() and cdns3_transfer_completed() respectively. Failing to flush the cache associated with the TRB Pool within cdns3_ep_run_transfer() results in the transfers never being initiated. Similarly, failing to invalidate the cache associated with the TRB pool within cdns3_transfer_completed() results in the transfers never being completed. Fix this. Fixes: 7e91f6ccdc84 ("usb: Add Cadence USB3 host and gadget driver") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Marek Vasut <marex@denx.de>
* | / spl: ram: hide SPL_RAM_SUPPORTJerome Forissier2024-09-241-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make SPL_RAM_SUPPORT a hidden Kconfig symbol, automatically selected by SPL_RAM_DEVICE or SPL_DFU. Avoids the situation where SPL_RAM_SUPPORT may be enabled without the other two being enabled, which results in the following build warning: common/spl/spl_ram.c:19:14: warning: ‘spl_ram_load_read’ defined but not used [-Wunused-function] 19 | static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, | ^~~~~~~~~~~~~~~~~ Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* | Merge patch series "Fix various bugs"WIP/18Sep2024-nextTom Rini2024-09-181-1/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simon Glass <sjg@chromium.org> says: This series includes the patches needed to make make the EFI 'boot' test work. That test has now been split off into a separate series along with the EFI patches. This series fixes these problems: - sandbox memory-mapping conflict with PCI - the fix for that causes the mbr test to crash as it sets up pointers instead of addresses for its 'mmc' commands - the mmc and read commands which cast addresses to pointers - a tricky bug to do with USB keyboard and stdio - a few other minor things
| * | usb: Drop old non-DM codeSimon Glass2024-09-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver model deadline for USB was in 2019, so drop the old USB keyboard code, to avoid needing to deal with the extra code path. Drop the unnecessary #ifdef around USB_KBD_BOOT_REPORT_SIZE while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
* | | phy: Extend generic_setup_phy() with PHY mode and submodeMarek Vasut2024-09-095-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend generic_setup_phy() parameter list with PHY mode and submode and call generic_phy_set_mode() in generic_setup_phy(), so the generic PHY setup function can configure the PHY into correct mode before powering the PHY up. Update all call sites of generic_setup_phy() as well, all of which are USB host related, except for DM test which now behaves as a USB host test. Note that if the PHY driver does not implement the .set_mode callback, generic_phy_set_mode() call returns 0 and does not error out, so this should not break any existing systems. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
* | | Merge tag 'u-boot-imx-next-20240902' of ↵WIP/02Sep2024-nextTom Rini2024-09-021-0/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/22211 - Enable SPI NOR flash support and MTD partitions for phycore_imx8mp. - Convert mx6slevk to OF_UPSTREAM and watchdog DM. - Cleanup some mx5/mx6 USB options. - Make PLL settings configurable at board level. - Set CONFIG_SPL_LOAD_FIT_ADDRESS for verdin-imx8m/p. - Make the mxc-gpio reading state of GPIO pins in output mode to be consistent with the Linux kernel. - Add HUK derivation support for ELE AHAB.
| * | | usb: ehci-mx5: Add a default for CFG_MXC_USB_PORTSCFabio Estevam2024-08-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just like drivers/usb/host/ehci-mx6.c, add a default for drivers/usb/host/ehci-mx5.c. The motivation for doing this is to remove CFG_MXC_USB_PORTSC from board config files. All the mx5 boards, with the exeption of mx51evk, define CFG_MXC_USB_PORTSC as: #define CFG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) So move this definition as a default into ehci-mx5.c. Signed-off-by: Fabio Estevam <festevam@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Marek Vasut <marex@denx.de>
* | | | Merge tag 'v2024.10-rc4' into nextTom Rini2024-09-021-4/+2
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| Prepare v2024.10-rc4
| * | usb: gadget: ux500: Do not redefine ops if CONFIG_USB_MUSB_HOST setMarek Vasut2024-08-221-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case CONFIG_USB_MUSB_HOST is set, the ux500_gadget_ops get overridden to musb_usb_ops . Simply set the ops one way or the other depending on whether CONFIG_USB_MUSB_HOST is set or not. Fixes: ac4bf5d48a9e ("usb: gadget: ux500: Convert interrupt handling to usb_gadget_generic_ops") Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240818200425.89045-1-marek.vasut+renesas@mailbox.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
* | | spl: Create a function to init spl_load_infoSimon Glass2024-08-231-6/+2
| |/ |/| | | | | | | | | | | | | | | Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
* | Merge tag 'u-boot-dfu-next-20240820' of ↵WIP/20Aug2024-nextTom Rini2024-08-203-48/+213
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-dfu into next u-boot-dfu-next-20240820 - Migrate Atmel usb gadget to DM_USB_GADGET - More small cleanups/improvements on the atmel UDC driver - Change udc uclass name from "usb" -> "usb_gadget"