mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunzhi Li <lyz@rock-chips.com>
To: John.Youn@synopsys.com, dianders@chromium.org,
	jwerner@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, wulf@rock-chips.com,
	kever.yang@rock-chips.com, frank.wang@rock-chips.com,
	huangtao@rock-chips.com, caesar.wang@rock-chips.com
Cc: Yunzhi Li <lyz@rock-chips.com>
Subject: [PATCH] usb: dwc2: hcd: fix periodic transfer schedule sequence
Date: Mon, 16 Nov 2015 23:25:32 +0800	[thread overview]
Message-ID: <1447687532-4820-1-git-send-email-lyz@rock-chips.com> (raw)

When checking dwc2 host channel interrupts, handle qh in
periodic_sched_queued list at first, then we could make sure CSPLIT
packets scheduled in the same order as SSPLIT packets.

Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
---
 drivers/usb/dwc2/hcd_intr.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index bda0b21..e8e8970 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -2115,6 +2115,8 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)
 {
 	u32 haint;
 	int i;
+	int hc_num;
+	struct dwc2_qh *qh, *qh_tmp;
 
 	haint = dwc2_readl(hsotg->regs + HAINT);
 	if (dbg_perio()) {
@@ -2123,6 +2125,26 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)
 		dev_vdbg(hsotg->dev, "HAINT=%08x\n", haint);
 	}
 
+	/*
+	 * According to USB 2.0 spec section 11.18.8, a host must
+	 * issue complete-split transactions in a microframe for a
+	 * set of full-/low-speed endpoints in the same relative
+	 * order as the start-splits were issued in a microframe for.
+	 * So here we should at first picking up host channels
+	 * from periodic_sched_queued list and checking if there is
+	 * any start-split have already finished then schedule
+	 * complete-split in the same order.
+	 */
+	list_for_each_entry_safe(qh, qh_tmp,
+				 &hsotg->periodic_sched_queued,
+				 qh_list_entry) {
+		hc_num = qh->channel->hc_num;
+		if (haint & (1 << hc_num)) {
+			dwc2_hc_n_intr(hsotg, hc_num);
+			haint &= ~(1 << hc_num);
+		}
+	}
+
 	for (i = 0; i < hsotg->core_params->host_channels; i++) {
 		if (haint & (1 << i))
 			dwc2_hc_n_intr(hsotg, i);
-- 
1.9.1



             reply	other threads:[~2015-11-16 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 15:25 Yunzhi Li [this message]
2015-11-16 18:27 ` Doug Anderson
2015-11-16 22:41 ` Caesar Wang
2016-01-21  0:23   ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447687532-4820-1-git-send-email-lyz@rock-chips.com \
    --to=lyz@rock-chips.com \
    --cc=John.Youn@synopsys.com \
    --cc=caesar.wang@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=frank.wang@rock-chips.com \
    --cc=huangtao@rock-chips.com \
    --cc=jwerner@google.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=wulf@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®