]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: add a member hci_version in xhci_ctrl struct
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 8 Sep 2020 16:59:55 +0000 (18:59 +0200)
committerMarek Vasut <marex@denx.de>
Thu, 1 Oct 2020 17:43:05 +0000 (19:43 +0200)
Add a member to save xHCI version, it's used some times.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
include/usb/xhci.h

index 092ed6eaf104c97cf3dbcdb7fff05592d2eefc16..79bfc349f44d99bce4ac149bec8b389d13800104 100644 (file)
@@ -682,7 +682,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
                        field |= TRB_ISP;
 
                /* Set the TRB length, TD size, and interrupter fields. */
-               if (HC_VERSION(xhci_readl(&ctrl->hccr->cr_capbase)) < 0x100)
+               if (ctrl->hci_version < 0x100)
                        remainder = xhci_td_remainder(length - running_total);
                else
                        remainder = xhci_v1_0_td_remainder(running_total,
@@ -830,7 +830,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
                field |= 0x1;
 
        /* xHCI 1.0 6.4.1.2.1: Transfer Type field */
-       if (HC_VERSION(xhci_readl(&ctrl->hccr->cr_capbase)) >= 0x100) {
+       if (ctrl->hci_version >= 0x100) {
                if (length > 0) {
                        if (req->requesttype & USB_DIR_IN)
                                field |= (TRB_DATA_IN << TRB_TX_TYPE_SHIFT);
index 126dabc11ba39f3f8ad54191504f58d9fd60b361..4be14112435a6b5c007024167bea8e8992397757 100644 (file)
@@ -1283,6 +1283,7 @@ static int xhci_lowlevel_init(struct xhci_ctrl *ctrl)
 
        reg = HC_VERSION(xhci_readl(&hccr->cr_capbase));
        printf("USB XHCI %x.%02x\n", reg >> 8, reg & 0xff);
+       ctrl->hci_version = reg;
 
        return 0;
 }
index 7d34103fd5ca147083cab16d0876dd5803bfe22c..a3e5914b10fa14f19ceeef47299a913c616b9c4c 100644 (file)
@@ -1227,6 +1227,7 @@ struct xhci_ctrl {
        struct xhci_scratchpad *scratchpad;
        struct xhci_virt_device *devs[MAX_HC_SLOTS];
        int rootdev;
+       u16 hci_version;
 };
 
 unsigned long trb_addr(struct xhci_segment *seg, union xhci_trb *trb);