From: Frank Wunderlich <linux@fw-web.de>
To: u-boot@lists.denx.de
Subject: [PATCH RESEND v4 5/9] usb: xhci: convert to TRB_TYPE()
Date: Tue, 8 Sep 2020 18:59:59 +0200 [thread overview]
Message-ID: <20200908170003.4002-5-linux@fw-web.de> (raw)
In-Reply-To: <20200908170003.4002-1-linux@fw-web.de>
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
drivers/usb/host/xhci-mem.c | 3 +--
drivers/usb/host/xhci-ring.c | 11 +++++------
include/usb/xhci.h | 1 -
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 1da0524aa0..d627aa5555 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -236,8 +236,7 @@ static void xhci_link_segments(struct xhci_segment *prev,
*/
val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
val &= ~TRB_TYPE_BITMASK;
- val |= (TRB_LINK << TRB_TYPE_SHIFT);
-
+ val |= TRB_TYPE(TRB_LINK);
prev->trbs[TRBS_PER_SEGMENT-1].link.control = cpu_to_le32(val);
}
}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3f915ae115..13c98fb09a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -696,7 +696,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
trb_fields[0] = lower_32_bits(addr);
trb_fields[1] = upper_32_bits(addr);
trb_fields[2] = length_field;
- trb_fields[3] = field | (TRB_NORMAL << TRB_TYPE_SHIFT);
+ trb_fields[3] = field | TRB_TYPE(TRB_NORMAL);
queue_trb(ctrl, ring, (num_trbs > 1), trb_fields);
@@ -823,7 +823,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
/* Queue setup TRB - see section 6.4.1.2.1 */
/* FIXME better way to translate setup_packet into two u32 fields? */
field = 0;
- field |= TRB_IDT | (TRB_SETUP << TRB_TYPE_SHIFT);
+ field |= TRB_IDT | TRB_TYPE(TRB_SETUP);
if (start_cycle == 0)
field |= 0x1;
@@ -860,9 +860,9 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
/* If there's data, queue data TRBs */
/* Only set interrupt on short packet for IN endpoints */
if (usb_pipein(pipe))
- field = TRB_ISP | (TRB_DATA << TRB_TYPE_SHIFT);
+ field = TRB_ISP | TRB_TYPE(TRB_DATA);
else
- field = (TRB_DATA << TRB_TYPE_SHIFT);
+ field = TRB_TYPE(TRB_DATA);
remainder = xhci_td_remainder(ctrl, 0, length, length,
usb_maxpacket(udev, pipe), true);
@@ -904,8 +904,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
trb_fields[2] = ((0 & TRB_INTR_TARGET_MASK) << TRB_INTR_TARGET_SHIFT);
/* Event on completion */
trb_fields[3] = field | TRB_IOC |
- (TRB_STATUS << TRB_TYPE_SHIFT) |
- ep_ring->cycle_state;
+ TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state;
queue_trb(ctrl, ep_ring, false, trb_fields);
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index cf4c0208b2..bdba51df59 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -903,7 +903,6 @@ union xhci_trb {
/* TRB bit mask */
#define TRB_TYPE_BITMASK (0xfc00)
#define TRB_TYPE(p) ((p) << 10)
-#define TRB_TYPE_SHIFT (10)
#define TRB_FIELD_TO_TYPE(p) (((p) & TRB_TYPE_BITMASK) >> 10)
/* TRB type IDs */
--
2.25.1
next prev parent reply other threads:[~2020-09-08 16:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 16:59 [PATCH RESEND v4 1/9] usb: xhci: add a member hci_version in xhci_ctrl struct Frank Wunderlich
2020-09-08 16:59 ` [PATCH RESEND v4 2/9] usb: xhci: create one unified function to calculate TRB TD remainder Frank Wunderlich
2020-09-09 13:26 ` Marek Vasut
2020-09-08 16:59 ` [PATCH RESEND v4 3/9] usb: xhci: add quirks flag to support MediaTek xHCI 0.96 Frank Wunderlich
2020-09-08 16:59 ` [PATCH RESEND v4 4/9] usb: xhci: convert to HCS_MAX_PORTS() Frank Wunderlich
2020-09-08 16:59 ` Frank Wunderlich [this message]
2020-09-08 17:00 ` [PATCH RESEND v4 6/9] usb: xhci: convert to TRB_LEN() and TRB_INTR_TARGET() Frank Wunderlich
2020-09-08 17:00 ` [PATCH RESEND v4 7/9] usb: xhci: convert to TRB_TX_TYPE() Frank Wunderlich
2020-09-08 17:00 ` [PATCH RESEND v4 8/9] usb: xhci: use macros with parameter to fill ep_info2 Frank Wunderlich
2020-09-08 17:00 ` [PATCH RESEND v4 9/9] usb: xhci: convert to readx_poll_sleep_timeout() Frank Wunderlich
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=20200908170003.4002-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.