From patchwork Mon Dec 10 07:21:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejas Joglekar X-Patchwork-Id: 10720685 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 484A7112E for ; Mon, 10 Dec 2018 07:21:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27D5829DD4 for ; Mon, 10 Dec 2018 07:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AD2F29DDD; Mon, 10 Dec 2018 07:21:27 +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 91B0229DD4 for ; Mon, 10 Dec 2018 07:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726517AbeLJHVZ (ORCPT ); Mon, 10 Dec 2018 02:21:25 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:53824 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbeLJHVZ (ORCPT ); Mon, 10 Dec 2018 02:21:25 -0500 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 48CA410C1417; Sun, 9 Dec 2018 23:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1544426485; bh=H9Rkn9ppL6h4sHvypL9Zliwo861FRyt0rVglzCYfz2g=; h=Date:From:Subject:To:CC:From; b=lOAROtrxEVJN4vUNx/UzC4mjnjCJEHO4PGBBscUZwngXTprB2OqX7UnQSRQcFwtLN z5JHUTSLtIso3BGaxIFh8/DkazWGiCZBlM8lStyDtUtbzBt2PCUUR7h/D/EZObTT7E 1yI6j95p3Kd6j8oiBvGCfGg4ctSAHLs+3Vne51pbBj0W/iULH4FGaKf1BC0LW8ufEM 0M7060PI+YVN3ZB+OY79paJmzBJbuhQFys77n78b1Oo7r30Kisa4VwNFipXCg96IZu YWCQrgviXhmZ/pupHkyDQnr6/gLhRhv/ShqmFwXGz28S1gLsCiq2pXagC8fdMagqMB YkylQuDpImQbQ== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 3C44E3AD5; Sun, 9 Dec 2018 23:21:25 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 9 Dec 2018 23:21:25 -0800 Received: from tejas-VirtualBox (10.145.66.15) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 9 Dec 2018 23:21:23 -0800 Received: by tejas-VirtualBox (sSMTP sendmail emulation); Mon, 10 Dec 2018 12:51:17 +0530 Date: Mon, 10 Dec 2018 12:51:17 +0530 From: Tejas Joglekar Subject: [PATCH] usb: dwc3: gadget: Disable CSP for stream OUT ep To: Felipe Balbi , CC: John Youn , Tejas Joglekar , MIME-Version: 1.0 Message-ID: <3bb329e5-b161-447f-a72f-66e4a95ca5f9@US01WEHTC1.internal.synopsys.com> 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 --- drivers/usb/dwc3/gadget.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f1089ec..0d2afc1 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -986,9 +986,15 @@ 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; + else + trb->ctrl |= DWC3_TRB_CTRL_CSP; if (short_not_ok) trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;