public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Frank Wunderlich <linux@fw-web.de>
To: u-boot@lists.denx.de
Subject: [RESEND PATCH v2 07/11] usb: xhci: convert to TRB_LEN()
Date: Wed,  2 Sep 2020 08:13:39 +0200	[thread overview]
Message-ID: <20200902061343.3185-7-linux@fw-web.de> (raw)
In-Reply-To: <20200902061343.3185-1-linux@fw-web.de>

From: Chunfeng Yun <chunfeng.yun@mediatek.com>

Use TRB_LEN(x) instead of ((x) & TRB_LEN_MASK)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-ring.c | 8 ++++----
 include/usb/xhci.h           | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 16d2e02cfa..99c84f95b3 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -688,7 +688,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 					      length, maxpacketsize,
 					      more_trbs_coming);
 
-		length_field = ((trb_buff_len & TRB_LEN_MASK) |
+		length_field = (TRB_LEN(trb_buff_len) |
 				TRB_TD_SIZE(remainder) |
 				TRB_INTR_TARGET(0));
 
@@ -848,7 +848,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
 	trb_fields[1] = le16_to_cpu(req->index) |
 			le16_to_cpu(req->length) << 16;
 	/* TRB_LEN | (TRB_INTR_TARGET) */
-	trb_fields[2] = (8 | TRB_INTR_TARGET(0));
+	trb_fields[2] = (TRB_LEN(8) | TRB_INTR_TARGET(0));
 	/* Immediate data in pointer */
 	trb_fields[3] = field;
 	queue_trb(ctrl, ep_ring, true, trb_fields);
@@ -864,11 +864,11 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
 
 	remainder = xhci_td_remainder(ctrl, 0, length, length,
 				      usb_maxpacket(udev, pipe), 1);
-	length_field = (length & TRB_LEN_MASK) | TRB_TD_SIZE(remainder) |
+	length_field = TRB_LEN(length) | TRB_TD_SIZE(remainder) |
 			TRB_INTR_TARGET(0);
 	debug("length_field = %d, length = %d,"
 		"xhci_td_remainder(length) = %d , TRB_INTR_TARGET(0) = %d\n",
-		length_field, (length & TRB_LEN_MASK),
+		length_field, TRB_LEN(length),
 		TRB_TD_SIZE(remainder), 0);
 
 	if (length > 0) {
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index ca3d99b954..35c66042ba 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -847,7 +847,6 @@ struct xhci_event_cmd {
 /* Normal TRB fields */
 /* transfer_len bitmasks - bits 0:16 */
 #define	TRB_LEN(p)			((p) & 0x1ffff)
-#define	TRB_LEN_MASK			(0x1ffff)
 /* TD Size, packets remaining in this TD, bits 21:17 (5 bits, so max 31) */
 #define TRB_TD_SIZE(p)          (min((p), (u32)31) << 17)
 /* Interrupter Target - which MSI-X vector to target the completion event@*/
-- 
2.25.1

  parent reply	other threads:[~2020-09-02  6:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02  6:13 [RESEND PATCH v2 01/11] usb: xhci: add a member hci_version in xhci_ctrl struct Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 02/11] usb: xhci: create one unified function to calculate TRB TD remainder Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 03/11] usb: xhci: add quirks flag to support MediaTek xHCI 0.96 Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 04/11] usb: xhci: convert to HCS_MAX_PORTS() Frank Wunderlich
2020-09-04  6:54   ` Bin Meng
2020-09-02  6:13 ` [RESEND PATCH v2 05/11] usb: xhci: convert to TRB_TYPE() Frank Wunderlich
2020-09-04  9:23   ` Bin Meng
2020-09-02  6:13 ` [RESEND PATCH v2 06/11] usb: xhci: convert to TRB_INTR_TARGET() Frank Wunderlich
2020-09-02  6:13 ` Frank Wunderlich [this message]
2020-09-02  6:13 ` [RESEND PATCH v2 08/11] usb: xhci: convert to TRB_TX_TYPE() Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 09/11] usb: xhci: convert to EP_TYPE() Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 10/11] usb: xhci: use macros with parameter to fill ep_info2 Frank Wunderlich
2020-09-02  6:13 ` [RESEND PATCH v2 11/11] usb: xhci: convert to readx_poll_sleep_timeout() Frank Wunderlich
2020-09-02 10:38 ` [RESEND PATCH v2 01/11] usb: xhci: add a member hci_version in xhci_ctrl struct Marek Vasut
2020-09-02 13:21   ` Bin Meng
2020-09-04  0:59 ` Bin Meng

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=20200902061343.3185-7-linux@fw-web.de \
    --to=linux@fw-web.de \
    --cc=u-boot@lists.denx.de \
    /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