Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2723146imj; Mon, 11 Feb 2019 07:31:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IY9sDgXmSZ5Z5iIJlNiAjXublKsFqe/u3w5sz3TB4hRZPdNpetlWoNLNQQnJsM59hfc0Jzz X-Received: by 2002:a17:902:bd86:: with SMTP id q6mr37152687pls.16.1549899103321; Mon, 11 Feb 2019 07:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899103; cv=none; d=google.com; s=arc-20160816; b=uIFCLUwBsoPXlY4bPZJBU8qMsOht1Z1cK8XCaPbVfQBotIGQtpg2ysqLDRb1Tqy1N5 VVO7btOkQGRPY9mTRKY4lp548afMlu/LEQ6ZWg5BVyMDZxAE6i3WFELyaMQ5nI3p6AQ4 b2eC5NkSww/1CUQJbVIDr9Oqtf+MOmL4R1jh0O04MCeHAUerSc7vAmzE6hH+673dkrss e1MAm72vJejJL1+8hB5Zez30ybwvZVy8Y3BIUiUMVaVNHnLO7qJhYeO152tojSMjhq1c LMmgfAzoZJHYvJpwB6hTt4tiuax93srfXr3bJ80nQ3pJeg0+kcVEMM0085fFo/hTIk+P c9VA== 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=s3mpEq+WRvppmGGX0xNTg5DRsCmdAVguPIePRR5RqR4=; b=UMkNKbYrC+tPYfjRwZwJynzbeTv3AJO3d+0vuQPWGcYCGSkxzWp9Y8Bn+kME7DUwHH JIQg3ThJTTQoCtZMiEO34QSPreEo+G6W8muhUwCUyrBTORTva2mw0Lk+p1RxBQRkd6Rh KJfvse3uTW7I0IUDrHznJbSvzqaExLpYOpobQOYUFy4AqYow/ulBdeqrq6Swz8mH/uxp DkdwWuLrAd23HiAUlo2U24240i65yFrgVVICqcsr0aVbj0It+p9qnO0jGLRpR9j3qwXU d0t+yvLx5CYJL7FYZfHJq3L4VFWuV9vywKr1EU5yzz/8udpg1jgyjVUr28/ghJ0GctS8 OAMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BrvdgTE0; 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 g69si10526762pfg.225.2019.02.11.07.31.22; Mon, 11 Feb 2019 07:31:43 -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=BrvdgTE0; 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 S2389418AbfBKO5s (ORCPT + 99 others); Mon, 11 Feb 2019 09:57:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:45254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389408AbfBKO5q (ORCPT ); Mon, 11 Feb 2019 09:57:46 -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 034662229E; Mon, 11 Feb 2019 14:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897065; bh=w1eHhEjxqkWFVDJKLuQ3hgylEVxTnKVs0h/QDlPmY3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BrvdgTE0GM262QrsoNu8142ySHH1s/Ta3sdnLdxriP5tA7qwwxF9G5JZYJGcfOBcX gc5IbXUhdzXDccxjDknmAv0ej4t94nQiTuZrUIBCL5tpp2nndvRz216PM33y/AY48Y HZH01hsypq+ZBVwmURp9bj+AX2wa+5/Bc0D+Zfl8= 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.14 079/205] usb: dwc3: gadget: Disable CSP for stream OUT ep Date: Mon, 11 Feb 2019 15:17:57 +0100 Message-Id: <20190211141833.866525233@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 b80eefa355b6..5b34994b7b08 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -959,9 +959,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