From patchwork Wed Aug 29 17:00:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grigor Tovmasyan X-Patchwork-Id: 10580663 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 BFAFA17DE for ; Wed, 29 Aug 2018 17:00:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1A12B682 for ; Wed, 29 Aug 2018 17:00:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A16842B6FD; Wed, 29 Aug 2018 17:00:43 +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 4CE7D2B682 for ; Wed, 29 Aug 2018 17:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbeH2U6b (ORCPT ); Wed, 29 Aug 2018 16:58:31 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:38512 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbeH2U6a (ORCPT ); Wed, 29 Aug 2018 16:58:30 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9032B24E04A5; Wed, 29 Aug 2018 10:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1535562041; bh=xAkXkOO1X2joe2lL6lV2CJkk23EYo5c4+8KunaAfVyU=; h=Date:In-Reply-To:References:From:Subject:To:CC:From; b=BbL3IfyZ/f2gvPZVSYKmmCqqH4vHftElLTQ/NU8PFu++f4kuxL1A4acATAsN6LDjH VS59tqqcIWtvqCD8lQ563IaZhwjSuTqv/le9ogcXqdX+QaSmvCZhxOtnbp13BADSms 1Nz5HFFiGsJKJAKGdzmfWTsplctSqrEms9STiCdCZriNpmHmEbcj9Ie+KnxCi8/FLi kjxiKp7aLzVv5/681JsjG5ScEI5o3S3p3ttXD034lA3x/5kj1rEXCCd/X005Bam5yA Lxl3T2eVMwG5VI0buHutTaDeiLVaLIz3bI8A5L2w6qEezu2bmahj2nYNY9T1PlMP86 3r90O1ilZ1BoA== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 817B55BBA; Wed, 29 Aug 2018 10:00:41 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (10.12.239.238) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 29 Aug 2018 10:00:41 -0700 Received: from tovmasya (10.13.184.20) by US01WEHTC2.internal.synopsys.com (10.12.239.238) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 29 Aug 2018 10:00:38 -0700 Received: by tovmasya (sSMTP sendmail emulation); Wed, 29 Aug 2018 21:00:33 +0400 Date: Wed, 29 Aug 2018 21:00:33 +0400 Message-ID: <92e6668af9b4cb77faa8bcbeca70271f47df94c5.1535561828.git.tovmasya@synopsys.com> In-Reply-To: References: From: Grigor Tovmasyan Subject: [PATCH 4/9] usb: dwc2: Update target (u)frame calculation To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , CC: John Youn , Grigor Tovmasyan MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] 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 service interval based scheduling target (u)frame must be set as a last frame in this the service interval. Signed-off-by: Grigor Tovmasyan --- drivers/usb/dwc2/gadget.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 58903b5c22a4..004701cad25c 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2830,6 +2830,23 @@ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) if (using_desc_dma(hsotg)) { hs_ep->target_frame = hsotg->frame_number; dwc2_gadget_incr_frame_num(hs_ep); + + /* In service interval mode target_frame must + * be set to last (u)frame of the service interval. + */ + if (hsotg->params.service_interval) { + /* Set target_frame to the first (u)frame of + * the service interval + */ + hs_ep->target_frame &= ~hs_ep->interval + 1; + + /* Set target_frame to the last (u)frame of + * the service interval + */ + dwc2_gadget_incr_frame_num(hs_ep); + dwc2_gadget_dec_frame_num_by_one(hs_ep); + } + dwc2_gadget_start_isoc_ddma(hs_ep); return; }