aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2019-02-11usb: gadget: Change Andrzej Pietrasiewicz's e-mail addressAndrzej Pietrasiewicz19-19/+19
My @samusung.com address is going to cease existing soon, so change it to an address which can actually be used to contact me. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-11usb: f_fs: Avoid crash due to out-of-scope stack ptr accessJohn Stultz1-0/+1
Since the 5.0 merge window opened, I've been seeing frequent crashes on suspend and reboot with the trace: [ 36.911170] Unable to handle kernel paging request at virtual address ffffff801153d660 [ 36.912769] Unable to handle kernel paging request at virtual address ffffff800004b564 ... [ 36.950666] Call trace: [ 36.950670] queued_spin_lock_slowpath+0x1cc/0x2c8 [ 36.950681] _raw_spin_lock_irqsave+0x64/0x78 [ 36.950692] complete+0x28/0x70 [ 36.950703] ffs_epfile_io_complete+0x3c/0x50 [ 36.950713] usb_gadget_giveback_request+0x34/0x108 [ 36.950721] dwc3_gadget_giveback+0x50/0x68 [ 36.950723] dwc3_thread_interrupt+0x358/0x1488 [ 36.950731] irq_thread_fn+0x30/0x88 [ 36.950734] irq_thread+0x114/0x1b0 [ 36.950739] kthread+0x104/0x130 [ 36.950747] ret_from_fork+0x10/0x1c I isolated this down to in ffs_epfile_io(): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/gadget/function/f_fs.c#n1065 Where the completion done is setup on the stack: DECLARE_COMPLETION_ONSTACK(done); Then later we setup a request and queue it, and wait for it: if (unlikely(wait_for_completion_interruptible(&done))) { /* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check * status. usb_ep_dequeue API should guarantee no race * condition with req->complete callback. */ usb_ep_dequeue(ep->ep, req); interrupted = ep->status < 0; } The problem is, that we end up being interrupted, dequeue the request, and exit. But then the irq triggers and we try calling complete() on the context pointer which points to now random stack space, which results in the panic. Alan Stern pointed out there is a bug here, in that the snippet above "assumes that usb_ep_dequeue() waits until the request has been completed." And that: wait_for_completion(&done); Is needed right after the usb_ep_dequeue(). Thus this patch implements that change. With it I no longer see the crashes on suspend or reboot. This issue seems to have been uncovered by behavioral changes in the dwc3 driver in commit fec9095bdef4e ("usb: dwc3: gadget: remove wait_end_transfer"). Cc: Alan Stern <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Zeng Tao <[email protected]> Cc: Jack Pham <[email protected]> Cc: Thinh Nguyen <[email protected]> Cc: Chen Yu <[email protected]> Cc: Jerry Zhang <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Vincent Pelletier <[email protected]> Cc: Andrzej Pietrasiewicz <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Linux USB List <[email protected]> Suggested-by: Alan Stern <[email protected]> Signed-off-by: John Stultz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-11Merge 5.0-rc6 into usb-nextGreg Kroah-Hartman8-32/+20
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-08usb: typec: ucsi: Remove debug.h fileHeikki Krogerus3-67/+64
It's not needed. Moving everything from it to trace.c. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-08usb: typec: Prepare alt mode enter/exit reporting for UCSI alt mode supportHeikki Krogerus1-1/+1
Because of UCSI, we have to support alt mode enter/exit reporting even when there is no alt mode driver bind to the alt mode device. With UCSI a firmware handles the alternate modes, and the modes are entered automatically from OS PoW. Changing typec_altmode_update_active() so that the driver module ref count is incremented/decremented only if there really is a driver for the alt mode. That avoids a NULL pointer dereference from happening when the driver is missing. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-08usb: typec: displayport: Move the Configuration VDO helpers to the headerHeikki Krogerus1-4/+0
The helpers used for reading and writing the pin assignment from and to the Configuration VDO will be useful in GPU drivers, and also UCSI driver after DisplayPort alt mode support is added to it. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-08USB: Fix configuration selection issues introduced in v4.20.0Nikolay Yakimov1-19/+25
Commit f13912d3f014a introduced changes to the usb_choose_configuration function to better support USB Audio UAC3-compatible devices. However, there are a few problems with this patch. First of all, it adds new "if" clauses in the middle of an existing "if"/"else if" tree, which obviously breaks pre-existing logic. Secondly, since it continues iterating over configurations in one of the branches, other code in the loop can choose an unintended configuration. Finally, if an audio device's first configuration is UAC3-compatible, and there are multiple UAC3 configurations, the second one would be chosen, due to the first configuration never being checked for UAC3-compatibility. Commit ff2a8c532c14 tries to fix the second issue, but it goes about it in a somewhat unnecessarily convoluted way, in my opinion, and does nothing to fix the first or the last one. This patch tries to rectify problems described by essentially rewriting code introduced in f13912d3f014a. Notice the code was moved to *before* the "if"/"else if" tree. Signed-off-by: Nikolay Yakimov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-08usb: handle warm-reset port requests on hub resumeJan-Marek Glogowski1-0/+7
On plug-in of my USB-C device, its USB_SS_PORT_LS_SS_INACTIVE link state bit is set. Greping all the kernel for this bit shows that the port status requests a warm-reset this way. This just happens, if its the only device on the root hub, the hub therefore resumes and the HCDs status_urb isn't yet available. If a warm-reset request is detected, this sets the hubs event_bits, which will prevent any auto-suspend and allows the hubs workqueue to warm-reset the port later in port_event. Signed-off-by: Jan-Marek Glogowski <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-07USB: serial: cp210x: add ID for Ingenico 3070Ivan Mironov1-0/+1
Here is how this device appears in kernel log: usb 3-1: new full-speed USB device number 18 using xhci_hcd usb 3-1: New USB device found, idVendor=0b00, idProduct=3070 usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-1: Product: Ingenico 3070 usb 3-1: Manufacturer: Silicon Labs usb 3-1: SerialNumber: 0001 Apparently this is a POS terminal with embedded USB-to-Serial converter. Cc: [email protected] Signed-off-by: Ivan Mironov <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-02-07USB: serial: cp210x: add minimum baud rate for CP2105 SCIJohanna Abrahamsson1-9/+8
Add minimum baud rate to the cp210x driver. According to the datasheet for CP2105, the SCI supports 2400 as the lowest baud rate. As this is not heeded in the current code, an error message 'failed set req 0x1e size 4 status: -32' when trying to set a lower baud rate such as 300. The other cp210x models to date supports a minimum baud rate of 300. Signed-off-by: Johanna Abrahamsson <[email protected]> [ johan: simplify min_speed init, move clamp after comment, and drop unused serial-data pointer from cp210x_get_actual_rate() ] Signed-off-by: Johan Hovold <[email protected]>
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: gadget: f_fs: preserve wMaxPacketSize across usb_ep_autoconfig() callAndrzej Pietrasiewicz1-0/+11
usb_ep_autoconfig() treats the passed descriptor as if it were an fs descriptor. In particular, for bulk endpoints, it clips wMaxPacketSize to 64. This patch preserves the original value. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: gadget: move non-super speed code out of usb_ep_autoconfig_ss()Andrzej Pietrasiewicz1-17/+24
The moved code refers to non-super speed endpoints only. This patch also makes the comment stress the fact, that autoconfigured descriptor might need some adjustments. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: gadget: function: sync f_uac1 ac header baInterfaceNrliangshengjun1-0/+2
f_uac1 audio control header descriptor default set baInterfaceNr[]={1,2}, but usb gadget make a configuration descriptor with more interfaces combination, it can not confirm f_uac1 function linked first. So always keep baInterfaceNr[]={1,2} is correct, and it is necessary to sync baInterfaceNr[] with usb_interface_id() value. Signed-off-by: Liang Shengjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: dwc2: gadget: Add scatter-gather modeAndrzej Pietrasiewicz1-36/+77
This patch adds support for transferring requests, which are non-contiguous in physical memory, i.e. the data buffer is described by a scatter-list. This allows transferring large requests without relying on error-prone contiguous buffer allocations. This way of allocating requests is already implemented in functionfs and TCM USB functions and automatically used if UDC driver advertises scatter-gather suppport. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> [mszyprow: fixed null pointer issue, rewrote commit message] Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: gadget: fix various indentation issuesColin Ian King5-28/+28
There are a bunch of various indentation issues, clean these up. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-07usb: dwc2: Fix EP TxFIFO number settingMinas Harutyunyan1-0/+1
In case when some EP IN is frequently reused, i.e. enabled/disabled by function driver. It is required to clear TxFIFO number field in DIEPCTL register before setting new number. Otherwise there is probability to have same TxFIFO number for different EP's because of OR operator. Signed-off-by: Minas Harutyunyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-06udc: net2280: Fix net2280_disableGuido Kiener1-2/+2
A reset e.g. calling ep_reset_338x() can happen while endpoints are enabled. The ep_reset_338x() sets ep->desc = NULL to mark endpoint being invalid. A subsequent call of net2280_disable will fail and return -EINVAL to parent function usb_ep_disable(), which will fail, too, and do not set the member ep->enabled = false. See: https://elixir.bootlin.com/linux/v5.0-rc5/source/drivers/usb/gadget/udc/core.c#L139 This fix ignores dp->desc and allows net2280_disable() to succeed. Subsequent calls to usb_ep_enable()/usb_ep_disable() succeeds. Acked-by: Alan Stern <[email protected]> Signed-off-by: Guido Kiener <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-06USB: gadget: Improve kerneldoc for usb_ep_dequeue()Alan Stern1-4/+4
Commit bf594c1070f5 ("USB: gadget: Document that certain ep operations can be called in interrupt context") documented that usb_ep_dequeue() may be called in a non-process context. It follows that the routine must not sleep or wait for events. However, the routine's existing kerneldoc seems to imply that it will wait until the request being cancelled has fully completed. This is not so, and thus the comment needs to be improved. Misunderstanding this point may very well have been responsible for a bug recently uncovered in the f_fs function. The updated comment explicitly says that the routine may return before the request's completion handler is called. Signed-off-by: Alan Stern <[email protected]> CC: John Stultz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-05scsi: remove bidirectional command supportChristoph Hellwig1-9/+2
No real need for bidi support once the OSD code is gone. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
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 <[email protected]>
2019-02-04scsi: target/core: Remove the write_pending_status() callback functionBart Van Assche1-9/+0
Due to the patch that makes TMF handling synchronous the write_pending_status() callback function is no longer called. Hence remove it. Acked-by: Felipe Balbi <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Andy Grover <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Bryant G. Ly <[email protected]> Cc: Nicholas Bellinger <[email protected]> Cc: Mike Christie <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Saurav Kashyap <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Juergen Gross <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-02-04USB: serial: cp210x: add GPIO support for CP2104Icenowy Zheng1-4/+78
The CP2104 chips feature 4 controllable GPIO pins, which are similar to the ones on CP2102N chip (output-only when push-pull, output or simulated input mode when open-drain). Add support for the GPIO pins for cp210x driver. The pin get/set routine is shared with CP2102N, but the pinconf initialization code is not shared because the acquisition of GPIO configuration in OTP ROM is similar to CP2105, not CP2102N. Signed-off-by: Icenowy Zheng <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
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 <[email protected]>
2019-02-04usb: core: Move variable initialization to appropriate placeSuwan Kim1-2/+1
It is better to initialize the variable 'cfgno' in the for loop than at the current place. Signed-off-by: Suwan Kim <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-02-01PCI: Move Rohm Vendor ID to generic listAndy Shevchenko1-1/+0
Move the Rohm Vendor ID to pci_ids.h instead of defining it in several drivers. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Mark Brown <[email protected]> Acked-by: Linus Walleij <[email protected]>
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-31usb: typec: tcpm: Correct the PPS out_volt calculationKyle Tso1-1/+2
When Sink negotiates PPS, the voltage range of selected PPS APDO might not cover the previous voltage (out_volt). If the previous out_volt is lower than the new min_volt, the output voltage in RDO might be set to an invalid value. For instance, supposed that the previous voltage is 5V, and the new voltage range in the APDO is 7V-12V. Then the output voltage in the RDO should not be set to 5V which is lower than the possible min_volt 7V. Fix this by choosing the maximal value between the previous voltage and the new min_volt first. And ensure that this value will not exceed the new max_volt. The new out_volt will fall within the new voltage range while being the closest value compared to the previous out_volt. Signed-off-by: Kyle Tso <[email protected]> Reviewed-by: Adam Thomson <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Fixes: c710d0bb76ff0 ("usb: typec: tcpm: Extend the matching rules on PPS APDO selection") Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-31Merge tag 'fixes-for-v5.0-rc4' of ↵Greg Kroah-Hartman5-9/+6
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v5.0-rc4 Dwc3 got a fix for cases when gadget driver queue an OUT request of length 0; this is a case that has been overlooked for quite some time now. Exynos' dwc3 glue layer got a fix on the error path for those cases where clk_prepare_enable() fails. TI's AM335x PHY driver got a fix for a race condition during probe. This race happened because driver was powering off the PHY only after adding the PHY handle to the framework. The result is that we could fall into a situation where user of the PHY (MUSB) could call phy_init() before phy driver's probe() called phy_poweroff() which would result in a powered off PHY after phy_init() was called. The old net2272 driver got a fix for an erroneous use of bitwise negation. * tag 'fixes-for-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: usb: phy: am335x: fix race condition in _probe usb: dwc3: exynos: Fix error handling of clk_prepare_enable usb: phy: fix link errors usb: gadget: udc: net2272: Fix bitwise and boolean operations usb: dwc3: gadget: Handle 0 xfer length for OUT EP
2019-01-30usb: gadget: musb: fix short isoc packets with inventra dmaPaul Elder2-22/+12
Handling short packets (length < max packet size) in the Inventra DMA engine in the MUSB driver causes the MUSB DMA controller to hang. An example of a problem that is caused by this problem is when streaming video out of a UVC gadget, only the first video frame is transferred. For short packets (mode-0 or mode-1 DMA), MUSB_TXCSR_TXPKTRDY must be set manually by the driver. This was previously done in musb_g_tx (musb_gadget.c), but incorrectly (all csr flags were cleared, and only MUSB_TXCSR_MODE and MUSB_TXCSR_TXPKTRDY were set). Fixing that problem allows some requests to be transferred correctly, but multiple requests were often put together in one USB packet, and caused problems if the packet size was not a multiple of 4. Instead, set MUSB_TXCSR_TXPKTRDY in dma_controller_irq (musbhsdma.c), just like host mode transfers. This topic was originally tackled by Nicolas Boichat [0] [1] and is discussed further at [2] as part of his GSoC project [3]. [0] https://groups.google.com/forum/?hl=en#!topic/beagleboard-gsoc/k8Azwfp75CU [1] https://gitorious.org/beagleboard-usbsniffer/beagleboard-usbsniffer-kernel/commit/b0be3b6cc195ba732189b04f1d43ec843c3e54c9?p=beagleboard-usbsniffer:beagleboard-usbsniffer-kernel.git;a=patch;h=b0be3b6cc195ba732189b04f1d43ec843c3e54c9 [2] http://beagleboard-usbsniffer.blogspot.com/2010/07/musb-isochronous-transfers-fixed.html [3] http://elinux.org/BeagleBoard/GSoC/USBSniffer Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support") Signed-off-by: Paul Elder <[email protected]> Signed-off-by: Bin Liu <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-30usbip: Fix vep_free_request() null pointer checks on input argsShuah Khan1-1/+2
Fix vep_free_request() to return when usb_ep and usb_request are null instead of calling WARN_ON. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-30usb: ehci-orion: add S2RAM supportMiquel Raynal1-0/+18
Add suspend/resume callbacks to reset the host controller properly during S2RAM operation. Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-30usb: ehci-orion: avoid double PHY initializationMiquel Raynal1-23/+3
No need to initialize the PHY from the driver's probe. It is done by the core automatically and doing it twice would increment the phy->powercount counter to 2 instead of 1. During later suspend operation, the counter will be decremented to one, no phy->power_off() will occur and worse than that, the following phy->power_on() at resume time will also be skipped, failing the whole S2RAM operation. Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-30usb: host: xhci: mvebu: add reset on resume quirkOfer Heifetz4-2/+26
The mvebu xHCI host driver does not have suspend/resume support. Use of the XHCI_RESET_ON_RESUME quirk is mandatory in order to avoid failures after resume. This will work only if no USB device is plugged-in. While at it, mention in the Kconfig file that this IP is also present on the A3700 SoC. Signed-off-by: Ofer Heifetz <[email protected]> [[email protected]: Reword the commit message] Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Gregory CLEMENT <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-30usb: core: comply to PHY frameworkMiquel Raynal3-0/+35
Current implementation of the USB core does not take into account the new PHY framework. Correct the situation by adding a call to phy_set_mode() before phy_power_on(). Signed-off-by: Miquel Raynal <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-28usb: phy: am335x: fix race condition in _probeBin Liu1-4/+1
power off the phy should be done before populate the phy. Otherwise, am335x_init() could be called by the phy owner to power on the phy first, then am335x_phy_probe() turns off the phy again without the caller knowing it. Fixes: 2fc711d76352 ("usb: phy: am335x: Enable USB remote wakeup using PHY wakeup") Cc: [email protected] # v3.18+ Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
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 <[email protected]> Signed-off-by: Alexey Khoroshilov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: phy: fix link errorsAnders Roxell1-1/+1
Fix link errors when CONFIG_FSL_USB2_OTG is enabled and USB_OTG_FSM is set to module then the following link error occurs. aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `fsl_otg_ioctl': drivers/usb/phy/phy-fsl-usb.c:1083: undefined reference to `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.c:1083:(.text+0x574): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `fsl_otg_start_srp': drivers/usb/phy/phy-fsl-usb.c:674: undefined reference to `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.c:674:(.text+0x61c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `fsl_otg_set_host': drivers/usb/phy/phy-fsl-usb.c:593: undefined reference to `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.c:593:(.text+0x7a4): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `fsl_otg_start_hnp': drivers/usb/phy/phy-fsl-usb.c:695: undefined reference to `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.c:695:(.text+0x858): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `a_wait_enum': drivers/usb/phy/phy-fsl-usb.c:274: undefined reference to `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.c:274:(.text+0x16f0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o:drivers/usb/phy/phy-fsl-usb.c:619: more undefined references to `otg_statemachine' follow aarch64-linux-gnu-ld: drivers/usb/phy/phy-fsl-usb.o: in function `fsl_otg_set_peripheral': drivers/usb/phy/phy-fsl-usb.c:619:(.text+0x1fa0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `otg_statemachine' make[1]: *** [Makefile:1020: vmlinux] Error 1 make[1]: Target 'Image' not remade because of errors. make: *** [Makefile:152: sub-make] Error 2 make: Target 'Image' not remade because of errors. Rework so that FSL_USB2_OTG depends on that the USB_OTG_FSM is builtin. Signed-off-by: Anders Roxell <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: gadget: udc: net2272: Fix bitwise and boolean operationsGustavo A. R. Silva1-1/+1
(!x & y) strikes again. Fix bitwise and boolean operations by enclosing the expression: intcsr & (1 << NET2272_PCI_IRQ) in parentheses, before applying the boolean operator '!'. Notice that this code has been there since 2011. So, it would be helpful if someone can double-check this. This issue was detected with the help of Coccinelle. Fixes: ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device controller") Cc: [email protected] Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
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: [email protected] Signed-off-by: Tejas Joglekar <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
2019-01-28usb: gadget: udc: renesas_usb3: add support for r8a774c0Fabrizio Castro1-0/+4
RZ/G2E USB 3.0 implementation is like the one found on R-Car E3, therefore add the same quirk. Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Fabrizio Castro <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: gadget: uvc: add uvcg_warn macroPaul Elder1-0/+2
We only have uvcg_dbg, uvcg_info, and uvcg_err, so add uvcg_warn macro to print gadget device name and function name along with format. Signed-off-by: Paul Elder <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: gadget: u_serial: process RX in workqueue instead of taskletMichał Mirosław1-21/+14
Switch RX processing from tasklet to (delayed) work queue. This allows receiver more room to process incoming data and prevents flood of "ttyGS0: RX not scheduled?" messages on HS receive on slow CPU. A side effect is 2.4MB/s zmodem transfer speed (up from 1.8MB/s) on my test board. Signed-off-by: Michał Mirosław <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: gadget: udc: reduce indentationJulia Lawall1-9/+8
Delete tab aligning a statement with the right hand side of a preceding assignment rather than the left hand side. Found with the help of Coccinelle. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>