]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thunderbolt: Verify Router Ready bit is set after router enumeration
authorGil Fine <gil.fine@linux.intel.com>
Wed, 6 May 2026 12:37:07 +0000 (15:37 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 20 May 2026 09:54:34 +0000 (11:54 +0200)
The USB4 Connection Manager guide specifies that after enumerating a
router, the Connection Manager shall verify that the Router Ready bit
(ROUTER_CS_6.RR) has been set to ensure hardware configuration has completed.
Currently, this step is missing from the enumeration sequence.

Add this check to follow the Connection Manager guide more closely.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb_regs.h
drivers/thunderbolt/usb4.c

index 75131fcfe04410869609d5a8ab66cf83049bd275..69ca4c379cc9d152915a6c892b45bd45ec0f8b69 100644 (file)
@@ -216,6 +216,7 @@ struct tb_regs_switch_header {
 #define ROUTER_CS_6_WOPS                       BIT(2)
 #define ROUTER_CS_6_WOUS                       BIT(3)
 #define ROUTER_CS_6_HCI                                BIT(18)
+#define ROUTER_CS_6_RR                         BIT(24)
 #define ROUTER_CS_6_CR                         BIT(25)
 #define ROUTER_CS_7                            0x07
 #define ROUTER_CS_9                            0x09
index 6f76bcaefa4915db541c523bc4013456eb7ab557..54f4f5fa3c5af076a5ece51845f8b9f92165ec7f 100644 (file)
@@ -294,7 +294,12 @@ int usb4_switch_setup(struct tb_switch *sw)
        /* TBT3 supported by the CM */
        val &= ~ROUTER_CS_5_CNS;
 
-       return tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1);
+       ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1);
+       if (ret)
+               return ret;
+
+       return tb_switch_wait_for_bit(sw, ROUTER_CS_6, ROUTER_CS_6_RR,
+                                     ROUTER_CS_6_RR, 500);
 }
 
 /**