From patchwork Wed Sep 21 14:54:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 12983804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03415C6FA8E for ; Wed, 21 Sep 2022 14:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbiIUOzD (ORCPT ); Wed, 21 Sep 2022 10:55:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbiIUOyn (ORCPT ); Wed, 21 Sep 2022 10:54:43 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2075.outbound.protection.outlook.com [40.107.94.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8F1175BF; Wed, 21 Sep 2022 07:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b1fU1PC7AWzIluX076xBRradiaoPoAYH/DOVCH9jpCk6cm3sVt1jUp1ae/EajhS1iwV63vkTB1W8SM+hTnzvxA/Pim4FpDLaKmjPR6guILB/wyyMMxtOF9wET7MCollrqI+QwsDuXjM4HfSyWEBM66YhzH1yr7fEOvQgQBhMpb6y2KMk6vhA+BVYK+Oy8DWz6z03jprjC4uxC//DkLz0cYkc0dT16y5rg/TNoXUK5QIjekpzqaq/0DisZZ3IOlRzWSgY1Vx4MNPJDBQaWqHTX59LLS98gYp770nbnV5hf9K7zl3W5Sg7KCwaLPNvSzO6VXJg7YHA+UpfQFrQ6XtREQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gtEEKX4Mqr80ZiaAUrQ4Xm3q8mimCTxh2KlKSHj9rsI=; b=AvMlYDZeQpUpm6k3uv2411y8hsd5tVKfDGmQp+zQhlncwJJSS/6eAVrc8kDhiKELC3saZ2JqEfyYTpRBBx2TGAkXNexsboNVJf6iCrrCkd0pBcNxFZ0olh6Y5zFNfr0GehYSh05fOim9LK4ERX1AQToBpwbLXxtWdK5fPl9/Fh1gX5yZMcDMBLZzJ++bWuzOfAAGXQfuEa2gAYqhvFAxl8kUi5B4ldDNJoAZTrWgrZ4q0s8Y1IVbnvo1fOJC4R9YghrMj9FUbn6d+yEzrdpvSQ6SzWL/MCDOzGmSuvnSMXtYDBvxjp/yFmCD820bzaTEX5YrnB0rM7OzD3/bNuZAJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gtEEKX4Mqr80ZiaAUrQ4Xm3q8mimCTxh2KlKSHj9rsI=; b=K0WJIyUkv4z6NpaZoIJzb0PgD5WRgSJtlvVT8U90qm5eUzeTMrQmFK79lnHY3soRlPaAgG43qzXI47op3PhSg3sZdMRaQTaN3bsr9Ts+kYOzJjDj5+AFxFFrE4H4TZ/qDRlDVPTvNYOCp2AfhetyhJJ0TQ+Tf2pT5umv9ObOmoE= Received: from DM6PR08CA0013.namprd08.prod.outlook.com (2603:10b6:5:80::26) by CH2PR12MB4296.namprd12.prod.outlook.com (2603:10b6:610:af::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Wed, 21 Sep 2022 14:54:38 +0000 Received: from DM6NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::c4) by DM6PR08CA0013.outlook.office365.com (2603:10b6:5:80::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17 via Frontend Transport; Wed, 21 Sep 2022 14:54:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT079.mail.protection.outlook.com (10.13.173.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Wed, 21 Sep 2022 14:54:38 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 21 Sep 2022 09:54:37 -0500 From: Mario Limonciello To: Mika Westerberg , Andreas Noever , Michael Jamet , "Yehezkel Bernat" CC: , Mario Limonciello , , Subject: [PATCH 1/2] thunderbolt: Explicitly reset plug events delay back to USB4 spec value Date: Wed, 21 Sep 2022 09:54:32 -0500 Message-ID: <20220921145434.21659-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220921145434.21659-1-mario.limonciello@amd.com> References: <20220921145434.21659-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT079:EE_|CH2PR12MB4296:EE_ X-MS-Office365-Filtering-Correlation-Id: a367bae9-8117-4544-8373-08da9be134fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uPZFPbfKDfcFwtQlGsCcSE5Mk5mmC068fca+nNsq9j4y4tHRqavz0d7XCKpkqhoiIN8Tp1aJ29IVrvgtV1Wfnk9vIG3kZpnyDAxHMBp6XL+uVxuwRRpo1KMiBnqs9LKI84HMxOmNUEo19phMSKzGl4NS1jY7/K3ckEoA/NNdAVQoYeOpL4P0QozpPUQn5t1123s4oKjoQ779It9ezOouqEpGjWooohCHQ/dgeogW0g8GcovclyH73QRx3lqD58/Jb1ExMKl3YzEj4C9mvbkOwa2iWdw21MVBeKE2RemmUy6HJeLHd3pzmpF0pDNWEZZSw38SXgZfxzXLRqNrHoEtuAtuy1LzbnYx3Pfb9o99sMawLCr7Nst/UcClnn1YYk4CER0+jMSD+i8j0BswlcmPjw8RGvanatUud8meL31m1Cf87Imhy2UH0gia+fz1yytcVrBDvAmhVAkQAYoe1L2y6Rf3AIbPy7o0H7t9qA4ky62LCKFKEH02o2ACg1mCJuZn1spIifzmHm8WvXuqMQ8NncHqNrWaf30n9ia7vlGsCqm9i92wDf0JgPek322uQcKz5sXLE5atnB831oof3pvSu9CXHCqpaNASUES2LzOZ3Kyn96vIGWcTnF6HXIl4M7jjw0elzDUEajVvKPskkSBPU5mH/NzfB6I4r20EXgTRGOfVDyTbioShAEbqxKLSH7oDmNFXMXSloxIGZvf1hoycv7OSV7sBtVxqWFhwvTrnbzT/LRChdVTrfdy0r3lNE4G8NM5SfRisjmlcdTCUTP03N3aLrOxP7GVtL8Rd8hGHpRHVev0NRhObCf+7WRWWdqEf X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(136003)(376002)(39860400002)(346002)(396003)(451199015)(36840700001)(40470700004)(46966006)(2906002)(8676002)(316002)(54906003)(110136005)(44832011)(4744005)(70206006)(40480700001)(70586007)(4326008)(40460700003)(82310400005)(6666004)(36860700001)(41300700001)(86362001)(5660300002)(8936002)(7696005)(36756003)(2616005)(1076003)(26005)(186003)(478600001)(426003)(336012)(16526019)(47076005)(81166007)(356005)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 14:54:38.4229 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a367bae9-8117-4544-8373-08da9be134fd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4296 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If any software has interacted with the USB4 registers before the Linux USB4 CM runs, it may have modified the plug events delay. It has been observed that if this value too large, it's possible that hotplugged devices will negotiate a fallback mode instead in Linux. To prevent this, explicitly align the plug events delay with the USB4 spec value of 10ms. Signed-off-by: Mario Limonciello --- drivers/thunderbolt/switch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index c63c1f4ff9dc..77d7f07ca075 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2413,6 +2413,7 @@ int tb_switch_configure(struct tb_switch *sw) * additional capabilities. */ sw->config.cmuv = USB4_VERSION_1_0; + sw->config.plug_events_delay = 0xa; /* Enumerate the switch */ ret = tb_sw_write(sw, (u32 *)&sw->config + 1, TB_CFG_SWITCH, From patchwork Wed Sep 21 14:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 12983805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AAA2C6FA82 for ; Wed, 21 Sep 2022 14:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbiIUOzE (ORCPT ); Wed, 21 Sep 2022 10:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiIUOyn (ORCPT ); Wed, 21 Sep 2022 10:54:43 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2698117597; Wed, 21 Sep 2022 07:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1I7ASTZ6sqYElofYs32FD0rEKlefVc+FX58ug6CJ7IFt496FLQyqXmpd1i/ERhHnCTixxzuNAadP8AYOzSkHIowVUv8vz1Q3bOOHqPRqPal0v3+r62uOAaGw/IEvAXHuO0Azd18CbBsuVm6TqvY2bEMu9tld5JzRCGeqr16X2vASGtM6qd1JfPSSLeJoqG9J2bhO6tUE17COi/b9vIl9CRy/a6y08M32jef2UOWGK5tCOMseS5/hvUukSFnYX2Cn2ocTLVlWr04m92Bez/CQ2bCVCplXlm3HjNTomtbIrAYQgRm+txaFi7Hb3HX6sB+F3X6KT+DQf5zBPLRwsSKgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4v0QBtGka5aJrkprvRPsPqcAK7O97kF4wDG7GSgdB6Y=; b=TVXpKWfFZqvxNq1+BYZE6M5LDKpjUkFqlXdKJ5WuH4bEjws4oAYN2q9vjFW7jAMqLJGUQibBIhMRXrCo0gf58bcc3WTbk5tWbQ6B0t202r/X0qUDNs4gfasfX8OYi9skToxFSlIcJaiK966tgbtZcQhTVqaWSYkZxtHSOvMKkIh2BOmoe45G+GmiVf/D733k0w/AGw4MaJGCT/HiTqD3mOuUoNsAnY/a8gQkd3clBI3Xv1tPXugXw17CMjWSsll7VL+En9dcz1U2SmNkhEor5o0OeaMPQ76Qhk5iLuKPxgku4R2TCEtfCVpM3ri0YKqYLP/89S4gyKgby8fh5y/27w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4v0QBtGka5aJrkprvRPsPqcAK7O97kF4wDG7GSgdB6Y=; b=AExLtYxfEKWiV/kg0HEu4NuoGEvLVemMZOXBMKviSbXO6VpUil2gwxeGhdcEomwWODWoGpfZ/O287iAR4W+WCng99xGthNfpEKPdAZw+8RppiCM4s67ZX+wDdDzIiiy66e9+Yj2fiy03HPYwafI8vq8OjPogf/vIdbh9RMEpX08= Received: from DM6PR08CA0018.namprd08.prod.outlook.com (2603:10b6:5:80::31) by MN2PR12MB4391.namprd12.prod.outlook.com (2603:10b6:208:269::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14; Wed, 21 Sep 2022 14:54:39 +0000 Received: from DM6NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::3b) by DM6PR08CA0018.outlook.office365.com (2603:10b6:5:80::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21 via Frontend Transport; Wed, 21 Sep 2022 14:54:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT079.mail.protection.outlook.com (10.13.173.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Wed, 21 Sep 2022 14:54:39 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 21 Sep 2022 09:54:38 -0500 From: Mario Limonciello To: Mika Westerberg , Andreas Noever , Michael Jamet , "Yehezkel Bernat" CC: , Mario Limonciello , , Subject: [PATCH 2/2] thunderbolt: Explicitly enable lane adapter hotplug events at startup Date: Wed, 21 Sep 2022 09:54:33 -0500 Message-ID: <20220921145434.21659-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220921145434.21659-1-mario.limonciello@amd.com> References: <20220921145434.21659-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT079:EE_|MN2PR12MB4391:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b0d1109-0d21-46e6-27a3-08da9be135c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RXR0BRlECM88U+lim0mkzCboSlEvnCZQ0QGZkAJA1+YCzHe06aPN2ljgBKeGajaCD9gE2m0QPApb8GlMXgoQanDPYk3eduRlRaz5Gm2mg4vgMtrtMKHcc7L4zYFzyALVwcxUXMCk2QDhlZ3entB5rDL3zEVoreOt1cLLyRXjX/Xg9Wg8jzBxD/UdsnzQYvAAuC5DGz6XSXZBRHk3YIIROuS1Uu3lM3+EPe3Gbflo6o4HizVRJNJ/udP3j3vDIYZ+pMatf9ODjc/u7gm0Hz0gaI+G4XeGNjV5xG15SV/RgZZWWlPmQsFk705pkEsva/yUPM3FVE6FP+lvws/4dHj8Grs29rRslLjGE7nQi8JcVhJ1IuaEQmrPTXfbxFxt9lYNjBqoa5gtO1B6gP0DvNqu1Bg5Z9lA9UnJhQg2Nwcvbkxv7Iy7y54dgAq+JZAXT0Dwyj96fJhLR/EyKRCXO1JP629HFTcZCqcbluiEmZQI6nC3lOcZ9E4V+EIMQackq88EsP5Ww9/w7dDbvtpUkyo1w61KY/V00cx1rR0C4z5/A/SWSIWyt3f4e5gljpRD+cxWL1RfmGL6IcpmhatzvzUBzORWC1TCK2ITWYPskGPITJf97eymgsTmRhGIThMuyUayYKOAYTP5HMdGz5zo/+LnBBc7+HJ1THMgDN4i/JgbcmAOj2e9UNgsfCyjgGfvJ4eUxrrDMyVJH4GdG+DmJtvMaO4My/1CSc1fpLelJFkmefh4eVTXtiXf6wkQfPGSi6f4BDIRFPn3CR3zp2zeCpsjTr0Oa0y/ibspae1MEGoCInw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36840700001)(40470700004)(46966006)(8676002)(6666004)(40480700001)(7696005)(36860700001)(478600001)(36756003)(41300700001)(70586007)(4326008)(44832011)(5660300002)(8936002)(70206006)(2616005)(356005)(316002)(54906003)(110136005)(2906002)(81166007)(86362001)(47076005)(1076003)(16526019)(186003)(82740400003)(40460700003)(336012)(26005)(82310400005)(83380400001)(426003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 14:54:39.7509 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b0d1109-0d21-46e6-27a3-08da9be135c8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4391 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Software that has run before the USB4 CM in Linux runs may have disabled hotplug events for a given lane adapter. Other CMs such as that one distributed with Windows 11 will enable hotplug events. Do the same thing in the Linux CM which fixes hotplug events on "AMD Pink Sardine". Signed-off-by: Mario Limonciello --- drivers/thunderbolt/switch.c | 4 ++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+) diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 77d7f07ca075..65f65cfe1101 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -792,6 +792,10 @@ static int tb_init_port(struct tb_port *port) (port->config.nfc_credits & ADP_CS_4_TOTAL_BUFFERS_MASK) >> ADP_CS_4_TOTAL_BUFFERS_SHIFT; + res = usb4_enable_hotplug(port); + if (res) + return res; + tb_dump_port(port->sw->tb, port); return 0; } diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index 5db76de40cc1..b66781ae9c16 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -1174,6 +1174,7 @@ int usb4_switch_add_ports(struct tb_switch *sw); void usb4_switch_remove_ports(struct tb_switch *sw); int usb4_port_unlock(struct tb_port *port); +int usb4_enable_hotplug(struct tb_port *port); int usb4_port_configure(struct tb_port *port); void usb4_port_unconfigure(struct tb_port *port); int usb4_port_configure_xdomain(struct tb_port *port); diff --git a/drivers/thunderbolt/tb_regs.h b/drivers/thunderbolt/tb_regs.h index 166054110388..bbe38b2d9057 100644 --- a/drivers/thunderbolt/tb_regs.h +++ b/drivers/thunderbolt/tb_regs.h @@ -308,6 +308,7 @@ struct tb_regs_port_header { #define ADP_CS_5 0x05 #define ADP_CS_5_LCA_MASK GENMASK(28, 22) #define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31) /* TMU adapter registers */ #define TMU_ADP_CS_3 0x03 diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c index 3a2e7126db9d..40ba14e8e227 100644 --- a/drivers/thunderbolt/usb4.c +++ b/drivers/thunderbolt/usb4.c @@ -1046,6 +1046,25 @@ int usb4_port_unlock(struct tb_port *port) return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); } +/** + * usb4_enable_hotplug() - Enables hotplug for a port + * @port: USB4 port to operate on + * + * Enables hot plug events on a given port. + */ +int usb4_enable_hotplug(struct tb_port *port) +{ + int ret; + u32 val; + + ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1); + if (ret) + return ret; + + val &= ~ADP_CS_5_DHP; + return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1); +} + static int usb4_port_set_configured(struct tb_port *port, bool configured) { int ret;