summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
AgeCommit message (Collapse)AuthorFilesLines
2020-01-20dwc3-generic: Add support for AM654 USB controllerVignesh Raghavendra1-0/+1
AM654 has DWC3 USB controller that is very similar to other TI SoCs. Add a new compatible to enable the same. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-12-21usb: dwc3: Fix UTMI/UTMIW phy interface initializationJagan Teki2-16/+16
DWC3 support phy interfaces like 8/16-bit UTMI+. phy interface initialization code would handle them properly along with UNKNOWN type by default if none of the user/board doesn't need to use the phy interfaces at all. The current code is masking the 8/16-bit UTMI+ interface bits globally which indeed effect the UNKNOWN cases, therefore it effects the platforms which are not using phy interfaces at all. So, handle the phy masking bits accordingly on respective interface type cases. Fixes: 6b7ebff00190 ("usb: dwc3: Add phy interface for dwc3_uboot") Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2019-12-03common: Move ARM cache operations out of common.hSimon Glass5-0/+5
These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-23usb: dwc3: Add phy interface for dwc3_ubootJagan Teki2-0/+39
U-Boot has two different variants of dwc3 initializations, - with dm variant gadget, so the respective dm driver would call the dwc3_init in core. - with non-dm variant gadget, so the usage board file would call dwc3_uboot_init in core. The driver probe would handle all respective gadget properties including phy interface via phy_type property and then trigger dwc3_init for dm-variant gadgets. So, to support the phy interface for non-dm variant gadgets, the better option is dwc3_uboot_init since there is no dedicated controller for non-dm variant gadgets. This patch support for adding phy interface like 8/16-bit UTMI+ code for dwc3_uboot. This change used Linux phy.h enum list, to make proper code compatibility. Cc: Marek Vasut <marex@denx.de> Tested-by: Levin Du <djw@t-chip.com.cn> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-10-31dwc3: flush cache only if there is a buffer attached to a requestMarek Szyprowski1-1/+2
Calling cache flush on invalid buffer, even with zero length might cause an exception on certain platforms. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2019-10-31dwc3-generic: Don't fail probe if clk/reset entries are absentVignesh Raghavendra1-2/+2
Some boards don't populate clk/reset entries as these are are optional as per binding documentation. Therefore, don't fail driver probe if clk/reset entries are absent in DT. This fixes fastboot failures seen due to enabling of CONFIG_CLK on AM57xx Fixes: e8e683d33b0c ("board: ti: am57xx-idk: Configure the CDCE913 clock synthesizer") Reported-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2019-10-24usb: dwc3: Kconfig: get rid of obsolete mode selectionJean-Jacques Hiblot2-18/+4
The mode selection for the DWC3 is kind of obsolete. The driver does not have to be host only or gadget only. This choice is confusing. All the remaining callers of dwc3_uboot_init() explicitly set dr_mode before calling the function, so none rely on a default behavior. Remove the choice menu and keep only the USB_DWC3_GADGET option. Enable it by default if USB_GADGET and USB_DWC3 are enabled. It must be disabled for the evb-rk3328 as it uses DWC2 for the gadget and DWC3 for the host. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3: Add dwc3_of_parse() to get quirks information from DTJean-Jacques Hiblot3-1/+71
Add a new function that read quirk and configuration information from the DT. The goal is to allow platforms using their own version of DWC3 driver to migrate to the generic DWC3 driver. The function is adapted from the function dwc3_get_properties() in the linux dwc3 driver introduced in commit c5ac6116db35d. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3-generic: if no max speed is specified in DT, assume super speedJean-Jacques Hiblot1-2/+2
There is no need to fail if the maximum speed is not specified. If the speed is not specified, do the same as linux and assume super speed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3-generic: add a new host driver that uses the dwc3 coreJean-Jacques Hiblot2-2/+54
Currently the host driver used by dwc3-generic is "xhci-dwc3". This is a functional driver but it doesn't use the dwc3 core and, in particular, it lacks some bits that may be important. For example on the k2 platforms, it is important that the phy are properly suspended when the USB is not used anymore. The dwc3 core also has a partial support for quirks. The new driver can be used as a drop-in replacement for "xhci-dwc3". In terms of implementation, it may seem strange that 2 private structures dwc3_generic_host_priv and dwc3_generic_priv) are used. The reason for this is simply that the xhci layer expects a struct xhci_ctrl at the beginning of the private data and it seemed wasteful to include it also for the peripheral case. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3-generic: factorize codeJean-Jacques Hiblot1-20/+35
Factor code for re-usability. This is another step toward adding host support. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3-generic: use platdataJean-Jacques Hiblot1-14/+23
Separate platform data from the private data. This is one step toward adding host support. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3: always use the inlined version of dwc3_host_init/dwc3_host_exitJean-Jacques Hiblot1-5/+0
No one is actually implementing those functions. We could remove calls to these altogether, but it does not really hurt to keep the empty inlined version at the moment and it satisfies a symmetry with the gadget mode. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-24usb: dwc3: switch to peripheral mode when exitingJean-Jacques Hiblot1-0/+13
This allow the phy to enter idle and then suspend. the K2 platforms require the PHY to be suspended before the USB domain clock can be turned off. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-10-08drivers: usb: dwc3: setup phy before dwc3 core soft resetT Karthik Reddy1-2/+2
Phy setup should be done before dwc3 soft core reset as it is done in linux & this fixes unreliable detection of usb cable on host side. Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com> Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-07-05usb: dwc3: Use UCLASS_NOP instead of UCLASS_MISC for the DWC3 generic glueJean-Jacques Hiblot1-1/+1
dwc3-generic has been broken since MISC uclass has been modified to scan DT sub-nodes after bind. Fixing it by a using the no-op uclass. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-05usb: dwc3-generic: remove dm_scan_fdt_dev() from the remove() callbackJean-Jacques Hiblot1-1/+1
There is simply no reason to do that here. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-05-09usb: dwc3: Add Meson G12A USB GlueNeil Armstrong3-0/+465
Adds support for Amlogic G12A USB Control Glue HW. The Amlogic G12A SoC Family embeds 2 USB Controllers : - a DWC3 IP configured as Host for USB2 and USB3 - a DWC2 IP configured as Peripheral USB2 Only A glue connects these both controllers to 2 USB2 PHYs, and optionnally to an USB3+PCIE Combo PHY shared with the PCIE controller. The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including routing of the OTG PHY between the DWC3 and DWC2 controllers, and setups the on-chip OTG mode selection for this PHY. This driver sets the OTG capable port as Host mode by default, the switch to Device mode is to be done in a separate patch. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Marek Vasut <marex@denx.de>
2018-12-14dwc3-generic: Add support for the am437xJean-Jacques Hiblot1-0/+1
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-12-14usb: dwc3-generic: make it compatible with "ti, keystone-dwc3"Jean-Jacques Hiblot1-0/+1
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-12-14usb: composite: Move bitmap related operations to ./include/linux/bitmap.hLukasz Majewski2-2/+0
The BITMAP related operations can now be moved to ./include/linux/bitmap.h file to mimic the Linux kernel directory tree. This change also allows to remove the lin_gadget_compat.h header file (which is a legacy code only for composite U-boot layer). It was also possible to remove #includes from several USB gadget drivers. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
2018-12-07dwc3-generic: Add support for the TI DWC3 glueJean-Jacques Hiblot1-0/+85
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07usb: dwc3: Fix a compilation error with the edison defconfigJean-Jacques Hiblot1-1/+1
The error is: In file included from include/part.h:10:0, from include/usb.h:18, from include/linux/usb/gadget.h:22, from drivers/usb/dwc3/ep0.c:20: include/ide.h:62:14: error: unknown type name ‘uchar’ void ide_led(uchar led, uchar status); Fixing it by including common.h that defines the uchar type. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07dwc3-generic: Add select_dr_mode operationJean-Jacques Hiblot1-0/+26
The select_dr_mode operation is executed when the glue driver is probed. The role of this optional function is to configure the operating mode of the controller at the glue level. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07dwc3-generic: Handle the PHYs, the clocks and the reset linesJean-Jacques Hiblot2-29/+137
This make the driver more generic. At this point this driver can replace the dwc3-of-simple implementation. Make the description in the Kconfig more generic too. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07dm: usb: create a new UCLASS ID for USB gadget devicesJean-Jacques Hiblot1-1/+1
UCLASS_USB_DEV_GENERIC was meant for USB devices connected to host controllers, not gadget devices. Adding a new UCLASS for gadget devices alone. Also move the generic DM code for USB gadgets in a separate file for clarity. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07dwc3: move phy operation to core.cJean-Jacques Hiblot1-2/+86
Those operations can be used for peripheral operation as well as host operation. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> # Conflicts: # drivers/usb/dwc3/core.c # drivers/usb/host/xhci-dwc3.c
2018-12-07dwc3_generic: do not probe the USB device driver when it's boundJean-Jacques Hiblot1-7/+0
The driver will be probed when usb_gadget_initialize() is called. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-12-07usb: udc: implement DM versions of ↵Jean-Jacques Hiblot1-12/+2
usb_gadget_initialize()/_release()/_handle_interrupt() When DM_USB_GADGET the platform code for the USB device must be replaced by calls to a USB device driver. usb_gadget_initialize() probes the USB device driver. usb_gadget_release() removes the USB device driver. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-12-07usb: introduce a separate config option for DM USB deviceJean-Jacques Hiblot2-4/+3
Using CONFIG_DM_USB for this purpose prevents using DM_USB for host and not for device. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-11-26usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/Sven Schwermer2-2/+2
This allows to disable the USB driver model in SPL because it checks the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for regular non-SPL builds. Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
2018-10-28drivers: cosmetic: Convert SPDX license tags to Linux Kernel stylePatrick Delaunay1-1/+1
Complete in the drivers directory the work started with commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style"). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-06-08bug.h: introduce WARN_ONCERamon Fried1-1/+0
Add WARN_ONCE definition to allow single time notification of warnings to the user. Taken from Linux kernel (4.17) with slight changes (Removed __section(.data.once)) Signed-off-by: Ramon Fried <ramon.fried@gmail.com> [trini: Drop the musb and dwc3 compat versions] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-18drivers: usb: dwc3: remove devm_zalloc from linux_compactMugunthan V N4-8/+8
devm_zalloc() is already defined in dm/device.h header, so devm_zalloc can be removed from linux_compact.h beader file. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18usb: dwc3: Add generic DWC3 glue logic driverMichal Simek3-0/+164
By enabling BLK by default this is the next driver which needs to get support for DM_USB. Adding generic DWC3 glue logic which only parse nodes and read device mode. Based on it probe proper host/peripheral DWC3 drivers for it. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18usb: dwc3: Add dwc3_init/remove with DM_USBMugunthan V N3-1/+62
The patch is preparing dwc3 core for enabling DM_USB with peripheral driver with using driver model support. The driver will be bound by the DWC3 wrapper driver based on the dr_mode device tree entry. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> (Remove dwc3-omap changes) Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini12-25/+12
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-15usb: dwc3-uniphier: replace <common.h> with <linux/bitops.h>Masahiro Yamada1-1/+1
Including <common.h> pulls in a lot of bloat. What this driver needs is BIT(), so replace it with <linux/bitops.h> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Marek Vasut <marex@denx.de>
2017-10-04bug.h: move runtime BUG/WARN macros into <linux/bug.h>Masahiro Yamada1-1/+0
Collect runtime BUG/WARN into a self-contained header <linux/bug.h> to make these macros easier to use. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04printk: collect printk stuff into <linux/printk.h> with loglevel supportMasahiro Yamada1-1/+0
When we import code from Linux, with regular re-sync planned, we want to use printk() and pr_*(). U-Boot does not support them in a clean way. So, people end up with local macros, or compat headers here and there, then we occasionally see build errors of definition conflicts. We have include/linux/compat.h, but putting all sorts of unrelated things into a single header is just a temporal workaround. Hence this patch, to find the best home for all printk variants. If you want to use printk() and friends, please include <linux/printk.h>. This header is self-contained, and pulls in only a few headers. When I was testing this clean-up, I noticed the image size exceeded its platform limit on some boards. This is because all pr_*() that were previously defined as no-op in include/linux/mtd/mtd.h (unless CONFIG_MTD_DEBUG is set), are now enabled. To make such boards happy, this commit also implements CONFIG_LOGLEVEL. The concept is similar to the kernel parameter "loglevel". (Actually, the Kconfig help message was taken from kernel-paremeter.txt of Linux) Messages with a loglevel smaller than console loglevel will be printed. The difference is the loglevel is build-time determined. To save the image size, lower priority pr_*() are compiled out. I set the default of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages are compiled in. I adjusted CONFIG_LOGLEVEL to avoid build error for some boards. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-01usb: dwc3: add UniPhier specific glue layerMasahiro Yamada3-0/+128
Add UniPhier platform specific glue layer to support USB3 Host mode on Synopsys DWC3 IP. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Marek Vasut <marex@denx.de>
2017-08-28usb: dwc3: fix Kconfig dependency to accept host driver in drivers/usb/dwc3Masahiro Yamada1-2/+2
We see the choice of USB_DWC3_HOST / _GADGET in drivers/usb/dwc3/Kconfig, but we can not choose USB_DWC3_HOST unless USB_GADGET is defined. This is strange. Loosen the "depends on" and also move "select USB_GADGET_DUALSPEED" to the correct place. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-04-14usb: dwc3: gadget: make cache-maintenance on event buffers more robustPhilipp Tomsich2-2/+5
Merely using dma_alloc_coherent does not ensure that there is no stale data left in the caches for the allocated DMA buffer (i.e. that the affected cacheline may still be dirty). The original code was doing the following (on AArch64, which translates a 'flush' into a 'clean + invalidate'): # during initialisation: 1. allocate buffers via memalign => buffers may still be modified (cached, dirty) # during interrupt processing 2. clean + invalidate buffers => may commit stale data from a modified cacheline 3. read from buffers This could lead to garbage info being written to buffers before reading them during even-processing. To make the event processing more robust, we use the following sequence for the cache-maintenance: # during initialisation: 1. allocate buffers via memalign 2. clean + invalidate buffers (we only need the 'invalidate' part, but dwc3_flush_cache() always performs a 'clean + invalidate') # during interrupt processing 3. read the buffers (we know these lines are not cached, due to the previous invalidation and no other code touching them in-between) 4. clean + invalidate buffers => writes back any modification we may have made during event processing and ensures that the lines are not in the cache the next time we enter interrupt processing Note that with the original sequence, we observe reproducible (depending on the cache state: i.e. running dhcp/usb start before will upset caches to get us around this) issues in the event processing (a fatal synchronous abort in dwc3_gadget_uboot_handle_interrupt on the first time interrupt handling is invoked) when running USB mass storage emulation on our RK3399-Q7 with data-caches on. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-04-14usb: dwc3: ensure consistent types for dwc3_flush_cachePhilipp Tomsich3-11/+11
The dwc3_flush_cache() call was declared and used inconsistently: * The declaration assumed 'int' for addresses (a potential issue when running in a LP64 memory model). * The invocation cast the address to 'long'. This change ensures that both the declaration and usage of this function consistently uses 'uintptr_t' for correct behaviour even when the allocated buffers (to be flushed) reside outside of the lower 32bits of memory. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-02-26usb: dwc3: gadget: Remove unused header inclusionVincent Tinelli1-1/+0
Remove sys_proto.h inclusion which is not used by the driver. Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-03ARM: DRA7x/AM57xx: Get rid of CONFIG_AM57XXNishanth Menon1-2/+2
CONFIG_AM57XX is just an unnecessary macro that is redundant given So, remove the same instead of spreading through out the u-boot source code and getting in the way to maintain common code for DRA7x family. Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabledRoger Quadros1-1/+1
It is pointless to build gadget driver if USB_GADGET is disabled. Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Marek Vasut <marex@denx.de>
2016-04-20usb: dwc3: Move CONFIG_USB_DWC3_PHY_* to KconfigSam Protsenko1-0/+17
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20usb: dwc3: Move CONFIG_USB_DWC3_OMAP to KconfigSam Protsenko1-0/+10
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20usb: dwc3: Move CONFIG_USB_DWC3_GADGET/HOST to KconfigSam Protsenko1-0/+23
Description was borrowed from kernel dwc3 Kconfig. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>