summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
AgeCommit message (Collapse)AuthorFilesLines
2024-09-11Merge tag 'thunderbolt-for-v6.12-rc1' of ↵Greg Kroah-Hartman4-52/+452
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.12 merge window This includes following USB4/Thunderbolt changes for the v6.12 merge window: - Improvements for software receiver lane margining - Enable support for optional voltage offset range for receiver lane margining. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.12-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Improve software receiver lane margining thunderbolt: Add optional voltage offset range for receiver lane margining thunderbolt: Consolidate margining parameters into a structure thunderbolt: Add missing usb4_port_sb_read() to usb4_port_sw_margin()
2024-09-03thunderbolt: Don't create device link from USB4 Host Interface to USB3 xHC hostMathias Nyman1-30/+10
USB core will create device links between tunneled USB3 devices and USB4 Host Interface during USB device creation. Those device links are removed with the tunneled USB3 devices, allowing USB4 Host Interface to runtime suspend if USB3 tunnels are not used. So remove device link creation between USB4 Host Interface and USB3 xHC during NHI probe Reported-by: Rajaram Regupathy <rajaram.regupathy@intel.com> Reported-by: Saranya Gopal <saranya.gopal@intel.com> Tested-by: Saranya Gopal <saranya.gopal@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20240830152630.3943215-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-22thunderbolt: Improve software receiver lane marginingR Kannappan4-16/+290
USB4 specification defines the metadata needed to perform software margining, as well as the necessary steps which include waiting for dwell time. - Add dwell_time attribute to set the wait time while performing margining and checking for link errors. - Add error_counter attribute to configure error counter prior to margining test. - Add voltage_time_offset attribute to set the voltage or time offset steps before performing the software margining test. - Perform software margining test for dwell duration, break if there are link errors, stop the clocks and provide results. Below is a minimalistic example how this can be used. Note these values are just examples. The exact values in practice depend on host specific capabilities and the type of measurement to be performed. # cd /sys/kernel/debug/thunderbolt/ROUTER/portX/margining/ # echo software > mode # echo 400 > dwell_time # echo 1 > run As usual the results attribute contains the results of a succesfull run. Signed-off-by: R Kannappan <r.kannappan@intel.com> Co-developed-by: Rene Sapiens <rene.sapiens@intel.com> Signed-off-by: Rene Sapiens <rene.sapiens@intel.com> Co-developed-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-08-22thunderbolt: Add optional voltage offset range for receiver lane marginingRene Sapiens4-0/+85
Add optional extended voltage offset range support for software and hardware margining as defined by the USB4 specification. If supported, it can be enabled like below: # cd /sys/kernel/debug/thunderbolt/ROUTER/portX/margining/ # echo Y > optional_voltage_offset Signed-off-by: Rene Sapiens <rene.sapiens@intel.com> Co-developed-by: R Kannappan <r.kannappan@intel.com> Signed-off-by: R Kannappan <r.kannappan@intel.com> Co-developed-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-08-22thunderbolt: Consolidate margining parameters into a structureRene Sapiens4-43/+78
Consolidate the hardware and software margining parameters into a single structure to reduce the number of parameters passed to the margining functions. Signed-off-by: Rene Sapiens <rene.sapiens@intel.com> Co-developed-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-08-22thunderbolt: Add missing usb4_port_sb_read() to usb4_port_sw_margin()Aapo Vienamo3-7/+13
Synchronize the operation completion by reading back the software margining operation completion metadata into margining->results. Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Co-developed-by: R Kannappan <r.kannappan@intel.com> Signed-off-by: R Kannappan <r.kannappan@intel.com> Co-developed-by: Rene Sapiens <rene.sapiens@intel.com> Signed-off-by: Rene Sapiens <rene.sapiens@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-08-06thunderbolt: Mark XDomain as unplugged when router is removedMika Westerberg1-0/+1
I noticed that when we do discrete host router NVM upgrade and it gets hot-removed from the PCIe side as a result of NVM firmware authentication, if there is another host connected with enabled paths we hang in tearing them down. This is due to fact that the Thunderbolt networking driver also tries to cleanup the paths and ends up blocking in tb_disconnect_xdomain_paths() waiting for the domain lock. However, at this point we already cleaned the paths in tb_stop() so there is really no need for tb_disconnect_xdomain_paths() to do that anymore. Furthermore it already checks if the XDomain is unplugged and bails out early so take advantage of that and mark the XDomain as unplugged when we remove the parent router. Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-08-02thunderbolt: Fix memory leaks in {port|retimer}_sb_regs_write()Aapo Vienamo1-4/+6
Add missing free_page() call for the memory allocated by validate_and_copy_from_user(). Fixes: 6d241fa00159 ("thunderbolt: Add sideband register access to debugfs") Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-07-25Merge tag 'driver-core-6.11-rc1' of ↵Linus Torvalds1-4/+4
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the big set of driver core changes for 6.11-rc1. Lots of stuff in here, with not a huge diffstat, but apis are evolving which required lots of files to be touched. Highlights of the changes in here are: - platform remove callback api final fixups (Uwe took many releases to get here, finally!) - Rust bindings for basic firmware apis and initial driver-core interactions. It's not all that useful for a "write a whole driver in rust" type of thing, but the firmware bindings do help out the phy rust drivers, and the driver core bindings give a solid base on which others can start their work. There is still a long way to go here before we have a multitude of rust drivers being added, but it's a great first step. - driver core const api changes. This reached across all bus types, and there are some fix-ups for some not-common bus types that linux-next and 0-day testing shook out. This work is being done to help make the rust bindings more safe, as well as the C code, moving toward the end-goal of allowing us to put driver structures into read-only memory. We aren't there yet, but are getting closer. - minor devres cleanups and fixes found by code inspection - arch_topology minor changes - other minor driver core cleanups All of these have been in linux-next for a very long time with no reported problems" * tag 'driver-core-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (55 commits) ARM: sa1100: make match function take a const pointer sysfs/cpu: Make crash_hotplug attribute world-readable dio: Have dio_bus_match() callback take a const * zorro: make match function take a const pointer driver core: module: make module_[add|remove]_driver take a const * driver core: make driver_find_device() take a const * driver core: make driver_[create|remove]_file take a const * firmware_loader: fix soundness issue in `request_internal` firmware_loader: annotate doctests as `no_run` devres: Correct code style for functions that return a pointer type devres: Initialize an uninitialized struct member devres: Fix memory leakage caused by driver API devm_free_percpu() devres: Fix devm_krealloc() wasting memory driver core: platform: Switch to use kmemdup_array() driver core: have match() callback in struct bus_type take a const * MAINTAINERS: add Rust device abstractions to DRIVER CORE device: rust: improve safety comments MAINTAINERS: add Danilo as FIRMWARE LOADER maintainer MAINTAINERS: add Rust FW abstractions to FIRMWARE LOADER firmware: rust: improve safety comments ...
2024-07-03driver core: have match() callback in struct bus_type take a const *Greg Kroah-Hartman1-4/+4
In the match() callback, the struct device_driver * should not be changed, so change the function callback to be a const *. This is one step of many towards making the driver core safe to have struct device_driver in read-only memory. Because the match() callback is in all busses, all busses are modified to handle this properly. This does entail switching some container_of() calls to container_of_const() to properly handle the constant *. For some busses, like PCI and USB and HV, the const * is cast away in the match callback as those busses do want to modify those structures at this point in time (they have a local lock in the driver structure.) That will have to be changed in the future if they wish to have their struct device * in read-only-memory. Cc: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Alex Elder <elder@kernel.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-19thunderbolt: debugfs: Use FIELD_GET()Aapo Vienamo2-27/+11
Use the FIELD_GET() macro instead of open coding the masks and shifts. This makes the code more compact and improves readability as it avoids the need to wrap excessively long lines. Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Yehezkel Bernat <YehezkelShB@gmail.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Add receiver lane margining support for retimersMika Westerberg6-48/+128
Retimers support lane margining as well so make this available through debugfs in the same way as we do for the USB4 ports. When this is enabled we also expose retimers on the other side of the cable because typically margining is implemented only on direction towards the cable. However, for the retimers on the other side of the cable we do not allow NVM upgrade to avoid confusing the existing userspace (the same retimer may now appear twice with different name) and is probably not a good idea anyway. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Make margining functions accept target and retimer indexMika Westerberg3-32/+50
In order to add lane margining support for retimers make the margining functions take sideband target and retimer index as parameters. This makes it possible to access both router and retimer sideband using the same functions. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Split out margining from USB4 portMika Westerberg1-122/+112
We are going to expand lane margining support for retimers too so split out the generic margining functionality out of being specific to USB4 ports. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Add sideband register access to debugfsMika Westerberg4-0/+307
This makes it possible to read and write USB4 port and retimer sideband registers through debugfs which is useful for debugging and manufacturing purposes. We add "sb_regs" debugfs attribute under each USB4 port and retimer that is used to access the sideband. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.cMika Westerberg3-75/+66
We need to call these from other files too so make them available outside of usb4.c. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Move usb4_port_margining_caps() declaration into correct placeMika Westerberg1-1/+1
It is supposed to be close with the other lane margining functions so move it there. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-06-17thunderbolt: Mention Thunderbolt/USB4 debugging tools in KconfigMika Westerberg1-1/+5
This allows the interested parties to find the Thunderbolt/USB4 debugging tools (aka tbtools) easier in case they need to look at the information under debugfs entries. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Suggested-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
2024-05-31thunderbolt: debugfs: Fix margin debugfs node creation conditionAapo Vienamo1-2/+3
The margin debugfs node controls the "Enable Margin Test" field of the lane margining operations. This field selects between either low or high voltage margin values for voltage margin test or left or right timing margin values for timing margin test. According to the USB4 specification, whether or not the "Enable Margin Test" control applies, depends on the values of the "Independent High/Low Voltage Margin" or "Independent Left/Right Timing Margin" capability fields for voltage and timing margin tests respectively. The pre-existing condition enabled the debugfs node also in the case where both low/high or left/right margins are returned, which is incorrect. This change only enables the debugfs node in question, if the specific required capability values are met. Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-05-10Merge tag 'thunderbolt-for-v6.10-rc1' of ↵Greg Kroah-Hartman9-47/+59
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.10 merge window This includes following USB4/Thunderbolt changes for the v6.10 merge window: - Enable NVM firmare upgrade on Intel Maple Ridge Thunderbolt 4 controller - Improve USB3 tunnel bandwidth calculation - Improve sideband access - Minor cleanups and fixes. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Correct trace output of firmware connection manager packets thunderbolt: Fix kernel-doc for tb_tunnel_alloc_dp() thunderbolt: Fix uninitialized variable in tb_tunnel_alloc_usb3() thunderbolt: There are only 5 basic router registers in pre-USB4 routers thunderbolt: No need to loop over all retimers if access fails thunderbolt: Increase sideband access polling delay thunderbolt: Get rid of TB_CFG_PKG_PREPARE_TO_SLEEP thunderbolt: Use correct error code with ERROR_NOT_SUPPORTED thunderbolt: Allow USB3 bandwidth to be lower than maximum supported thunderbolt: Fix calculation of consumed USB3 bandwidth on a path thunderbolt: Enable NVM upgrade support on Intel Maple Ridge
2024-04-29thunderbolt: Correct trace output of firmware connection manager packetsMika Westerberg1-2/+11
These are special packets that the drivers sends directly to the firmware connection manager (ICM). These do not have route string because they are always consumed by the firmware connection manager running on the host router, so hard-code that in the output accordingly. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-27thunderbolt: Fix kernel-doc for tb_tunnel_alloc_dp()Gil Fine1-4/+4
In case of no bandwidth available for DP tunnel, the function get the arguments @max_up and @max_down set to zero. Fix the kernel-doc to describe more accurately the purpose of the function. No functional changes. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-27thunderbolt: Fix uninitialized variable in tb_tunnel_alloc_usb3()Gil Fine1-5/+5
Currently in case of no bandwidth available for USB3 tunnel, we are left with uninitialized variable that can lead to huge negative allocated bandwidth. Fix this by initializing the variable to zero. While there, fix the kernel-doc to describe more accurately the purpose of the function tb_tunnel_alloc_usb3(). Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/linux-usb/6289898b-cd63-4fb8-906a-1b6977321af9@moroto.mountain/ Fixes: 25d905d2b819 ("thunderbolt: Allow USB3 bandwidth to be lower than maximum supported") Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-24thunderbolt: There are only 5 basic router registers in pre-USB4 routersMika Westerberg1-1/+1
Intel pre-USB4 routers only have ROUTER_CS_0 up to ROUTER_CS_4 and it immediately follows the TMU router registers. Correct this accordingly. Reported-by: Rajaram Regupathy <rajaram.regupathy@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-23thunderbolt: No need to loop over all retimers if access failsMika Westerberg1-4/+8
When we read the NVM authentication status or unsetting the inbound SBTX there is no point to continue the loop after first access to a retimer fails because there won't be any more retimers after this anyway so bail out from the loops early. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-23thunderbolt: Increase sideband access polling delayMika Westerberg1-7/+15
The USB4 sideband access is slow compared to the high-speed link and the access timing parameters are tens of milliseconds according the spec. To avoid too much unnecessary polling for the sideband pass the wait delay to usb4_port_wait_for_bit() and use larger (5ms) value compared to the high-speed access. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-19thunderbolt: Get rid of TB_CFG_PKG_PREPARE_TO_SLEEPMika Westerberg1-6/+0
This is not used anywhere in the driver so remove it. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-19thunderbolt: Use correct error code with ERROR_NOT_SUPPORTEDMika Westerberg1-1/+1
We check for -EOPNOTSUPP but tb_xdp_handle_error() translated it to -ENOTSUPP instead which is dealt as "transient" error and retried after a while. Fix this so that we bail out early when the other side clearly tells us it is does not support this. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-12thunderbolt: Allow USB3 bandwidth to be lower than maximum supportedGil Fine1-15/+10
Currently USB3 tunnel setup fails if USB4 link available bandwidth is too low to allow USB3 Maximum Supported Link Rate. In reality, this limitation is not needed, and may cause failure of USB3 tunnel establishment, if USB4 link available bandwidth is lower than USB3 Maximum Supported Link Rate. E.g. if we connect to USB4 v1 host router, a USB4 v1 device router, via 10 Gb/s cable. Hence, here we discard this limitation, and now we only limit USB3 bandwidth allocation to be not higher than 90% of USB3 Max Supported Link Rate (for first USB3 tunnel only). Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-12thunderbolt: Fix calculation of consumed USB3 bandwidth on a pathGil Fine1-4/+5
Currently, when setup a new USB3 tunnel that is starting from downstream USB3 adapter of first depth router (or deeper), to upstream USB3 adapter of a second depth router (or deeper), we calculate consumed bandwidth. For this calculation we take into account first USB3 tunnel consumed bandwidth while we shouldn't, because we just recalculating the first USB3 tunnel allocated bandwidth. Fix that, so that more bandwidth is available for the new USB3 tunnel being setup. While there, fix the kernel-doc to decribe more accurately the purpose of the function. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-10thunderbolt: Avoid notify PM core about runtime PM resumeGil Fine4-11/+36
Currently we notify PM core about occurred wakes after any resume. This is not actually needed after resume from runtime suspend. Hence, notify PM core about occurred wakes only after resume from system sleep. Also, if the wake occurred in USB4 router upstream port, we don't notify the PM core about it since it is not actually needed and can cause unexpected autowake (e.g. if /sys/power/wakeup_count is used). While there add the missing kernel-doc for tb_switch_resume(). Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-10thunderbolt: Fix wake configurations after device unplugGil Fine1-7/+14
Currently we don't configure correctly the wake events after unplug of device router. What can happen is that the downstream ports of host router will be configured to wake on: USB4-wake and wake-on-disconnect, but not on wake-on-connect. This may cause the later plugged device not to wake the domain and fail in enumeration. Fix this by clearing downstream port's "USB4 Port is Configured" bit, after unplug of a device router. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-08thunderbolt: Enable NVM upgrade support on Intel Maple RidgeAlex James1-0/+1
Intel Maple Ridge supports NVM firmware upgrade with the same flows used on previous discrete Thunderbolt contollers from Intel (such as Titan Ridge). Advertise NVM upgrade support for Maple Ridge in icm_probe() to expose the corresponding files in /sys/bus/thunderbolt. The NVM firmware process was successfully tested on a system with a JHL8540 controller (ASUS ProArt Z790-CREATOR). Signed-off-by: Alex James <git@alextjam.es> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-04-02thunderbolt: Do not create DisplayPort tunnels on adapters of the same routerMika Westerberg1-0/+6
Probably due to a firmware bug Dell TB16 dock announces that one of its DisplayPort adapters is actually DP IN. Now this is possible and used with some external GPUs but not likely in this case as we are dealing with a dock. Anyways the problem is that the driver tries to create a DisplayPort tunnel between adapters of the same router which then shows to user that there is no picture on the display (because there are no available DP OUT adapters on the dock anymore). Fix this by not creating DisplayPort tunnels between adapters that are on the same router. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10265 Fixes: 274baf695b08 ("thunderbolt: Add DP IN added last in the head of the list of DP resources") Cc: Gil Fine <gil.fine@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-03-21Merge tag 'usb-6.9-rc1' of ↵Linus Torvalds21-439/+1111
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB / Thunderbolt updates from Greg KH: "Here is the big set of USB and Thunderbolt changes for 6.9-rc1. Lots of tiny changes and forward progress to support new hardware and better support for existing devices. Included in here are: - Thunderbolt (i.e. USB4) updates for newer hardware and uses as more people start to use the hardware - default USB authentication mode Kconfig and documentation update to make it more obvious what is going on - USB typec updates and enhancements - usual dwc3 driver updates - usual xhci driver updates - function USB (i.e. gadget) driver updates and additions - new device ids for lots of drivers - loads of other small updates, full details in the shortlog All of these, including a "last minute regression fix" have been in linux-next with no reported issues" * tag 'usb-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (185 commits) usb: usb-acpi: Fix oops due to freeing uninitialized pld pointer usb: gadget: net2272: Use irqflags in the call to net2272_probe_fin usb: gadget: tegra-xudc: Fix USB3 PHY retrieval logic phy: tegra: xusb: Add API to retrieve the port number of phy USB: gadget: pxa27x_udc: Remove unused of_gpio.h usb: gadget/snps_udc_plat: Remove unused of_gpio.h usb: ohci-pxa27x: Remove unused of_gpio.h usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined usb: Clarify expected behavior of dev_bin_attrs_are_visible() xhci: Allow RPM on the USB controller (1022:43f7) by default usb: isp1760: remove SLAB_MEM_SPREAD flag usage usb: misc: onboard_hub: use pointer consistently in the probe function usb: gadget: fsl: Increase size of name buffer for endpoints usb: gadget: fsl: Add of device table to enable module autoloading usb: typec: tcpm: add support to set tcpc connector orientatition usb: typec: tcpci: add generic tcpci fallback compatible dt-bindings: usb: typec-tcpci: add tcpci fallback binding usb: gadget: fsl-udc: Replace custom log wrappers by dev_{err,warn,dbg,vdbg} usb: core: Set connect_type of ports based on DT node dt-bindings: usb: Add downstream facing ports to realtek binding ...
2024-03-02Merge tag 'thunderbolt-for-v6.9-rc1' of ↵Greg Kroah-Hartman21-439/+1111
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.9 merge window This includes following USB4/Thunderbolt changes for the v6.9 merge window: - Reset the topology also for USB4 v1 routers on driver load - DisplayPort tunneling and bandwidth allocation mode improvements - Tracepoint support for the control channel - Couple of minor fixes and cleanups. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (23 commits) thunderbolt: Constify the struct device_type usage thunderbolt: Add trace events support for the control channel thunderbolt: Keep the domain powered when USB4 port is in redrive mode thunderbolt: Improve DisplayPort tunnel setup process to be more robust thunderbolt: Calculate DisplayPort tunnel bandwidth after DPRX capabilities read thunderbolt: Reserve released DisplayPort bandwidth for a group for 10 seconds thunderbolt: Introduce tb_tunnel_direction_downstream() thunderbolt: Re-order bandwidth group functions thunderbolt: Fail the failed bandwidth request properly thunderbolt: Log an error if DPTX request is not cleared thunderbolt: Handle bandwidth allocation mode disable request thunderbolt: Re-calculate estimated bandwidth when allocation mode is enabled thunderbolt: Use DP_LOCAL_CAP for maximum bandwidth calculation thunderbolt: Correct typo in host_reset parameter thunderbolt: Skip discovery also in USB4 v2 host thunderbolt: Reset only non-USB4 host routers in resume thunderbolt: Remove usage of the deprecated ida_simple_xx() API thunderbolt: Fix rollback in tb_port_lane_bonding_enable() for lane 1 thunderbolt: Fix XDomain rx_lanes_show and tx_lanes_show thunderbolt: Reset topology created by the boot firmware ...
2024-03-02Merge tag 'thunderbolt-for-v6.8-rc7' of ↵Greg Kroah-Hartman1-0/+3
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus Mika writes: thunderbolt: Fix for v6.8-rc7 This includes one USB4/Thunderbolt fix for v6.8-rc7: - Fix NULL pointer dereference in tb_port_update_credits() on Apple Thunderbolt 1 hardware. This has been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Fix NULL pointer dereference in tb_port_update_credits()
2024-02-26thunderbolt: Constify the struct device_type usageRicardo B. Marliere6-10/+10
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the tb_domain_type, tb_retimer_type, tb_switch_type, usb4_port_device_type, tb_service_type and tb_xdomain_type variables to be constant structures as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-26thunderbolt: Add trace events support for the control channelGil Fine5-5/+209
Sometimes it is useful to see the traffic happening inside the control channel, especially when debugging a possible problem. This adds tracepoints close to the hardware which can be enabled dynamically as needed using the standard Linux trace events facility. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Co-developed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-26thunderbolt: Keep the domain powered when USB4 port is in redrive modeMika Westerberg3-1/+66
If a DiplayPort cable is directly connected to the host routers USB4 port, there is no tunnel involved but the port is in "redrive" mode meaning that it is re-driving the DisplayPort signals from its DisplayPort source. In this case we need to keep the domain powered on otherwise once the domain enters D3cold the connected monitor blanks too. Since this happens only on Intel Barlow Ridge add a quirk that takes runtime PM reference if we detect that the USB4 port entered redrive mode (and release it once it exits the mode). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Improve DisplayPort tunnel setup process to be more robustGil Fine1-41/+43
After DisplayPort tunnel setup, we add verification that the DPRX capabilities read process completed. Otherwise, we bail out, teardown the tunnel, and try setup another DisplayPort tunnel using next available DP IN adapter. We do so till all DP IN adapters tried. This way, we avoid allocating DP IN adapter and (bandwidth for it) for unusable tunnel. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Calculate DisplayPort tunnel bandwidth after DPRX capabilities readGil Fine1-10/+6
According to USB4 Connection Manager guide, after DisplayPort tunnel was setup, the DPRX capabilities read is performed by the DPTX. According to VESA spec, this shall be completed within 5 seconds after the DisplayPort tunnel was setup. Hence, if the bit: DPRX Capabilities Read Done, was not set to '1' by this time, we timeout and fail calculating DisplayPort tunnel consumed bandwidth. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Reserve released DisplayPort bandwidth for a group for 10 secondsMika Westerberg3-29/+184
The USB4 spec says that the Connection Manager should reserve the bandwidth that is released in the same group for 10 seconds before it can be shared with other groups. Add support for this. We also delay the symmetric transition by that same 10 seconds to avoid any unnecessary transitions (i.e if the released bandwidth is used by another DisplayPort tunnel in the same group the link can stay asymmetric the whole time). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Introduce tb_tunnel_direction_downstream()Mika Westerberg3-20/+18
This helper takes tunnel as parameter. Convert existing code to call this where possible. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Re-order bandwidth group functionsMika Westerberg1-229/+225
This is needed by the following patches so that we do not have to add forward declaratations for any of these. Separating the move and the actual changes also makes it easier to review the code. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Fail the failed bandwidth request properlyMika Westerberg1-5/+18
The USB4 spec says that if the Connection Manager writes Allocated_BW that is smaller than Requested_BW, the DisplayPort IN adapter signals this failure back to the DPTX (graphics driver). Implement this by rewriting the same allocated bandwidth values back. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Log an error if DPTX request is not clearedMika Westerberg1-1/+3
This helps debugging issues around DisplayPort bandwidth allocation mode. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Handle bandwidth allocation mode disable requestMika Westerberg1-6/+16
Graphics can disable DisplayPort bandwidth allocation mode as well so if this make sure to reset the tunnel state accordingly. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Re-calculate estimated bandwidth when allocation mode is enabledMika Westerberg1-3/+12
When we program the initial bandwidth estimation the DPTX (graphics driver) has not yet read the capabilities of the monitor so the values used are the highest possible of the involved DisplayPort IN and OUT adapters, not the actual monitor capabilities. To allow the graphics more accurate bandwidth estimation re-calculate it once we receive the bandwidth allocation mode enabled notification. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2024-02-16thunderbolt: Use DP_LOCAL_CAP for maximum bandwidth calculationMika Westerberg1-32/+25
The DisplayPort IN adapter DP_LOCAL_CAP holds the aggregated capabilities and gets updated after graphics side does the DPRX capabilities read so we should use this to figure out the maximum possible bandwidth for the DisplayPort tunnel. While there make the variable name to match better what it is used for and add kernel-doc comment to the function. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>