diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2020-09-08 18:59:56 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2020-10-01 19:43:05 +0200 |
commit | e3ea481bee1fbc8f090f46c38354838a64958af4 (patch) | |
tree | 3117859503e3c7497f7b180d55bad666abaa5825 /include/usb | |
parent | 719d7d8df41d2f20be599c38c3ab3e7a904c92c6 (diff) | |
download | u-boot-e3ea481bee1fbc8f090f46c38354838a64958af4.tar.gz |
usb: xhci: create one unified function to calculate TRB TD remainder
xhci versions 1.0 and later report the untransferred data remaining in a
TD a bit differently than older hosts.
We used to have separate functions for these, and needed to check host
version before calling the right function.
Now Mediatek host has an additional quirk on how it uses the TD Size
field for remaining data. To prevent yet another function for calculating
remainder we instead want to make one quirk friendly unified function.
Porting from the Linux:
c840d6ce772d("xhci: create one unified function to calculate TRB TD remainder.")
124c39371114("xhci: use boolean to indicate last trb in td remainder calculation")
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/usb')
-rw-r--r-- | include/usb/xhci.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/usb/xhci.h b/include/usb/xhci.h index a3e5914b10..15926eb9f4 100644 --- a/include/usb/xhci.h +++ b/include/usb/xhci.h @@ -850,6 +850,8 @@ struct xhci_event_cmd { /* 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 at */ #define TRB_INTR_TARGET_SHIFT (22) #define TRB_INTR_TARGET_MASK (0x3ff) |