Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2520710iob; Fri, 6 May 2022 04:57:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp7f1bg+9l1tWlBm5I53VmSjOnPzmyBiDIVQvICDmotsF/6qEprCxJLVwgaF0XD4WcyKkz X-Received: by 2002:a17:90b:3ec7:b0:1dc:b008:3cd3 with SMTP id rm7-20020a17090b3ec700b001dcb0083cd3mr12039037pjb.226.1651838219765; Fri, 06 May 2022 04:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651838219; cv=none; d=google.com; s=arc-20160816; b=S8OYP0IGCN8l89OpONHDxBIWKHkzf8M+RA58Qm/vag32cUgb5eiboGri9zdzDqOsJE CPeXRfK2KayrNuh60Jq0fE8gmq1DOHVB7/AvRzWXgMlALOKqSPE+sRY87zGNSLLMisoE 0eXNzh+1R4oRyCyjH/n1xG7tKvEW8CXV0cJ1PPr3fpx5oHruj44iGVwVYbPqCPcJMnbg zxW9LnV0pmz8WgkWwL+1SFjgnmvNMRS5x93VTCsMrWJV3lVZOHH8EgEZoC8zYk/ZWuBZ aWtwUXhawBuk+kqWHbvl8jNWjDCe5KcGJW8PLmNhcyX/JT8PFeTVx/lBNaO+Vwfde1Zx qhIQ== 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=GLzHAxMKpiyuPd1FUCfBfklgiMk+aCsFhSYcgFUOpBI=; b=X3JbHtVDGnE+s5uawaKSM8CCxWUwNUfJDWy+beDGYqB0ZW5QJoTIChlo/A1/ziw657 yS0EzXism6BBvQ99IAkspb3AL+lQ6vIbfnIjzNLIWrQAEz+oSN1bqPQ4qHWPiwjOy/fn ZCqbb6E+GVYKf7JhYA3eaPO0Qj+BttrPv+hA98Dmq/0kPkot+sbrbJ4km0i6Y3w5uV7J OsGoABf6DTUhUhgQ9PrdvZl87yp6lUEJlIPPRpVpQtg//z2k7FuJ5w9Ydc5ewiR21FbP fulQtm3LavgHtOzBC8bo6b964jyCxW+xfFlGL54GOCyugfu/ZaFKtj2e3Q6rgKr4jGiY xamQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K4LxhxHT; 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 s7-20020a170902ea0700b00158f3c64e2fsi2204142plg.244.2022.05.06.04.56.44; Fri, 06 May 2022 04:56:59 -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=K4LxhxHT; 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 S1353792AbiEDQw1 (ORCPT + 99 others); Wed, 4 May 2022 12:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353613AbiEDQv6 (ORCPT ); Wed, 4 May 2022 12:51:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B4D744A3E; Wed, 4 May 2022 09:48:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4CABFB82554; Wed, 4 May 2022 16:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C7BC385B1; Wed, 4 May 2022 16:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651682899; bh=wc3rDHdA1PWnE21lxT4hEmsW7Iuq8hxO5HNjLyXzhN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4LxhxHTQNXoYP8H79agzHR/8If4pEpDwosn83RH1IrCuF2AqsjcpKxc3spqy+2ro vfeObS82q/BWIHXbqcN9HZ7aUNFopKmh/DNoiWcV5igCS+3y1SrfxrnVBcml6lcl2l SsWjwVZyObN51Ua9F2+clfHavAjDWtpO93ZU1xVQ= 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.4 05/84] usb: mtu3: fix USB 3.0 dual-role-switch from device to host Date: Wed, 4 May 2022 18:43:46 +0200 Message-Id: <20220504152928.124644155@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504152927.744120418@linuxfoundation.org> References: <20220504152927.744120418@linuxfoundation.org> User-Agent: quilt/0.66 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 @@ -41,10 +41,8 @@ static char *mailbox_state_string(enum m 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 */