Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6233422iob; Tue, 10 May 2022 13:31:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTdzb154Wq9VVfj7Z+2v1KlCF+84kc+3CZ5VLMd1N0Z7r/fSgZN28kqEu5AMBaCPjHgnV+ X-Received: by 2002:a05:6a00:1744:b0:510:56fa:d3d6 with SMTP id j4-20020a056a00174400b0051056fad3d6mr22002386pfc.22.1652214669434; Tue, 10 May 2022 13:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652214669; cv=none; d=google.com; s=arc-20160816; b=GWjNCE+DkImL0NSLB01jqiEVayUru/m3XnlWfTxoqWxsRWz5anbtLtQeahloAzhXty mLkZll0lCcjnPCL6KyuY2Gh4Z0wMakWpLQ09iau6v6OKH2uY1U/LsUgnNp8u07uI99d3 KHlC/xxlv6e7qavN1oOa8VbCi25xA2owCcWg3DP4pN0beE219Eh6kk/JwTZqB8IIaPfq 8D+YYCzLv9It71m9dJXfGc20oaHQAiVmIiMXNtQ5OrMvxxYQr8HE04VQxz6Smsiv+IZu Av6Sda//R27SeZ1M0av1r09PNVrvD2CbXcW4d8+baTl9BLthEeOOO94pN2TcqtbQ9RVM n62w== 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=ek1mag03vjIrM1hCsLK1KRE9FO6XyiSUD7BGeJB+MSk=; b=WvX9mUcccSG4FnmEvHcAtavx9m+wF+AoZ25dIvlvHwE0PWreHTrxy16ZTxcWgU0TS0 vEjxl/2x/csq3Q5lBoJLHHeoR7L6dIiE/SF6MeNn+AOfFfDUCH5k7ynfDVLOsAGvHpXk ErQQbKHEZYK4y5UxCRa8PRO1CHj++pXN2Fnvq6+BFCFIV0c6hIyjZmqx5mcbRtQDihGP IpS6U/Hh3ibMPIuy9jDfFO+axN6LsnklhpBLOI7tEi8NLt9OT90sSYkS77jn4VOnBo/x cwGKQ6aw3+FnE3JF72lcZNabUHuuZ9Q8H8gXZsO6Voe+UrtFPdYy6KOiHqTG+iXT+TME +xLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LOpPWQfK; 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 30-20020a63145e000000b003a94e627cc2si349574pgu.360.2022.05.10.13.30.53; Tue, 10 May 2022 13:31:09 -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=LOpPWQfK; 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 S243007AbiEJNZg (ORCPT + 99 others); Tue, 10 May 2022 09:25:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243397AbiEJNVv (ORCPT ); Tue, 10 May 2022 09:21:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 077D847ACE; Tue, 10 May 2022 06:15:58 -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 07EB36165A; Tue, 10 May 2022 13:15:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0947DC385C6; Tue, 10 May 2022 13:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188525; bh=FZfg3tIgQzItUpFCdxmW/CBbwci+zbGsCQcD8ZzaOdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOpPWQfK0KuvpsV++Wl2i2knLyf5HpY28p4h/q0dHhQ/e7yxtZ2gth8QGPNIti/6E nW1eKuY6RpIfpAuzzCOA5GXTFaPpurD7V2o1dNpfqBvlPyBMNyBToJUlQrnOJNeuWN Yd46OlQAo/+nCGsIFcv/ckZY/kOUbejCLFOhePkI= 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 4.14 07/78] usb: mtu3: fix USB 3.0 dual-role-switch from device to host Date: Tue, 10 May 2022 15:06:53 +0200 Message-Id: <20220510130732.745738342@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@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,URIBL_BLOCKED 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 @@ -39,10 +39,8 @@ enum mtu3_vbus_id_state { 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 */