]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: convert to TRB_TYPE()
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 8 Sep 2020 16:59:59 +0000 (18:59 +0200)
committerMarek Vasut <marex@denx.de>
Thu, 1 Oct 2020 17:43:05 +0000 (19:43 +0200)
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
drivers/usb/host/xhci-ring.c
include/usb/xhci.h

index 1da0524aa0e92583944ef3a96acaa2068e1bc853..d627aa555560d5289539624720fcfcf5d5859f94 100644 (file)
@@ -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);
        }
 }
index 3f915ae115e7fc2412302b350fcacaf7434d027d..13c98fb09a7d513a126371e2f9c723e4b46d5392 100644 (file)
@@ -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);
 
index cf4c0208b2d6db5c660975a05699b6f32025cd17..bdba51df599f8fcf589f8966b397984fd8ea741d 100644 (file)
@@ -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 */