aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3/host.c
AgeCommit message (Collapse)AuthorFilesLines
2024-09-11usb: xhci: fix loss of data on Cadence xHCPawel Laszczak1-1/+3
Streams should flush their TRB cache, re-read TRBs, and start executing TRBs from the beginning of the new dequeue pointer after a 'Set TR Dequeue Pointer' command. Cadence controllers may fail to start from the beginning of the dequeue TRB as it doesn't clear the Opaque 'RsvdO' field of the stream context during 'Set TR Dequeue' command. This stream context area is where xHC stores information about the last partially executed TD when a stream is stopped. xHC uses this information to resume the transfer where it left mid TD, when the stream is restarted. Patch fixes this by clearing out all RsvdO fields before initializing new Stream transfer using a 'Set TR Dequeue Pointer' command. Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") cc: [email protected] Signed-off-by: Pawel Laszczak <[email protected]> Reviewed-by: Peter Chen <[email protected]> Link: https://lore.kernel.org/r/PH7PR07MB95386A40146E3EC64086F409DD9D2@PH7PR07MB9538.namprd07.prod.outlook.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
2024-02-19usb: cdnsp: blocked some cdns3 specific codePawel Laszczak1-2/+14
host.c file has some parts of code that were introduced for CDNS3 driver and should not be used with CDNSP driver. This patch blocks using these parts of codes by CDNSP driver. These elements include: - xhci_plat_cdns3_xhci object - cdns3 specific XECP_PORT_CAP_REG register - cdns3 specific XECP_AUX_CTRL_REG1 register cc: [email protected] Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") Signed-off-by: Pawel Laszczak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-11-09usb: cdns3: host: fix endless superspeed hub port resetLi Jun1-28/+28
When usb 3.0 hub connect with one USB 2.0 device and NO USB 3.0 device, some usb hub reports endless port reset message. [ 190.324169] usb 2-1: new SuperSpeed USB device number 88 using xhci-hcd [ 190.352834] hub 2-1:1.0: USB hub found [ 190.356995] hub 2-1:1.0: 4 ports detected [ 190.700056] usb 2-1: USB disconnect, device number 88 [ 192.472139] usb 2-1: new SuperSpeed USB device number 89 using xhci-hcd [ 192.500820] hub 2-1:1.0: USB hub found [ 192.504977] hub 2-1:1.0: 4 ports detected [ 192.852066] usb 2-1: USB disconnect, device number 89 The reason is the runtime pm state of USB2.0 port is active and USB 3.0 port is suspend, so parent device is active state. cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb2/power/runtime_status suspended cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb1/power/runtime_status active cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/power/runtime_status active cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/power/runtime_status active So xhci_cdns3_suspend_quirk() have not called. U3 configure is not applied. move U3 configure into host start. Reinit again in resume function in case controller power lost during suspend. Cc: [email protected] 5.10 Signed-off-by: Li Jun <[email protected]> Signed-off-by: Frank Li <[email protected]> Reviewed-by: Peter Chen <[email protected]> Acked-by: Alexander Stein <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-12-03treewide: Add missing includes masked by cgroup -> bpf dependencyJakub Kicinski1-0/+1
cgroup.h (therefore swap.h, therefore half of the universe) includes bpf.h which in turn includes module.h and slab.h. Since we're about to get rid of that dependency we need to clean things up. v2: drop the cpu.h include from cacheinfo.h, it's not necessary and it makes riscv sensitive to ordering of include files. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Krzysztof WilczyƄski <[email protected]> Acked-by: Peter Chen <[email protected]> Acked-by: SeongJae Park <[email protected]> Acked-by: Jani Nikula <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ # v1 Link: https://lore.kernel.org/all/[email protected]/ # cacheinfo discussion Link: https://lore.kernel.org/bpf/[email protected]
2020-12-29usb: cdns3: Removes xhci_cdns3_suspend_quirk from host-export.hPawel Laszczak1-1/+3
Function xhci_cdns3_suspend_quirk is used only in host.c file. We can make it as static and removes it from host-export.h. Signed-off-by: Pawel Laszczak <[email protected]> Acked-by: Roger Quadros <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-29usb: cdns3: Refactoring names in reusable codePawel Laszczak1-11/+11
Patch change the functions and objects names in reusable code. The reusable code includes core.c, core.h, drd.c and drd.h files. It also changes the names of all references to these functions and objects in other cdns3 files. There are a lot of changes, but all changes are very trivial. The reason of this patch is to avoid of mixing prefix cdns3 and cdnsp in in cdnsp driver what could introduce some confusion in understanding of cdnsp driver. This patch assumes to use three different prefixes in Cadence USB drivers: cdns: for common reusable code cdnsp: for names related only with cdnsp driver cdns3: for names related only with cdns3 driver Signed-off-by: Pawel Laszczak <[email protected]> Tested-by: Aswath Govindraju <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-10usb: cdns3: fix NULL pointer dereference on no platform dataRoger Quadros1-1/+1
Some platforms (e.g. TI) will not have any platform data which will lead to NULL pointer dereference if we don't check for NULL pdata. Fixes: 7cea9657756b ("usb: cdns3: add quirk for enable runtime pm by default") Reported-by: Nishanth Menon <[email protected]> Signed-off-by: Roger Quadros <[email protected]> Acked-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-10usb: cdns3: add quirk for enable runtime pm by defaultPeter Chen1-3/+17
Some vendors (eg: NXP) may want to enable runtime pm by default for power saving, add one quirk for it. Reviewed-by: Jun Li <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-10usb: cdns3: host: disable BEI supportPeter Chen1-1/+1
The Cadence xHCI doesn't support BEI well, it causes the disconnection of ISOC devices can't be detected, so we disable it. Reviewed-by: Jun Li <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-10usb: cdns3: host: add xhci_plat_priv quirk XHCI_SKIP_PHY_INITPeter Chen1-0/+1
cdns3 manages PHY by own DRD driver, so skip the management by HCD core. Reviewed-by: Jun Li <[email protected]> Reviewed-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-12-10usb: cdns3: host: add .suspend_quirk for xhci-plat.cPeter Chen1-0/+43
cdns3 has some special PM sequence between xhci_bus_suspend and xhci_suspend, add quirk to implement it. Reviewed-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]>
2020-10-02usb: cdns3: add runtime PM supportPeter Chen1-0/+7
Introduce runtime PM and wakeup interrupt handler for cdns3, the runtime PM is default off since other cdns3 may not implement glue layer support for runtime PM. One typical wakeup event use case is xHCI runtime suspend will clear USBCMD.RS bit, after that the xHCI will not trigger any interrupts, so its parent (cdns core device) needs to resume xHCI device when any (wakeup) events occurs at host port. When the controller is in low power mode, the lpm flag will be set. The interrupt triggered later than lpm flag is set considers as wakeup interrupt and handled at cdns_wakeup_irq. Once the wakeup occurs, it first disables interrupt to avoid later interrupt occurrence since the controller is in low power mode at that time, and access registers may be invalid at that time. At wakeup handler, it will call pm_request_resume to wakeup xHCI device, and at runtime resume handler, it will enable interrupt again. The API platform_suspend is introduced for glue layer to implement platform specific PM sequence. Reviewed-by: Pawel Laszczak <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2020-07-24usb: cdns3: drd: simplify *switch_gadet and *switch_hostPawel Laszczak1-2/+2
Patch split function cdns3_drd_switch_gadget and cdns3_drd_switch_host into: - cdns3_drd_host_on - cdns3_drd_host_off - cdns3_drd_gadget_on - cdns3_drd_gadgett_off These functions don't have any shared code so it's better to have smaller, faster and easier functions. Signed-off-by: Pawel Laszczak <[email protected]> Reviewed-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-10-27usb: cdns3: include host-export,h for cdns3_host_initBen Dooks (Codethink)1-0/+1
The cdns3_host_init() function is declared in host-export.h but host.c does not include it. Add the include to have the declaration present (and remove the declaration of cdns3_host_exit which is now static). Fixes the following sparse warning: drivers/usb/cdns3/host.c:58:5: warning: symbol 'cdns3_host_init' was not declared. Should it be static? Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-08-29usb: cdns3: Add Cadence USB3 DRD DriverPawel Laszczak1-0/+74
This patch introduce new Cadence USBSS DRD driver to Linux kernel. The Cadence USBSS DRD Controller is a highly configurable IP Core which can be instantiated as Dual-Role Device (DRD), Peripheral Only and Host Only (XHCI)configurations. The current driver has been validated with FPGA platform. We have support for PCIe bus, which is used on FPGA prototyping. The host side of USBSS-DRD controller is compliant with XHCI specification, so it works with standard XHCI Linux driver. Signed-off-by: Pawel Laszczak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>