aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-04Revert "usb:gadget Separated decoding functions from dwc3 driver."Greg Kroah-Hartman2-1/+253
This reverts commit 3db1b636c07e15ff7410db782832dc2e7ffd2bce. It's broken. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Felipe Balbi <balbi@kernel.org> Cc: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03usb:gadget Separated decoding functions from dwc3 driver.Pawel Laszczak2-253/+1
Patch moves some decoding functions from driver/usb/dwc3/debug.h driver to driver/usb/gadget/debug.c file. These moved functions include: dwc3_decode_get_status dwc3_decode_set_clear_feature dwc3_decode_set_address dwc3_decode_get_set_descriptor dwc3_decode_get_configuration dwc3_decode_set_configuration dwc3_decode_get_intf dwc3_decode_set_intf dwc3_decode_synch_frame dwc3_decode_set_sel dwc3_decode_set_isoch_delay dwc3_decode_ctrl These functions are used also in inroduced cdns3 driver. All functions prefixes were changed from dwc3 to usb. Also, function's parameters has been extended according to the name of fields in standard SETUP packet. Additionally, patch adds usb_decode_ctrl function to include/linux/usb/gadget.h file. Signed-off-by: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-07-03usb: dwc3: pci: add support for TigerLake DevicesFelipe Balbi1-0/+4
This patch adds the necessary PCI ID for TGP-LP devices. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-20usb: dwc3: remove unused @lock member of dwc3_ep structChunfeng Yun2-4/+0
The member @lock of dwc3_ep struct is only initialized, and not used elsewhere, so remove it. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-20usb: dwc3: pci: Add Support for Intel Elkhart Lake DevicesFelipe Balbi1-0/+4
This patch simply adds a new PCI Device ID Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: gadget: Add support for disabling U1 and U2 entriesAnurag Kumar Vulisha5-1/+42
Gadget applications may have a requirement to disable the U1 and U2 entry based on the usecase. Below are few usecases where the disabling U1/U2 entries may be possible. Usecase 1: When combining dwc3 with an redriver for a USB Type-C device solution, it sometimes have problems with leaving U1/U2 for certain hosts, resulting in link training errors and reconnects. For this U1/U2 state entries may be avoided. Usecase 2: When performing performance benchmarking on mass storage gadget the U1 and U2 entries can be disabled. Usecase 3: When periodic transfers like ISOC transfers are used with bInterval of 1 which doesn't require the link to enter into U1 or U2 state entry (since ping is issued from host for every uframe interval). In this case the U1 and U2 entry can be disabled. Disablement of U1/U2 can be done by setting U1DevExitLat and U2DevExitLat values to 0 in the BOS descriptor. Host on seeing 0 value for U1DevExitLat and U2DevExitLat, it doesn't send SET_SEL requests to the gadget. There may be some hosts which may send SET_SEL requests even after seeing 0 in the UxDevExitLat of BOS descriptor. To aviod U1/U2 entries for these type of hosts, dwc3 controller can be programmed to reject those U1/U2 requests by not enabling ACCEPTUxENA bits in DCTL register. This patch updates the same. Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> Signed-off-by: Claus H. Stovgaard <cst@phaseone.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: qcom: Use of_clk_get_parent_count()Kefeng Wang1-2/+1
Use of_clk_get_parent_count() instead of open coding. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: Fix core validation in probe, move after clocks are enabledEnric Balletbo i Serra1-5/+7
The required clocks needs to be enabled before the first register access. After commit fe8abf332b8f ("usb: dwc3: support clocks and resets for DWC3 core"), this happens when the dwc3_core_is_valid function is called, but the mentioned commit adds that call in the wrong place, before the clocks are enabled. So, move that call after the clk_bulk_enable() to ensure the clocks are enabled and the reset deasserted. I detected this while, as experiment, I tried to move the clocks and resets from the glue layer to the DWC3 core on a Samsung Chromebook Plus. That was not detected before because, in most cases, the glue layer initializes SoC-specific things and then populates the child "snps,dwc3" with those clocks already enabled. Fixes: b873e2d0ea1ef ("usb: dwc3: Do core validation early on probe") Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: qcom: Improve error handlingLee Jones1-0/+3
dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an argument. If of_count_phandle_with_args() returns an error, the number of clocks will be a negative value and will lead to undefined behaviour. Ensure we check for an error before attempting to blindly use the value. Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: qcom: Start USB in 'host mode' on the SDM845Lee Jones1-0/+12
When booting with Device Tree, the current default boot configuration table option, the request to boot via 'host mode' comes from the 'dr_mode' property. A property of the same name can be used inside ACPI tables too. However it is missing from the SDM845's ACPI tables so we have to supply this information using Platform Device Properties instead. This does not change the behaviour of any currently supported devices. The property is only set on ACPI enabled platforms, thus for H/W booting DT, unless a 'dr_mode' property is present, the default is still OTG (On-The-Go) as per [0]. Any new ACPI devices added will also be able to over-ride this implementation by providing a 'dr_mode' property in their ACPI tables. In cases where 'dr_mode' is omitted from the tables AND 'host mode' should not be the default (very unlikely), then we will have to add some way of choosing between them at run time - most likely by ACPI HID. [0] Documentation/devicetree/bindings/usb/generic.txt Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: qcom: Add support for booting with ACPILee Jones2-29/+179
In Linux, the DWC3 core exists as its own independent platform device. Thus when describing relationships in Device Tree, the current default boot configuration table option, the DWC3 core often resides as a child of the platform specific node. Both of which are given their own address space descriptions and the drivers can be mostly agnostic to each other. However, other Operating Systems have taken a more monolithic approach, which is evident in the configuration ACPI tables for the Qualcomm Snapdragon SDM850, where all DWC3 (core and platform) components are described under a single IO memory region. To ensure successful booting using the supplied ACPI tables, we need to devise a way to chop up the address regions provided and subsequently register the DWC3 core with the resultant information, which is precisely what this patch aims to achieve. Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: dwc3: meson-g12a: Add support for IRQ based OTG switchingNeil Armstrong1-5/+31
Add support for the OTG ID change interrupt to switch between Host and Device mode. Tested on the Hardkernel Odroid-N2 board. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-08Merge tag 'drm-next-2019-05-09' of git://anongit.freedesktop.org/drm/drmLinus Torvalds1-1/+2
Pull drm updates from Dave Airlie: "This has two exciting community drivers for ARM Mali accelerators. Since ARM has never been open source friendly on the GPU side of the house, the community has had to create open source drivers for the Mali GPUs. Lima covers the older t4xx and panfrost the newer 6xx/7xx series. Well done to all involved and hopefully this will help ARM head in the right direction. There is also now the ability if you don't have any of the legacy drivers enabled (pre-KMS) to remove all the pre-KMS support code from the core drm, this saves 10% or so in codesize on my machine. i915 also enable Icelake/Elkhart Lake Gen11 GPUs by default, vboxvideo moves out of staging. There are also some rcar-du patches which crossover with media tree but all should be acked by Mauro. Summary: uapi changes: - Colorspace connector property - fourcc - new YUV formts - timeline sync objects initially merged - expose FB_DAMAGE_CLIPS to atomic userspace new drivers: - vboxvideo: moved out of staging - aspeed: ASPEED SoC BMC chip display support - lima: ARM Mali4xx GPU acceleration driver support - panfrost: ARM Mali6xx/7xx Midgard/Bitfrost acceleration driver support core: - component helper docs - unplugging fixes - devm device init - MIPI/DSI rate control - shmem backed gem objects - connector, display_info, edid_quirks cleanups - dma_buf fence chain support - 64-bit dma-fence seqno comparison fixes - move initial fb config code to core - gem fence array helpers for Lima - ability to remove legacy support code if no drivers requires it (removes 10% of drm.ko size) - lease fixes ttm: - unified DRM_FILE_PAGE_OFFSET handling - Account for kernel allocations in kernel zone only panel: - OSD070T1718-19TS panel support - panel-tpo-td028ttec1 backlight support - Ronbo RB070D30 MIPI/DSI - Feiyang FY07024DI26A30-D MIPI-DSI panel - Rocktech jh057n00900 MIPI-DSI panel i915: - Comet Lake (Gen9) PCI IDs - Updated Icelake PCI IDs - Elkhartlake (Gen11) support - DP MST property addtions - plane and watermark fixes - Icelake port sync and VEBOX disable fixes - struct_mutex usage reduction - Icelake gamma fix - GuC reset fixes - make mmap more asynchronous - sound display power well race fixes - DDI/MIPI-DSI clocks for Icelake - Icelake RPS frequency changing support - Icelake workarounds amdgpu: - Use HMM for userptr - vega20 experimental smu11 support - RAS support for vega20 - BACO support for vega12 + fixes for vega20 - reworked IH interrupt handling - amdkfd RAS support - Freesync improvements - initial timeline sync object support - DC Z ordering fixes - NV12 planes support - colorspace properties for planes= - eDP opts if eDP already initialized nouveau: - misc fixes etnaviv: - misc fixes msm: - GPU zap shader support expansion - robustness ABI addition exynos: - Logging cleanups tegra: - Shared reset fix - CPU cache maintenance fix cirrus: - driver rewritten using simple helpers meson: - G12A support vmwgfx: - Resource dirtying management improvements - Userspace logging improvements virtio: - PRIME fixes rockchip: - rk3066 hdmi support sun4i: - DSI burst mode support vc4: - load tracker to detect underflow v3d: - v3d v4.2 support malidp: - initial Mali D71 support in komeda driver tfp410: - omap related improvement omapdrm: - drm bridge/panel support - drop some omap specific panels rcar-du: - Display writeback support" * tag 'drm-next-2019-05-09' of git://anongit.freedesktop.org/drm/drm: (1507 commits) drm/msm/a6xx: No zap shader is not an error drm/cma-helper: Fix drm_gem_cma_free_object() drm: Fix timestamp docs for variable refresh properties. drm/komeda: Mark the local functions as static drm/komeda: Fixed warning: Function parameter or member not described drm/komeda: Expose bus_width to Komeda-CORE drm/komeda: Add sysfs attribute: core_id and config_id drm: add non-desktop quirk for Valve HMDs drm/panfrost: Show stored feature registers drm/panfrost: Don't scream about deferred probe drm/panfrost: Disable PM on probe failure drm/panfrost: Set DMA masks earlier drm/panfrost: Add sanity checks to submit IOCTL drm/etnaviv: initialize idle mask before querying the HW db drm: introduce a capability flag for syncobj timeline support drm: report consistent errors when checking syncobj capibility drm/nouveau/nouveau: forward error generated while resuming objects tree drm/nouveau/fb/ramgk104: fix spelling mistake "sucessfully" -> "successfully" drm/nouveau/i2c: Disable i2c bus access after ->fini() drm/nouveau: Remove duplicate ACPI_VIDEO_NOTIFY_PROBE definition ...
2019-05-03usb: dwc3: Rename DWC3_DCTL_LPM_ERRATAThinh Nguyen2-3/+2
The macro name DWC3_DCTL_LPM_ERRATA is uninformative and does not do masking. Remove DWC3_DCTL_LPM_ERRATA_MASK and rename DWC3_DCTL_LPM_ERRATA to DWC3_DCTL_NYET_THRES with proper masking. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: Fix default lpm_nyet_threshold valueThinh Nguyen1-1/+1
The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change the default value to 15. Cc: stable@vger.kernel.org Fixes: 80caf7d21adc ("usb: dwc3: add lpm erratum support") Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: debug: Print GET_STATUS(device) tracepointThinh Nguyen1-0/+3
DWC3 is missing the printing of control request GET_STATUS(device) tracepoint. This patch prints that. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: Do core validation early on probeThinh Nguyen1-6/+5
The setting of the dr_mode may need to check the controller's revision. The revision is set in the dwc3_core_is_valid(), which comes after dr_mode setting. Let's move it closer to the start of the dwc3_probe() function and before calling dwc3_get_dr_mode(). Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: gadget: Set lpm_capableThinh Nguyen1-0/+1
All DWC3 controllers are LPM capable. Report that in the usb_gadget.lpm_capable for the gadget driver to properly output the bcdUSB value in the descriptor. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: move synchronize_irq() out of the spinlock protected blockMarek Szyprowski2-2/+2
dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context calling synchronize_irq() is not allowed. Move the problematic call out of the protected block to fix the following kernel BUG during system suspend: BUG: sleeping function called from invalid context at kernel/irq/manage.c:112 in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake 6 locks held by rtcwake/1601: #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c #1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4 #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04 #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c irq event stamp: 11252 hardirqs last enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74 hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c softirqs last enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168 Preemption disabled at: [<00000000>] (null) CPU: 7 PID: 1601 Comm: rtcwake Not tainted 5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14) [<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8) [<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8) [<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84) [<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c) [<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410) [<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c) [<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54) [<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc) [<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c) [<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588) [<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74) [<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04) [<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc) [<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20) [<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50) [<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4) [<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160) [<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c) [<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c) [<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28) Exception stack(0xed55ffa8 to 0xed55fff0) ... Fixes: 01c10880d242 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: Free resource immediately after useAndy Shevchenko1-0/+3
When we read an array of integers from device properties, the temporary buffer is allocated. However, in case of dwc3_set_incr_burst_type() it's not freed. Free allocated buffer immediately after use. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: of-simple: Convert to bulk clk APIRobin Murphy1-78/+17
Now that the bulk API has a "get all of the clocks" helper to match what this code wants, there's little reason not to switch over. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: Add Amlogic G12A DWC3 glueNeil Armstrong3-0/+615
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 drivers supports the on-probe setup of the OTG mode, and manually via a debugfs interface. The IRQ mode change detect is yet to be added in a future patchset, mainly due to lack of hardware to validate on. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03usb: dwc3: Allow building USB_DWC3_QCOM without EXTCONMarc Gonzalez1-2/+4
Keep EXTCON support optional, as some platforms do not need it. Do the same for USB_DWC3_OMAP while we're at it. Fixes: 3def4031b3e3f ("usb: dwc3: add EXTCON dependency for qcom") Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-04-24Merge tag 'drm/tegra/for-5.2-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-nextDave Airlie1-1/+2
drm/tegra: Changes for v5.2-rc1 This contains a fix for the usage of shared resets that previously generated a WARN on boot. In addition, there's a fix for CPU cache maintenance of GEM buffers allocated using get_pages(). (airlied: contains a merge from a shared tegra tree) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thierry Reding <thierry.reding@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190418151447.9430-1-thierry.reding@gmail.com
2019-03-20reset: Add acquired flag to of_reset_control_array_get()Thierry Reding1-1/+2
In order to be able to request an array of reset controls in acquired or released mode, add the acquired flag to of_reset_control_array_get() and pass the flag to subsequent calls of __of_reset_control_get(). Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-03-20usb: dwc3: pci: add support for Comet Lake PCH IDFelipe Balbi1-0/+4
This patch simply adds a new PCI Device ID Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-19usb: dwc3: drd: Defer probe if extcon device is not foundAndy Shevchenko1-2/+7
In case the "linux,extcon-name" property is defined but device itself is not ready, defer the probe. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-15Merge tag 'usb-for-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-nextGreg Kroah-Hartman9-116/+158
Felipe writes: USB: changes for v5.1 merge window Dwc3 now works on TI's AM6xx platforms. Also on dwc3 we have a few changes which improve request cancellation and some improvements to how we print to the trace buffer. Renesas_usb3 got support for r8a774c0 device. Dwc2 got scatter-gather support. Apart from these, the usual set of minor fixes and all sorts of small details. * tag 'usb-for-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (40 commits) usb: phy: twl6030-usb: fix possible use-after-free on remove usb: misc: usbtest: add super-speed isoc support usb: dwc3: Reset num_trbs after skipping usb: dwc3: gadget: don't enable interrupt when disabling endpoint fotg210-udc: pass struct device to DMA API functions fotg210-udc: remove a bogus dma_sync_single_for_device call usb: gadget: Change Andrzej Pietrasiewicz's e-mail address usb: f_fs: Avoid crash due to out-of-scope stack ptr access usb: dwc3: haps: Workaround matching VID PID usb: gadget: f_fs: preserve wMaxPacketSize across usb_ep_autoconfig() call usb: gadget: move non-super speed code out of usb_ep_autoconfig_ss() usb: gadget: function: sync f_uac1 ac header baInterfaceNr usb: dwc2: gadget: Add scatter-gather mode usb: gadget: fix various indentation issues usb: dwc2: Fix EP TxFIFO number setting udc: net2280: Fix net2280_disable USB: gadget: Improve kerneldoc for usb_ep_dequeue() usb: dwc3: debug: purge usage of strcat usb: dwc3: trace: pass trace buffer size to decoding functions usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING ...
2019-02-13usb: dwc3: Reset num_trbs after skippingThinh Nguyen1-0/+2
Currently req->num_trbs is not reset after the TRBs are skipped and processed from the cancelled list. The gadget driver may reuse the request with an invalid req->num_trbs, and DWC3 will incorrectly skip trbs. To fix this, simply reset req->num_trbs to 0 after skipping through all of them. Fixes: c3acd5901414 ("usb: dwc3: gadget: use num_trbs when skipping TRBs on ->dequeue()") Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-13usb: dwc3: gadget: don't enable interrupt when disabling endpointFelipe Balbi1-7/+9
Since we're disabling the endpoint anyway, we don't worry about getting endpoint command completion interrupt. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-11Merge 5.0-rc6 into usb-nextGreg Kroah-Hartman2-3/+3
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-07usb: dwc3: haps: Workaround matching VID PIDThinh Nguyen1-0/+9
i.MX6QP and i.MX7D platform use a PCIe controller with the same VID and PID as this USB controller. The system may incorrectly match this driver to that PCIe controller. To workaround this, specifically use class type USB with PCI device ID to prevent incorrect driver matching. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-05usb: dwc3: debug: purge usage of strcatFelipe Balbi1-5/+9
Now that buffer size is always passed around, we don't need to rely on strcat anymore. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-04usb: dwc3: trace: pass trace buffer size to decoding functionsFelipe Balbi2-69/+80
Instead of assuming that our buffer is big enough, let's pass the buffer size around so printing functions can make sure they won't overflow the buffer. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-04usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDINGFelipe Balbi3-13/+6
Now that we modified the code to fix a race condition, it's clear that DWC3_EP_END_TRANSFER_PENDING is unnecessary, considering that DWC3_EP_TRANSFER_STARTED will remain set until End Transfer completes. Tested-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-04usb: dwc3: gadget: early giveback if End Transfer already completedFelipe Balbi1-1/+5
There is a rare race condition that may happen during a Disconnect Interrupt if we have a started request that happens to be dequeued *after* completion of End Transfer command. If that happens, that request will be left waiting for completion of an End Transfer command that will never happen. If End Transfer command has already completed before, we are safe to giveback the request straight away. Tested-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-04usb: dwc3: gadget: don't use resource_index as a flagFelipe Balbi1-2/+2
We have a proper flag for testing that we have a valid transfer in flight, let's use that instead. This patch is in preparation to fix a rare race condition that happens upon Disconnect Interrupt. Tested-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-02-01usb: dwc3: gadget: clear DWC3_EP_TRANSFER_STARTED on cmd completeFelipe Balbi1-14/+5
We must wait until End Transfer completes in order to clear DWC3_EP_TRANSFER_STARTED, otherwise we may confuse the driver. This patch is in preparation to fix a rare race condition that happens upon Disconnect Interrupt. Tested-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: exynos: Fix error handling of clk_prepare_enableAlexey Khoroshilov1-2/+2
If clk_prepare_enable() fails in dwc3_exynos_probe() or in dwc3_exynos_resume(), exynos->clks[0] is left undisabled because of usage preincrement in while condition. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 9f2168367a0a ("usb: dwc3: exynos: Rework clock handling and prepare for new variants") Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: gadget: Handle 0 xfer length for OUT EPTejas Joglekar1-1/+1
For OUT endpoints, zero-length transfers require MaxPacketSize buffer as per the DWC_usb3 programming guide 3.30a section 4.2.3.3. This patch fixes this by explicitly checking zero length transfer to correctly pad up to MaxPacketSize. Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: gadget: remove req->started flagFelipe Balbi3-5/+0
Now that we have req->status, we don't need this extra flag anymore. It's safe to remove it. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: gadget: prevent dwc3_request from being queued twiceFelipe Balbi1-0/+5
Queueing the same request twice can introduce hard-to-debug problems. At least one function driver - Android's f_mtp.c - is known to cause this problem. While that function is out-of-tree, this is a problem that's easy enough to avoid. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: gadget: add dwc3_request status trackingFelipe Balbi3-0/+14
This patch starts tracking dwc3_request status. A following patch will build on top of this to prevent a request from being queued twice. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: keystone: Add support for ti,am654-dwc3Roger Quadros2-4/+13
The AM654 SoC contains a DWC3 controller with TI specific wrapper. Add support for that. Unlike the Keystone 2 case, for AM654 We don't need to process any IRQs for basic USB operation. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: gadget: Fix OTG events when gadget driver isn't loadedRoger Quadros1-0/+2
On v3.10a in dual-role mode, if port is in device mode and gadget driver isn't loaded, the OTG event interrupts don't come through. It seems that if the core is configured to be OTG2.0 only, then we can't leave the DCFG.DEVSPD at Super-speed (default) if we expect OTG to work properly. It must be set to High-speed. Fix this issue by configuring DCFG.DEVSPD to the supported maximum speed at gadget init. Device tree still needs to provide correct supported maximum speed for this to work. This issue wasn't present on v2.40a but is seen on v3.10a. It doesn't cause any side effects on v2.40a. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28usb: dwc3: qcom: Add support for MSM8998Jeffrey Hugo1-0/+1
Add a MSM8998 specific DT compatible so that we can properly bind to the device and enable the USB controller. Reviewed-by: Andy Gross <andy.gross@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-28Merge 5.0-rc4 into usb-nextGreg Kroah-Hartman1-0/+4
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-22USB: add missing SPDX lines to Kconfig and MakefilesGreg Kroah-Hartman1-0/+2
There are a few remaining drivers/usb/ files that do not have SPDX identifiers in them, all of these are either Kconfig or Makefiles. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-14usb: dwc3: gadget: Fix the uninitialized link_state when udc startsZeng Tao1-0/+1
Currently the link_state is uninitialized and the default value is 0(U0) before the first time we start the udc, and after we start the udc then stop the udc, the link_state will be undefined. We may have the following warnings if we start the udc again with an undefined link_state: WARNING: CPU: 0 PID: 327 at drivers/usb/dwc3/gadget.c:294 dwc3_send_gadget_ep_cmd+0x304/0x308 dwc3 100e0000.hidwc3_0: wakeup failed --> -22 [...] Call Trace: [<c010f270>] (unwind_backtrace) from [<c010b3d8>] (show_stack+0x10/0x14) [<c010b3d8>] (show_stack) from [<c034a4dc>] (dump_stack+0x84/0x98) [<c034a4dc>] (dump_stack) from [<c0118000>] (__warn+0xe8/0x100) [<c0118000>] (__warn) from [<c0118050>](warn_slowpath_fmt+0x38/0x48) [<c0118050>] (warn_slowpath_fmt) from [<c0442ec0>](dwc3_send_gadget_ep_cmd+0x304/0x308) [<c0442ec0>] (dwc3_send_gadget_ep_cmd) from [<c0445e68>](dwc3_ep0_start_trans+0x48/0xf4) [<c0445e68>] (dwc3_ep0_start_trans) from [<c0446750>](dwc3_ep0_out_start+0x64/0x80) [<c0446750>] (dwc3_ep0_out_start) from [<c04451c0>](__dwc3_gadget_start+0x1e0/0x278) [<c04451c0>] (__dwc3_gadget_start) from [<c04452e0>](dwc3_gadget_start+0x88/0x10c) [<c04452e0>] (dwc3_gadget_start) from [<c045ee54>](udc_bind_to_driver+0x88/0xbc) [<c045ee54>] (udc_bind_to_driver) from [<c045f29c>](usb_gadget_probe_driver+0xf8/0x140) [<c045f29c>] (usb_gadget_probe_driver) from [<bf005424>](gadget_dev_desc_UDC_store+0xac/0xc4 [libcomposite]) [<bf005424>] (gadget_dev_desc_UDC_store [libcomposite]) from[<c023d8e0>] (configfs_write_file+0xd4/0x160) [<c023d8e0>] (configfs_write_file) from [<c01d51e8>] (__vfs_write+0x1c/0x114) [<c01d51e8>] (__vfs_write) from [<c01d5ff4>] (vfs_write+0xa4/0x168) [<c01d5ff4>] (vfs_write) from [<c01d6d40>] (SyS_write+0x3c/0x90) [<c01d6d40>] (SyS_write) from [<c0107400>] (ret_fast_syscall+0x0/0x3c) Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-01-14usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanupJack Pham1-0/+1
OUT endpoint requests may somtimes have this flag set when preparing to be submitted to HW indicating that there is an additional TRB chained to the request for alignment purposes. If that request is removed before the controller can execute the transfer (e.g. ep_dequeue/ep_disable), the request will not go through the dwc3_gadget_ep_cleanup_completed_request() handler and will not have its needs_extra_trb flag cleared when dwc3_gadget_giveback() is called. This same request could be later requeued for a new transfer that does not require an extra TRB and if it is successfully completed, the cleanup and TRB reclamation will incorrectly process the additional TRB which belongs to the next request, and incorrectly advances the TRB dequeue pointer, thereby messing up calculation of the next requeust's actual/remaining count when it completes. The right thing to do here is to ensure that the flag is cleared before it is given back to the function driver. A good place to do that is in dwc3_gadget_del_and_unmap_request(). Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Jack Pham <jackp@codeaurora.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>