From patchwork Tue Nov 17 00:51:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 7631561 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 766349F54F for ; Tue, 17 Nov 2015 00:52:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DFBA203DF for ; Tue, 17 Nov 2015 00:52:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8280B20532 for ; Tue, 17 Nov 2015 00:52:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyUVJ-0002Eb-2m; Tue, 17 Nov 2015 00:52:13 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyUVD-00026D-N9 for linux-rockchip@lists.infradead.org; Tue, 17 Nov 2015 00:52:09 +0000 Received: by pacej9 with SMTP id ej9so85137807pac.2 for ; Mon, 16 Nov 2015 16:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nac/DHWfNJxMYDiSjt+JYkLVlaI7ODvcPXHLzNDtO18=; b=mqaB6YSCf+3fnHNa137XSX10BzPwpZKb3msMrv3UTM/kcLo28HGuR3AEEzxIa255Fg +ijWNGTiLns6v5MjOVlaX5Q3y2IYyP4lZTufkuk13jvTx4g0YglvR7aVqfbXSLluXP3V iE4LDdkRUneHbYyBrs7XtF87OuWNMTUWXoqvk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nac/DHWfNJxMYDiSjt+JYkLVlaI7ODvcPXHLzNDtO18=; b=WrBpDy9sldtUprOjRwFKDp4rkmmK01MEMlQ53F1nPakPHL85C6C5lMZ0IiCMy7puu0 5s9ksi6ss1Tp85frsS0DJYSyJyemmRc8Q7CUgEZ+CE1feVdCGGfJqs2AIfU6XmSJ0jr/ A7VGaUEKcTR67AGIrbowk6M0tCjOZ/zdaGEOgKuswURTMQmqW42tDgWvVziaFjNfl7nj 2OLcr5hRop6zYsAGJL3JLBCo6HXwdasE5/LRDOZz0DZ6MNkVUbub5MpF+4gHKdQ9cmBJ BLRAmtOtPSF9JTLobstbG2hRvnNJlmNRtNIQJlbdrqOBHAJl4l5ursmioZtZCCF96eEb +g/w== X-Gm-Message-State: ALoCoQnqq3Cz91AxWW2/o96zmeq0w8cYS60JfHcBXJaxRVMc/yKrm3jk2YHch52PigVSNNq0Apv3 X-Received: by 10.66.141.36 with SMTP id rl4mr4580811pab.78.1447721507044; Mon, 16 Nov 2015 16:51:47 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id hg2sm16316243pbb.7.2015.11.16.16.51.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Nov 2015 16:51:46 -0800 (PST) From: Douglas Anderson To: John Youn , balbi@ti.com Subject: [PATCH v3 5/8] usb: dwc2: host: Keep track of and use our scheduled microframe Date: Mon, 16 Nov 2015 16:51:21 -0800 Message-Id: <1447721484-22548-6-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1447721484-22548-1-git-send-email-dianders@chromium.org> References: <1447721484-22548-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151116_165208_068271_00DE74A2 X-CRM114-Status: GOOD ( 14.17 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregory.herrero@intel.com, =?UTF-8?q?Heiko=20St=C3=BCbner?= , johnyoun@synopsys.com, gregkh@linuxfoundation.org, ming.lei@canonical.com, linux-usb@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, yousaf.kaukab@intel.com, stern@rowland.harvard.edu, Yunzhi Li , Julius Werner , dinguyen@opensource.altera.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The microframe scheduler did a lot of work to pick the proper microframe. Then dwc2_sched_periodic_split() went ahead and ignored which microframe we picked if it ever needed to re-assign things. Let's keep track of the uframe and then we'll always use it. Signed-off-by: Douglas Anderson --- Changes in v3: - Keep track and use our uframe new for v3. Changes in v2: None drivers/usb/dwc2/hcd.h | 4 ++++ drivers/usb/dwc2/hcd_queue.c | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index a3dbc561fe3f..ff99cb44c89d 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h @@ -231,6 +231,9 @@ enum dwc2_transaction_type { * @do_split: Full/low speed endpoint on high-speed hub requires split * @td_first: Index of first activated isochronous transfer descriptor * @td_last: Index of last activated isochronous transfer descriptor + * @sched_uframe: The microframe that we're scheduled to be in (0 - 7). + * Whenever we start a new split this is expected to be the + * lower 3 bits of sched_frame. * @usecs: Bandwidth in microseconds per (micro)frame * @interval: Interval between transfers in (micro)frames * @sched_frame: (Micro)frame to initialize a periodic transfer. @@ -263,6 +266,7 @@ struct dwc2_qh { u8 do_split; u8 td_first; u8 td_last; + u8 sched_uframe; u16 usecs; u16 interval; u16 sched_frame; diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 64b779a5c93f..4c1d9cf482d0 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c @@ -464,8 +464,10 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) /* Set the new frame up */ if (frame >= 0) { - qh->sched_frame &= ~0x7; - qh->sched_frame |= (frame & 7); + qh->sched_uframe = frame; + + /* The next frame that matches our scheduled uframe */ + qh->sched_frame = ((qh->sched_frame + 7) & ~7) | frame; dwc2_sch_dbg(hsotg, "sched_p %p sch=%04x, uf=%d, us=%d\n", qh, qh->sched_frame, frame, @@ -668,7 +670,15 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg, qh->interval); if (dwc2_frame_num_le(qh->sched_frame, frame_number)) qh->sched_frame = frame_number; - qh->sched_frame |= 0x7; + + if (hsotg->core_params->uframe_sched > 0) + /* The next frame that matches our scheduled uframe */ + qh->sched_frame = ((qh->sched_frame + 7) & ~7) | + qh->sched_uframe; + else + /* The beginning of the next full frame */ + qh->sched_frame |= 0x7; + qh->start_split_frame = qh->sched_frame; }