summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt
Commit message (Collapse)AuthorAgeFilesLines
* thunderbolt: Only add device router DP IN to the head of the DP resource listMika Westerberg2023-11-171-1/+11
| | | | | | | | | | | | | | | | When pairing DP IN and DP OUT adapters for DisplayPort tunneling, we should prioritize the possible external GPU DP IN adapters to take advantage of the its capabilities. However the commit in question did this for host router DP IN adapters too and that changes ordering of the initial DP IN resources in such way that resuming from suspend may end up using different resource and that may confuse the user. Fix this so that we only put DP IN adapters of device routers to the top of the resource list and leave host routers as is. Fixes: 274baf695b08 ("thunderbolt: Add DP IN added last in the head of the list of DP resources") Reported-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Send uevent after asymmetric/symmetric switchMika Westerberg2023-11-171-2/+2
| | | | | | | | | | | | | | | We should send uevent to userspace whenever the link speed or width changes but tb_switch_asym_enable() and tb_switch_asym_disable() set the sw->link_width already so tb_switch_update_link_attributes() never noticed the change. Fix this so that we let tb_switch_update_link_attributes() update the fields accordingly. Fixes: 81af2952e606 ("thunderbolt: Add support for asymmetric link") Reported-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Set lane bonding bit only for downstream portGil Fine2023-11-171-1/+1
| | | | | | | | | | | Fix the lane bonding procedure to follow the steps described in USB4 Connection Manager guide. Hence, set the lane bonding bit only for downstream port. This is needed for certain ASMedia device, otherwise lane bonding fails and the device disconnects. Cc: stable@vger.kernel.org Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* Merge tag 'usb-6.7-rc1' of ↵Linus Torvalds2023-11-0312-387/+1299
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.7-rc1. Nothing really major in here, just lots of constant development for new hardware. Included in here are: - Thunderbolt (i.e. USB4) fixes for reported issues and support for new hardware types and devices - USB typec additions of new drivers and cleanups for some existing ones - xhci cleanups and expanded tracing support and some platform specific updates - USB "La Jolla Cove Adapter (LJCA)" support added, and the gpio, spi, and i2c drivers for that type of device (all acked by the respective subsystem maintainers.) - lots of USB gadget driver updates and cleanups - new USB dwc3 platforms supported, as well as other dwc3 fixes and cleanups - USB chipidea driver updates - other smaller driver cleanups and additions, full details in the shortlog All of these have been in the linux-next tree for a while with no reported problems" * tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (167 commits) usb: gadget: uvc: Add missing initialization of ssp config descriptor usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility usb: raw-gadget: report suspend, resume, reset, and disconnect events usb: raw-gadget: don't disable device if usb_ep_queue fails usb: raw-gadget: properly handle interrupted requests usb:cdnsp: remove TRB_FLUSH_ENDPOINT command usb: gadget: aspeed_udc: Convert to platform remove callback returning void dt-bindings: usb: fsa4480: Add compatible for OCP96011 usb: typec: fsa4480: Add support to swap SBU orientation dt-bindings: usb: fsa4480: Add data-lanes property to endpoint usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() Revert "dt-bindings: usb: Add bindings for multiport properties on DWC3 controller" Revert "dt-bindings: usb: qcom,dwc3: Add bindings for SC8280 Multiport" thunderbolt: Fix one kernel-doc comment usb: gadget: f_ncm: Always set current gadget in ncm_bind() usb: core: Remove duplicated check in usb_hub_create_port_device usb: typec: tcpm: Add additional checks for contaminant arm64: dts: rockchip: rk3588s: Add USB3 host controller usb: dwc3: add optional PHY interface clocks dt-bindings: usb: add rk3588 compatible to rockchip,dwc3 ...
| * Merge tag 'thunderbolt-for-v6.7-rc1' of ↵Greg Kroah-Hartman2023-10-2712-387/+1299
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.7 merge window This includes following USB4/Thunderbolt changes for the v6.7 merge window: - Configure asymmetric link if the DisplayPort bandwidth requires so - Enable path power management packet support for USB4 v2 routers - Make the bandwidth reservations to follow the USB4 v2 connection manager guide suggestions - DisplayPort tunneling improvements - Small cleanups and improvements around the driver. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (25 commits) thunderbolt: Fix one kernel-doc comment thunderbolt: Configure asymmetric link if needed and bandwidth allows thunderbolt: Add support for asymmetric link thunderbolt: Introduce tb_switch_depth() thunderbolt: Introduce tb_for_each_upstream_port_on_path() thunderbolt: Introduce tb_port_path_direction_downstream() thunderbolt: Set path power management packet support bit for USB4 v2 routers thunderbolt: Change bandwidth reservations to comply USB4 v2 thunderbolt: Make is_gen4_link() available to the rest of the driver thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth() thunderbolt: Use constants for path weight and priority thunderbolt: Add DP IN added last in the head of the list of DP resources thunderbolt: Create multiple DisplayPort tunnels if there are more DP IN/OUT pairs thunderbolt: Log NVM version of routers and retimers thunderbolt: Use tb_tunnel_xxx() log macros in tb.c thunderbolt: Expose tb_tunnel_xxx() log macros to the rest of the driver thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistent thunderbolt: Fix typo of HPD bit for Hot Plug Detect thunderbolt: Fix typo in enum tb_link_width kernel-doc thunderbolt: Fix debug log when DisplayPort adapter not available for pairing ...
| | * thunderbolt: Fix one kernel-doc commentYang Li2023-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a spelling errors in kernel doc comment, silence the warning: drivers/thunderbolt/tb.c:760: warning: expecting prototype for tb_maximum_banwidth(). Prototype was for tb_maximum_bandwidth() instead Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7048 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Configure asymmetric link if needed and bandwidth allowsGil Fine2023-10-201-123/+558
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 v2 spec defines a Gen 4 link that can operate as an asymmetric 120/40G. When the link is asymmetric, the USB4 port on one side of the link operates with three TX lanes and one RX lane, while the USB4 port on the opposite side of the link operates with three RX lanes and one TX lane. Using asymmetric link we can get much more bandwidth from one direction and that allows us to support the new Ultra High Bit Rate DisplayPort modes (that consume up to 77.37 Gb/s). Add the basic logic for changing Gen 4 links to asymmetric and back following the below rules: 1) The default threshold is 45 Gb/s (tunable by asym_threshold) 2) When DisplayPort tunnel is established, or when there is bandwidth request through bandwidth allocation mode, the links can be transitioned to asymmetric or symmetric (depending on the required bandwidth). 3) Only DisplayPort bandwidth on a link, is taken into account when deciding whether a link is transitioned to asymmetric or symmetric 4) If bandwidth on a link is >= asym_threshold transition the link to asymmetric 5) If bandwidth on a link < asym_threshold transition the link to symmetric (unless the bandwidth request is above currently allocated on a tunnel). 6) If a USB4 v2 device router with symmetric link is connected, transition all the links above it to symmetric if the bandwidth allows. 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>
| | * thunderbolt: Add support for asymmetric linkGil Fine2023-10-205-55/+381
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 v2 spec defines a Gen 4 link that can operate as an aggregated symmetric (80/80G) or asymmetric (120/40G). When the link is asymmetric, the USB4 port on one side of the link operates with three TX lanes and one RX lane, while the USB4 port on the opposite side of the link operates with three RX lanes and one TX lane. Add support for the asymmetric link and provide functions that can be used to transition the link to asymmetric and back. 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>
| | * thunderbolt: Introduce tb_switch_depth()Mika Westerberg2023-10-202-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful helper to find out the depth of a connected router. Convert the existing users to call this helper instead of open-coding. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Introduce tb_for_each_upstream_port_on_path()Mika Westerberg2023-10-201-0/+15
| | | | | | | | | | | | | | | | | | This is useful when walking over upstream lane adapters over given path. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Introduce tb_port_path_direction_downstream()Gil Fine2023-10-203-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce tb_port_path_direction_downstream() to check if path from source adapter to destination adapter is directed towards downstream. Convert existing users to call this helper instead of open-coding. No functional changes. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Set path power management packet support bit for USB4 v2 routersMika Westerberg2023-10-204-13/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 v2 spec allows USB4 links that are part of a pass through tunnel (such as DisplayPort and USB 3.x Gen T) to enter lower CL states, which provide better power management. For this USB4 v2 routers in their path config space of lane 0 adapter include a new bit PMPS (PM packet support) that needs to be set. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Change bandwidth reservations to comply USB4 v2Gil Fine2023-10-203-3/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 v2 Connection Manager guide (section 6.1.2.3) suggests to reserve bandwidth in a sligthly different manner. It suggests to keep minimum of 1500 Mb/s for each path that carry a bulk traffic. Here we change the bandwidth reservations to comply to the above for USB 3.x and PCIe protocols over Gen 4 link, taking weights into account (that's 1500 Mb/s for PCIe and 3000 Mb/s for USB 3.x). For Gen 3 and below we use the existing reservation. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Make is_gen4_link() available to the rest of the driverGil Fine2023-10-202-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rework the function to return the link generation, update the name to tb_port_get_link_generation(), and make available to the rest of the driver. This is needed in the subsequent patches. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth()Mika Westerberg2023-10-201-3/+6
| | | | | | | | | | | | | | | | | | | | | Instead of magic numbers use the constants we introduced in the previous commit to make the code more readable. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Use constants for path weight and priorityMika Westerberg2023-10-201-12/+27
| | | | | | | | | | | | | | | | | | Makes it easier to follow and update. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Add DP IN added last in the head of the list of DP resourcesGil Fine2023-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If DP IN on device router exist, position it at the beginning of the DP resources list, so that it is used before DP IN on host router. This way external GPU will be prioritized when pairing DP IN and DP OUT for DisplayPort tunnel setup. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Create multiple DisplayPort tunnels if there are more DP IN/OUT ↵Gil Fine2023-10-131-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pairs Currently we only create one DisplayPort tunnel even if there would be more DP IN/OUT pairs available. Specifically this happens when a router is unplugged and we check if a new DisplayPort tunnel can be created. To cover this create tunnels as long as we find suitable DP IN/OUT pairs. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Log NVM version of routers and retimersGil Fine2023-10-132-0/+2
| | | | | | | | | | | | | | | | | | | | | This is useful when debugging possible issues. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Use tb_tunnel_xxx() log macros in tb.cMika Westerberg2023-10-131-22/+28
| | | | | | | | | | | | | | | | | | | | | Now that the macros are available we can use them in tb.c. This makes the log output more consistent. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Expose tb_tunnel_xxx() log macros to the rest of the driverMika Westerberg2023-10-132-22/+28
| | | | | | | | | | | | | | | | | | | | | In order to allow more consistent logging of tunnel related information make these logging macros available to the rest of the driver. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistentMika Westerberg2023-10-131-35/+30
| | | | | | | | | | | | | | | | | | | | | This makes it easier to find out the tunnel in question. Also drop a couple of lines that generate duplicate information. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Fix typo of HPD bit for Hot Plug DetectGil Fine2023-10-132-6/+6
| | | | | | | | | | | | | | | | | | | | | Fix typo of HPD bit stands for Hot Plug Detect. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Fix debug log when DisplayPort adapter not available for pairingGil Fine2023-10-131-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix debug log when looking for a DisplayPort adapter pair of DP IN and DP OUT. In case of no DP adapter available, log the type of the DP adapter that is not available. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Check for unplugged router in tb_switch_clx_disable()Mika Westerberg2023-10-131-0/+3
| | | | | | | | | | | | | | | | | | | | | There is no point disabling CL states if the router is unplugged so in that case return early. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Make tb_switch_clx_is_supported() staticMika Westerberg2023-10-132-23/+22
| | | | | | | | | | | | | | | | | | | | | This function is not used outside of clx.c so make it static. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Get rid of usb4_usb3_port_actual_link_rate()Mika Westerberg2023-10-134-42/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out there is no need to use the actual link rate when reclaiming bandwidth for USB 3.x. The reason is that we use consumed bandwidth which is coming from xHCI when releasing bandwidth (for example for DisplayPort tunneling) and this can be anything between 1000 Mb/s to maximum, so when reclaiming we can just bump it up back to maximum instead of actual link rate (which is always <= maximum). This allows us to get rid of couple of unnecessary lines of code. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: dma_test: Use enum tb_link_widthMika Westerberg2023-10-131-9/+5
| | | | | | | | | | | | | | | | | | Since we have it, use it in the DMA test driver as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * thunderbolt: Apply USB 3.x bandwidth quirk only in software connection managerMika Westerberg2023-09-151-0/+3
| | | | | | | | | | | | | | | | | | | | | This is not needed when firmware connection manager is run so limit this to software connection manager. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | | Merge tag 'thunderbolt-for-v6.6-rc7' of ↵Greg Kroah-Hartman2023-10-171-4/+6
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus Mika writes: thunderbolt: Fix for v6.6-rc7 This includes a single commit that fixes a memory leak when DisplayPort bandwidth allocation request is being handled by the driver. This has been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Call tb_switch_put() once DisplayPort bandwidth request is finished
| * | thunderbolt: Call tb_switch_put() once DisplayPort bandwidth request is finishedGil Fine2023-10-051-4/+6
| |/ | | | | | | | | | | | | | | | | | | | | When handling DisplayPort bandwidth request tb_switch_find_by_route() is called and it returns a router structure with reference count increased. In order to avoid resource leak call tb_switch_put() when finished. Fixes: 6ce3563520be ("thunderbolt: Add support for DisplayPort bandwidth allocation mode") Cc: stable@vger.kernel.org Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Restart XDomain discovery handshake after failureMika Westerberg2023-09-151-17/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alex reported that after rebooting the other host the peer-to-peer link does not come up anymore. The reason for this is that the host that was not rebooted tries to send the UUID request only 10 times according to the USB4 Inter-Domain spec and gives up if it does not get reply. Then when the other side is actually ready it cannot get the link established anymore. The USB4 Inter-Domain spec requires that the discovery protocol is restarted in that case so implement this now. Reported-by: Alex Balcanquall <alex@alexbal.com> Fixes: 8e1de7042596 ("thunderbolt: Add support for XDomain lane bonding") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Correct TMU mode initialization from hardwareMika Westerberg2023-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | David reported that cppcheck found following possible copy & paste error from tmu_mode_init(): tmu.c:385:50: style: Expression is always false because 'else if' condition matches previous condition at line 383. [multiCondition] And indeed this is a bug. Fix it to use correct index (TB_SWITCH_TMU_MODE_HIFI_UNI). Reported-by: David Binderman <dcb314@hotmail.com> Fixes: d49b4f043d63 ("thunderbolt: Add support for enhanced uni-directional TMU mode") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Check that lane 1 is in CL0 before enabling lane bondingMika Westerberg2023-09-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Marek reported that when BlackMagic UltraStudio device is connected the kernel repeatedly tries to enable lane bonding without success making the device non-functional. It looks like the device does not have lane 1 connected at all so even though it is enabled we should not try to bond the lanes. For this reason check that lane 1 is in fact CL0 (connected, active) before attempting to bond the lanes. Reported-by: Marek Šanta <teslan223@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217737 Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple RidgeMika Westerberg2023-09-151-20/+20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some systems the IOMMU blocks the first couple of driver ready messages to the connection manager firmware as can be seen in below excerpts: thunderbolt 0000:06:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0010 address=0xbb0e3400 flags=0x0020] or DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Write] Request device [04:00.0] PASID ffffffff fault addr 69974000 [fault reason 05] PTE Write access is not set The reason is unknown and hard to debug because we were not able to reproduce this locally. This only happens on certain systems with Intel Maple Ridge Thunderbolt controller. If there is a device connected when the driver is loaded the issue does not happen either. Only when there is nothing connected (so typically when the system is booted up). We can work this around by sending the driver ready several times. After a couple of retries the message goes through and the controller works just fine. For this reason make the number of retries a parameter for icm_request() and then for Maple Ridge (and Titan Ridge as they us the same function but this should not matter) increase number of retries while shortening the timeout accordingly. Reported-by: Werner Sembach <wse@tuxedocomputers.com> Reported-by: Konrad J Hambrick <kjhambrick@gmail.com> Reported-by: Calvin Walton <calvin.walton@kepstin.ca> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=214259 Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* Merge tag 'thunderbolt-for-v6.6-rc1' of ↵Greg Kroah-Hartman2023-08-225-52/+71
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.6 merge window This includes following Thunderbolt/USB4 changes for the v6.6 merge window: - Replace broken mailing list address in the ABI document - Small improvements. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: Documentation/ABI: thunderbolt: Replace 01.org in contact thunderbolt: Check Intel vendor ID in tb_switch_get_generation() thunderbolt: Log a warning if device links are not found thunderbolt: Set variable tmu_params storage class specifier to static
| * thunderbolt: Check Intel vendor ID in tb_switch_get_generation()Mika Westerberg2023-08-081-37/+38
| | | | | | | | | | | | | | | | Only Intel made Thunderbolt 1-3 devices so to avoid possible confusion check for the Intel vendor ID before deciding the device generation. While there move the USB4 check to happen first. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Log a warning if device links are not foundMika Westerberg2023-08-083-14/+32
| | | | | | | | | | | | | | | | The software connection manager needs the device links in order to establish the tunnels before the native protocols so log a warning if they are not found. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Set variable tmu_params storage class specifier to staticTom Rix2023-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | smatch reports drivers/thunderbolt/tmu.c:30:3: warning: symbol 'tmu_params' was not declared. Should it be static? This variable is only used in its defining file so should be static. Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Fix memory leak in tb_handle_dp_bandwidth_request()Mika Westerberg2023-08-041-0/+2
| | | | | | | | | | | | | | | | | | The memory allocated in tb_queue_dp_bandwidth_request() needs to be released once the request is handled to avoid leaking it. Fixes: 6ce3563520be ("thunderbolt: Add support for DisplayPort bandwidth allocation mode") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | thunderbolt: Fix Thunderbolt 3 display flickering issue on 2nd hot plug onwardsSanjay R Mehta2023-08-031-1/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | Previously, on unplug events, the TMU mode was disabled first followed by the Time Synchronization Handshake, irrespective of whether the tb_switch_tmu_rate_write() API was successful or not. However, this caused a problem with Thunderbolt 3 (TBT3) devices, as the TSPacketInterval bits were always enabled by default, leading the host router to assume that the device router's TMU was already enabled and preventing it from initiating the Time Synchronization Handshake. As a result, TBT3 monitors experienced display flickering from the second hot plug onwards. To address this issue, we have modified the code to only disable the Time Synchronization Handshake during TMU disable if the tb_switch_tmu_rate_write() function is successful. This ensures that the TBT3 devices function correctly and eliminates the display flickering issue. Co-developed-by: Sanath S <Sanath.S@amd.com> Signed-off-by: Sanath S <Sanath.S@amd.com> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Add test case for 3 DisplayPort tunnelsMika Westerberg2023-06-161-0/+83
| | | | | | | | | Intel Barlow Ridge Thunderbolt controller has 3 DP IN adapters. This allows 3 simultaneus DisplayPort tunnels through either one or two USB4 downstream ports (in any possible configuration). Add test case for this. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Add DisplayPort 2.x tunneling supportMika Westerberg2023-06-162-16/+87
| | | | | | | | | | | This adds support for the UHBR (Ultra High Bit Rate) bandwidths introduced with DisplayPort 2.0 (and refined in 2.1). These can go up to 80 Gbit/s and their support is represent in additional bits in the DP IN capability. This updates the DisplayPort tunneling to support these new rates too. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Make bandwidth allocation mode function names consistentMika Westerberg2023-06-164-46/+52
| | | | | | | | | Make sure the DisplayPort bandwidth allocation mode function names are consistent with the existing ones, such as USB3. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Enable CL2 low power stateMika Westerberg2023-06-162-15/+25
| | | | | | | For USB4 v2 routers we can also enable CL2 which allows better power savings and thermal management than CL0s and CL1. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Add support for enhanced uni-directional TMU modeMika Westerberg2023-06-166-173/+614
| | | | | | | | | | | | This is new TMU mode introduced with the USB4 v2. This mode is simpler than the existing ones and allows all CL states as well. Enable this for all links where both side routers are v2 and keep the existing functionality for the v1 and earlier links. Currently only support the MedRes rate. We can add the HiFi rate later too if it turns out to be useful. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Increase NVM_MAX_SIZE to support Intel Barlow Ridge controllerGil Fine2023-06-161-1/+1
| | | | | | | | Intel Barlow Ridge discrete USB4 controller has larger NOR Flash, hence increase NVM_MAX_SIZE to support it. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Move constants related to NVM into nvm.cGil Fine2023-06-163-9/+10
| | | | | | | | | | Move constants related to NVM into nvm.c to make the code cleaner. Use a separate constant for USB4_DATA_DWORDS in usb4.c. No functional changes. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Limit Intel Barlow Ridge USB3 bandwidthMika Westerberg2023-06-162-0/+10
| | | | | | | | | Intel Barlow Ridge discrete USB4 host router has the same limitation as the previous generations so make sure the USB3 bandwidth limitation quirk is applied to Barlow Ridge too. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* thunderbolt: Add Intel Barlow Ridge PCI IDMika Westerberg2023-06-162-0/+4
| | | | | | | | | | | | Intel Barlow Ridge is the first USB4 v2 controller from Intel. The controller exposes standard USB4 PCI class ID in typical configurations, however there is a way to configure it so that it uses a special class ID to allow using s different driver than the Windows inbox one. For this reason add the Barlow Ridge PCI ID to the Linux driver too so that the driver can attach regardless of the class ID. Tested-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>