Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1283631iob; Wed, 4 May 2022 19:52:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsWcbpeHdkehOEaX3u1DNwSeSY3mtoyCu5xB1294JCkh7zTpiCFrP70PIwJPZlQml3YBs3 X-Received: by 2002:a17:90a:b78d:b0:1d9:4f4f:bc2a with SMTP id m13-20020a17090ab78d00b001d94f4fbc2amr3347353pjr.155.1651719125074; Wed, 04 May 2022 19:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651719125; cv=none; d=google.com; s=arc-20160816; b=t2Vll+Ln+S901OhnAqZMlOGxufNh/NXqjnjpQwv2P0f8Dzo19nVn74WT9vQCNIXu5c pIsDIFENWolPCH1IgTrmZdY9G2O3IJfWybUOx1hyPczuQXudne5gmfuRwo/vUwTpIfmc Fxc2NZvSvsqWA4zc2UCqTsaVFu5y302t3dBvc6k5tQVMw4cuId/Xcf6MBSh0GaL/HAVn ENmK4SDNMpXA0n6kPKnyqF3NpvvfoTG1M6sqRYIfwwcuq9hOToBg2Bobm5K+x8VPbxu0 VE0CeB/p8OnP+3Sk4APzeOBHwa0PNwuEU5Okb9FD59JuvjYzyZ/5KFjkxiCsvAt6ljyJ P94g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lrPmJ6zLJTEyZgIKGDOxDkRc2Ch3pG8L48HAcRoiuHU=; b=y+4xzSiuwb3uPOOkH9ladz5BTOt1bGkAMbdfvxa0aZwIxOgaOwiEYk9M5xMzaISOJL 1ApTKjVhjD7Xxx9hlbQ7y0NuHb6FEBGA3m1JdO+pjQBItcv2APEvMYU/JBHegXMqoPjH 55rdyQeZYICqWF1JecArpLog3Lv220KlkuOjrmfVEEiGo+bPcqBzLZb5CbPd/5cJNFs/ Gq6+oV5u1ZbcIIJCeZpjZDcDaeOc4+TFDDGC8LfUA/7It/Gjun1ajgDeRdzkXcv1q6eX RPuFQ9QrY8IZnnf+E54kqX4X/SfMDrgCvNH4P5aQhyCf6Zq+luNe4DrzbDuj8zEVmVk8 uOnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YSQarjeD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a170902db1000b0015eb690beedsi631944plx.405.2022.05.04.19.51.49; Wed, 04 May 2022 19:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YSQarjeD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356227AbiEDRNj (ORCPT + 99 others); Wed, 4 May 2022 13:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354396AbiEDRCe (ORCPT ); Wed, 4 May 2022 13:02:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 986214BFF9; Wed, 4 May 2022 09:52:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 93A6261866; Wed, 4 May 2022 16:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBD28C385A5; Wed, 4 May 2022 16:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683144; bh=iNXzK1WcdnCq/Yq1HO1iylpDNBr+hFpA09E9qtHvPec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSQarjeDT7NERWvjLm4CAnG0+CMapaS9fpGun86TYN+4y2sur0Y8MSLzvfLYErKoB doCM+cpa+da/2IBrA2JAb2TDKs9D1tnXU0nPng5hN1YTR2enin4lqKkzWvBFX1CyC3 XkGmny0PqXhXzqR2pygK5HMv19z2bMHdiLSV0hnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabien Parent , Chunfeng Yun , Macpaul Lin , Tainping Fang Subject: [PATCH 5.15 001/177] usb: mtu3: fix USB 3.0 dual-role-switch from device to host Date: Wed, 4 May 2022 18:43:14 +0200 Message-Id: <20220504153053.958173430@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Macpaul Lin commit 456244aeecd54249096362a173dfe06b82a5cafa upstream. Issue description: When an OTG port has been switched to device role and then switch back to host role again, the USB 3.0 Host (XHCI) will not be able to detect "plug in event of a connected USB 2.0/1.0 ((Highspeed and Fullspeed) devices until system reboot. Root cause and Solution: There is a condition checking flag "ssusb->otg_switch.is_u3_drd" in toggle_opstate(). At the end of role switch procedure, toggle_opstate() will be called to set DC_SESSION and SOFT_CONN bit. If "is_u3_drd" was set and switched the role to USB host 3.0, bit DC_SESSION and SOFT_CONN will be skipped hence caused the port cannot detect connected USB 2.0 (Highspeed and Fullspeed) devices. Simply remove the condition check to solve this issue. Fixes: d0ed062a8b75 ("usb: mtu3: dual-role mode support") Cc: stable@vger.kernel.org Tested-by: Fabien Parent Reviewed-by: Chunfeng Yun Signed-off-by: Macpaul Lin Signed-off-by: Tainping Fang Link: https://lore.kernel.org/r/20220419081245.21015-1-macpaul.lin@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mtu3/mtu3_dr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/usb/mtu3/mtu3_dr.c +++ b/drivers/usb/mtu3/mtu3_dr.c @@ -21,10 +21,8 @@ static inline struct ssusb_mtk *otg_sx_t static void toggle_opstate(struct ssusb_mtk *ssusb) { - if (!ssusb->otg_switch.is_u3_drd) { - mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION); - mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN); - } + mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION); + mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN); } /* only port0 supports dual-role mode */