thunderbolt: Read retimer NVM authentication status prior tb_retimer_set_inbound_sbtx()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 26 May 2023 11:46:44 +0000 (14:46 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 12 Jun 2023 05:38:00 +0000 (08:38 +0300)
According to the USB4 retimer guide the correct order is immediately
after sending ENUMERATE_RETIMERS so update the code to follow this.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/retimer.c

index ccc2f0e7adba72a3e0dbda4608fc6e0b65a723b2..fb8e113488db448e0c7e9b99de9d15ff560c459d 100644 (file)
@@ -187,6 +187,21 @@ static ssize_t nvm_authenticate_show(struct device *dev,
        return ret;
 }
 
+static void tb_retimer_nvm_authenticate_status(struct tb_port *port, u32 *status)
+{
+       int i;
+
+       tb_port_dbg(port, "reading NVM authentication status of retimers\n");
+
+       /*
+        * Before doing anything else, read the authentication status.
+        * If the retimer has it set, store it for the new retimer
+        * device instance.
+        */
+       for (i = 1; i <= TB_MAX_RETIMER_INDEX; i++)
+               usb4_port_retimer_nvm_authenticate_status(port, i, &status[i]);
+}
+
 static void tb_retimer_set_inbound_sbtx(struct tb_port *port)
 {
        int i;
@@ -449,18 +464,16 @@ int tb_retimer_scan(struct tb_port *port, bool add)
                return ret;
 
        /*
-        * Enable sideband channel for each retimer. We can do this
-        * regardless whether there is device connected or not.
+        * Immediately after sending enumerate retimers read the
+        * authentication status of each retimer.
         */
-       tb_retimer_set_inbound_sbtx(port);
+       tb_retimer_nvm_authenticate_status(port, status);
 
        /*
-        * Before doing anything else, read the authentication status.
-        * If the retimer has it set, store it for the new retimer
-        * device instance.
+        * Enable sideband channel for each retimer. We can do this
+        * regardless whether there is device connected or not.
         */
-       for (i = 1; i <= TB_MAX_RETIMER_INDEX; i++)
-               usb4_port_retimer_nvm_authenticate_status(port, i, &status[i]);
+       tb_retimer_set_inbound_sbtx(port);
 
        for (i = 1; i <= TB_MAX_RETIMER_INDEX; i++) {
                /*