Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3703887imu; Mon, 28 Jan 2019 09:19:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN5+80l/46N/vniDcT/WGslZqgWxAlySN25oRws+emY/7ekraGvM91LCBt4otka2OVKR/5ca X-Received: by 2002:a17:902:724a:: with SMTP id c10mr22997047pll.51.1548695942898; Mon, 28 Jan 2019 09:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695942; cv=none; d=google.com; s=arc-20160816; b=kwTmYERot5snWag85iwM1aAc0tD3mlkCgV4rrpagWhLRyJi8cEFG9RRyCRZUUglnSV 1ZWYXw0Q5aw8hQTVXLl9Kgta5yF/LCNai9eg5dESon18oi/CJhAxQRwlhF1H4VMBmABE 5Ix1Tvbcl/pD2pix5voc8sBPeZKAoRacUmc5xNYCyJ2w5l+t4IQ18JauHRyete5E9TgN 4+b1+ObtwucQ2/bzsRk3BizqdCbM94vpYsymRjWpmNsu4RUkzLZdTmmGHp+zG4JyH2zs zF0pXlEZkY211p+KVOXgqMnCC26nJjrWP0HMTBsb1IPYepbtLkR+YfZ111VaFIiPNLig E4UA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JAu3A0Xu00oYqowBr9AIsD/3h4RusTCy7zUXOTLVC3s=; b=AazWNtfh99P7bh0PUJCntZlTDq9/ovXZNN3HjpKnu8In56qZLrEP5lj8MxRCAAE8R6 Rk6M8Bsi9qrXMK25GHk6BaShl91fImiKyVPtMbFTPgv64vooWYw2Udvjtp0BBLOaCuKe bBA8pv/fLIS4f9i5eXt0PTyaow+2eXGxv2nkThTUnOly97HrMkvthfOGjTeAn3Wgyyj8 bLmDlBbykjyjR8l6LBSh1/pgMifi5J8jE+xYQusaIN7pstzpa2JLmM7n7ElXALtxuMMM Qx+QUdOApg6agwuip0ywTJJFj0Bgws8uJkkE6tQzmQVqaVqtNe7gZmgbCawOXE4oqcGg gJzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iyPFJ2cN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si14125420pgt.498.2019.01.28.09.18.46; Mon, 28 Jan 2019 09:19:02 -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=iyPFJ2cN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732509AbfA1RSP (ORCPT + 99 others); Mon, 28 Jan 2019 12:18:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:51926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731803AbfA1QFW (ORCPT ); Mon, 28 Jan 2019 11:05:22 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A329420989; Mon, 28 Jan 2019 16:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691522; bh=70RbbwzPpgq67y5WTaypyfqdLlmGeJeivE28I4UlsYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iyPFJ2cNHdBR95DlC99jA9QJK6zVrwrpqUw/vWESmu8V9Hj0xruTQ1ybScyI8s7/k u5StqYS0mmZdR8Qvh0JPJIyweFkWhrfj/Kk8wu5kbuQlUY+RYzgqJKhvBft9Hd/+RQ TA6NTka02hR8pipxN/+F83obvCmv4PT792la4DaU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tejas Joglekar , Tejas Joglekar , Felipe Balbi , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 127/258] usb: dwc3: gadget: Disable CSP for stream OUT ep Date: Mon, 28 Jan 2019 10:57:13 -0500 Message-Id: <20190128155924.51521-127-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejas Joglekar [ 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 a9f22a0a3462..e82be2ec859a 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -979,9 +979,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