summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
Commit message (Collapse)AuthorAgeFilesLines
* usb: dwc3: of-simple: remove unmatchable compatiblesAhmad Fatoum2024-01-111-6/+0
| | | | | | | | | | Only three of the compatibles listed exist in up-to-date upstream device trees. As barebox need not worry about backwards compatibility with older device trees, remove the rest that would never be matched. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240108132721.1666173-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-132-0/+2
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2023-04-197-1664/+3218
|\
| * usb: dwc3: sync with Linux-6.3-rc2Sascha Hauer2023-03-247-1646/+3201
| | | | | | | | | | | | | | | | | | | | | | | | Our DWC3 driver is based on a relatively old Kernel driver. Although it is updated from Linux-5.2 once, it still shows traces of an U-Boot driver taken from Linux-3.19. The driver misbehaves in gadget mode, like for example it gets stuck when the USB cable is unplugged and plugged again. Do a fresh port from Linux-6.3-rc2. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: Update core to Linux-6.3-rc2Sascha Hauer2023-03-241-2/+1
| | | | | | | | | | | | Our usbgadget stack is quite outdated. Sync core.c with Linux-6.3-rc2. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: ch9: Update from Linux KernelSascha Hauer2023-03-203-15/+15
| | | | | | | | | | | | | | | | Update ch9.h from Linux-6.3-rc2. Linux has split up the file into a kernel and a uapi portion. We do the same for barebox for easier updating in the future. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: move include files to place where Linux has themSascha Hauer2023-03-204-7/+7
| | | | | | | | | | | | | | | | | | For easier patch merging and comparison with Linux move the usb gadget files to where Linux has them. For now do a plain git mv include/usb include/linux/usb, eventhough there might be some files which are purely barebox specific. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: populate parent of xHCI devAhmad Fatoum2023-04-171-4/+4
|/ | | | | | | | | | Reparent xHCIs instantiated from DWC3 controllers to their parents instead of them being direct children of the bus. Apart from improving devinfo/drvinfo output, this should introduce no functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230414145259.3644816-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: Use clk_bulk_get_all()Sascha Hauer2023-03-031-40/+4
| | | | | | | | | | The binding described three clocks, but not all SoCs actually provide all three clocks. For example Xilinx Zynqmp doesn't have s suspend clock. Use clk_bulk_get_all() to get all clocks that are actually there. Link: https://lore.barebox.org/20230303134530.102237-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-102-2/+2
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-105-15/+15
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-102-12/+12
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: support snps,dis-u2-freeclk-exists-quirk for i.MX8MPHans Christian Lonstad2022-09-171-0/+2
| | | | | | | | | | | | | | | | | | | | The driver currently configures the Synopsis USB 3.0/2.0 PHY to unconditionally provide a free-running PHY clock. This must be disabled on the i.MX8MP as well as RK3328 and RK3399 SoC, because the clock control input is inactive. The upstream Linux binding specifies a boolean DT property snps,dis-u2-freeclk-exists-quirk to disable the free-running PHY clock and the property is already used in the i.MX8MP DT, that barebox imports from upstream. Thus implement the binding for barebox. This fixes barebox USB host support on the i.MX8MP, which previously triggered a BUG() when enumerating[1]. Link: https://github.com/saschahauer/barebox/issues/13 [1] Fixes: e213627bbe1d ("usb: dwc3: of-simple: add i.MX8MP compatible") Signed-off-by: Hans Christian Lønstad <hcl@datarespons.no> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-05-191-10/+40
|\
| * usb: dwc3: align dwc3 clocks with bindingMichael Riesch2022-05-111-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device tree bindings snps,dwc3.yaml and rockchip,dwc3.yaml specify different clock names. This inconsistency did not matter in the past as the snps,dwc3 used to be a subnode of the rockchip,rk3xyz-dwc3 glue node. For the RK356x, however, a different approach is used and the two nodes are merged. Therefore, the dwc3 driver must accept both groups of clock names. This step is a prerequisite for replacing the initial rk3568.dtsi in arch/arm/dts with the mainline Linux version. For compatibility, the former is updated accordingly. This also illustrates the migration from glue node and subnode to a single device tree node. Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.barebox.org/20220509113618.1602657-3-michael.riesch@wolfvision.net Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: of-simple: add i.MX8MP compatibleLucas Stach2022-04-141-0/+1
|/ | | | | | | | | | | The DWC3 DT node in the i.MX8MP is contained in a wrapper node for the glue logic. Linux uses this wrapper for wakeup handling, but we don't need this functionality in Barebox, so we can just handle it with the of-simple DWC3 driver. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Link: https://lore.barebox.org/20220412195241.126535-2-l.stach@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-2211-11/+11
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-151-0/+1
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rockchip'Sascha Hauer2021-11-152-0/+13
|\ \
| * | usb: dwc3: reset controller before using itSascha Hauer2021-10-122-0/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | Some dwc3 controllers have a reset assigned to them. Request it and reset the device before using it. Linux upstream driver uses an array of resets here, but in barebox we currently do have this functionality, so for now use the first reset only. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20211012073352.4071559-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / usb: dwc3: remove unneeded EPROBE_DEFER checkAhmad Fatoum2021-11-011-2/+0
|/ | | | | | | | We early exit on all errors, so no need to single out EPROBE_DEFER. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175446.2274194-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: Use _io functions on dma coherent memorySascha Hauer2021-06-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On both ARM and ARM64 we map DMA coherent memory the same as IO memory. This has the effect that unaligned accesses are not possible on DMA coherent memory. The dwc3 gadget driver uses memset() and memcpy() on that memory which may generate unaligned accesses and result in data aborts. Use memcpy_fromio() and memset_io() instead which are desgined to work on IO space and thus do not generate unaligned accesses. The alternative would be to map DMA coherent memory as MT_NORMAL_NC instead of MT_DEVICE_nGnRnE, but that require us to add memory barriers to drivers which we currently do not have. SO instead of risking regressions in drivers we take the easy way out and avoid unaligned accesses in the dwc3 driver. In this concrete case the dwc3 driver generated unaligned accesses on a Rockchip RK3568 ARM64 system. The driver copies data out of the receive queue. In my case first 4 bytes were copied, both source and target were aligned. The second access then copied more data beginning at the place where the first memcpy stopped. On this 4byte aligned address memcpy generated an 8byte read access which resulted in a data abort. On an ARM32 system this might not be a problem as that place, while not 8byte aligned, is still 4byte aligned, enough for a 32bit system. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210622074545.17059-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3-of-simple: Use clk_bulk APISascha Hauer2020-09-241-48/+10
| | | | | | | | | | Use clk_bulk_get_all() to retrieve all clocks rather than open code this. Also actually enable the clocks, previously they had been disabled in the error path, but never enabled before. Also this fixes a memory corruption: The driver populated an array of clks, but only allocated space for a single entry. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: Whitespace cleanupSascha Hauer2020-09-231-3/+3
| | | | | | Replace spaces with tabs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2019-12-103-10/+15
|\
| * usb: dwc3: register otg deviceSascha Hauer2019-11-213-4/+12
| | | | | | | | | | | | | | When the role in the device tree is specified as "otg" then register a otg device in barebox so that the user can configure the desired mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: dwc3: remove unnecessary warningSascha Hauer2019-11-211-6/+3
| | | | | | | | | | | | | | | | | | The dwc3 driver warns when the value written to DWC3_GFLADJ happens to be same as already read from the register. This always happens when the driver was previously running when started 2nd stage from another barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: dual role mode needs gadget supportLucas Stach2019-12-021-0/+1
| | | | | | | | | | | | | | | | Obviously the mode where both host and gadget mode are available also needs to depend on the Barebox gadget support. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: depend on OFDEVICELucas Stach2019-12-021-0/+1
|/ | | | | | | | | | The DWC3 driver uses some functions which are only available when Barebox is built with OFDEVICE support. Since there is no platform without DT support suing DWC3 we can reasonably depend on this config option. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: Remove wrong error messagesSascha Hauer2019-11-141-2/+0
| | | | | | | When phy_get() returns -ENOSYS or -ENODEV it means we can go without phy. Do not print an error message in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: add support for gadget modeSteffen Trumtrar2019-09-178-20/+5094
| | | | | | | | Expand the DWC3 usb core with gadget support. Patches imported and adopted from Linux v5.2. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: Toggle GCTL.CORESOFTRESET as a first stepAndrey Smirnov2019-03-181-0/+21
| | | | | | | | | | | | | Toggle GCTL.CORESOFTRESET before trying to access any of the block's registers. Without this additional step, first read of DWC3_GHWPARAMS* that follows results in assertion of GSTS.CSRTIMEOUT and IP block stuck in a non-functional state. Note that all above has only been observerd on i.MX8MQ (ZII Zest board) for USB1 controller. USB2 doesn't seem to be affected by this. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Import DWC3 USB controller driver from LinuxAndrey Smirnov2019-02-227-0/+2780
Import DWC3 USB controller driver from Linux. This is a bare minimum port of the code needed to support USB host functionality on i.MX8MQ. No other use-case is explicitly supported. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>