From patchwork Mon Dec 10 10:38:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Joglekar X-Patchwork-Id: 10721081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C0CC112E for ; Mon, 10 Dec 2018 10:38:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0952129BC1 for ; Mon, 10 Dec 2018 10:38:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F169A29BCD; Mon, 10 Dec 2018 10:38:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9986B29BC1 for ; Mon, 10 Dec 2018 10:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbeLJKiV (ORCPT ); Mon, 10 Dec 2018 05:38:21 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:36686 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726292AbeLJKiV (ORCPT ); Mon, 10 Dec 2018 05:38:21 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 4E8F324E1190; Mon, 10 Dec 2018 02:38:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1544438301; bh=mKma5ZTAPMDl+bLW+6IyKlp434/zKRL6tSZCXD+T49k=; h=Date:From:Subject:To:CC:From; b=bFPUzarQ5k1ePjw0R9DMVjd0v9kFypS9KypBcD2oXEKxY7aKE5xQZXMUvW8R9ixjV dLzyt0ZpthEKa5fiw3SyM6dQkkAzsfNYq31IX+IMilH7ogd1a3K/GQ0QYBY5k/B2RM GQZ54kaYs111Fdy8gVsg+nhxjjlXEe+db2iGYfLjc7iiWyjPed6fqq3Wqes6cUdfP/ HQLgv+wClCU5IVLYLESyKEbPPE2p3HIJC+6DyJqK8CSZsjeKpUgcQWF1zCKLBYOjhH ZTCsQAywacX1iPpwAjCADN2PbkCEfHqTXq2yna9DzoLR5b8yiSoZzeQi82XbCR76lj BlB6LL0mRsKng== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 45F853E27; Mon, 10 Dec 2018 02:38:21 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 02:38:21 -0800 Received: from tejas-VirtualBox (10.145.66.15) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 02:38:19 -0800 Received: by tejas-VirtualBox (sSMTP sendmail emulation); Mon, 10 Dec 2018 16:08:13 +0530 Date: Mon, 10 Dec 2018 16:08:13 +0530 From: Tejas Joglekar Subject: [PATCH v2] usb: dwc3: gadget: Disable CSP for stream OUT ep To: Felipe Balbi , CC: John Youn , Tejas Joglekar , MIME-Version: 1.0 Message-ID: X-Originating-IP: [10.145.66.15] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- changes in v2: - CSP condition change as suggested by balbi 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 f1089ec..a4ebbad 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -986,9 +986,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;