aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2021-04-13USB: serial: xr: rename GPIO-pin definesJohan Hovold1-17/+17
Rename the GPIO-pin defines so that they reflect how they are used. Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: xr: rename GPIO-mode definesJohan Hovold1-7/+7
Rename the GPIO mode defines so that they reflect the datasheet and how they are used. Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: xr: add support for XR21V1412 and XR21V1414Johan Hovold1-4/+51
Add support for the two- and four-port variants of XR21V1410. Use the interface number of each control interface (e.g. 0, 2, 4, 6) to derive the zero-based channel index: XR21V1410 0 XR21V1412 0, 1 XR21V1414 0, 1, 2, 3 Note that the UART registers reside in separate blocks per channel, while the UART Manager functionality is implemented using per-channel registers. Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: clean up termios CSIZE handlingJohan Hovold1-8/+8
Remove the random white space from the CSIZE switch. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: use kernel types consistentlyJohan Hovold1-17/+17
Replace the remaining uses of user-space __XX types. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: add port-command helpersJohan Hovold1-50/+44
Add two port-command helpers to handle the UART module-id parameter instead of open coding. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: clean up vendor-request helpersJohan Hovold1-8/+7
Make the vendor-request helpers data parameters be void pointers and drop the caller casts. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: drop unnecessary packed attributesJohan Hovold1-4/+4
Drop unnecessary packed attributes from structures that don't need it. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: drop unnecessary packed attributesJohan Hovold2-4/+4
Drop unnecessary packed attributes from structures that don't need it and use the __packed macro consistently. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: use kernel types consistentlyJohan Hovold2-71/+71
Use kernel types consistently by replacing the remaining __uXX types. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: add read-port-command helperJohan Hovold1-6/+9
Add a read-port-command helper analogous to the send-port-command helper to take care of the UART module id instead of open coding. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: add send-port-command helperJohan Hovold1-28/+13
Add a send-port-command helper which takes care of determining the UART module id when sending commands instead of doing so at every call site. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: clean up vendor-request helpersJohan Hovold1-7/+6
Clean up the vendor-request helpers by using kernel-types consistently and using void pointers for the data arguments, which allows removing a cast from one caller. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: drop drain delay for 3410Johan Hovold1-3/+14
Unlike the TUSB5052, the TUSB3410 has an LSR TEMT bit to tell if both the transmitter data and shift registers are empty. Make sure to check also the shift register on TUSB3410 when waiting for the transmit buffer to drain during close and drop the time-based one-char delay which is otherwise needed (e.g. 90 ms at 110 bps). Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: ti_usb_3410_5052: reduce drain delay to one charJohan Hovold1-1/+5
The three-character drain delay was added by commit f1175daa5312 ("USB: ti_usb_3410_5052: kill custom closing_wait") when removing the custom closing-wait implementation, which used a fixed 20 ms poll period and drain delay. This was likely a bit too conservative as a one-character timeout (e.g. 33 ms at 300 bps) should be enough to compensate for the lack of a transmitter empty bit in the TUSB5052 line-status register. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: io_ti: document reason for drain delayJohan Hovold1-0/+4
Document that the device line-status register doesn't tell when the transmitter shift register has emptied and that this is why the one-character drain delay is needed. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13USB: serial: f81232: drop time-based drain delayJohan Hovold1-1/+0
The f81232 driver now waits for the transmit FIFO to drain during close so there is no need to keep the time-based drain delay, which would add up to two seconds on every close for low line speeds. Fixes: 98405f81036d ("USB: serial: f81232: add tx_empty function") Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-13usb: dwc2: Add exit clock gating before removing driverArtur Petrosyan1-0/+9
When dwc2 core is in clock gating mode loading driver again causes driver fail. Because in that mode registers are not accessible. Added a flow of exiting clock gating mode to avoid the driver reload failure. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add clock gating exiting flow by system resumeArtur Petrosyan1-0/+22
If not hibernation nor partial power down are supported, port resume is done using the clock gating programming flow. Adds a new flow of exiting clock gating when PC is resumed. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add clock gating entering flow by system suspendArtur Petrosyan1-0/+9
If not hibernation nor partial power down are supported, clock gating is used to save power. Adds a new flow of entering clock gating when PC is suspended. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Allow exit clock gating in urb enqueueArtur Petrosyan1-0/+8
When core is in clock gating state and an external hub is connected, upper layer sends URB enqueue request, which results in port reset issue. Added exit from clock gating state to avoid port reset issue and process upper layer request properly. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Update exit clock gating when port is resumedArtur Petrosyan1-25/+4
Updates the implementation of exiting clock gating mode when core receives port resume. Instead of setting the required bit fields of the registers inline, called the "dwc2_host_exit_clock_gating()" function. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Update enter clock gating when port is suspendedArtur Petrosyan1-15/+4
Updates the implementation of entering clock gating mode when core receives port suspend. Instead of setting the required bit fields of the registers inline, called the "dwc2_host_enter_clock_gating()" function. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add exit clock gating when port reset is assertedArtur Petrosyan1-0/+4
Adds clock gating exit flow when set port feature reset is received in suspended state. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add exit clock gating from session request interruptArtur Petrosyan1-6/+13
Added clock gating exit flow from session request interrupt handler according programming guide. Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add exit clock gating from wakeup interruptArtur Petrosyan1-11/+22
Added exit from clock gating mode when wakeup interrupt is detected. To exit from the clock gating in device mode "dwc2_gadget_exit_clock_gating()" function is used with rem_wakeup parameter 0. To exit clock gating in host mode "dwc2_host_exit_clock_gating()" with rem_wakeup parameter 1. Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Allow entering clock gating from USB_SUSPEND interruptArtur Petrosyan1-3/+7
If core doesn't support hibernation or partial power down power saving options, power can still be saved using clock gating on all the clocks. - Added entering clock gating state from USB_SUSPEND interrupt. Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add host clock gating support functionsArtur Petrosyan2-0/+91
Added host clock gating support functions according programming guide. Added function names: dwc2_host_enter_clock_gating() dwc2_host_exit_clock_gating() Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-13usb: dwc2: Add device clock gating support functionsArtur Petrosyan2-2/+79
Added device clock gating support functions according programming guide. Moved "bus_suspended" flag to "dwc2_hsotg" struct because we need to set that flag while entering to clock gating in case when the driver is built in peripheral mode. Added function names: dwc2_gadget_enter_clock_gating() dwc2_gadget_exit_clock_gating() Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Artur Petrosyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-12Merge tag 'usb-v5.13-rc1' of ↵Greg Kroah-Hartman11-43/+162
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: Several Cadence3 improvements are introduced in v5.13-rc1: - Add recovery during resume if the controller was lost power at system suspend - Reduce DMA memory footprint - Other small improvements * tag 'usb-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: cdnsp: Fixes issue with Configure Endpoint command usb: cdnsp: remove redundant initialization of variable ret usb: cdns3: delete repeated clear operations usb: cdns3: Optimize DMA request buffer allocation usb: cdns3: Use dma_pool_* api to alloc trb pool usb: cdns3: fix static checker warning. usb: cdns3: imx: mark cdns_imx_system_resume as __maybe_unused usb: cdns3: trace: delete the trace parameter for request->trb usb: cdns3: imx: add power lost support for system resume usb: cdns3: add power lost support for system resume
2021-04-12Revert "usb: Link the ports to the connectors they are attached to"Greg Kroah-Hartman1-3/+0
This reverts commit 63cd78617350dae99cc5fbd8f643b83ee819fe33 as it causes a build error: depmod: ERROR: Cycle detected: usbcore -> typec -> usbcore depmod: ERROR: Found 2 modules in dependency cycles! Reported-by: Stephen Rothwell <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-12usb: cdnsp: Fixes issue with Configure Endpoint commandPawel Laszczak2-5/+13
Patch adds flag EP_UNCONFIGURED to detect whether endpoint was unconfigured. This flag is set in cdnsp_reset_device after Reset Device command. Among others this command disables all non control endpoints. Flag is used in cdnsp_gadget_ep_disable to protect controller against invoking Configure Endpoint command on disabled endpoint. Lack of this protection in some cases caused that Configure Endpoint command completed with Context State Error code completion. Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") Signed-off-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdnsp: remove redundant initialization of variable retColin Ian King1-1/+1
The variable ret is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: delete repeated clear operationsWang Qing1-1/+0
dma_alloc_coherent already zeroes out memory, so memset is not needed. Signed-off-by: Wang Qing <[email protected]> Reviewed-by: Pawel Laszczak <[email protected]> Acked-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: Optimize DMA request buffer allocationSanket Parmar2-6/+25
dma_alloc_coherent() might fail on the platform with a small DMA region. To avoid such failure in cdns3_prepare_aligned_request_buf(), dma_alloc_coherent() is replaced with dma_alloc_noncoherent() to allocate aligned request buffer of dynamic length. Reported-by: Aswath Govindraju <[email protected]> Signed-off-by: Sanket Parmar <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: Use dma_pool_* api to alloc trb poolSanket Parmar2-23/+20
Allocation of DMA coherent memory in atomic context using dma_alloc_coherent() might fail on platforms with smaller DMA region. To fix it, dma_alloc_coherent() is replaced with dma_pool API to allocate a smaller chunk of DMA coherent memory for TRB rings. Reported-by: Aswath Govindraju <[email protected]> Signed-off-by: Sanket Parmar <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: fix static checker warning.Frank Li1-1/+1
The patch c450e48eb570: "usb: cdns3: add power lost support for system resume" from Feb 18, 2021, leads to the following static checker warning: drivers/usb/cdns3/core.c:551 cdns_resume() error: uninitialized symbol 'ret'. drivers/usb/cdns3/core.c 544 545 if (!role_changed) { 546 if (cdns->role == USB_ROLE_HOST) 547 ret = cdns_drd_host_on(cdns); 548 else if (cdns->role == USB_ROLE_DEVICE) 549 ret = cdns_drd_gadget_on(cdns); "ret" is uninitialized at else branch. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Frank Li <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: imx: mark cdns_imx_system_resume as __maybe_unusedWei Yongjun1-1/+1
The function cdns_imx_system_resume() may have no callers depending on configuration, so it must be marked __maybe_unused to avoid harmless warning: drivers/usb/cdns3/cdns3-imx.c:378:12: warning: 'cdns_imx_system_resume' defined but not used [-Wunused-function] 378 | static int cdns_imx_system_resume(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~~ Fixes: 67982dfa59de ("usb: cdns3: imx: add power lost support for system resume") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: trace: delete the trace parameter for request->trbPeter Chen1-4/+1
It is not correct using %pa to print virtual address of request->trb, and it is hard to print its physical address due to the virtual address is zero before using. It could use index (start_trb/end_trb) to know the current trb position, so no matter virtual address or physical address for request-trb is not so meaningful. Reported-by: Steven Rostedt <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: imx: add power lost support for system resumeFrank Li1-0/+34
imx need special handle when controller lost power Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Frank Li <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12usb: cdns3: add power lost support for system resumeFrank Li5-3/+68
If the controller lost its power during the system suspend, we need to do all initialiation operations. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Frank Li <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2021-04-12USB: serial: cp210x: add gpio-configuration debug printkJohan Hovold1-0/+6
Add a debug printk to dump the GPIO configuration stored in EEPROM during probe. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-12USB: serial: cp210x: provide gpio valid maskJohan Hovold1-12/+13
Use the new GPIO valid-mask feature to inform gpiolib which pins are available for use instead of handling that in a request callback. This also allows user space to figure out which pins are available through the chardev interface without having to request each pin in turn. Note that the return value when requesting an unavailable pin will now be -EINVAL instead of -ENODEV. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2021-04-12usbip: vudc: fix missing unlock on error in usbip_sockfd_store()Ye Bin1-0/+2
Add the missing unlock before return from function usbip_sockfd_store() in the error handling case. Fixes: bd8b82042269 ("usbip: vudc synchronize sysfs code paths") Reported-by: Hulk Robot <[email protected]> Acked-by: Shuah Khan <[email protected]> Signed-off-by: Ye Bin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-12Merge 5.12-rc7 into usb-nextGreg Kroah-Hartman8-7/+50
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-10usb: dwc3: qcom: Detect DWC3 DT-nodes using compatible stringSerge Semin1-1/+1
In accordance with the USB HCD/DRD schema all the USB controllers are supposed to have DT-nodes named with prefix "^usb(@.*)?". Since the existing DT-nodes will be renamed in a subsequent patch let's fix the DWC3 Qcom-specific code to detect the DWC3 sub-node just by checking its compatible string to match the "snps,dwc3". The semantic of the code won't change seeing all the DWC USB3 nodes are supposed to have the compatible property with any of those strings set. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-10usb: dwc3: qcom: Remove redundant dev_err call in dwc3_qcom_probe()Bixuan Cui1-1/+0
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Bixuan Cui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-10usb: core: reduce power-on-good delay time of root hubChunfeng Yun1-2/+4
Return the exactly delay time given by root hub descriptor, this helps to reduce resume time etc. Due to the root hub descriptor is usually provided by the host controller driver, if there is compatibility for a root hub, we can fix it easily without affect other root hub Acked-by: Alan Stern <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-10USB:ehci:fix Kunpeng920 ehci hardware problemLongfang Liu1-0/+3
Kunpeng920's EHCI controller does not have SBRN register. Reading the SBRN register when the controller driver is initialized will get 0. When rebooting the EHCI driver, ehci_shutdown() will be called. if the sbrn flag is 0, ehci_shutdown() will return directly. The sbrn flag being 0 will cause the EHCI interrupt signal to not be turned off after reboot. this interrupt that is not closed will cause an exception to the device sharing the interrupt. Therefore, the EHCI controller of Kunpeng920 needs to skip the read operation of the SBRN register. Acked-by: Alan Stern <[email protected]> Signed-off-by: Longfang Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-04-09USB: serial: do not use tty class device for debuggingJohan Hovold3-22/+21
Use the port struct device rather than tty class device for debugging. Note that while USB serial doesn't support serdev yet (due to serdev not handling hotplugging), serdev ttys do not have a corresponding class device and would have been logged using a "(NULL device *):" prefix. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>