Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: linux-usb@vger.kernel.org
Cc: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org,
	kernel@pengutronix.de, balbi@kernel.org
Subject: [PATCH v4 1/3] usb: dwc3: gadget: add frame number mask
Date: Wed,  1 Jul 2020 11:31:36 +0200
Message-ID: <20200701093137.19485-2-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <20200701093137.19485-1-m.grzeschik@pengutronix.de>

This patch adds an define DWC3_FRNUMBER_MASK for the common used
0x3fff mask and uses it.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

---
v4: - first version

 drivers/usb/dwc3/gadget.c | 4 ++--
 drivers/usb/dwc3/gadget.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8de6f10d335e1c0..5fb78535efa9bdc 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1403,7 +1403,7 @@ static int dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep)
 		 * Check if we can start isoc transfer on the next interval or
 		 * 4 uframes in the future with BIT[15:14] as dep->combo_num
 		 */
-		test_frame_number = dep->frame_number & 0x3fff;
+		test_frame_number = dep->frame_number & DWC3_FRNUMBER_MASK;
 		test_frame_number |= dep->combo_num << 14;
 		test_frame_number += max_t(u32, 4, dep->interval);
 
@@ -1450,7 +1450,7 @@ static int dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep)
 	else if (test0 && test1)
 		dep->combo_num = 0;
 
-	dep->frame_number &= 0x3fff;
+	dep->frame_number &= DWC3_FRNUMBER_MASK;
 	dep->frame_number |= dep->combo_num << 14;
 	dep->frame_number += max_t(u32, 4, dep->interval);
 
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index 24dca38720225dd..a0fc46f72b9e30a 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -54,6 +54,8 @@ struct dwc3;
 /* U2 Device exit Latency */
 #define DWC3_DEFAULT_U2_DEV_EXIT_LAT	0x1FF	/* Less then 511 microsec */
 
+/* Frame/Microframe Number Mask */
+#define DWC3_FRNUMBER_MASK		0x3fff
 /* -------------------------------------------------------------------------- */
 
 #define to_dwc3_request(r)	(container_of(r, struct dwc3_request, request))
-- 
2.27.0


  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01  9:31 [PATCH v4 0/3] usb: dwc3: gadget: improve isoc handling Michael Grzeschik
2020-07-01  9:31 ` Michael Grzeschik [this message]
2020-07-01  9:52   ` [PATCH v4 1/3] usb: dwc3: gadget: add frame number mask Sergei Shtylyov
2020-07-01  9:31 ` [PATCH v4 2/3] usb: dwc3: gadget: make starting isoc transfers more robust Michael Grzeschik
2020-07-01 18:06   ` Thinh Nguyen
2020-07-01  9:31 ` [PATCH v4 3/3] usb: dwc3: gadget: when the started list is empty stop the active xfer Michael Grzeschik
2020-07-01  9:53   ` Sergei Shtylyov

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=20200701093137.19485-2-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-usb@vger.kernel.org \
    /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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git