Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2763632imj; Mon, 11 Feb 2019 08:07:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IYheZTpg2PWs2Zjcz0q99kuf29Zwc+FKTfJwCTDN/69xFdCQHzo08io5pMX/MJssgzUwVs0 X-Received: by 2002:a63:4b12:: with SMTP id y18mr19317040pga.340.1549901246527; Mon, 11 Feb 2019 08:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901246; cv=none; d=google.com; s=arc-20160816; b=WGnRAK5M5iqSXl6fOGHmiv7gU/Mbd3yFgM8vXB58h2JCvMJdRkiVKPa21UuNa7H43G LbHwmvajfjE14He7AQKWBBcc4ZwmnKcJgKR3adf8dOYVjSuIGEMZqBvb/zhKNhTSg1Gb a3L38kHShxmOl/MZHcFZPbO2NUkjt70Fccu0DuB2tNrKTww9hLZ9+sXcGjooILMzC/Yu ptGEumP8AO9eNhJ/+1rHBhZzDU7lhvbga04pXpvoc9xP+EJpbix5jc+d3WY/j8K1ihuV uxeSXGQfcj3Z5n+AqOBHSPeohLXr3t4sBuDfSPsewV0d/x5QPqxc4xtdAPRnqxbb/wLl EoVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JattgyNZTdNrXqND+/GLToUooqaUQo6hfEGBwlBtwvM=; b=vQpFj/2XX/ojhPjpXq8xDaUiMBbpniCMKURlRnpUUM60sheDJq6sBdDAYErvgXI+k6 xShm6/N7lnnXjyWnHBU/fIcghVdD7MurL09ag4X4b8BwSQ2ojdzlClYBSkN1ifFATYDH rpT7mKgYgzpyjxtqau8KWtsj4MLOdmkxJOuC527TVecx4fY21qqWUS8YcL81n7+fz1w4 ZOh/m5s6nYMLUPad6tPRbYPd1oeHWxaheU/gxHx+DnYLIlkMJyCrSjhsLLU6Pje3h2Zb P+5/a1dyzIgnyD8RoP+7rMaT6J5w78NBf/XWoGCBz0nwHCVNIBBoXt3F3YV53Gw+lI6Z SSaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SgA6gJRM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j66si10557213pfc.251.2019.02.11.08.07.05; Mon, 11 Feb 2019 08:07:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SgA6gJRM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730191AbfBKQF5 (ORCPT + 99 others); Mon, 11 Feb 2019 11:05:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:33286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726943AbfBKO13 (ORCPT ); Mon, 11 Feb 2019 09:27:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C640214DA; Mon, 11 Feb 2019 14:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895248; bh=4ly3N3X+3sGiw+0HJQZKh10aKDLsx43I9emOZvXAaTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgA6gJRMG5aSKwhrDgEzOfYS/DAibBNJmnOwoTu/5TUXpeDDjwZDDCRfvJYXLnSBH rFU/aGjJbc3iLpEUpgCKdz2fVfQCpIBtwRX2qd8lLoSNoKCcjqEcYWcJGopUDibeQG E30w/vjEiIGYUrvaEQUZ1dH3JABIcOyT9MGFeOO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejas Joglekar , Felipe Balbi , Sasha Levin Subject: [PATCH 4.20 141/352] usb: dwc3: gadget: Disable CSP for stream OUT ep Date: Mon, 11 Feb 2019 15:16:08 +0100 Message-Id: <20190211141855.495645697@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 244add8ebfb231c39db9e33b204bd0ce8f24f782 ] In stream mode, when fast-forwarding TRBs, the stream number is not cleared causing the new stream to not get assigned. So we don't want controller to carry on transfers when short packet is received. So disable the CSP for stream capable endpoint. This is based on the 3.30a Programming guide, where table 3-1 device descriptor structure field definitions says for CSP bit If this bit is 0, the controller generates an XferComplete event and remove the stream. So if we keep CSP as 1 then switching between streams would not happen as in stream mode, when fast-forwarding TRBs, the stream number is not cleared causing the new stream to not get assigned. Signed-off-by: Tejas Joglekar Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/gadget.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 88f69d823be5..357a2b330137 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -990,9 +990,13 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, usb_endpoint_type(dep->endpoint.desc)); } - /* always enable Continue on Short Packet */ + /* + * Enable Continue on Short Packet + * when endpoint is not a stream capable + */ if (usb_endpoint_dir_out(dep->endpoint.desc)) { - trb->ctrl |= DWC3_TRB_CTRL_CSP; + if (!dep->stream_capable) + trb->ctrl |= DWC3_TRB_CTRL_CSP; if (short_not_ok) trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; -- 2.19.1